Structure extension in satndard bapi for sales order
hi all,
i have a requirement where i have to create sales order with some custom fields on to the screen.
how can i use the extension structure in bapi 'BAPI_SALESORDER_CREATEFROMDAT2' .
to upload the data of the custom fields.
regards
vijay
Hi Vijay sharma,
Please check these links
http://help.sap.com/saphelp_46c/helpdata/en/c3/40999d8b8911d396b70004ac96334b/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/4099a68b8911d396b70004ac96334b/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/4099ac8b8911d396b70004ac96334b/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/3e/0e1089c24611d1ad09080009b0fb56/content.htm
Example for BAPI
http://www.sapmaterial.com/bapi_example.html
Hope this helps...
Best regards,
raam
Similar Messages
-
RFC/BAPI For Sales Order Credit Block Release like vkm3 (very urgent )!!
hi experts,
I need the RFC/BAPI For Sales Order Credit Block Release like vkm3 function ,please help
thanks
Godspeedhi
can get the list of all the bapis..
http://www.planetsap.com/LIST_ALL_BAPIs.htm
Reward if USeful
Thanx & regards.
Naren.. -
I'm looking for BAPI, which returns all items for sales order.
Returned items must have included all information, which we can see in transaction va02 on card Item Overview
I'll reward with points for good BAPI.
BR TomekIn the i_bapi_view structure, populate which tables you would like to have returned by using a value of X.
Use the sales documents table to pass which documents you want information on.
So if you wanted item details:
i_bapi_view-item = 'X'.
sales_documents-vbeln = '0000012345'.
append sales_documents.
call function 'BAPISDORDER_GETDETAILEDLIST'
exporting
i_bapi_view = i_bapi_view
tables
sales_documents = sales_documents
order_items_out = order_items_out. -
Regarding bapis for sales order creation and modification
Hi,
I am trying to create a syncbo for sales order creation, modification and display. The bapis that I am using are
1.BAPI_SALESORDER_GETLIST
2.BAPISDORDER_GETDETAILEDLIST
3.BAPI_SALESORDER_CREATEFROMDATA1
4. BAPI_SALESORDER_CHANGE
Am I using the correct bapis. When I tried to create a syncbo it gave the following errors
BAPISDORDER_GETDETAILEDLIST does not have RETURN parameter in export or tables parameter
RETURN parameter in Create BAPI Wrapper should refer to structure BAPIRET2
RETURN parameter in GetList BAPI Wrapper should refer to structure BAPIRET2
GetDetail BAPI Wrapper does not have RETURN parameter in export or tables parameter
No Export parameter referring to header structure exists in GetDetail BAPI Wrapper
No Import parameter referring to header structure exists in Create BAPI Wrapper
No Import parameter referring to header structure exists in Modify BAPI Wrapper
No Import parameter referring to a field of header structure exists in GetDetail BAPI Wrapper
No Export parameter referring to a field of header structure exists in Create BAPI Wrapper
No Tables parameter referring to item structure exists in Create BAPI Wrapper
No Tables parameter referring to item structure exists in Modify BAPI Wrapper
I am informed that the above bapis are standard bapis.
I am not sure as to why I am getting the errors.
Does the syncbo require the bapi's to be in a specific format.
What would be the header and item structures for sales order bapis
Regards
Raja SekharHi Raja,
ya , for creating Sync BOs ,our BAPI wrappers must satisfy certain conditions..
just go through this link.
u can use the standard BAPIs of SALES Order in ur Custom BAPI Wrapper
http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/appdev/smartsync/what_is_a_bapi_wrapper.html
the RETURN must be of type BAPIRET2..
Regards
Kishor Gopinathan -
BAPI for Sales Order & Production Order
Hi Experts,
1)i need to Identify standard BAPI's for Sales Order & Production Order.ie for one BAPI need both sales order and production order.
2)i need to Identify standard BAPI to return delivery number and shipment number for a particular Sale Order. If any one give me answer thanks for advance. it's really helpful for my project.
thanks and regards,
bala.Hi Bala
Kindly do not open duplicate threads for the same topic. Help to close one thread and continue with the other to avoid confusion.
Kind Regards
Eswar -
BAPI for Sales Order Creation.
Hello gurus,
I want to create a sales order using BAPI.
I have tried some BAPI's like BAPI_SALESORDER_CREATEFROMDAT1, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_SALESORDER_CREATEFROMDATA, BAPI_SALESDOCU_CREATEWITHDIA.
But I am not able to update the Miscellaneous Information like Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
Is there any other BAPI thru which i can update these fields while creation of Sales Order.
The Fields which I can provide to BAPI as import parameter is:
Order Type(VBAK-AUART),
Contract(VBAK_VGBEL),
SALES Org (VBAK-VGORT),
Dist Channel(VBAK-VTWEG),
Division (VBAK-SPART),
Open Quantity (VBAK-KWMENG)
Plant(VBAP-WERKS)
Storage Location (VBAP-LGORT)
Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
Thanks In Advance,
Points will be rewarded for Best Solution......
Yogesh Sharmahi,
I can give u a suggestion .. try it ..
its a quite a long process....
in BAPI_SALESORDER_CREATEFROMDAT2
there is a table EXTENSIONIN...
here u can add append structure and carry on ur sales order creation
Follow the process
Customer Enhancement for VBAK, VBAP, VBEP
Description
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.
Technical information about Customer Enhancements
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.
For example:
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
Further Information
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
VALUEPART1 | 000010Customermateriallongtext50
VBELN POSNR ZMAT50 -
BAPI FOR SALES ORDER PROBELM IN PRICING VALUE
Respected Members
i have a problem in creating sales order through BAPI
i will explain you.
My flat file structure is
doc_type sales_org dis_Ch division part_num pono itm_num material short_text qty plant price
OR 1000 20 10 1000 123 10 100-100 abc 50 1000 500
OR 1000 20 10 1000 254 10 100-200 XYZ 70 1000 800
Now when i am executing my program with this flat file data , everything is coming but problem is that in second sales order which is getting create is also having the quantity and price value of the first sales order ie 50 and 500 and it is not taking quantity as 70 and price as 800.
Rest everything is getting changed .
For eg Material is getting changed and description is getting changed for second po.
for second sales order it is taking material 100-200 and description XYZ only.
Then why it is taking values for quantity and price same as first sales order.
i m using the bapi function module in the loop only and thats why two sales order are getting generated.
also at the debugging when the values are passed to BAPI function module it is passing the correct values ie 70 and 800 but finally when i am going to tcode VA02 and seeing the sales order then it is showing the values of the previous order.
Please give me the solution as soon as possible.
ThanksHello Manish,
If you are calling the BAPI within a loop, try to put the BAPI_TRANSACTION_COMMIT within the loop as well so every order is commited properly before the next one is created.
Hope that solves your problem.
Michael -
hi all ,
could any one give me the step by step procedure how to creat a sales order using bapi. i found BAPI_SALESORDER_CREATEFROMDAT2 this the bapi ... but iam not sure about the passing the parameters. please it would be help ful.
the fields which i have to upload are
order type - or
organisational data -1000 ,10 ,00.
sold to party - 1000
purchase oder number- 10
purchase order date - 31 03 2005
required dlivery date- 5 4 07
material - p-103
quantity 10
regards
reenaHi,
Please check the code below:
DATA ok_code LIKE sy-ucomm.
DATA:
Order partners
li_order_partners TYPE STANDARD TABLE OF bapiparnr,
l_order_partners LIKE bapiparnr,
Structures for order header
l_order_header_in LIKE bapisdhd1,
l_order_header_inx LIKE bapisdhd1x,
Tables for order items
li_order_items_in TYPE STANDARD TABLE OF bapisditm,
l_order_items_in LIKE bapisditm,
li_order_items_inx TYPE STANDARD TABLE OF bapisditmx,
l_order_items_inx LIKE bapisditmx,
Return table from bapi call
li_return TYPE STANDARD TABLE OF bapiret2,
l_return TYPE bapiret2,
Sales document number
l_vbeln LIKE bapivbeln-vbeln,
Error flag
l_errflag(1) TYPE c.
DATA: BEGIN OF lt_itab OCCURS 0,
vbeln(10),
augru(3),
bstkd(10),
ean11(18),
END OF lt_itab.
START-OF-SELECTION.
CALL SCREEN 100.
Build partner information
CLEAR l_order_partners.
l_order_partners-partn_role = 'AG'. "Remember German codes !
l_order_partners-partn_numb = itab-st.
APPEND l_order_partners TO li_order_partners.
Build order header
Update flag
l_order_header_inx-updateflag = 'I'.
Sales document type
l_order_header_in-doc_type = 'YR30'.
l_order_header_inx-doc_type = 'X'.
customer reference
l_order_header_in-ord_reason = lt_itab-augru.
l_order_header_inx-ord_reason = 'X'.
Distribution channel
l_order_header_in-refdoctype = lt_itab-vbeln.
l_order_header_inx-doc_type = 'X'.
Purchase order
l_order_header_in-purch_no_c = lt_itab-bstkd.
l_order_header_inx-purch_no_c = 'X'.
Build order item(s) - Only 1 is used in this example
l_order_items_in-ean_upc = lt_itab-ean11.
l_order_items_inx-ean_upc = lt_itab-ean11.
l_order_items_in-material = itab-matnr.
l_order_items_inx-material = 'X'.
l_order_items_in-comp_quant = itab-qty.
l_order_items_inx-comp_quant = 'X'.
APPEND l_order_items_in TO li_order_items_in.
l_order_items_inx-updateflag = 'I'.
APPEND l_order_items_inx TO li_order_items_inx.
CALL Bapi
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'CREATE'.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = l_order_header_in
order_header_inx = l_order_header_inx
testrun = 'X'
IMPORTING
salesdocument = l_vbeln
TABLES
return = li_return
order_items_in = li_order_items_in
order_items_inx = li_order_items_inx.
order_partners = li_order_partners.
PERFORM error.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
*ENDMODULE. " USER_COMMAND_0100 INPUT
ENDFORM. " call_bapi
Check and write Return table
FORM error.
DATA: l_errflag(1) TYPE c,
Return table from bapi call
li_return TYPE STANDARD TABLE OF bapiret2,
l_return TYPE bapiret2.
LEAVE TO LIST-PROCESSING.
CLEAR l_errflag.
WRITE: / 'Sales dcoument: ', l_vbeln.
LOOP AT li_return INTO l_return.
WRITE: / l_return-type, l_return-message(50).
IF l_return-type = 'E'.
l_errflag = 'X'.
ENDIF.
ENDLOOP.
PERFORM commit.
ENDFORM. " ERROR INPUT
No errors - Commit
FORM commit.
DATA: l_errflag(1) TYPE c.
IF l_errflag IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
ENDFORM. " COMMIT INPUT
Regards
Kannaiah -
Bapi for Sales Order (VA02) change
Hi frnds,
i want to update one field of items in sales order. i understood that BAPI_SALESORDER_CHANGE is right bapi for that. but i dont know how to start this. remember i have to update this thru one report. i mean after executing the report i am displaying the values in ALV report. in that ALV report i am mentioning which sale order items to be changed.
now my doubt after getting the values in internal table how to call that BAPI and what all are should be maintained. if any one have done this or similar to this like calling Stanadard BAPI please send me code to [email protected]
hope it is clear.
Regards,
BaluSee this example.
*& Report ZTEST1
REPORT ZTEST1
NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 65(0)
MESSAGE-ID ZZ.
TABLES: VBAP.
DATA: V_VBELN LIKE VBAP-VBELN.
DATA: ORDERHEADERINX LIKE BAPISDH1X.
*DATA: ORDERHEADERIN LIKE BAPISDH1.
*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 IT_EXTENSIONIN OCCURS 0.
INCLUDE STRUCTURE BAPIPAREX.
DATA: END OF IT_EXTENSIONIN.
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.
DATA: l_zavbak TYPE bape_vbak,
l_zavbakx TYPE bape_vbakx.
* POPULATE BAPI DATA AND RUN BAPI
* CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
* RETURN, BAPIRETURN.
* REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
V_VBELN = '0000000153'.
ORDERHEADERINX-UPDATEFLAG = 'U'.
*ORDERHEADERIN-
IT_EXTENSIONIN-STRUCTURE = 'BAPE_VBAK'.
l_zavbak-vbeln = V_VBELN.
l_zavbak-zzplant = '0020'.
IT_EXTENSIONIN-valuepart1 = l_zavbak.
APPEND IT_EXTENSIONIN.
IT_EXTENSIONIN-STRUCTURE = 'BAPE_VBAKX'.
l_zavbakx-vbeln = V_VBELN.
l_zavbakx-zzplant = 'X'.
IT_EXTENSIONIN-valuepart1 = l_zavbakx.
APPEND IT_EXTENSIONIN.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = V_VBELN
* ORDER_HEADER_IN = ORDERHEADERIN
ORDER_HEADER_INX = ORDERHEADERINX
behave_when_error = 'P'
TABLES
RETURN = RETURN
* ORDER_ITEM_IN = ORDERITEMIN
* ORDER_ITEM_INX = ORDERITEMINX
EXTENSIONIN = IT_EXTENSIONIN.
LOOP AT RETURN.
WRITE: / RETURN-TYPE, RETURN-ID, RETURN-NUMBER, RETURN-MESSAGE,
RETURN-LOG_NO, RETURN-LOG_MSG_NO, RETURN-MESSAGE_V1, RETURN-MESSAGE_V2,
RETURN-MESSAGE_V3, RETURN-MESSAGE_V4.
ENDLOOP.
Write: / 'BEFORE COMMITT'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = '1'
IMPORTING
RETURN = BAPIRETURN.
Write: / 'AFTER COMMITT'.
LOOP AT RETURN.
WRITE: / RETURN-TYPE, RETURN-ID, RETURN-NUMBER, RETURN-MESSAGE,
RETURN-LOG_NO, RETURN-LOG_MSG_NO, RETURN-MESSAGE_V1, RETURN-MESSAGE_V2,
RETURN-MESSAGE_V3, RETURN-MESSAGE_V4.
ENDLOOP.
** WRITE OUT RETURN
LOOP AT BAPIRETURN.
WRITE: / BAPIRETURN-TYPE, BAPIRETURN-ID, BAPIRETURN-NUMBER, BAPIRETURN-MESSAGE,
BAPIRETURN-LOG_NO, BAPIRETURN-LOG_MSG_NO, BAPIRETURN-MESSAGE_V1, BAPIRETURN-MESSAGE_V2,
BAPIRETURN-MESSAGE_V3, BAPIRETURN-MESSAGE_V4.
ENDLOOP.
** WRITE: / BAPIRETURN. -
BAPI for sales order creation with Reference
Hello Experts,
I have a order, with its reference I have to create a new sales order.
Am looking for BAPi, with which I can create a sales order with a Reference order (which is in my hand), so I checked SE37 with wild cards, but I did not find any!!
1) Pls. let me know a BAPI
2) And just like that I do not want to create a new order with the reference(existing) order, I have to change the PO number & order Reason(2 fileds) in newley creationg order, pls. let me know How to do it
Thank youHi,
First try to pass these two parameters to BAPI_SALESORDER_CREATEFROMDAT2
ORDER_HEADER_IN-REFDOCTYPE = Your Sch. Agreement No. (Please Check) and
ORDER_HEADER_IN-SD_DOC_CAT = 'E'.
If the above doesnt work ,than try using BAPI "BAPI_SALESDOCUMENT_COPY"
I hope you are working in SAP R/3 4.6C and above version because i am not sure whether this BAPI is available in lower version.
Let us know if this helps you..
Rgds,
Mayank -
Hi Experts,
I am using BAPI_SALESDOCU_CREATEFROMDATA to create sale orders.
As of now i m giving the following inputs to the BAPI
WA_HEADER-DOC_TYPE = T_UPLOAD-AUART.
WA_HEADERX-DOC_TYPE = 'X'.
WA_HEADER-PMNTTRMS = T_UPLOAD-ZTERM.
WA_HEADERX-PMNTTRMS = 'X'.
Sales organization
WA_HEADER-SALES_ORG = T_UPLOAD-VKORG.
WA_HEADERX-SALES_ORG = 'X'.
Distribution channel
WA_HEADER-DISTR_CHAN = T_UPLOAD-VTWEG.
WA_HEADERX-DISTR_CHAN = 'X'.
Division
WA_HEADER-DIVISION = T_UPLOAD-SPART.
UNPACK WA_HEADER-DIVISION TO WA_HEADER-DIVISION.
WA_HEADERX-DIVISION = 'X'.
WA_HEADER-PURCH_NO_C = T_UPLOAD-BSTKD.
WA_HEADERX-PURCH_NO_C = 'X'.
WA_HEADERX-UPDATEFLAG = 'I'.
UNPACK T_UPLOAD-KUNNR TO T_UPLOAD-KUNNR.
T_PARTNER-PARTN_ROLE = 'AG'.
T_PARTNER-PARTN_NUMB = T_UPLOAD-KUNNR.
APPEND T_PARTNER.
CLEAR T_PARTNER.
T_ITEMS-ITM_NUMBER = CNT.
T_ITEMS-MATERIAL = <MAT>.
T_ITEMS-TARGET_QTY = <QTY>.
T_ITEMSX-ITM_NUMBER = 'X'.
T_ITEMSX-MATERIAL = 'X'.
T_ITEMSX-TARGET_QTY = 'X'.
T_SCHEDULES_IN-ITM_NUMBER = CNT.
T_SCHEDULES_IN-SCHED_LINE = CNT1.
T_SCHEDULES_IN-REQ_QTY = <QTY>.
T_SCHEDULES_INX-ITM_NUMBER = CNT.
T_SCHEDULES_INX-SCHED_LINE = CNT1.
T_SCHEDULES_INX-UPDATEFLAG = 'X'.
T_SCHEDULES_INX-REQ_QTY = 'X'.
ALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
SALES_HEADER_IN = WA_HEADER
SALES_HEADER_INX = WA_HEADERX
IMPORTING
SALESDOCUMENT_EX = W_VBELN
TABLES
RETURN = T_RETURN
SALES_ITEMS_IN = T_ITEMS
SALES_ITEMS_INX = T_ITEMSX
SALES_PARTNERS = T_PARTNER
SALES_SCHEDULES_IN = T_SCHEDULES_IN
SALES_SCHEDULES_INX = T_SCHEDULES_INX.
I am getting the following error
No item category available (Table T184 ZORT NORM TAPA)
I understand Material Determination is not happening.
Could you please help me in this issue ?
Regards,
PremHi,
In SPRO-> Sales and distributuin-> Sales-> sales documents-> sales doc item -> assign item category.
In your case, for ZORT document type , and NORM item category group, TAPA item category is not assigned. make an entry with this combination.
Regards, -
HAI TO ALL
CAN I KNOW WHERE TO PASS THIS SHIP-TO PARTY AND SOLD-TO PARTY IN BAPI_SALESORDER_CREATEFROMDAT2
SIMILARLY I HAVE TO PASS PARTNER DETAILS IN HEADER DOCUMENT DETAILS IN WHICH PARAMETER I HAVE TO PASS
PLEASE ADVICE ME ASAP
REGARDS
VIJAY<b>Notes
1. Mandatory entries:
ORDER_HEADER_IN : DOC_TYPE Sales document type
SALES_ORG Sales organization
DISTR_CHAN Distribution channel
DIVISION Division
ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party
PARTN_NUMB Customer number
ORDER_ITEMS_IN..: MATERIAL Material number
2. Ship-to party:
If no ship-to party is entered, use the following: Ship-to party =
sold-to party.
3. Commit control:
The BAPI does not have a database commit. This means that the relevant application must leave the commit, in order that can be carried out on on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.
4. German key words:
The following key words must be entered in German, independantly of
the logon language:
DOC_TYPE Sales document type, for example: TA for standard order
PARTN_ROLE Partner role, for example: WE for ship-to party
Further Information
You can find further information in the OSS. The note 93091 contains general information on the BAPIs in SD.</b>
regards
Prabhu -
How to pass header text in bapi for sale order
hai to all
i am using BAPI_SALESORDER_CREATEFROMDAT2 to create sale order
i can find order_text in tables parameters for creating item texts
but in my senario i have to maintain header text
please advice me how to proceed
rgds
vijayHi Vijay,
As I mentioned <b>it is very much possible to create sales order header text with this BAPI only</b>.
Just check out following working code:
REPORT yab_testso .
DATA: orderheaderin LIKE bapisdhd1,
orderitem TYPE TABLE OF bapisditm,
wa_orderitem TYPE bapisditm,
orderitemx TYPE TABLE OF bapisditmx,
wa_orderitemx TYPE bapisditmx,
orderpart TYPE TABLE OF bapiparnr,
wa_orderpartner TYPE bapiparnr,
ordertext TYPE TABLE OF bapisdtext,
wa_text TYPE bapisdtext,
orderret TYPE TABLE OF bapiret2,
wa_ret TYPE bapiret2,
lv_lines type i.
orderheaderin-doc_type = 'ZZOR'.
orderheaderin-sales_org = 'SS01'.
orderheaderin-distr_chan = 'SH'.
orderheaderin-division = 'ST'.
wa_orderpartner-partn_role = 'SP'.
wa_orderpartner-partn_numb = '1000000342'.
APPEND wa_orderpartner TO orderpart.
wa_orderpartner-partn_role = 'WE'.
wa_orderpartner-partn_numb = '1000000342'.
APPEND wa_orderpartner TO orderpart.
wa_orderitem-itm_number = '10'.
wa_orderitem-material = '000000111000000185'.
wa_orderitem-target_qty = '10'.
APPEND wa_orderitem TO orderitem.
wa_text-text_id = '0012'.
wa_text-langu = 'E'.
wa_text-text_line = 'Test for text creation'.
APPEND wa_text TO ordertext.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
order_header_in = orderheaderin
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT =
TABLES
return = orderret
order_items_in = orderitem
ORDER_ITEMS_INX =
order_partners = orderpart
ORDER_SCHEDULES_IN =
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
order_text = ordertext
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
describe table orderret lines lv_lines.
READ TABLE orderret into wa_ret index lv_lines.
IF wa_ret-type = 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / wa_ret-message_v2.
ENDIF.
Hope it helps.
Regards,
Akshay Bhagwat
Note: Pls reward points if this helps you. -
Getting error msg even I entered all mandatories to BAPI for sales order.
Hi Experts,
I am trying to create sales order using standard BAPI
"BAPI_SALESORDER_CREATEFROMDAT2". But, even I had entered all mandatory fields, I am unable to create sales order sucessfully.
I had gone through the documentaion of this BAPI and entered these fields.
These are the mandatory fields that which I had tried to create,
ORDER_HEADER_IN :
DOC_TYPE Sales document type
SALES_ORG Sales organization
DISTR_CHAN Distribution channel
DIVISION Division
ORDER_PARTNERS..:
PARTN_ROLE Partner role, SP sold-to party
PARTN_NUMB Customer number
ORDER_ITEMS_IN..:
MATERIAL Material number
Do we have anymore fields to give as inputs? I am getting this error message as below :
Msg: Personal number 00007176 does not exit.
But, I am not giving any personal number manually. This personal number was having connection with partner role field,
I had reffered this from the VBPA (Sales Document: Partner Table). Now, please suggest me how to solve this?
Can anyone tell me how to solve this problem and create sales order sucessfully.
Thanks in advance,
Surender Batlanki.hi,
try out this sample code.. it is working fine in creating sales order through BAPI.
REPORT z_bapi_salesorder_create.
Parameters
Sales document type
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
PARAMETERS: p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Sales organization
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Distribution channel
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Division.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Sold-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Ship-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Material
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Quantity.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Plant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
Initialization.
INITIALIZATION.
v_text = 'Order type'.
v_text1 = 'Sales Org'.
v_text2 = 'Distribution channel'.
v_text3 = 'Division'.
v_text4 = 'Sold-to'.
v_text5 = 'Ship-to'.
v_text6 = 'Material'.
v_text7 = 'Quantity'.
v_text9 = 'Plant'.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = p_auart.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
Division
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = p_matnr.
itemx-material = 'X'.
Plant
item-plant = p_plant.
itemx-plant = 'X'.
Quantity
item-target_qty = p_menge.
itemx-target_qty = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI to create the sales order.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
Commit the work.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
regards,
pavan reddy -
Hi Experts,
I want to select all sales order items in my ABAP-Program like in Ta VL10C. Any idea ? BAPI ? Funktion ?
Thanks for support.
Regards,
DavidHello,
You can try the below BAPIs.
BAPI_SALESORDER_GETLIST
BAPI_SALESORDER_GETSTATUS
BAPI_SALESORDER_GETDETAILBOS
BAPI_SALESORDER_GETLISTBOS
Thanks and Regards,
Venkat Phani Prasad Konduri
Maybe you are looking for
-
How to get selected value from selectOneRadio ???
Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean. Note i have about 10 selectOneRadio group in one page i want to know value of each one of them. Plzzzzzzzz i need help
-
ETA for SQL Developer 2?
I'm a little excited. Is there an ETA for SQL Developer 2? Is it soon? :-)
-
hallo i am pretty sure that once i could use the snapshot tool to copy vector format into the clipboard (emf, wmf) when i had vector information in the pdf file. now with acrobat reader X i always end up with pixels. i found the option to increase re
-
Is there a alternative to audible flash player ?
The games I play on Facebook keep asking for a flash player on my I pad 2 but apple won't let me download audible flash player just wandering if there was an alternative flash player I can use ?
-
Analyse this dump analysis any error inthis
MOVE L_NAME1 TO L_NAME. "moloy29112005 CONCATENATE L_NAME1 L_NAME2 INTO L_NAME SEPARATED BY SPACE. READ TABLE T_OUT3 WITH KEY 'NAME' . MOVE L_NAME TO T_OUT3-VALUE. MODIFY T_OUT3 INDEX SY-TABIX. ENDFORM. "DATA_EXTRACT1 *&