Sales Order Punching Through Bapi
Hi Experts, I have got an assignment of doing Salesorder punching in portal and through web dynpro.
I have used BAPI_SALESORDER_GETLIST through RFC connection. But can you tell me what diffrent Bapi's will be required for my task and where relevant documents can be found so that it may help to insert values in R/#
answered
Similar Messages
-
Sales order uploading through bapi
hi
i want to upload sales order to bapi pls give the code and i also error handling through bapi
regards
A.KHi Awadhesh,
pls look at this link you will get a clear idea and the code.
http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
Happy to help you.
Regards,
Viveks -
Sales order change through bapi
iam uploading va02 changes through bapi..but its not changing the sales order
details in bapi_change function module item number its taking as zero. plz can any one
say where iam going wrong.this is my code
*______BAPI STRUCTURES
data : bapi_header type BAPISDH1 occurs 0 with header line,
bapi_item type BAPISDITM occurs 0 with header line,
bapi_header_x like BAPISDH1X occurs 0 with header line,
bapi_item_x type BAPISDITMX occurs 0 with header line,
it_return type BAPIRET2 occurs 0 with header line.
data: v_vbeln like BAPIVBELN-VBELN,
v_bstkd like bapisdh1-purch_no_c,
v_zterm like bapisdh1-pmnttrms,
v_inco1 like bapisdh1-incoterms1,
v_inco2 like bapisdh1-incoterms2,
v_arktx like bapisditm-short_text,
v_koe1n like bapisditm-currency.
*_____ Internal to hold the records in the text file
DATA : BEGIN OF it_header OCCURS 100,
VBELN(10) ,
BSTKD(35) ,
ZTERM(4) ,
INCO1(3) ,
INCO2(28) ,
POSNR(6) ,
matnr(18) ,
ARKTX(40) ,
END OF it_header.
*_____ Internal table to hold excel file data
DATA : it_intern TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK scr1 WITH FRAME TITLE text-111.
PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY .
*paRAMETERS : p_header TYPE i DEFAULT 0.
parameters : p_begcol TYPE i DEFAULT 1 NO-DISPLAY,
p_begrow TYPE i DEFAULT 1 NO-DISPLAY,
p_endcol TYPE i DEFAULT 100 NO-DISPLAY,
p_endrow TYPE i DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK scr1.
___________START-OF-SELECTION________________
START-OF-SELECTION.
PERFORM convert_xls_itab. "to convert excel data into internal table
___________END-OF-SELECTION________________
END-OF-SELECTION.
*& Form convert_xls_itab
text
--> p1 text
<-- p2 text
FORM convert_xls_itab .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = p_begcol
i_begin_row = p_begrow
i_end_col = p_endcol
i_end_row = p_endrow
TABLES
intern = it_intern.
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM move_data. " to move the data into an internal table
ENDFORM. " convert_xls_itab
___________END-OF-SELECTION________________
END-OF-SELECTION.
PERFORM upload_so. "to upload salesorder changes
*& Form upload_so
text
--> p1 text
<-- p2 text
*& Form move_data
text
--> p1 text
<-- p2 text
FORM move_data .
DATA : lv_index TYPE i.
FIELD-SYMBOLS <fs>.
SORT it_intern BY row col. "Sorting Internal Table
CLEAR it_intern.
LOOP AT it_intern.
MOVE it_intern-col TO lv_index.
ASSIGN COMPONENT lv_index OF STRUCTURE it_header TO <fs>. " assigning each record to internal table row
MOVE it_intern-value TO <fs>.
AT END OF row.
APPEND it_header.
CLEAR it_header.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
" move_data
*& Form upload_so
text
--> p1 text
<-- p2 text
FORM upload_so .
LOOP AT it_header.
Header
v_vbeln = it_header-VBELN.
bapi_header-purch_no_c = it_header-BSTKD.
bapi_header-pmnttrms = it_header-ZTERM.
bapi_header-incoterms1 = it_header-INCO1.
bapi_header-incoterms2 = it_header-INCO2.
APPEND BAPI_header.
bapi_header_x-updateflag = 'U'.
bapi_header_x-purch_no_c = 'X'.
bapi_header_x-pmnttrms = 'X'.
bapi_header_x-incoterms1 = 'X'.
bapi_header_x-incoterms2 = 'X'.
APPEND BAPI_header_x.
item
REFRESH BAPI_item.
bapi_item-ITM_NUMBER = it_header-POSNR.
bapi_item-material = it_header-matnr.
bapi_item-short_text = it_header-arktx.
bapi_item-currency = it_item-koein.
APPEND BAPI_item.
bapi_item_x-updateflag = 'U'.
bapi_item_x-ITM_NUMBER = it_header-POSNR.
bapi_item_x-MATERIAL = 'X'.
bapi_item_x-short_text = 'X'.
bapi_item_x-currency = 'X'.
APPEND bapi_item_x.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = V_VBELN
IMPORTING
OUTPUT = V_VBELN.
BAPI to change sales order
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = v_vbeln
ORDER_HEADER_IN = bapi_header
ORDER_HEADER_INX = bapi_header_x
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
NO_STATUS_BUF_INIT = ' '
TABLES
RETURN = it_return
ORDER_ITEM_IN = bapi_item
ORDER_ITEM_INX = bapi_item_x
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES =
SCHEDULE_LINESX =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
COMMIT WORK.
ENDLOOP.
IF IT_return-type = 'E'.
WRITE: / 'Error :', IT_return-message, / 'for VBELN:',it_HEADER-VBELN.
ELSEIF IT_return-type = 'S'.
WRITE: / 'Successfully CHANGED', it_HEADER-VBELN.
ENDIF.
ENDFORM. " upload_so
thankshi
You can use ORDER_ITEMS_IN. For further details use the documentation of the function module.This must help you in your requirement.
regards
Aakash Banga -
Regarding Sales order Copy Through BAPI
HI SAP Gurus,
My requirement is to create a new SO from existing SO.
I have tried BAPI_SALESDOCUMENT_COPY by passing SO No. and Doc. Type, It is working fine, but the header details like PO Number, PO Date and Shp.Mode. (In Shipping Tab)are not appearing in the newly created SO.
Is there any other BAPI to copy an existing SO,
Please suggest,
Regards,
Pavan.hi
You can use ORDER_ITEMS_IN. For further details use the documentation of the function module.This must help you in your requirement.
regards
Aakash Banga -
Changing Rejected Sales Order Items with BAPI?
Hi Forum,
I have the following challenge, would be great if someone of you could help me out. Will help me solve some of my performance problems.
I have sales orders which are temporary and have 'rejected order items'. Now the requirement is that I have to change the 'rejected order items' (quantity and Delivery dates) based on some XYZ criteria. Now using the BAPI_SALESORDER_CHANGE bapi I have to
1. first get rid of the 'REJECTION REASON'
2. Change the order item and then reset the above.
I tried doing it by populating the order_items internal table with two entries but to my surprise it works once and fails twice!!! I get some errors that are totally irrelated and wierd.
As for now, I've just adjusted the program(dirtily??) and will be calling the BAPI twice for a change !!!(Huh!)
Now if anybody knows how to deal with the above problem just drop a few lines, will be of good help to me.
Thanks and regards,
ZAMHi Srinivas,
Thanks for the reply. The rejection reason is set manually, when creating the sales order. I do set the update flag to 'U' and also activating all the X structures. But still it did not work.
Let me put it very simple. Is it possible to change the rejected order items, through BAPI's? If yes, how?
Regarding the error messages I will have to change the code again to recreate the messages will let you know as soon as I am finished with some things. But however here are some errors
Field 'WMENG' cannot be changed, VBEPKOM 000100 0001 ready for input
Field 'WMENG' cannot be changed, VBEPKOM 000100 0001 ready for input
Sales document 0030000031 was not changed
there are few others which appear now and then indicating a system error !!
thanks,
ZAM -
Unable to update sales order unsing the BAPI 'BAPI_SALESORDER_CHANGE'
Hi All,
I am unable to update the payment method field for some sales orders using the bapi 'BAPI_SALESORDER_CHANGE'. I am getting the reason in the table RETURN as 'Field 'ZLSCH' cannot be changed, VBAPKOM 000050 ready for input'.
Could anyone throw some light on it.
Thanks a ton.
Regards,
Santosh Kotra.Hi
Without reversing invoice we can't update price and this is standard bevaior which is logical too. For your scenario I am wondering why would you want to change price for a line item or order which is alrady invoiced and posted to FI. What difference would it make to change price in sale order when this has already been posted in FI?
Thank$ -
Change only material qunatity in sales order by using BAPI
Hi All,
How to change only the material quantity in existing sales order by using BAPI.
Please help me in this regards.
Regards
Deekshitha.Hi
See the sample code and do accordingly
REPORT Z_SALES_ORDER_CHANGE
NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 65(0)
MESSAGE-ID ZZ.
TABLES: VBAP.
DATA:
V_FILEIN(90) TYPE C,
V_RECIN TYPE I,
V_RECVBAP TYPE I,
V_RECORDER TYPE I,
V_VBELN LIKE VBAP-VBELN,
ORDERHEADERINX LIKE BAPISDH1X.
DATA: BEGIN OF I_ORDERS OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
BRGEW(18) TYPE C,
VOLUM(18) TYPE C,
END OF I_ORDERS.
DATA: BEGIN OF I_OUTPUT OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
GEWEI LIKE VBAP-GEWEI,
BRGEW LIKE VBAP-BRGEW,
VOLUM LIKE VBAP-VOLUM,
CKWGT TYPE C,
CKVOL TYPE C,
END OF I_OUTPUT.
DATA: BEGIN OF ORDERITEMIN OCCURS 0.
INCLUDE STRUCTURE BAPISDITM.
DATA: END OF ORDERITEMIN.
DATA: BEGIN OF ORDERITEMINX OCCURS 0.
INCLUDE STRUCTURE BAPISDITMX.
DATA: END OF ORDERITEMINX.
DATA: BEGIN OF RETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF RETURN.
DATA: BEGIN OF BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPIRETURN.
PARAMETERS:
P_PATH(45) TYPE C DEFAULT '/usr/users/ftpsapom/' LOWER CASE,
P_FNAME(32) TYPE C DEFAULT '/sweetjo.txt' LOWER CASE.
START-OF-SELECTION.
CONCATENATE PATH AND FILE NAME INTO ONE VARIABLE
CONCATENATE P_PATH P_FNAME INTO V_FILEIN.
OPEN DATASET
IF V_FILEIN IS INITIAL.
MESSAGE E002 WITH 'FILE' V_FILEIN 'DOES NOT CONTAIN ANY DATA!'.
ELSE.
OPEN DATASET V_FILEIN
FOR INPUT
IN TEXT MODE.
IF SY-SUBRC = 0.
READ DATASET
DO.
READ DATASET V_FILEIN INTO I_ORDERS.
IF SY-SUBRC = 0.
APPEND I_ORDERS.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET
CLOSE DATASET V_FILEIN.
IF SY-SUBRC <> 0.
MESSAGE E002 WITH 'ERROR - CLOSING' V_FILEIN.
ENDIF.
ELSE.
MESSAGE E002 WITH 'ERROR - COULD NOT OPEN' V_FILEIN.
ENDIF.
ENDIF.
SORT AND REMOVE DUPLICATES FROM I_ORDERS
SORT I_ORDERS BY VBELN POSNR.
DELETE ADJACENT DUPLICATES FROM I_ORDERS.
POPULATE I_OUTPUT
LOOP AT I_ORDERS.
SHIFT I_ORDERS-POSNR LEFT DELETING LEADING SPACE.
CONCATENATE '0' I_ORDERS-POSNR INTO I_ORDERS-POSNR.
SELECT SINGLE BRGEW VOLUM
FROM VBAP
INTO (VBAP-BRGEW, VBAP-VOLUM)
WHERE VBELN = I_ORDERS-VBELN
AND POSNR = I_ORDERS-POSNR.
IF SY-SUBRC = 0.
IF VBAP-BRGEW = 0.
I_OUTPUT-CKWGT = 'X'.
ENDIF.
IF VBAP-VOLUM = 0.
I_OUTPUT-CKVOL = 'X'.
ENDIF.
I_OUTPUT-VBELN = I_ORDERS-VBELN.
I_OUTPUT-POSNR = I_ORDERS-POSNR.
I_OUTPUT-GEWEI = 'ST'.
I_OUTPUT-BRGEW = I_ORDERS-BRGEW.
I_OUTPUT-VOLUM = I_ORDERS-VOLUM.
APPEND I_OUTPUT.
CLEAR: I_OUTPUT.
ENDIF.
V_RECIN = V_RECIN + 1.
ENDLOOP.
POPULATE BAPI DATA AND RUN BAPI
CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
RETURN, BAPIRETURN.
REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
ORDERHEADERINX-UPDATEFLAG = 'U'.
LOOP AT I_OUTPUT WHERE CKWGT = 'X' OR CKVOL = 'X'.
V_RECVBAP = V_RECVBAP + 1.
IF I_OUTPUT-VBELN <> V_VBELN AND SY-TABIX <> 1.
V_RECORDER = V_RECORDER + 1.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = V_VBELN
ORDER_HEADER_INX = ORDERHEADERINX
TABLES
RETURN = RETURN
ORDER_ITEM_IN = ORDERITEMIN
ORDER_ITEM_INX = ORDERITEMINX.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
WRITE OUT RETURN
LOOP AT RETURN.
WRITE: / RETURN.
ENDLOOP.
WRITE: / BAPIRETURN.
SKIP.
CLEAR: ORDERITEMIN, ORDERITEMINX,
RETURN, BAPIRETURN.
REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
ENDIF.
ORDERITEMIN-ITM_NUMBER = I_OUTPUT-POSNR.
ORDERITEMIN-UNTOF_WGHT = I_OUTPUT-GEWEI.
IF NOT I_OUTPUT-CKWGT IS INITIAL.
ORDERITEMIN-GROSS_WGHT = I_OUTPUT-BRGEW.
ORDERITEMINX-GROSS_WGHT = 'X'.
ENDIF.
IF NOT I_OUTPUT-CKVOL IS INITIAL.
ORDERITEMIN-VOLUME = I_OUTPUT-VOLUM.
ORDERITEMINX-VOLUME = 'X'.
ENDIF.
APPEND ORDERITEMIN.
ORDERITEMINX-ITM_NUMBER = I_OUTPUT-POSNR.
ORDERITEMINX-UNTOF_WGHT = 'X'.
ORDERITEMINX-UPDATEFLAG = 'U'.
APPEND ORDERITEMINX.
V_VBELN = I_OUTPUT-VBELN.
ENDLOOP.
RUN BAPI ON LAST ORDER
IF NOT ORDERITEMIN IS INITIAL.
V_RECORDER = V_RECORDER + 1.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = V_VBELN
ORDER_HEADER_INX = ORDERHEADERINX
TABLES
RETURN = RETURN
ORDER_ITEM_IN = ORDERITEMIN
ORDER_ITEM_INX = ORDERITEMINX.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
WRITE OUT RETURN
LOOP AT RETURN.
WRITE: / RETURN.
ENDLOOP.
WRITE: / BAPIRETURN.
SKIP.
ENDIF.
WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT FROM FILE ', V_RECIN.
SKIP.
WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT OF LINES TO CHANGE ', V_RECVBAP.
SKIP.
WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT OF ORDERS TO CHANGE ', V_RECORDER.
SKIP.
TOP OF PAGE
TOP-OF-PAGE.
WRITE:/1(5) TEXT-H01, 6(8) SY-DATUM MM/DD/YY,
100(8) TEXT-H02, 126(8) SY-PAGNO.
WRITE:/1(5) TEXT-H03, 6(8) SY-UZEIT USING EDIT MASK '__:__:__',
20(77) TEXT-H04,
100(8) TEXT-H05, 108(25) SY-REPID.
WRITE:/1(6) TEXT-H06, 8(12) SY-UNAME,
20(4) TEXT-H07, 25(32) SY-HOST,
100(13) TEXT-H08, 121(8) SY-SYSID,
129 '/', 130(3) SY-MANDT.
ULINE.
SKIP.
Reward points if useful
Regards
Anji -
Reena Prabhakar - Sales order creation Using BAPI
Hi Reena,
This is Dinesh,i also face problem in Sales order creation using BAPI if you can send me the code it would be great help to me.
Regards,
DineshAnyhow, here is the code that I am using currently which works perfectly well. Not sure if it will be of any help to you, since the values to the BAPI come from the Webdynpro application. I have values stored in my "Test data directory" which I use for testing from the backend.
FUNCTION ztest.
Call the BAPI to create Sales Order
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = l_order_header
IMPORTING
salesdocument = l_salesdocument
TABLES
return = it_return
order_items_in = it_order_items
order_partners = it_order_partners
order_schedules_in = it_order_schdl
order_conditions_in = it_order_conditions
order_text = it_order_text.
READ TABLE it_return WITH KEY type = 'E'.
IF sy-subrc = 0.
*-- error occured
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
*-- no error
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
ENDFUNCTION. -
Need sales order creation using bapi in oops
need code for sales order creation using bapi in oops
hi rocky,
could you pls give a bit explanation on what you are expecting.
regards,
Pavan -
Mass sales order creation using BAPI
Dear All,
Can anyone help in mass sales order creation using Bapi BAPI_SALESORDER_CREATEFROMDAT2.
For example if i want to create 3 sales order with three item per order . i am populating
HEADER = 3 Records
Item = 9 records
schedule = 9 records
partner = 1 record.
Then after populating the records I am calling Bapi BAPI_SALESORDER_CREATEFROMDAT2
to create order. It should have created three order but unfortunately it creates
only one sales order. I debugged and found that records are correct both in header,
item, scheudle and partners.
Could you please guide me what I am missing for creation of mass orders.
I appreciate your time and many thanks in advance.
cheers
chandraHi Chandra,
Do like this.
Loop at Header table into wa_header.
*-- Move BAPI Header data
Loop at item table into wa_item where condition.
*-- in this move all Item and Schedule line item to the BAPI.
At end of item .
Use the below function modules.
BAPI_SALESORDER_CREATEFROMDAT2
BAPI_TRANSACTION_COMMIT.
Endloop.
Endloop.
Regards,
Balavardhan.K -
Sales order creation using BAPI in LSMW
Hi ABAPers,
I am trying to create Sales orders using the BAPI SALESORDER_CREATEFROMDAT2.
I am supplying the item target quantity in sale units to the field
E1BPSDITM-- TARGET_QTY. my documents are getting posted but when i go to VA03 to display my documents, the quantity is showing up as 0 for all items. and the document is incomplete.
please any suggestions on this.
Regards,
RajHI Raj M
jus refer the following link it has step by step procedure
http://sapbrain.com/TUTORIALS/TECHNICAL/LSMW_tutorial.html -
Trying to create a Sales Order Confirmation through IDoc
Hi,
I am trying to create Sales Order Confirmation through ALE with message control.
My recieving system is XI server.
Can u please send me the steps to what to be done to trigger IDoc automatically.
The condition types and access sequence created is for Output type customer but i am sending it to XI Server.
please help me.
Thank you in advance,
Gangolu.Hi Gangolu,
Have a look at url. Hope this provides some inputs.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/73527b2c-0501-0010-5398-c4ac372c9692
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6bd6f69a-0701-0010-a88b-adbb6ee89b34
Thanks
Lakshman -
Changing the Ship-to partner details in Sales order header through exit
Hi all,
I have a requirement where in during the process of the sales order creation, based on certain
criteria, the details in the ship-to partner would have to be modified.
These details like the Name, Street, etc would be maintained in a local table and based on the criteria,
the appropriate record from this table would be fetched and updated to the ship-to partner.
I was trying to implement this in the MV45AFZZ user exit. However, I was not able to update this through the exit.
Would I have to somehow update the ADRC table directly through this exit or is there any better method.
Please suggest.
Regards,
SudeepHi,
If you could not find Street in this Routine call the BAPI BAPI_BUPA_ADDRESS_CHANGE to update Street and required details ..
Thanks and regards,
Sree. -
Populating Customized fields in Sales Order Creation using BAPI
Hi All,
I have a requirement that, I need to populate 2 customized fields which are appedned in the VBAK tables through Append structure. I am using BAPI_SALESORDER_CREATEFROMDAT2 FM for creating it.
Could anybody tell me how to send these 2 coustomized field values in this BAPI using EXTERNIN parameter.
Regards
Rajesh
[email protected]Hi,
To add data to custom fields there are two appraoches.
<b>1)</b>Using the <b>EXTENSIONIN</b> in the Tables option in the FM <b>BAPI_SALESORDER_CREATEFROMDAT2</b>
Check the Documentation for the same,
<b>Customer Enhancement for VBAK, VBAP, VBEP</b>
<i>Description</i>
You can use this parameter to transfer user-specific enhancments to a BAPI. The customer has to complete the EXTENSION structure and the system automatically continues processing it. If you have not defined any user-specific fields, then you can transfer a blank EXTENSIONIN structure.
<b>Technical information about Customer Enhancements</b>
The following description uses an example to explain how to proceed with customer enhancements to the SD tables VBAK, VBKD, VBAP and VBEP.
The customer has added their own fields to table VBAP using the INCLUDE structure CUTEST. This structure contains 2 fields:
CFIELD1, CHAR 10
CFIELD2, CHAR 3.
The customer also requires that these two fields can be maintained with the BAPI.
1. Maintain structure CUTEST in table VBAP
2. Because the BAPIs work with checkboxes, you must also define a CUTESTX checkbox for the customer structure. It should be structured like this:
Field name Data element
CFIELD1 CHAR1
CFIELD2 CHAR1
3. Define these customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
4. Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
5. Adjust the following structures for customer enhancements to table VBAK:
a) VBAKKOZ
b) VBAKKOZX
c) BAPE_VBAK
d) BAPE_VBAKX
6. Adjust the following structures for customer enhancements to table VBEK:
a) VBEPKOZ
b) VBEPKOZX
c) BAPE_VBEP
d) BAPE_VBEPX
7. Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
8. If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
<i>For example:</i>
You want to change customer field VBAP-CFIELD2 for item 20 to "XYZ" in order 4711.
The following entries are expected:
Import: BAPIVBELN-VBELN = '0000004711' Document number
BAPISDHD1X-UPDATEFLAG = 'U' UPDKZ for doc header
Tables: BAPISDITM-ITM_NUMBER = '000020' Item number
BAPISDITMX-ITM_NUMBER = '000020' Item number
+ BAPISDITMX-UPDATEFLAG = 'U' UPDKZ for item
You must complete the EXTENSION table as follows:
STRUCTURE VALUEPART1 1234561234567890123
BAPE_VBAP 0000004711000020 XYZ
BAPE_VBAPX 0000004711000020 X
<b>Further Information</b>
You can find more information in the BAPI programming guide in the chapter for enhancements to BAPIs.
Notes
You must complete the STRUCTURE field with the name of the relevant enhancement structure (BAPE_VBAK, BAPE_VBAP, BAPE_VBEP). You can complete the remaining fields with the append structures from the enhancement structures.
At the moment, you can use the BAPI to store enhancements in the following structures:
VBAK : An enhancement to header data requires an append structure to BAPE_VBAK and an enhancement to structure VBAKKOZ.
VBAP : An enhancement to item data requires an append structure to BAPE_VBAP and an enhancment to structure VBAPKOZ.
VBEP : An enhancement to schedule line data requires an append structure to BAPE_VBEP and an enhancement to structure VBEPKOZ.
VBKD : If you are using an enhancement for header data, you must add an append structure to BAPE_VBAK. You also need to enhance structure VBAKKOZ. If it is for item data, you need to add an append structure to BAPE_VBAP. You must also enhance structure VBAPKOZ.
If you also want to work with checkboxes, each X-structure must also contain an append structure.
For example:
A customer has created an order and wants to include the material long text (50 digits long).
The EXTENSIONIN structure must be completed with BAPE_VBAP. Two fields have fixed definitions in this structure. These are in the VBAP host key (VBELN, POSNR). The customer sets up an append structure that contains field ZMAT50.
Because the VBELN is normally blank when you create an order, the data can look like this:
STRUCTURE |BAPE_VBAP
<b>2)</b> Create the Sales Document using the FM and when successfully craeted you will get the Sales Document No in the Export parameter <b>SALESDOCUMENT</b>.
After its created and Committed using <b>BAPI_TRANSACTION_COMMIT</b> , do a <b>BDC</b> recording for the same to (<b>VA02</b> Change Sales Order) update the fields only and save the document.
Regards,
AS -
Update sales order qty through BAPI_SALESORDER_CREATEFROMDAT2
HI
Can anybody help me out. I have the requirement for creating sales order through BAPI_SALESORDER_CREATEFROMDAT2. The sales order is created but with 0 quantity.
I am using fields RNDDLV_QTY and TARGET_QTY and REQ_QTY in schedule lines & also setting the update indicator to 'X' in the corresponding itemx structures.
In fact it used to work earlier and has stopped now. I am also checking if there could be any change in configuration but don't think this should be the reason.
Can someone guide me as to which quantity fields of the BAPI are the right ones to update sales order qty?
thanksHi,
You are using the correct fields i.e. TARGET_QTY and REQ_QTY. Just check if you are passing the same Item Number in both the tables.
Hope it helps...
Lokesh
Maybe you are looking for
-
Keyboard problems: hardware or software?
The keyboard on my iBook G4 has dead keys, not all in a row but grouped on the right side of the keyboard (they include the enter key, 'l', the comma, and three or four others). There's no obvious damage to the keyboard (I've lifted the keyboard out
-
EJB 3.0 NullPointerException
Hi, I'm a new to JavaEE, especially to ejb3. I'm trying to develop a client that call a method against a facade method. This's the "session bean for entity class" (automatically written by NeatBeans) equipped to Remote Interface. package ejb; import
-
Overriding SPMetal Defaults by Using a Parameters XML File
hi everybody, I have a datatable Employee below : FullName Single line of text Age Number After use SPMetal to generate entities, i have EmployeeItem below: FullName string Age double? I want Age is Integer so i use "Overriding SPMetal Defaults by Us
-
I forgot my security question answers and now I cant buy this game I wanted to.
I forgot my security question answers and now I cant buy this game I wanted to.
-
FAQ: Installing Elements 10, or What do all these disks do?
When you purchase Photoshop and/or Premiere Elements 10 as a boxed product, you get a fair number of disks. The main reason for this is that a boxed product purchase of Elements is dual platform, that is, it's for both Windows and Macintosh. When dea