Stock Transfport Order Creation using IDOC
Hello Everybody,
I am trying to create a Stock Transport Order using IDOC's. All configuration for the STO has been done and I have no problems creating these orders using ME21N.
Now I need to create STO using IDOC. I am using Message Type ORDERS and Basic Type ORDERS05, but I am not sure what Process Code to use in the Partner Profile configuration in order to pick up proper processing module....
Any help would be appreciated,
Than you in advance
Felix
I ended up writing my own processing FM for this and used BAPI_PO_CREATE1 to post the PO
Similar Messages
-
LSMW - Sales Order creation using IDoc
Hello,
I'm receiving a file containing different category of products and need to create a sales order (using IDoc or BAPI) per category. The input file contains UPC code, I use a SELECT statement to check the category and append the UPC code to the specific internal table .(one internal table per category). The issue I have is to do loop in all internal table and then to create a sales order. I have some difficulties to update item segment. Only one UPC is populated to the required segment. Please let me know if this could be done using LSMW.
Thanks ! Thanks ! Thanks ! Thanks !
MehdiYou can use program RVINVB10 ( Direct Input ) to create Sales Order , Before you run this program you will have to create a file with data in specific format.
Read the documenatation of the program.
LSMw can help in formatting the data but beetr write your own progarm to format data and then run above program as LSMW has limitations and I am not sure what type of file you are getting. In you custom program you will have more control.
Cheers. -
Error in : Purchase order Creation using BAPI_PO_CREATE1
Hell guys,
I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
* Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
* Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
* Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
* Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
* Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
* Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa[].
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
poitem = i_bpoi[]
poitemx = i_bpoix[]
poschedule = i_bpos[]
poschedulex = i_bposx[].
i_order = i_new_ebeln .
SHIFT i_order LEFT DELETING LEADING '0' .
i_return-errortype = c_char_i .
i_return-workarea = c_zsw .
i_return-message = '064' .
i_return-variable1 = i_order .
loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
append i_bapiretn to t_bapi_return .
endloop .
if t_bapi_return[] is initial .
i_create_order = c_char_x .
CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
EXPORTING
act_return = i_return. "Popup with new PO no.
ENDCASE . " Docind
ENDIF .
ENDLOOP.Hi Shareen,
I think in the following parts of the code,
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa[].
Error in : Purchase order Creation using BAPI_PO_CREATE1
Posted: Mar 20, 2006 7:39 PM Reply E-mail this post
Hell guys,
I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = <b>i_ekpa[].</b>
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
<b> poitem = i_bpoi[]
poitemx = i_bpoix[]
poschedule = i_bpos[]
poschedulex = i_bposx[].</b>
it should be only i_bpoi, i_bpoix, i_bpos, i_bposx but not i_bpoi[], i_bpoix[], i_bpos[], i_bposx[].
CHange the code as follows:
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa.
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
poitem = i_bpoi
poitemx = i_bpoix
poschedule = i_bpos
poschedulex = i_bposx.
i_order = i_new_ebeln .
SHIFT i_order LEFT DELETING LEADING '0' .
i_return-errortype = c_char_i .
i_return-workarea = c_zsw .
i_return-message = '064' .
i_return-variable1 = i_order .
loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
append i_bapiretn to t_bapi_return .
endloop .
if t_bapi_return[] is initial .
i_create_order = c_char_x .
CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
EXPORTING
act_return = i_return. "Popup with new PO no.
ENDCASE . " Docind
ENDIF .
ENDLOOP. -
Reena Prabhakar - Sales order creation Using BAPI
Hi Reena,
This is Dinesh,i also face problem in Sales order creation using BAPI if you can send me the code it would be great help to me.
Regards,
DineshAnyhow, here is the code that I am using currently which works perfectly well. Not sure if it will be of any help to you, since the values to the BAPI come from the Webdynpro application. I have values stored in my "Test data directory" which I use for testing from the backend.
FUNCTION ztest.
Call the BAPI to create Sales Order
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = l_order_header
IMPORTING
salesdocument = l_salesdocument
TABLES
return = it_return
order_items_in = it_order_items
order_partners = it_order_partners
order_schedules_in = it_order_schdl
order_conditions_in = it_order_conditions
order_text = it_order_text.
READ TABLE it_return WITH KEY type = 'E'.
IF sy-subrc = 0.
*-- error occured
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
*-- no error
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
ENDFUNCTION. -
Need sales order creation using bapi in oops
need code for sales order creation using bapi in oops
hi rocky,
could you pls give a bit explanation on what you are expecting.
regards,
Pavan -
Mass sales order creation using BAPI
Dear All,
Can anyone help in mass sales order creation using Bapi BAPI_SALESORDER_CREATEFROMDAT2.
For example if i want to create 3 sales order with three item per order . i am populating
HEADER = 3 Records
Item = 9 records
schedule = 9 records
partner = 1 record.
Then after populating the records I am calling Bapi BAPI_SALESORDER_CREATEFROMDAT2
to create order. It should have created three order but unfortunately it creates
only one sales order. I debugged and found that records are correct both in header,
item, scheudle and partners.
Could you please guide me what I am missing for creation of mass orders.
I appreciate your time and many thanks in advance.
cheers
chandraHi Chandra,
Do like this.
Loop at Header table into wa_header.
*-- Move BAPI Header data
Loop at item table into wa_item where condition.
*-- in this move all Item and Schedule line item to the BAPI.
At end of item .
Use the below function modules.
BAPI_SALESORDER_CREATEFROMDAT2
BAPI_TRANSACTION_COMMIT.
Endloop.
Endloop.
Regards,
Balavardhan.K -
Upload data for Tcode LT06(Transfer order creation) using BDC -very urgent
hi experts,
I got stucked up in writing a BDC for the Tcode LT06(Transfer order creation using wearhouse number) in MM module,
the problem is like this, when i go to the tcode LT06 , it will ask for material doucument,mat. docu. year and wearhouse number, iam entering the inputs and then press enter, as soon as i press enter it takes me to the second screen where i will be selecting the item and then click on the button called 'Generate TO item'
here the problem arises, as soon as i click the button iam getting a standard SAP error message(No Destination Storage Bin found in storage type 'IMP'). Due to this errror iam not able populate the batch input data on the screen, suggest me a proper solution. rewards will given if solution found useful.
Kishore KHi ,
I have done the same in Background with BDC and TR Number for Multiple Materials ,
Can u please explain the scenario, so then I would be able to try for solution ?
Warm Regards. -
Sales order creation using webdynpro in ABAP
Plz give the process how to create sales order creation using webdynpro in ABAP. if not possible plz let me know how to create in JAVA.
It is very urgent. I hope i will get it very soon.
Thanks all
SaiIn your WDA application, all you need to do is call the BAPI BAPI_SALESORDER_CREATEFROMDAT2 when the user clicks some button. Most likely, you can put the code for this BAPI call in the onAction method for your button.
Regards,
Rich Heilman -
Sales Order Creation using LSMW IDOC method.. ( Custome Interface)
Hi ABAP'rs,
Please provide me LSMW steps for creating Sales Order using IDOC method.
Thanks and Regards,
Param.LSMW-IDOC in General
LSMW Step by Step Guide: Legacy System Migration Workbench is an R/3 Based tool for data transfer from legacy to R/3 for one time or periodic transfer.
Basic technique is Import data from Spreadsheet / Sequential file, convert from source format to target format and import into R/3 database. LSMW not part of standard R/3, if we need this product email [email protected]
Advantages of LSMW:
Most of the functions are within R/3, hence platform independence.
Quality and data consistency due to standard import techniques.
Data mapping and conversion rules are reusable across projects.
A variety of technical possibilities of data conversion.
Generation of the conversion program on the basis of defined rules
Interface for data in spreadsheet format.
Creation of data migration objects on the basis of recorded transactions.
Charge-free for SAP customers and partners.
Working With LSMW:
Use TCODE LSMW
Objects of LSMW:
Project ID with max of 10 char to Name the data transfer project.
Subproject Used as further structuring attribute.
Object ID with max of 10 Characters, to name the Business object .
Project can have multiple sub projects and subprojects can have multiple objects.
Project documentation displays any documentation maintained for individual pop ups and processing steps
User Guide: Clicking on Enter leads to interactive user guide which displays the Project name, sub project name and object to be created.
Object type and import techniques:
Standard Batch / Direct input.
Batch Input Recording
o If no standard programs available
o To reduce number of target fields.
o Only for fixed screen sequence.
BAPI
IDOC
o Settings and preparations needed for each project
Preparations for IDOC inbound processing:
Choose settings -> IDOC inbound processing in LSMW
Set up File port for file transfer, create port using WE21.
Additionally set up RFC port for submitting data packages directly to function module IDoc_Inbound_Asynchronous, without creating a file during data conversion.
Setup partner type (SAP recommended US) using WE44.
Maintain partner number using WE20.
Activate IDOC inbound processing.
Verify workflow customizing.
Steps in creating LSMW Project:
Maintain attributes choose the import method.
Maintain source structure/s with or without hierarchical relations. (Header, Detail)
Maintain source fields for the source structures. Possible field types C,N,X, date, amount and packed filed with decimal places.
Fields can be maintained individually or in table form or copy from other sources using upload from a text file
Maintain relationship between source and target structures.
Maintain Field mapping and conversion rules
For each Target field the following information is displayed:
o Field description
o Assigned source fields (if any)
o Rule type (fixed value, translation etc.)
o Coding.
o Some fields are preset by the system & are marked with Default setting.
Maintain Fixed values, translations, user defined routines Here reusable rules can be processed like assigning fixed values, translation definition etc.
Specify Files
o Legacy data location on PC / application server
o File for read data ( extension .lsm.read)
o File for converted data (extension .lsm.conv)
Assign Files to defined source structures
Read data Can process all the data or part of data by specifying from / to transaction numbers.
Display read data To verify the input data being read
Convert Data Data conversion happens here, if data conversion program is not up to date, it gets regenerated automatically.
Display converted data To verify the converted data
Import Data Based on the object type selected
Standard Batch input or Recording
o Generate Batch input session
o Run Batch input session
Standard Direct input session
o Direct input program or direct input transaction is called
BAPI / IDOC Technique:
IDOC creation
o Information packages from the converted data are stored on R/3 Database.
o system assigns a number to every IDOC.
o The file of converted data is deleted.
IDOC processing
o IDOCS created are posted to the corresponding application program.
o Application program checks data and posts in the application database.
Finally Transport LSMW Projects:
R/3 Transport system
o Extras ->Create change request
o Change request can be exported/imported using CTS
Export Project
o Select / Deselect part / entire project & export to another R/3 system
Import Project
o Exported mapping / rules can be imported through PC file
o Existing Project data gets overwritten
o Prevent overwriting by using
Import under different name
Presetting for Inbound IDOC processing not transportable.
Reward if useful.
regards
santhosh reddy -
Sales order creation using BAPI using IDoc
Hi all,
I am getting an IDoc from PI server. I need to process that IDoc in SAP for which I have created a function module.
I need to read that IDoc in the FM.
Please give me sample code / procedure of coding step by step to validate the data from Idoc structure and creating sales order from the IDoc data.
Also tell me which BAPI / FM should I use to create sales order.
Thanks,
~SachinHi Sachin
Extended order type ORDERS05 to ZFRORDERS05 with additional fields is goodu2026
But you can write user exits to populate the additional field to sale order fieldsu2026.
And FM IDOC_INPUT_ORDERS will post the data and create the SALES ORDERu2026
This is standard function every industry will followu2026. And this is recommended.
If you want to create custom FM then call (BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order) in you custom FM.
Thanks
Ramesh -
Line item Ship-to Info is not the same in Header Ship-to Party During Sales Order Creation via IDOC
We have observed that during creation of sales order using idoc, the line item ship-to party is not the same with header ship-to. The ship-to party info in line item is equivalent to the header's sold to party. To give you a quick background, Sold to party info is given in idoc and ship to party is being determined using table EDPAR. In this specific scenario, sold to customer is not the same with ship to customer.
Initial checking on the code leads us in function module VIEW_KUAGV. This FM populates partner details of sales order header and line item in program LVEDAF1Z
Below is the code for Sales order Header. Notice that WE_INPUT parameter which contains Ship to party is passed as exporting parameter in FM VIEW_KUAGV. This is the reason why Ship to Party is populated correctly in sales order header but not in sales order item.
Initially, it first set to Sold-To Party. However, if WE_INPUT is given or provided, partner details is set to Ship-To Party.
Please advise on how we can make the ship to party info in header and line item be consistent. This is SAP Standard program which why we are hesitant to make change on the program. If there is a configuration to make this happen, kindly advise.
Regards,
RommelHi Jayesh,
If I understand you correctly, you want that when creating SO from Quoatation
the Ship to Party also follow/copy Ship to Party from Quotation, right?
Just to confirm with you, when you creating SO reference from Quotation, you
use copy/follow-up function, am I right?
You can do this by setting in configuration of Copy Control (like mentioned by Hui).
Step as follow :
1. Go to IMG->CRM->Transactions->Basic Settings->Copying Control for
Business Transactions
2. Create your BAdi (Business Add-In for Copying Control), such as get Ship to
Party value from source document and use it in current document
3. Use this Rule you have created in BAdi (no. 2), in copy control transaction type
IMG->CRM->Transactions->Basic Settings->Copying Control for
Business Transactions-> Define Copying Control for Transaction Types
4. Here you set Copying Routine for your transaction types (put name of your Badi
created in step no. 2)
Or alternatively, you can set it on access sequence in Partner Function
Ship to Party in configuration. You can define access sequence the Ship
to Party is taken from Preceeding Document -> Ship To Party
1. Go to Partner Function access sequence :
IMG->CRM->Basic Functions->Partner Processing->Define Access Sequence
2. Create new access sequence with following entry :
- Source COM_PARTNER_A (PrecedingPartner)
- Check Mapping for Partner Being search
- Partner Function in Source = Ship To Party
3. Assign this Access Sequence in you Partner Function used in Sales Order Transaction
Type.
Tell me if this is what you looking for
Gun. -
Stock transport order creation
hi gurus
i want pricing should be carried out at the time of creation of stock transport order.
kindly advice what to do for this requirement.
thanks & regards
sumanHi Suman,
Just to add to what is mentioned above.
There are two types of STO same company n cross company.
1) If it is same company then there will be no pricing carried out
2) if it is corss company then like Pricing procedure in Sales Order we have Pricing schema in STO .
This can be well assisted by MM team.
Hope it helps.
Thanks and Regards
Rohit. -
GETTING ERROR RELATED TO TASK LIST IN ORDER CREATION USING BAPI_ALM_ORDER_M
hi all ,
I am using bapi_alm_order_maintain to create a new work order . i am passing task list group and task list counter in IT_TASK_list tables . on execution it is showing an error message " PLEASE PROVIDE THE MANDATORY TASK LIST DURING WORK ORDER CREATION.
SEEKING YOUR HELP TO REMOVE THIS ERROR.hi all ,
I am using bapi_alm_order_maintain to create a new work order . i am passing task list group and task list counter in IT_TASK_list tables . on execution it is showing an error message " PLEASE PROVIDE THE MANDATORY TASK LIST DURING WORK ORDER CREATION.
SEEKING YOUR HELP TO REMOVE THIS ERROR. -
LSMW Sales Order creation using Bapi method
Hi folks ,
iam doing Lsmw bapimethod ,sales order creation .In the step start idoc processing iam getting error "Has Not been Accepted for Processing ",why iam not getting plz let me know points will be awarded for all answers .Hi,
You need to set the IDOC settings in the initial LSMW screen. It will be there in menu path.
Award points if helpful
Regards,
RamaKrishna C -
SALES order creation using BAPI's
Hai to all,
I want to create sales order using bapis .I am new to this topic could any body guide me how to create sales order step by step process using bapis.
Thanks in advance.
Regards,
Chaitanya** プログラムID       : ZBAPI_SALESORDER_CREATE *
** プログラム名称      : Upload Sales Order Creation *
** 処理概要         : *
** 作成者           : Karthik.P *
** 作成日           : 2006/08/10 *
REPORT ZBAPI_SALESORDER_CREATE LINE-SIZE 132 MESSAGE-ID ZMMBAPI .
Internal table definition *
****<<<<<Communication Fields: Sales and Distribution Document Header>>>>>>>>
DATA: GT_ORDER_HEADER_IN LIKE BAPISDHD1,
*******<<<Checkbox Fields for Sales and Distribution Document Header>>>>>>>>>
GT_ORDER_HEADER_INX LIKE BAPISDHD1X,
*****<<<<<Return Parameter>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GT_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE, " Return Messages
*********<<<Communication Fields: Sales and Distribution Document Item<>>>>>
GT_ORDER_ITEMS_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE, " Item Data
*********<<<Communication Fields: Sales and Distribution Document Item>>>>>>>
GT_ORDER_ITEMS_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE, "Item Data Checkbox
*********<<<Communication Fields: Sales and Distribution Document Item>>>>>>>
GT_SALESDOCUMENT LIKE BAPIVBELN-VBELN , "Number of Generated Document
*********<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
GT_ORDER_PARTNERS LIKE BAPIPARNR OCCURS 0 WITH HEADER LINE, "Document Partner
********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
GT_ORDER_SCHEDULES_IN LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE, "Schedule Line Data
****<<<<<<<<Checkbox List for Maintaining Sales Document Schedule Line>>>>>>>>
GT_ORDER_SCHEDULES_INX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE, " Checkbox Schedule Line Data
*******Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_IN LIKE BAPICOND OCCURS 0 WITH HEADER LINE,
******Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_INX LIKE BAPICONDX OCCURS 0 WITH HEADER LINE.
Data definition *
DATA: BEGIN OF GT_FT_SALES OCCURS 0,
DOC_TYPE(4) , "Sales Document Type
SALES_ORG(4) , "Sales Organization
DISTR_CHAN(2) , "Distribution Channel
DIVISION(2) , "DIVISION(2)
SALES_DIST(6) , "Sales district
INCOTERMS1(3) , "Incoterms (part 1)
INCOTERMS2(28) , "Incoterms (part 2)
PMNTTRMS(4) , "Terms of payment key
PRICE_DATE(8) , "Date for pricing and exchange rate
PURCH_NO_C(35) , "Customer purchase order number
PURCH_NO_S(35) , "Ship-to Party's Purchase Order Number
EXCHG_RATE(8) , "Directly quoted exchange rate for pricing and statistics
CURRENCY(5) , "SD document currency
MATERIAL(18), "MATERIAL
TARGET_QTY(13) , "Target quantity in sales units
ITEM_CATEG(4) , "Sales document item category
MATL_GROUP(8) , "Material Group
PURCH_NO_C1(35), "Customer purchase order number
SALES_DIST1(6) , "Sales district
INCOTERMS11(3) , "Incoterms (part 1)
INCOTERMS21(28), "Incoterms (part 2)
PMNTTRMS1(4) , "Terms of payment key
EXCHG_RATE1(8) , "Directly quoted exchange rate for pricing and statistics
PRICE_DATE1(8) , "Date for pricing and exchange rate
TRG_QTY_NO(5) , "Factor for converting sales units to base units (target qty)
DIVISION1(2) , "DIVISION1
SALQTYNUM(5) , "Numerator (factor) for conversion of sales quantity into SKU
GROSS_WGHT(3) , "Gross Weight of the Item
NET_WEIGHT(15) , "Net Weight of the Item
UNTOF_WGHT(3) ,"Weight Unit
PARTN_ROLE(2) ,"Partner function
PARTN_NUMB(10) ,"Customer Number 1
********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
ITM_NUMBER(6) ,"Item number of the SD document
REQ_QTY(8) , "Schedule line date
DLV_DATE(8) , "Schedule line date
MS_DATE(8) , "Material availability date
LOAD_DATE(8) , "Loading time (local time with reference to a shipping point)
GI_DATE(8), "Time of goods issue (local DATE, with reference to a plant)
TP_DATE(8) , "Transportation planning -time (local w/ref. to shipping pnt)
ITM_NUMBER2(6) , "Condition item number
END OF GT_FT_SALES,
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
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 .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = FILE.
**<<<<<<<<<<<<<<<<<START-OF-SELECTION.>>>>>>>>>>>>>>>>>>>>>>>>>>>
START-OF-SELECTION.
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.
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, 111 SY-UNAME,
/ TEXT-004, 13 SY-DATUM , 104 TEXT-005, 111 SY-UZEIT.
FORMAT COLOR COL_NEGATIVE INVERSE OFF.
SKIP 3.
LOOP AT GT_FT_SALES.
PERFORM SLALE_UPLOAD_DATA.
ENDLOOP.
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.
*& Form SLALE_UPLOAD_DATA
text
--> p1 text
<-- p2 text
FORM SLALE_UPLOAD_DATA .
*******<<<<<<<<<<Communication Fields: Sales and Distribution Document Header>>>>>>
GT_ORDER_HEADER_IN-DOC_TYPE = 'TA'.
GT_ORDER_HEADER_IN-SALES_ORG = GT_FT_SALES-SALES_ORG . "'0001'
GT_ORDER_HEADER_IN-DISTR_CHAN = GT_FT_SALES-DISTR_CHAN. "'01'
GT_ORDER_HEADER_IN-DIVISION = GT_FT_SALES-DIVISION. " '01'
GT_ORDER_HEADER_IN-SALES_DIST = GT_FT_SALES-SALES_DIST ."'000001'
GT_ORDER_HEADER_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1. "'CFR'
GT_ORDER_HEADER_IN-INCOTERMS2 = GT_FT_SALES-INCOTERMS2 . "'HAMBURG'
GT_ORDER_HEADER_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS . "'0001'
GT_ORDER_HEADER_IN-PRICE_DATE = GT_FT_SALES-PRICE_DATE ."'20060818'
GT_ORDER_HEADER_IN-PURCH_NO_C = '32'.
GT_ORDER_HEADER_IN-PURCH_NO_S = '32'.
GT_ORDER_HEADER_IN-EXCHG_RATE = GT_FT_SALES-EXCHG_RATE ."'1.00000'
GT_ORDER_HEADER_IN-CURRENCY = GT_FT_SALES-CURRENCY . " 'EUR'
********<<<Checkbox Fields for Sales and Distribution Document Header>>>>>>>>>
GT_ORDER_HEADER_INX-DOC_TYPE = 'X'.
GT_ORDER_HEADER_INX-SALES_ORG = 'X'.
GT_ORDER_HEADER_INX-DISTR_CHAN = 'X'.
GT_ORDER_HEADER_INX-DIVISION = 'X'.
GT_ORDER_HEADER_INX-SALES_DIST = 'X'.
GT_ORDER_HEADER_INX-INCOTERMS1 = 'X'.
GT_ORDER_HEADER_INX-INCOTERMS2 = 'X'.
GT_ORDER_HEADER_INX-PMNTTRMS = 'X'.
GT_ORDER_HEADER_INX-PRICE_DATE = 'X'.
GT_ORDER_HEADER_INX-PURCH_NO_C = 'X'.
GT_ORDER_HEADER_INX-PURCH_NO_S = 'X'.
GT_ORDER_HEADER_INX-EXCHG_RATE = 'X'.
GT_ORDER_HEADER_INX-CURRENCY = 'X'.
*****<<<<<<Communication Fields: Sales and Distribution Document Item>>>
GT_ORDER_ITEMS_IN-ITM_NUMBER = '000010'.
GT_ORDER_ITEMS_IN-MATERIAL = GT_FT_SALES-MATERIAL .
GT_ORDER_ITEMS_IN-PO_ITM_NO = '32'.
GT_ORDER_ITEMS_IN-CUST_MAT22 = 'AGNI-IV'.
GT_ORDER_ITEMS_IN-BILL_DATE = '20060808'.
GT_ORDER_ITEMS_IN-PLANT = '0001'.
*GT_ORDER_ITEMS_IN-STORE_LOC = '0001'.
GT_ORDER_ITEMS_IN-TARGET_QTY = GT_FT_SALES-TARGET_QTY . "'1000'
GT_ORDER_ITEMS_IN-ITEM_CATEG = GT_FT_SALES-ITEM_CATEG . "'TAN'
GT_ORDER_ITEMS_IN-MATL_GROUP = GT_FT_SALES-MATL_GROUP . "'01'
GT_ORDER_ITEMS_IN-PURCH_NO_C = GT_FT_SALES-PURCH_NO_C . "'32'
GT_ORDER_ITEMS_IN-SALES_DIST = GT_FT_SALES-SALES_DIST . "'000001'
GT_ORDER_ITEMS_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1 . "'CFR'
GT_ORDER_ITEMS_IN-INCOTERMS2 = GT_FT_SALES-INCOTERMS2 . "'HAMBURG'
GT_ORDER_ITEMS_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS . "'0001'.
GT_ORDER_ITEMS_IN-EXCHG_RATE = GT_FT_SALES-EXCHG_RATE . "'1.00000'
GT_ORDER_ITEMS_IN-PRICE_DATE = GT_FT_SALES-PRICE_DATE . "'20060808'
*GT_ORDER_ITEMS_IN-SALES_UNIT = 'DZ'.
GT_ORDER_ITEMS_IN-TRG_QTY_NO = GT_FT_SALES-TRG_QTY_NO . "'23'
GT_ORDER_ITEMS_IN-DIVISION = GT_FT_SALES-DIVISION . "'01'
GT_ORDER_ITEMS_IN-SALQTYNUM = GT_FT_SALES-SALQTYNUM . "'32'
GT_ORDER_ITEMS_IN-GROSS_WGHT = GT_FT_SALES-GROSS_WGHT. " ' 25272000'
GT_ORDER_ITEMS_IN-NET_WEIGHT = GT_FT_SALES-NET_WEIGHT. "'24464000'
GT_ORDER_ITEMS_IN-UNTOF_WGHT = GT_FT_SALES-UNTOF_WGHT . " 'KG'
*GT_ORDER_ITEMS_IN-CURRENCY = 'EUR'.
APPEND GT_ORDER_ITEMS_IN.
****<<<<<<Communication Fields: Sales and Distribution Document Item>>>
GT_ORDER_ITEMS_INX-ITM_NUMBER = '000010'.
GT_ORDER_ITEMS_INX-MATERIAL = 'X'.
*GT_ORDER_ITEMS_INX-PO_ITM_NO = 'X'.
GT_ORDER_ITEMS_INX-CUST_MAT22 = 'X'.
GT_ORDER_ITEMS_INX-BILL_DATE = 'X'.
GT_ORDER_ITEMS_INX-PLANT = 'X'.
*GT_ORDER_ITEMS_INX-STORE_LOC = 'X'.
GT_ORDER_ITEMS_INX-TARGET_QTY = 'X'.
GT_ORDER_ITEMS_INX-ITEM_CATEG = 'X'.
GT_ORDER_ITEMS_INX-MATL_GROUP = 'X'.
GT_ORDER_ITEMS_INX-PURCH_NO_C = 'X'.
GT_ORDER_ITEMS_INX-SALES_DIST = 'X'.
GT_ORDER_ITEMS_INX-INCOTERMS1 = 'X'.
GT_ORDER_ITEMS_INX-INCOTERMS2 = 'X'.
GT_ORDER_ITEMS_INX-PMNTTRMS = 'X'.
GT_ORDER_ITEMS_INX-EXCHG_RATE = 'X'.
GT_ORDER_ITEMS_INX-PRICE_DATE = 'X'.
*GT_ORDER_ITEMS_INX-SALES_UNIT = 'X'.
GT_ORDER_ITEMS_INX-TRG_QTY_NO = 'X'.
GT_ORDER_ITEMS_INX-DIVISION = 'X'.
GT_ORDER_ITEMS_INX-SALQTYNUM = 'X'.
GT_ORDER_ITEMS_INX-GROSS_WGHT = 'X'.
GT_ORDER_ITEMS_INX-NET_WEIGHT = 'X'.
GT_ORDER_ITEMS_INX-UNTOF_WGHT = 'X'.
*GT_ORDER_ITEMS_IN-CURRENCY = 'x'.
APPEND GT_ORDER_ITEMS_INX.
*****<<<<<<Communications Fields: SD Document Partner: WWW
GT_ORDER_PARTNERS-PARTN_ROLE = 'WE'.
GT_ORDER_PARTNERS-PARTN_NUMB = '0000000057'.
***GT_ORDER_PARTNERS-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER . " '000010'.
APPEND GT_ORDER_PARTNERS.
*********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
GT_ORDER_SCHEDULES_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER." '000010'
GT_ORDER_SCHEDULES_IN-REQ_QTY = GT_FT_SALES-REQ_QTY . "'234'
GT_ORDER_SCHEDULES_IN-DLV_DATE = GT_FT_SALES-DLV_DATE ." '20060824'.
GT_ORDER_SCHEDULES_IN-MS_DATE = GT_FT_SALES-MS_DATE . "'20060808'
GT_ORDER_SCHEDULES_IN-LOAD_DATE = GT_FT_SALES-LOAD_DATE. " '20060822'
GT_ORDER_SCHEDULES_IN-GI_DATE = GT_FT_SALES-GI_DATE . " '20060823'
GT_ORDER_SCHEDULES_IN-TP_DATE = GT_FT_SALES-TP_DATE . "'20060821'
APPEND gt_ORDER_SCHEDULES_IN.
*********<<<<Communications Fields: SD Document Partner: WWW FLAG>>>>>>>>>>>>>>>>>>
GT_ORDER_SCHEDULES_INX-ITM_NUMBER = '000010'.
GT_ORDER_SCHEDULES_INX-REQ_QTY = 'X'.
GT_ORDER_SCHEDULES_INX-DLV_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-MS_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-LOAD_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-GI_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-DLV_DATE = 'X'.
APPEND gt_ORDER_SCHEDULES_INX.
********Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER ." '000010'
APPEND GT_ORDER_CONDITIONS_IN.
***Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_INX-ITM_NUMBER = '000010'.
APPEND GT_ORDER_CONDITIONS_INX.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
ORDER_HEADER_IN = GT_ORDER_HEADER_IN
ORDER_HEADER_INX = GT_ORDER_HEADER_INX
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = GT_SALESDOCUMENT
TABLES
RETURN = GT_RETURN
ORDER_ITEMS_IN = GT_ORDER_ITEMS_IN
ORDER_ITEMS_INX = GT_ORDER_ITEMS_INX
ORDER_PARTNERS = GT_ORDER_PARTNERS
ORDER_SCHEDULES_IN = GT_ORDER_SCHEDULES_IN
ORDER_SCHEDULES_INX = GT_ORDER_SCHEDULES_INX
ORDER_CONDITIONS_IN = GT_ORDER_CONDITIONS_IN
ORDER_CONDITIONS_INX = GT_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 =
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-TYPE EQ 'S'.
S_REC = S_REC + 1.
FORMAT COLOR COL_POSITIVE INVERSE ON.
MSG = GT_RETURN-MESSAGE.
CONDENSE MSG.
WRITE: / MSG .
FORMAT COLOR COL_POSITIVE INVERSE OFF.
PERFORM COMMIT_MM.
ENDIF.
CLEAR: GT_RETURN[], MSG.
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_RETURN.
clear: GT_ORDER_ITEMS_IN[],GT_ORDER_CONDITIONS_IN[].
ENDFORM. " COMMIT_MM
Maybe you are looking for
-
I have a Mac OS X (10.6.6) 2.3 GHz Intel Core i5 Memory 4GD 1333MHz DDR3 A while ago I eliminated mi icloud by mistake I´ve been trying to redownload or get it back but no luck. If you have any advice I would really appreciate it!!
-
SQL*Plus Raises: ORA-3113 End of file on communication channel
I have a Win2000 machine running Oracle client 8i, connecting to an HP-UX server running 9i RAC, with an unknown collection of switches/firewalls in between. Using SQL*Plus I can successfully connect and run queries. However, if I leave the session i
-
HI, I am trying to modify the Apps login page. I just renamed the page AppsLocalLogin.jsp to xxxAppsLocalLogin.jsp and try to access from the server. This gives me error java.lang.RuntimeException: Cannot access oracle.app.fnd.sso Here .app. access t
-
C7250 All in One "Disconnected" error when trying to use Solution Center
This C7250 All in One is connected via USB to our home desktop, and we also connect wirelessly when using laptops. From my laptop when printing from various programs or e-mail the printer works fine. However, when I open Solution Center to attempt sc
-
Mouse stops working after being left alone
My issue is: If I don't use my mouse for an extended period of time (especially if afk, happenes when at the computer too though) it stops working and I need to replug it for it to work, the time seems to range from 2 seconds to half an hour or more