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
vijay
Hi 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.
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.. -
How to Modify the standard layout set for Sales Order
Hi all,
Do we have any sap defined standard to modify the sales order,if no How to Modify the standard layout set for Sales Order,an also plz send me the step by step procedure for the same.
Thanks in advance
Santosh RHi, Dear Ferry Lianto,
Thank you very much.
Commonly I know the total pricing procedures.
But, would you please tell me how to control the CURRENCY for the subitem of a condition type as follows?
For example, I can see the following kind of
contents in the Tab:condition of a sales order:
PR00 Price 130.00000 TEST 100
Gross Value 20.12 USD 100 <-how to
Discount Amount 0.00 USD 100
Rebate Basis 20.12 USD 100
Net Value for Item 20.12 USD 100
Net Value 2 20.12 USD 100
Net Value 3 20.12 USD 100
VPRS Cost 27.22 HKD
Profit Margin 16.61 USD
The currency of PR00:price can be controlled via tcode VK12; but how to control the currency of its subitem such as gross value, discount amountm, net value for item, net value 2, & net calue 3...
Thanks and regards. -
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. -
Header text is different from Sales order to dElivery
Hi all,
Can you please help me regarding this?
I have created a delivery with different sold-to and ship-to. And then, I entered the text manually. But when created a delivery, different text appears. How can this be?
I have checked the determination, it seems behaving ok but why it has gotten a different text. I have checked the sales text of the ship-to party, it has no text maintained.
Please help.Hello Rumar
I guess you entered the text manually in the sales order. The Ship-to may not be having any text, but the Sold-to may be and it may be coming from sold to.
In transaction VOTXN, check the access sequence for the text type id and see which one takes precedence - one from customer master or from the order by checking the order of accesses. -
Update Delivery Text - As done for Sales order using RTEXT-SELKZ
Dear all,
We have to update the delivery header texts. But could not find the exact field name for the BDC .
The similar field name for Sales order is RTEXT-SELKZ.
Thanks in Advance,
Regards,
Vivek KHello,
if you need to update delivery header texts ,then you can get text data from input file .& then find out what's the text id where you have to insert text data.
Text id,object,language,Text name ,these 3 fields can help you from delivery.
Delivery-> display->header-> select particular text-> presss details icon->goto->header.This path will give text id ,object name details of the required text.
Then use function save_text to load this data for each delivery .
Hope this helps.
Thanks. -
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 -
My query is
In BAPI_SALESORDER_CREATEFROMDAT2, when pricing condition types have been passed in ORDER_CONDITIONS_IN tables, after creation of sales order, double conditions types occurred in sales order.
How to remove that duplicacy ?
Suggestion is that
1st set of condition types occurring based on config
2nd set of conditions types coming from FM.
How to ignore 1st of data?hi
Hi,
Go through this one
*& Report ZSD_j_SALESORDER
report zsd_j_salesorder1 line-size 132 message-id zmmbapi .
*& Created By : janani
*& Created on : 13.10.2007
*& Requested By : vardhman
*& Description of program :
Internal table definition *
data: gt_order_header_in like bapisdhead occurs 0 with header line,
gt_return like bapireturn1 occurs 0 with header line, " Return Messages
gt_order_items_in like bapiitemin occurs 0 with header line, " Item Data
gt_salesdocument like bapivbeln-vbeln , "Number of Generated Document
gt_order_partners like bapiparnr occurs 0 with header line, "Document Partner
gt_return1 like bapiret2 occurs 0 with header line.
Data definition *
types: begin of ty_gt_ft_sales ,
partn_numb(10) type n ,"Customer Number 1
partn_role(2) ,"Partner function
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
material(18), "MATERIAL
targetquantity(020),"Target quantity
reqqty(020), "Req quantity
reqdate(010), "req date
*REQ_DATE_H(010),
ref_1(012), "Ref
unload_pt(025),
*PARTN_ROLE(2) ,"Partner function
*PARTN_NUMB(10) ,"Customer Number 1
end of ty_gt_ft_sales,
begin of ty_header ,
partn_numb(10) ,"Customer Number 1
partn_role(2) ,"Partner function
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
unload_pt(025),
req_date_h(010),
end of ty_header,
begin of ty_item,
material(18), "MATERIAL
targetquantity(020),"Target quantity
reqqty(020), "Req quantity
reqdate(010), "req date
ref_1(012), "Ref
*UNLOAD(025),
end of ty_item.
data : msg(240) type c, " Return Message
e_rec(8) type c, " Error Records Counter
rec_no(8) type c, " Records Number Indicator
s_rec(8) type c, " Successful Records Counter
t_rec(8) type c, " Total Records Counter
v_matnr like mara-matnr,
v_parvw type parvw.
data : gt_ft_sales type standard table of ty_gt_ft_sales with header line.
data : wa_gt_ft_sales type ty_gt_ft_sales,
wa_order_items_in like gt_order_items_in,
wa_gt_ft_sales1 type ty_gt_ft_sales,
wa_header type ty_header,
salesdocument like bapivbeln-vbeln.
selection block for EXCEL UPLOAD FILE
selection-screen begin of block b1 with frame title text-000.
parameters file type ibipparms-path obligatory.
selection-screen end of block b1.
*<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
at selection-screen on value-request for file .
perform getname.
form getname.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
importing
file_name = file.
endform.
*TOP-OF-PAGE.
top-of-page.
skip 3.
format color col_heading inverse on.
write 40 text-001.
format color col_heading inverse off.
skip 1.
format color col_negative inverse on.
write :/ text-002, 13 sy-mandt , 104 text-003, 121 sy-uname,
/ text-004, 13 sy-datum , 104 text-005, 121 sy-uzeit.
format color col_negative inverse off.
skip 3.
*START-OF-SELECTION.
start-of-selection.
perform get_data.
perform bapi.
*end-of-page.
perform result.
form result.
t_rec = e_rec + s_rec.
skip 3.
format color col_total inverse on.
write: /38 text-007, t_rec.
format color col_total inverse off.
format color col_negative inverse on.
write: /38 text-008, e_rec.
format color col_negative inverse off.
format color col_total inverse on.
write: /38 text-009, s_rec.
format color col_total inverse off.
endform.
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
call function 'WS_UPLOAD' "#EC *
exporting
filename = file
filetype = 'DAT'
tables
data_tab = gt_ft_sales
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11.
if sy-subrc 0 .
message e000.
endif.
endform. " get_data
*& Form BAPI
form bapi .
loop at gt_ft_sales into wa_gt_ft_sales.
wa_gt_ft_sales1 = wa_gt_ft_sales.
at new partn_numb.
wa_header-doc_type = wa_gt_ft_sales1-doc_type..
wa_header-sales_org = wa_gt_ft_sales1-sales_org . "'0001'
wa_header-distr_chan = wa_gt_ft_sales1-distr_chan. "'01'
wa_header-division = wa_gt_ft_sales1-division. " '01'
wa_header-purch_no = wa_gt_ft_sales1-purch_no.
wa_header-req_date_h = wa_gt_ft_sales1-reqdate.
call function 'CONVERSION_EXIT_PARVW_INPUT'
exporting
input = wa_gt_ft_sales1-partn_role
importing
output = v_parvw.
wa_header-partn_role = v_parvw.
wa_header-partn_numb = wa_gt_ft_sales1-partn_numb.
wa_header-unload_pt = wa_gt_ft_sales1-unload_pt.
move-corresponding wa_header to gt_order_partners.
move-corresponding wa_header to gt_order_header_in.
append gt_order_header_in.
append gt_order_partners.
endat.
call function 'CONVERSION_EXIT_CCMAT_INPUT'
exporting
input = wa_gt_ft_sales1-material
importing
output = v_matnr.
gt_order_items_in-material = v_matnr .
gt_order_items_in-target_qty = wa_gt_ft_sales1-targetquantity . "'1000'
gt_order_items_in-req_qty = wa_gt_ft_sales1-reqqty.
gt_order_items_in-req_date = wa_gt_ft_sales1-reqdate.
*GT_ORDER_ITEMS_IN-BILL_DATE = wa_GT_FT_SALES1-REQDATE.
gt_order_items_in-ref_1 = wa_gt_ft_sales1-ref_1.
append gt_order_items_in.
clear : wa_gt_ft_sales1,wa_header.
at end of partn_numb.
call function 'BAPI_SALESORDER_CREATEFROMDAT1'
exporting
order_header_in = gt_order_header_in
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = 'X'
importing
salesdocument = salesdocument
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
return = gt_return
tables
order_items_in = gt_order_items_in
order_partners = gt_order_partners.
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CCARD =
ORDER_CFGS_BLOB =
ORDER_SCHEDULE_EX =
if gt_return-type eq 'E' .
e_rec = e_rec + 1.
read table gt_return with key id = 'V1'.
format color col_negative inverse on.
rec_no = e_rec + s_rec.
concatenate text-006 rec_no ':'
gt_return-message into msg separated by space .
condense msg.
write: / msg.
format color col_negative inverse off.
elseif gt_return-number = '000'.
s_rec = s_rec + 1.
format color col_positive inverse on.
msg = 'SUCCESS'.
condense msg.
write: / msg .
format color col_positive inverse off.
write :/ salesdocument, 'Has been created'.
perform commit_mm.
endif.
clear: gt_return[], msg.
endat.
endloop.
endform. " SLALE_UPLOAD_DATA
*& Form COMMIT_MM
text
--> p1 text
<-- p2 text
form commit_mm .
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
importing
return = gt_return1.
clear: gt_order_items_inhttp://].\"GT_ORDER_CONDITIONS_IN[.
endform. " COMMIT_MM
inthis pass re_doc field in header... -
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 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 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 -
Error thrown in BAPI for SALE order
Hi,
In BAPI_SALESORDER_CREATEFROMDAT1 i got one error
Personnel master record (some number) does not exist for sales
How to solve this issue. Please give the solution.
thanks,
Suresh.MHi,
Can you please mention the exact data you are passing to the bapi ?
Kindly, check the partners details you are passing in the bapi as well.
KR Jaideep, -
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 -
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
Maybe you are looking for
-
Question on Synonyms and Implicit Cursor
Hi, I've two doubts. Question1: Why Oracle is allowing me to create a synonym even base object does not exist in database. For example in below example user ABC and object def doesnt exist in my database. Why I didnt get any error while creating a sy
-
Dual Displays Plus a Preview Monitor for FCP Supported?
Hello! I have the iMac 20" and do video editing. Beyond using a second display for an extended desktop, is it possible to have an additional monitor/TV for the preview while editing or for playback? Thanks! iMac (early 2006) Mac OS X (10.4.6) Als
-
The Subject says it all. No need to reply. Thanks, Supportcuenet.com http://www.cuenet.com Infocuenet.com -= At the speed of the Internet =-
-
Java.lang.ClassCastException in WebLogic 10.3.3 after recompile
While editing some code a developer noticed this error after a recompile in Weblogic 10.3.3. And the underlying object is a DimensionLabel. And we tried this in Weblogic 9.2 and it works fine with no exception. The developer simply recompiled the cla
-
DPI, pt units, font size, different screens, real physical size?
Hi, Usually the default dpi are 96dpi but we can set our screen dpi... But the only application I know that seems to work is in the evince(pdf reader) where I can very accurately see the real size of a paper/document... I've 2 laptops now, and I was