|
Written by Kevin Wilson
|
|
Wednesday, 30 September 2009 |
If you have custom ZZ fields on VBAP and VBAK then you can update these fields using the standard BAPI to create or change the order and update these fields. A lot has been spoken about this but nowhere does it spell out the pitfalls and give you an end-to-end procedure on how to do it. I even found some "SAP Experts - Ask a question" on Search SAP give a complete wrong answer!!! So here is the correct way to do it.
To do so you first need to ensure that the following 5 tables are in synch. 1) VBAP: In your append structure you specify your ZZFIELD with the data type as needed 2) BAPE_VBAP: In the append structure here also add the ZZFIELD with the data type as needed with limitations. No decimals. Try and stick to char characters 3) BAPE_VBAPX: In the append structure add the field ZZFIELD of type BAPIUPDATE (NOTE: (2) and (3) must have the same number of fields in the same order)
4) VBAPKOZ: In the append structure here also add the ZZFIELD with the data type as needed with limitations. No decimals. Try and stick to char characters 5) VBAPKOZX: In the append structure add the field ZZFIELD of type BAPIUPDATE (NOTE: (4) and (5) must have the same number of fields in the same order)
Similarly do for VBAK, BAPE_VBAK, BAPE_VBAKX, VBAKKOZ and VBAKKOZX. Next we get to the code to fill in the structure EXTENSIONIN I will demonstrate how to call the create sales order BAPI with custom fields. * Local definitions DATA: wa_extensionin TYPE bapiparex, wa_bape_vbap TYPE bape_vbap, wa_bape_vbapx TYPE bape_vbapx, wa_bape_vbak TYPE bape_vbak, wa_bape_vbakx TYPE bape_vbakx, lv_posnr TYPE posnr. * Processing the header extension CLEAR wa_bape_vbak. wa_bape_vbak-ZZFIELD = 'HDRTEST'. wa_extensionin-structure = 'BAPE_VBAK'. wa_extensionin+30(960) = wa_bape_vbak. append wa_extensionin to lt_extensionin. clear wa_extensionin. * Processing the line extension LOOP AT line_items INTO wa_lineitems. ADD 10 TO lv_posnr. CLEAR wa_bape_vbap. wa_bape_vbap-ZZFIELD = 'TEST'. wa_extensionin-structure = 'BAPE_VBAP'. wa_bape_vbap-posnr = lv_posnr. wa_extensionin+30(960) = wa_bape_vbap. append wa_extensionin to lt_extensionin. clear wa_extensionin. CLEAR wa_bape_vbapx. wa_bape_vbapx-ZZFIELD = 'X'. wa_extensionin-structure = 'BAPE_VBAPX'. wa_bape_vbapx-posnr = lv_posnr. wa_extensionin+30(960) = wa_bape_vbapx. append wa_extensionin to lt_extensionin. clear wa_extensionin. ENDLOOP. * Then the call to the BAPI CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = ls_order_header_in order_header_inx = ls_order_header_inx IMPORTING salesdocument = lv_salesdocument TABLES return = lt_ret2 order_items_in = lt_order_items_in order_items_inx = lt_order_items_inx order_partners = lt_order_partners order_keys = lt_order_keys extensionin = lt_extensionin. Note: If you have a need to force a different Business Object type or wish to see the extension return fields then use the function SD_SALESDOCUMENT_CREATE instead. CALL FUNCTION 'SD_SALESDOCUMENT_CREATE' EXPORTING sales_header_in = ls_order_header_in sales_header_inx = ls_order_header_inx business_object = 'BUS2032' IMPORTING salesdocument_ex = lv_salesdocument sales_header_out = lv_sales_header_out sales_header_status = lv_sales_header_status TABLES return = lt_ret2 sales_items_in = lt_order_items_in sales_items_inx = lt_order_items_inx sales_partners = lt_order_partners sales_keys = lt_order_keys extensionin = lt_extensionin incomplete_log = lt_incomplete_log extensionex = lt_extensionex. There were quite a few documents and help pointing out how to do this but none putting it all together in one document and setting you on your way. You can say that no more. Enjoy!!! |
|
|
Written by Kevin Wilson
|
|
Thursday, 21 August 2008 |
|
It is sometimes necessary to link an RFC destination to a logical system (when doing synchronous calls between systems and you want to use the logical system).... Table entries are in TBLSYSDEST. Use transaction BD97 to do the linking. |
|
|
Written by Amit khari
|
|
Tuesday, 02 October 2007 |
To create a function module, you first need to start the Function Builder. Choose Tools ® ABAP Workbench, Function Builder. For more information about creating function modules, refer to the ABAP Workbench Tools documentation. To be able to call a function module in an update work process, you must flag it in the Function Builder. When you create the function module, set the Process Type attribute to one of the following values:
|
|
Read more...
|
|
|
Written by Amit khari
|
|
Thursday, 02 August 2007 |
To represent the remote enabled function module as a BAPI, BAPI Wizard is used. The wizard generates some additional code to allow the BAPI to be called as a workflow method apart from being called by an outside program. When creating a new object type in BOR (Business Object Repository), there can be two possibilities. Either it is created as a subtype of an existing business object or it is created as a new business object from scratch. |
|
Read more...
|
|
|
Written by Amit khari
|
|
Sunday, 10 June 2007 |
Modularization Techniques Processing blocks that are called from ABAP programs:
- Subroutines
- Function modules
- Methods
Procedures Procedures contain a set of statements, and are called from other ABAP programs. The processing blocks that you call from ABAP programs are called procedures You define procedures in ABAP programs. When the program is generated, they remain as standalone modules. You can call procedures in the program in which they are defined, or from external programs. Procedures have an interface for passing data, and can also contain local data.
ABAP contains the following kinds of procedures: |
|
Read more...
|
|
|
Written by P. Renjith Kumar
|
|
Thursday, 17 May 2007 |
This gives the code that is used to establish connection between SAP and other applications using BAPI Active X Controls : |
|
Last Updated ( Thursday, 17 May 2007 )
|
|
Read more...
|
|
|
Written by P. Renjith Kumar
|
|
Wednesday, 16 May 2007 |
|
Synchronous BAPIs Synchronous means we will have the action immediately . Synchronous BAPIs are generally used to read data from a remote logical system, for example to display a customer list. Asynchronous BAPIs Asynchronus will perform the action in background . Asynchronous BAPIs are generally used for replicating data on one or more logical systems, for example to distribute article master data.
|
|
Last Updated ( Wednesday, 16 May 2007 )
|
|
Read more...
|
|
|
Written by Rich
|
|
Tuesday, 15 May 2007 |
|
Source Code Patterns. In the ABAP editor there is the functionality to insert code into your program using what is called a pattern. You use this functionality each time you insert a function call for example. This menu option is reached via the menu path SE38->Edit->Pattern: |
|
Read more...
|
|
|
Written by Rich
|
|
Tuesday, 15 May 2007 |
|
Calling An External Program From SAP. Operating system programs and other application programs can be called from SAP in one of four ways. The first two methods depend on the location of the application program – whether it resides on the local PC, or the application server. Both are easy to implement. The third way, using ABAP objects relies on the application being called being an OLE server. The fourth I regard as a kind of back door.... An OLE server uses object technology for sharing information and services across process and machine boundaries. |
|
Last Updated ( Tuesday, 15 May 2007 )
|
|
Read more...
|
|
|
Written by Pavan
|
|
Thursday, 26 April 2007 |
|
How to connect to external database?? |
|
Last Updated ( Thursday, 26 April 2007 )
|
|
Read more...
|
|
|
Written by Kevin Wilson
|
|
Friday, 16 March 2007 |
|
If you've experienced RFC calls that provide different results for the same interface values passed consider checking the gateway setting on your RFC destination. If you test the RFC using SE37 it will use the current app server to process the request. If you call the RFC remotely and specify the incorrect gateway then the RFC may appear to work but return no results... |
|
|
Written by Anon.
|
|
Wednesday, 31 January 2007 |
|
Programming a BAPI consists of 6 major tasks: - Defining BAPI Data structures in SE11
- Program a RFC enabled BAPI function module for each method
- Create a Business object for the BAPI in the BOR
- Documentation of the BAPI
- Generate ALE interface for asynchronous BAPIs
- Generate and release
Tip: You can use the BAPI explorer to get a step by step instruction / checklist in how to create a BAPI. In the BAPI explorer select the Project tab. |
|
Read more...
|
|
|
Written by Anon.
|
|
Friday, 26 January 2007 |
|
Comprehensive list of function modules and descriptions of what they do..... |
|
Read more...
|
|
|
Written by Bob Billings
|
|
Thursday, 25 January 2007 |
|
You can use the DCOM connector or the Java Connector to connect to an SAP system if you have access to a programming language like VB, C++ or Java. If you don't and a client of yours needs to extract data from an SAP system to a flat file then here is the procedure to accomplish it. We make use of a DOS batch file which will call the SAP standard STARTRFC executable to attach to the SAP machine. |
|
Read more...
|
|