Regarding BAPI at sales order
Dear guys,
I have CSV file having records, which is read from local PC and has to be uploaded in R/3 screen.
Concretely speaking, Now Records from CSV files will be displayed in Sales order screen. customer will correct the data changes in screen(if necessary for each record) and save the record to sales table.
1-Here i want to know should i have to use BAPI or not for saving datas in sales order table.
(Its purely ABAP programming module)
2-if Bapi is required could you pls tell what BAPI is required to save in sales table.
Thanks in advance.
ambichan.
Hi Ambichan,
first of all: don't make changes (/ use exits / BADI) for this task. Only if you need different functionality for sales document creation itself, you might do some enhancements.
Copy of this transaction doesn't make much sense: to much to delete. Maybe you use screen definition, but the rest you should do on your own.
Do you need feedback from system?
Yes: use BAPI_SALESORDER_SIMULATE to get feedback (like delivery days, availability...) and display results in own transaction.
No: just display the values like an editor (but in corresponding fields and places of VA01).
If you create only one order at a time, then it's also possible to use a batch input (VA01), started in error mode, to fill all fields. Then your last action is pressing enter (instead of save). Transaction will pop up, because it's not finished -> user is in correct transaction, feedback from system is available, all additional functions (like display customer / article / whatever else data) are at hand...
Regards,
Christian
Similar Messages
-
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 -
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.. -
BAPI Simulate Sales order issue
When iam using the BAPI for sales order simulation, it is giving the netvalue of item as
NET_VALUE field in the item out table( Description: Net value as num. field - 00000901 equals 9,01 ). How to change that value into actual currency amount ie into vbap-netwr.
In debugging the value is
I_BAPIITEMOUT[1]-NET_VALUE NUMC 15 000000000005000.
The actual value should be P 12
value: 50.0000.Just we need to divide it by 100.
This is standard method that will be followed by SAP standard programs also. -
To update conditiontype values using change BAPI of sales order
Hi Gurus,
i am using the standard bapi 'BAPI_SALESORDER_CHANGE' and i am passing the values for the conditiontypes as follows.......
vbeln is my sales order number..
wa_conditions_in-itm_number = '00010'.
wa_conditions_in-cond_count = '01'.
wa_conditions_in-cond_type = 'ZCUS'.
wa_conditions_in-applicatio = 'V'.
wa_conditions_in-cond_value = '1000.00'.
wa_conditions_in-currency = 'INR'.
wa_conditions_in-cond_p_unt = '1'.
wa_conditions_inx-itm_number = '00010'.
wa_conditions_inx-cond_count = '01'.
wa_conditions_inx-cond_type = 'ZCUS'.
wa_conditions_inx-updateflag = 'U'.
wa_conditions_inx-cond_value = 'X'.
wa_conditions_inx-currency = 'X'.
wa_conditions_inx-cond_p_unt = 'X'.
APPEND wa_conditions_in TO conditions_in.
APPEND wa_conditions_inx TO conditions_inx.
CLEAR : order_header_in, order_header_inx.
order_header_in1-purch_no_c = 'Order'.
order_header_inx1-purch_no_c = 'X'.
order_header_in1-purch_no_s = 'Order'.
order_header_inx1-purch_no_s = 'X'.
order_header_inx1-updateflag = 'U'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = vbeln
order_header_in = order_header_in1
order_header_inx = order_header_inx1
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
TABLES
return = return
conditions_in = conditions_in
conditions_inx = conditions_inx
EXTENSIONIN =
while executing in the order it is not updating the value for the condition type 'ZCUS' and it is inserting as new record.
Please help me in this regard.
Thanks & Regards,
R.P.SastryHI,
Take the below sample code. for example and try to use like that.
REPORT ZTEST_BAPI .
Data: salesd like BAPIVBELN-VBELN.
data: it_BAPISDH1 type BAPISDH1.
data: it_BAPISDH1X type BAPISDH1X.
data: it_BAPIPARNR type BAPIPARNR occurs 0 with header line.
data: it_BAPIRET2 type BAPIRET2 occurs 0 with header line.
data: it_BAPIPARNRC type BAPIPARNRC occurs 0 with header line.
data: it_BAPISDITMX type BAPISDITMX occurs 0 with header line.
data: it_BAPISDITM type standard table of BAPISDITM with header line.
constants: c_bp(2) type c value 'BP'.
it_BAPISDH1X-UPDATEFLAG = 'U'.
it_BAPISDH1X-SALES_ORG = 'X'.
it_BAPISDH1X-DISTR_CHAN = 'X'.
it_BAPISDH1X-DIVISION = 'X'.
it_BAPISDH1X-PURCH_NO_C = 'X'.
it_BAPISDH1X-CUST_GROUP = 'X'.
it_BAPISDH1-SALES_ORG = '1000'.
it_BAPISDH1-DISTR_CHAN = '01'.
it_BAPISDH1-DIVISION = '00'.
it_BAPISDH1-PURCH_NO_C = 'Test1'.
it_BAPIPARNR-PARTN_ROLE = 'RE'.
it_BAPIPARNR-PARTN_NUMB = '0000000171'.
it_BAPIPARNR-ITM_NUMBER = '00000'.
append it_BAPIPARNR.
it_BAPIPARNR-PARTN_ROLE = 'RE'.
it_BAPIPARNR-PARTN_NUMB = '0000000179'.
it_BAPIPARNR-ITM_NUMBER = '000000'.
append it_BAPIPARNR.
it_BAPIPARNRC-DOCUMENT = '000000375'.
it_BAPIPARNRC-ITM_NUMBER = '000000'.
it_BAPIPARNRC-UPDATEFLAG = 'U'.
it_BAPIPARNRC-PARTN_ROLE = 'WE'.
it_BAPIPARNRC-P_NUMB_OLD = '0000000171'.
it_BAPIPARNRC-P_NUMB_NEW = '0000000179'.
it_BAPIPARNRC-ADDRESS = '26324'.
it_BAPIPARNRC-ADDR_LINK = '0000000003'.
it_BAPIPARNRC-REFOBJTYPE = 'BUS2032'.
it_BAPIPARNRC-REFOBJKEY = '000000375'.
append it_BAPIPARNRC.
data PARTNERADDRESSES like BAPIADDR1 occurs 0 with header line.
PARTNERADDRESSES-ADDR_NO = '0000000003'.
PARTNERADDRESSES-NAME = 'Test Cust'.
PARTNERADDRESSES-STREET = '222nd AVE'.
PARTNERADDRESSES-NAME_2 = 'NEW Bldg A2'.
PARTNERADDRESSES-CITY = 'MILPITAS'.
PARTNERADDRESSES-REGION = 'CA'.
PARTNERADDRESSES-POSTL_COD1 = '950351'.
PARTNERADDRESSES-COUNTRY = 'IN'.
PARTNERADDRESSES-LANGU = 'E'.
APPEND PARTNERADDRESSES. CLEAR PARTNERADDRESSES.
it_BAPISDITMX-ITM_NUMBER = '00010'.
it_BAPISDITMX-UPDATEFLAG = 'U'.
it_BAPISDITMX-MATERIAL = 'X'.
it_BAPISDITMX-CUST_GROUP = 'X'.
append it_BAPISDITMX.
it_BAPISDITM-ITM_NUMBER = '00010'.
it_BAPISDITM-MATERIAL = '946'.
append it_BAPISDITM.
break-point.
salesd = '0000000375'.
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = salesd
ORDER_HEADER_IN = it_BAPISDH1
order_header_inx = it_BAPISDH1X
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
tables
ORDER_ITEM_IN = it_BAPISDITM
ORDER_ITEM_INX = it_BAPISDITMX
PARTNERS = it_BAPIPARNR
return = it_BAPIRET2
PARTNERCHANGES = it_BAPIPARNRC
PARTNERADDRESSES = 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 =
If sy-subrc = 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
. endif.
You need to sepaeately use the *Update* and *Change* and *Insert* flags while filling the data
Thanks!
Edited by: Mr. M on Jan 9, 2009 6:23 PM -
BAPI: Create Sales order with reference to Quotation
Hi ...
I am using bapi BAPI_SALESOREDER_CREATEFROMDATA2 and
i want to create sales order with reference Quotation... All quotation data like Materials prices and conditions must be copied from reference quotaion which is allready created .....
..Thanks..
..AshishHello,
nice to see that this has already been solved.
But it actually doesnt work in my scenario. Do you have an example coding which will explain your solution.
Mine looks like this:
* Update Flag
ls_header_inx-updateflag = 'I'.
* Angebotskopf einlesen
SELECT SINGLE * FROM vbak INTO ls_vbak
WHERE vbeln = iv_vbeln
AND vbtyp = lc_vbtyp.
IF sy-subrc <> 0.
EXIT.
ENDIF.
* Auftragskopf setzen
ls_header_in-doc_type = ls_vbak-auart.
ls_header_in-sales_org = ls_vbak-vkorg.
ls_header_in-distr_chan = ls_vbak-vtweg.
ls_header_in-division = ls_vbak-spart.
ls_header_in-req_date_h = ls_vbak-VDATU.
ls_header_in-ref_doc = ls_vbak-vbeln.
ls_header_in-refdoc_cat = 'B'.
* Angebots-Partner einlesen (Nur AG und WE)
* Auftrag anlegen
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
order_header_in = ls_header_in
* order_header_inx = ls_header_inx
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* testrun = 'X'
* CONVERT = ' '
IMPORTING
salesdocument = ev_vbeln
TABLES
return = et_return
* order_items_in = lt_items_in
* order_items_inx = lt_items_inx
order_partners = lt_partners
* ORDER_SCHEDULES_IN =
* ORDER_SCHEDULES_INX =
* ORDER_CONDITIONS_IN =
* ORDER_CONDITIONS_INX =
* 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 =
* ORDER_KEYS =
* EXTENSIONIN =
* PARTNERADDRESSES = .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Unfortunatly this just makes the reference to the quotation but does not takeover ALL data from header and pos level.
Thanks and regards
Markus Armbruster -
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 -
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, -
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 -
BAPI with Sales Order User Information
Hi Guys,
I need BAPI Contains the User information of Sales Order like who created the sales order No of users Accessing the sales Order .Thanks in advance.
Thanks
Kiran.BHi
In the header data of any BAPi you will get the information who has created the sales order,
Who has accessed this sales order
you can see this info using SUIM tcode
Users who accessed this Tcode VA01/VA02
reward points if useful
regards
Anji -
Can any one prvide documentaion for BAPI Material, Sales order and Pricing?
Hi,
Can any one provide documentaion for BAPI Material create and change, Sales order create and change and Pricing?
thanks & Regards,
Gop.Hi!
TABLES: t184.
IF NOT VBAP-PSTYV IS INITIAL.
SELECT SINGLE * FROM t184 WHERE pstyv = vbap-pstyv.
IF sy-subrc = 0.
IF t184-vwpos IS INITIAL.
IF t184-psty2 <> vbap-psty2.
MESSAGE e987(ZSD). "create the 987 message with SE91 transaction - ZSD mess.class
ENDIF.
ENDIF.
ENDIF.
ENDIF.
Somehow like this.
Regards
Tamá -
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
vijayHi 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 -
Function module/ Bapi for Sales order change
Hi Experts,
I require to have a Bapi/ function module to change a existing sales order to insert value in the field VBAP-SOBKZ.
Please suggest.
Thanks,
Shibaji.HI,
I have identified this Bapi but this Bapi does not contain the relevant field to update. Can you suggest any other Function module/ Bapi to update the field.
Thanks & Regards,
Shibaji -
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
-
Problem using Read_text
Hi, I am using the Read_text in the following manner: TYPES : BEGIN OF STR_VBRP, VGBEL TYPE VBRP-VGBEL, VGPOS TYPE VBRP-VGPOS, END OF STR_VBRP. DATA : IT_VBRP TYPE STANDARD TABLE OF STR_VBRP INITIAL SIZE 0, WA
-
How users access the sites in NTLM authentication
Hi, For kerberos when users try to access the site actually they able to access the site through the app-pool account of the web app for which we register the SPN. But for NTLM how that works. When a user tries to access the site in NTLM does it go
-
How do you configure which YouTube iPhone connects to?
How/where is the configuration for the YouTube application on the iPhone 3G? How does it know which country you want it to connect to? YouTube Australia or YouTube USA? My iPhone with no sim card connects to YouTube USA and iTunes Australia. The one
-
Rfc_Call_Transaction, AL08
Hi, In SAP I can see a list of logged on users with transaction AL08. What I want to do is access this data in a .NET application. I think that the way to do this is by using Rfc_Call_Transaction? Unfortuanately I haven't been able to find much infor
-
What is mechanism behind in the stateless
Hi, I have implemented stateful and stateless session bean with same methods.. when u pass the command line argument as any name then the output will be name 1 , name 1, name 2... for stateless name 1, name 2, name 3 ... for stateful.... what is the