order_cfgs_ref =
order_cfgs_inst =
order_cfgs_part_of =
order_cfgs_value =
order_cfgs_blob =
report z_ .
tables: vbak , vbap.
data: begin of order_header_in occurs 1.
include structure bapisdhd1.
data: end of order_header_in.
data: begin of order_header_inx occurs 1.
include structure bapisdhd1x.
data: end of order_header_inx.
data: begin of order_items_in occurs 1.
include structure bapisditm.
data: end of order_items_in.
data: begin of order_items_inx occurs 1.
include structure bapisditmx.
data: end of order_items_inx.
data: begin of order_schedules_in occurs 1.
include structure bapischdl.
data: end of order_schedules_in.
data: begin of order_schedules_inx occurs 1.
include structure bapischdlx.
data: end of order_schedules_inx.
data: begin of order_partners occurs 1.
include structure bapiparnr.
data: end of order_partners.
*data: begin of order_text occurs 1.
- include structure bapisdtext.
*data: end of order_text.
data: begin of li_return occurs 1.
include structure bapiret2.
data: end of li_return.
data: begin of order_cfgs_vk occurs 1.
include structure bapicuvk.
data: end of order_cfgs_vk.
data: begin of order_cfgs_inst occurs 1.
include structure bapicuins.
data: end of order_cfgs_inst.
data: begin of order_cfgs_part_of occurs 1.
include structure bapicuprt.
data: end of order_cfgs_part_of.
data: begin of order_cfgs_ref occurs 1.
include structure bapicucfg.
data: end of order_cfgs_ref.
data: begin of order_cfgs_value occurs 1.
include structure bapicuval.
data: end of order_cfgs_value.
data: l_vbeln like bapivbeln-vbeln.
data: l_salesdocument like bapivbeln-vbeln.
parameters: p_vbeln like vbak-vbeln.
start-of-selection.
l_salesdocument = p_vbeln.
perform set_header.
perform set_item.
perform set_partner.
- PERFORM set_text.
perform call_bapi.
form set_partner.
clear order_partners.
order_partners-partn_role = 'AG'. "Remember German codes !
order_partners-partn_numb = 'ST000'.
append order_partners .
clear order_partners.
order_partners-partn_role = 'WE'. "Remember German codes !
order_partners-partn_numb = 'ST000'.
append order_partners.
clear order_partners.
order_partners-partn_role = 'RE'. "Remember German codes !
order_partners-partn_numb = 'ST000'.
append order_partners.
clear order_partners.
order_partners-partn_role = 'RG'. "Remember German codes !
order_partners-partn_numb = 'ST000'.
append order_partners.
endform. " set_partner
form set_header.
- Sales document type
order_header_in-doc_type = 'ORD'. "Remember German codes !
order_header_in-sales_org = '2000'.
order_header_in-distr_chan = '00'.
order_header_in-division = '01'.
order_header_in-purch_no_c = 'DG-19970626-300'.
order_header_in-req_date_h = '20040829'.
order_header_in-cmlqty_dat = '20040829'.
append order_header_in.
order_header_inx-updateflag = 'I'.
order_header_inx-doc_type = 'X'.
order_header_inx-sales_org = 'X'.
order_header_inx-distr_chan = 'X'.
order_header_inx-division = 'X'.
order_header_inx-purch_no_c = 'X'.
order_header_inx-req_date_h = 'X'.
- order_header_in-CMLQTY_DAT = '20040829'.
append order_header_inx.
endform. " set_header
order_items_in-itm_number = '000010'.
order_items_in-material = 'M11032-ST000-49C'.
- order_items_in-ITEM_CATEG = 'TAC'.
order_items_in-po_itm_no = '000050'.
- order_items_in-val_contr = '0040000101'.
- order_items_in-val_con_i = '000010'.
order_items_in-ref_doc = '0040000101'.
order_items_in-ref_doc_it = '000010'.
append order_items_in.
order_items_inx-updateflag = 'I'.
order_items_inx-itm_number = '000010'.
order_items_inx-material = 'X'.
order_items_inx-po_itm_no = 'X'.
- order_items_inx-val_contr = 'X'.
- order_items_inx-val_con_i = 'X'.
order_items_inx-ref_doc = 'X'.
order_items_inx-ref_doc_it = 'X'.
- order_items_inx-ITEM_CATEG ='X'.
append order_items_inx .
order_schedules_in-itm_number = '000010'.
order_schedules_in-req_date = '29.08.2004'.
order_schedules_in-req_qty = '10.000'.
order_schedules_inx-itm_number = '000010'.
order_schedules_inx-req_date = 'X'.
order_schedules_inx-req_qty = 'X'.
order_schedules_inx-updateflag = 'I'.
append order_schedules_in.
append order_schedules_inx.
order_cfgs_ref-posex = '000050'.
order_cfgs_ref-config_id = '000010'.
order_cfgs_ref-root_id = '000010'.
APPEND order_cfgs_ref.
order_cfgs_value-config_id = '000050'.
order_cfgs_value-inst_id = '000010'.
order_cfgs_value-charc = 'M05727_COLOR'.
order_cfgs_value-value = 'B'.
APPEND order_cfgs_value.
order_cfgs_value-config_id = '000050'.
order_cfgs_value-inst_id = '000010'.
order_cfgs_value-charc = 'M05727_SIZE'.
order_cfgs_value-value = '42-16-120'.
APPEND order_cfgs_value.
endform. " set_item
- order_text-text_id = '0003'.
- order_text-langu = 'M'.
- order_text-langu_iso = 'ZF'.
- order_text-format_col = '*'.
- order_text-text_line = 'text line 1'.
**order_text-FUNCTION
- append order_text.
- order_text-text_line = 'text line 2'.
- append order_text.
- order_text-text_line = 'text line 3'.
- append order_text.
- order_text-text_line = 'text line 4'.
- append order_text.
- order_text-doc_number = p_vbeln.
- order_text-itm_number = '000010'.
- order_text-text_id = '0002'.
- order_text-langu = 'M'.
- order_text-langu_iso = 'ZF'.
- order_text-format_col = '*'.
- order_text-text_line = 'item text'.
- append order_text.
call function 'CUXC_INIT'.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
order_header_in = order_header_in
order_header_inx = order_header_inx
salesdocumentin = l_salesdocument
- testrun = 'X'
importing
salesdocument = p_vbeln
tables
return = li_return
order_items_in = order_items_in
order_items_inx = order_items_inx
order_schedules_in = order_schedules_in
order_schedules_inx = order_schedules_inx
order_partners = order_partners
- order_cfgs_ref = order_cfgs_ref
- order_cfgs_inst = order_cfgs_inst
- order_cfgs_part_of = order_cfgs_part_of
- order_cfgs_value = order_cfgs_value
- order_cfgs_vk = order_cfgs_vk
- order_text = order_text
call function 'BAPI_TRANSACTION_COMMIT'.
loop at li_return.
write:/ li_return-type,
li_return-message.
endloop.
endform. " call_bapi
RELATED POST
ALV AND NORMAL REPORT COMPARISION
SAP ABAP FAQ'S ON INTERACTIVE REPORT
SAP ABAP INTERVIEW QUESTIONS ON SCRIPTS PART ONE
SAP ABAP INTERVIEW QUESTIONS ON SCRIPTS PART TWO
SAP ABAP INTERVIEW QUESTIONS ON SCRIPTS PART THREE
SAP ABAP INTERVIEW ROUND ONE FAQ'S PART ONE
No comments:
Post a Comment