PPDS order creation
Hi all,
I understand that we can combine make-to-stock and make-to-order strategy using forecasting horizon in SNP. That's, within forecasting horizon SNP creates orders only against sales order and dependent requirement and not against PIR. Can we do the same in PP planning? is there a way to run PP heuristics so that planned orders are created only against SO, dep requirement and not against PIR (in my case there is PIR at plant level)?
I appreciate your inputs..
Hi,
In PPDS also you can decide either to Plan Sales order or PIR using Planning strtegy
If yr strategy is MTS , it will MTS only & viceversa
I hope this will solve your problem on Hand.
In case your requirement is something different that I explained, please reexplaing alongwith strategy & which heuristic you are using. There are some BADI in PPDS with the help of which you can selectivel;y consider the planning input
Please let me know yr scenario in detail so that I can suggest the apprpprite badi
Thanks,
Mangesh A> Kulkarni
Similar Messages
-
APO: RRP3 automate Production order creation from planned order ?
Hi everyone ,
I have got a business requirement in APO where in Open sale orders uploaded in R/3, needs to be converted to Planned order and subsequently to Production order in APO-PPDS tcode RRP3 at all stages. They want to automate this process rather than doing it
manually.
Can anyone tell how is this possible . Any BAPI or function module available to do this . Please help.
Regards,
SyedHi,
1.You need to run the heuristics Planning of standard lots SAP_PP_002 in /SAPAPO/CDPSB0 by specifying the time profile
and strategy profile, planning version and propagation range, product and location.
2. Convert PPDS Planned Orders created to process orders thru /SAPAPO/RRP7 by specifying the product location start date of the order for production order creation.
Out put of step 1- For sales order requirement, PPDS Planned orders gets created.
Out put of step 2- PPDS Planned orders are converted to production orders.
Thanks,
nandha -
Production declaration based on order creation date in R/3
Hi,
Can we do the production declaaration in R/3 (mfbf) for PPDS planned orders sent to R/3 from APO based on order creation date?
This is because we need to differentiate between SNP and PPDS planned orders in R/3.
As there is no differentition in SNP and PPDS orders in R/3, while production decalration,
it's not possible that only PPDS orders will get consumed (in mfbf).
SO can we do production declaration based on order creation date instead of order number?
Please share the information.
Thanks,
VinayakHello Santosh
Production versions are selected on the standard system according to the basic finish date, however, you can change the standard system behavior with the implementation of the following note:
351773 - Selection of production versions for planned order
Alternatively, you may use BAdI MD_MODIFY_PRODVERS to create your own logic to select the production versions.
BR
Caetano -
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. -
Sales order creation, standard event trigger is taking long time .
We have a requirement where we are sending data to CRM system using RFC function module. This data is sent while sales order creation or change. We have used standard event BUS2032.CREATED to trigger CRM FM in sales order creation mode. In sales order change mode, we are using custom event. In production system, our custom change event is getting triggered fine and data is sent to CRM system with small time lag of around 1 minute. But, while sales order creation, standard event trigger is taking long time ( sometimes about 20 minutes) in production system.
We tried triggering same custom event at the time of sales order creation using FM u2018SWE_EVENT_CREATE_IN_UPD_TASKu2019 as well but, still we are not able to improve performance of the event trigger at sales order creation.
Regards,
Sushee JoshiHI,
we have written SWE_EVENT_CREATE in update task
I think instead of calling in update task simply call to function module CALL FUNCTION "SWE_EVENT_CREATE" might trigger the event immediately.. Did you try to check in this way..
OR
And I also suggest you to check the entry in SWE2 txn with respect to your workflow tempalte, may be you have enable the option ENABLE EVENT QUEUE, this could be one of the reasons.. If it is enabled please disable it (uncheck)
Please check..
Regards
Pavan -
Hi Guys
I need a help with a problem here
Our maintenance guys work in 3 different shifts. We would like to get a report about the workload in each shift
I was wondering if its possible to get a list of orders with the creation time of each order.
How can I get this info? The work order creation time?
Thanks and RegardsTransaction IW38 will give you a list based on the the date created you would need to create a varaint with a list of the user ID's that belong in each of the 3 shiftes this would then give a report of the orders created by Shift on any given day.
Alternatively if you wanted to find out the orders on a weekly basis this could be done using the user ID's with a period of time over a week for instance.
Hope this helps
Jim -
Purchase Order Creation from ME5A Report
Hi experts,
My client wants Purchase Order Creation from ME5A Report.
He wants show Open Purchase Requisition through ME5A report then he will select Purchase Requisition Number or line item for po creation from there only.
Please advice how I can map this process in sap.
Thanks in advance,
ChandhuWhy don't you use ME57 to display open PRs and then assign sources and convert them to PO?
Or use ME57 to assign sources and ME59 to automatically convert them to PO.
You can create your very own format for report display using custom "Scope Of List" for ME57.
Look in SPRO under Purchasing>Reporting>Maintain Purchase requisition lists. -
Credit block should not prevent service order creation
An upgrade from 4.7 to ECC6, without any changes made to the configuration or program change, has lead to the following issue. ECC6 is not creating a service order connected to a sales order, when the customer has exceeded the credit limit. The sales order of custom order type is getting saved with a warning message that credit limit has exceeded. However, earlier in 4.7, the message would not stop creating subsequent service order. What could be different, that prevent ECC6 environment to hold on to service order creation? A subsequent release of the credit block through VKM1 however triggers the service order being created.
Are you using credit card processing in SAP to get the authorization?
If you are then the authorization should not block the order.
Or are you using credit card as a form of payment (without authorization) in which case this needs to be put on the customers account as a payment and then the order entered.
Where are you holding the credit card details? -
IDOC/BAPI for Production order creation from Legacy system
Hi all
We are using an interface to create Production orders from legacy to SAP. Would you recommend an IDOC or a BAPI to create Production orders. If IDOC or BAPI then could you please mention which one?
thanks a bunchHi John,
For your purposes, please use BAPI for production order creation from legacy system. There is no standard inbound IDoc available to use. SAP has an IDoc for outbound interface only (message type LOIPRO).
If there is an inbound IDoc available, I would recommend to use an IDoc.
IDoc technology has excellent error handling and will allow you to reprocess an error (if any).
BAPI is also good approach to use and fast in term of processing.
For BAPI approach, you can use BAPI BAPI_PRODORD_CREATE.
Hope this will help.
Regards,
Ferry Lianto -
Sales order creation with bapi in webdynpro using table control
When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items. Pls give me some idea to resolve this issue, here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2' method CREATE_SALES_ORDER .
Declaration for Order Header Node DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.
-
Sales order creation with bapi in webdynpro
When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items.
Pls give me some idea to resolve this issue,
here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
method CREATE_SALES_ORDER .
Declaration for Order Header Node
DATA: node_order_header TYPE REF TO if_wd_context_node,
elem_order_header TYPE REF TO if_wd_context_element,
stru_order_header TYPE if_componentcontroller=>element_order_header .
Declaration for Order Items Node
DATA: node_order_items TYPE REF TO if_wd_context_node,
elem_order_items TYPE REF TO if_wd_context_element,
stru_order_items TYPE if_componentcontroller=>element_order_items .
Declaration for Order Partners Node
DATA: node_order_partners TYPE REF TO if_wd_context_node,
elem_order_partners TYPE REF TO if_wd_context_element,
stru_order_partners TYPE if_componentcontroller=>element_order_partners .
node_order_header = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_header
elem_order_header = node_order_header->get_element( ).
elem_order_header->get_static_attributes(
IMPORTING static_attributes = stru_order_header
<ORDER_ITEMS> via lead selection
node_order_items = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_items ).
elem_order_items = node_order_items->get_element( ).
elem_order_items->get_static_attributes(
IMPORTING static_attributes = stru_order_items ).
<ORDER_PARTNERS> via lead selection
node_order_partners = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_partners ).
elem_order_partners = node_order_partners->get_element( ).
elem_order_partners->get_static_attributes(
IMPORTING static_attributes = stru_order_partners ).
DATA: v_sales_doc TYPE bapivbeln-vbeln.
DATA: w_order_header_in TYPE bapisdhd1,
i_order_header_in TYPE table of bapisdhd1,"
i_order_partners TYPE TABLE OF bapiparnr,
w_order_partners TYPE bapiparnr,
i_return TYPE TABLE OF bapiret2,
w_return TYPE bapiret2,
i_order_items_in TYPE TABLE OF bapisditm,
w_order_items_in TYPE bapisditm,
i_order_conditions_in TYPE TABLE OF bapicond,
w_order_conditions_in TYPE bapicond,
w_order_SCHDL type BAPISCHDL,
i_order_SCHDL type table of BAPISCHDL.
Order Header Details
CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
refresh : i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, i_order_SCHDL.
w_order_header_in-doc_type = stru_order_header-doc_type.
w_order_header_in-sales_org = stru_order_header-sales_org.
w_order_header_in-distr_chan = stru_order_header-distr_chan.
w_order_header_in-division = stru_order_header-division.
w_order_header_in-req_date_h = stru_order_header-req_date_h.
w_order_header_in-sales_dist = stru_order_header-sales_dist.
w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
Order Item Details
CLEAR: i_order_items_in,w_order_items_in.
w_order_items_in-itm_num = stru_order_items-itm_num.
w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER.
w_order_items_in-material = stru_order_items-material.
w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
w_order_items_in-plant = stru_order_items-plant.
w_order_items_in-target_val = stru_order_items-target_val.
w_order_items_in-currency = stru_order_items-currency.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_order_items_in-material
IMPORTING output = w_order_items_in-material.
APPEND w_order_items_in TO i_order_items_in.
Order Partner Details
CLEAR: i_order_partners,w_order_partners.
w_order_partners-partn_role = stru_order_partners-partn_role.
w_order_partners-partn_numb = stru_order_partners-partn_numb.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING input = w_order_partners-partn_numb
IMPORTING output = w_order_partners-partn_numb.
APPEND w_order_partners TO i_order_partners.
Order Condition Details
w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'.
w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'.
APPEND w_order_SCHDL to i_order_SCHDL.
Create Sales Order BAPI Call
*loop at i_order_header_in into w_order_header_in.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = w_order_header_in
IMPORTING
salesdocument = v_sales_doc
TABLES
return = i_return
order_items_in = i_order_items_in
order_partners = i_order_partners
order_schedules_in = i_order_SCHDL
order_conditions_in = i_order_conditions_in.
Get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.
DATA: v_message_text TYPE string.
When Sales Order is created commit the data
IF NOT v_sales_doc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
INTO v_message_text SEPARATED BY space.
Report Success message
CALL METHOD l_message_manager->report_success
EXPORTING message_text = v_message_text.
ELSE.
v_message_text = 'Error Creating Sales Order'.
Report Error message
CALL METHOD l_message_manager->report_error_message
EXPORTING message_text = v_message_text.
ENDIF.
*endloop.
endmethod.
and code for table control i am using is
method WDDOINIT .
Types : Begin of item_tab,
itm_number type bapisditm-itm_number,
material type bapisditm-material,
plant type bapisditm-plant ,
target_qty type bapisditm-target_qty,
target_qu type bapisditm-target_qu,
target_val type bapisditm-target_val,
currency type bapisditm-currency,
end of item_tab.
*Creating internal table and Work Area of the same structure
*as that of the Node created.
Data : it_item type standard table of item_tab,
wa_item type item_tab.
*Appending Blank Work Area to Internal table.
***********************************************888
*LOOP AT it_item INTO wa_item.
**wa_item-itm_number to bapisditm-itm_number.
**wa_item-material to bapisditm-material.
**wa_item-plant to bapisditm-plant.
**wa_item-target_qty to bapisditm-target_qty.
**wa_item-target_qu to bapisditm-target_qu.
**wa_item-target_val to bapisditm-target_val.
**wa_item-currency to bapisditm-currency.
APPEND wa_item TO it_item.
*ENDLOOP.
**********************************************88
Do 10 times.
Append wa_item to it_item.
enddo.
"Binding the table
DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
DATA lt_material TYPE wd_this->Elements_material.
navigate from <CONTEXT> to <MATERIAL> via lead selection
lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
@TODO handle non existant child
IF lo_nd_material IS INITIAL.
ENDIF.
@TODO compute values
e.g. call a model function
lo_nd_order_items->bind_table( new_items =
it_item set_initial_elements = abap_true ).
endmethod.When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items.
Pls give me some idea to resolve this issue,
here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
method CREATE_SALES_ORDER .
Declaration for Order Header Node
DATA: node_order_header TYPE REF TO if_wd_context_node,
elem_order_header TYPE REF TO if_wd_context_element,
stru_order_header TYPE if_componentcontroller=>element_order_header .
Declaration for Order Items Node
DATA: node_order_items TYPE REF TO if_wd_context_node,
elem_order_items TYPE REF TO if_wd_context_element,
stru_order_items TYPE if_componentcontroller=>element_order_items .
Declaration for Order Partners Node
DATA: node_order_partners TYPE REF TO if_wd_context_node,
elem_order_partners TYPE REF TO if_wd_context_element,
stru_order_partners TYPE if_componentcontroller=>element_order_partners .
node_order_header = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_header
elem_order_header = node_order_header->get_element( ).
elem_order_header->get_static_attributes(
IMPORTING static_attributes = stru_order_header
<ORDER_ITEMS> via lead selection
node_order_items = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_items ).
elem_order_items = node_order_items->get_element( ).
elem_order_items->get_static_attributes(
IMPORTING static_attributes = stru_order_items ).
<ORDER_PARTNERS> via lead selection
node_order_partners = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_partners ).
elem_order_partners = node_order_partners->get_element( ).
elem_order_partners->get_static_attributes(
IMPORTING static_attributes = stru_order_partners ).
DATA: v_sales_doc TYPE bapivbeln-vbeln.
DATA: w_order_header_in TYPE bapisdhd1,
i_order_header_in TYPE table of bapisdhd1,"
i_order_partners TYPE TABLE OF bapiparnr,
w_order_partners TYPE bapiparnr,
i_return TYPE TABLE OF bapiret2,
w_return TYPE bapiret2,
i_order_items_in TYPE TABLE OF bapisditm,
w_order_items_in TYPE bapisditm,
i_order_conditions_in TYPE TABLE OF bapicond,
w_order_conditions_in TYPE bapicond,
w_order_SCHDL type BAPISCHDL,
i_order_SCHDL type table of BAPISCHDL.
Order Header Details
CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
refresh : i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, i_order_SCHDL.
w_order_header_in-doc_type = stru_order_header-doc_type.
w_order_header_in-sales_org = stru_order_header-sales_org.
w_order_header_in-distr_chan = stru_order_header-distr_chan.
w_order_header_in-division = stru_order_header-division.
w_order_header_in-req_date_h = stru_order_header-req_date_h.
w_order_header_in-sales_dist = stru_order_header-sales_dist.
w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
Order Item Details
CLEAR: i_order_items_in,w_order_items_in.
w_order_items_in-itm_num = stru_order_items-itm_num.
w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER.
w_order_items_in-material = stru_order_items-material.
w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
w_order_items_in-plant = stru_order_items-plant.
w_order_items_in-target_val = stru_order_items-target_val.
w_order_items_in-currency = stru_order_items-currency.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_order_items_in-material
IMPORTING output = w_order_items_in-material.
APPEND w_order_items_in TO i_order_items_in.
Order Partner Details
CLEAR: i_order_partners,w_order_partners.
w_order_partners-partn_role = stru_order_partners-partn_role.
w_order_partners-partn_numb = stru_order_partners-partn_numb.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING input = w_order_partners-partn_numb
IMPORTING output = w_order_partners-partn_numb.
APPEND w_order_partners TO i_order_partners.
Order Condition Details
w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'.
w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'.
APPEND w_order_SCHDL to i_order_SCHDL.
Create Sales Order BAPI Call
*loop at i_order_header_in into w_order_header_in.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = w_order_header_in
IMPORTING
salesdocument = v_sales_doc
TABLES
return = i_return
order_items_in = i_order_items_in
order_partners = i_order_partners
order_schedules_in = i_order_SCHDL
order_conditions_in = i_order_conditions_in.
Get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.
DATA: v_message_text TYPE string.
When Sales Order is created commit the data
IF NOT v_sales_doc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
INTO v_message_text SEPARATED BY space.
Report Success message
CALL METHOD l_message_manager->report_success
EXPORTING message_text = v_message_text.
ELSE.
v_message_text = 'Error Creating Sales Order'.
Report Error message
CALL METHOD l_message_manager->report_error_message
EXPORTING message_text = v_message_text.
ENDIF.
*endloop.
endmethod.
and code for table control i am using is
method WDDOINIT .
Types : Begin of item_tab,
itm_number type bapisditm-itm_number,
material type bapisditm-material,
plant type bapisditm-plant ,
target_qty type bapisditm-target_qty,
target_qu type bapisditm-target_qu,
target_val type bapisditm-target_val,
currency type bapisditm-currency,
end of item_tab.
*Creating internal table and Work Area of the same structure
*as that of the Node created.
Data : it_item type standard table of item_tab,
wa_item type item_tab.
*Appending Blank Work Area to Internal table.
***********************************************888
*LOOP AT it_item INTO wa_item.
**wa_item-itm_number to bapisditm-itm_number.
**wa_item-material to bapisditm-material.
**wa_item-plant to bapisditm-plant.
**wa_item-target_qty to bapisditm-target_qty.
**wa_item-target_qu to bapisditm-target_qu.
**wa_item-target_val to bapisditm-target_val.
**wa_item-currency to bapisditm-currency.
APPEND wa_item TO it_item.
*ENDLOOP.
**********************************************88
Do 10 times.
Append wa_item to it_item.
enddo.
"Binding the table
DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
DATA lt_material TYPE wd_this->Elements_material.
navigate from <CONTEXT> to <MATERIAL> via lead selection
lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
@TODO handle non existant child
IF lo_nd_material IS INITIAL.
ENDIF.
@TODO compute values
e.g. call a model function
lo_nd_order_items->bind_table( new_items =
it_item set_initial_elements = abap_true ).
endmethod. -
Create warning message at the time of order creation
I am looking for a solution :- "Create warning message at the time of order creation/save if a cc is assigned in the settlement rule that crosses the company code of the order or where the company code of the plant for the order is different from the company code assigned to the cc"
The txn code : IW32 (maintenance order) , this warning message for settlement rule creation using Cost center as a settlement receiver. If the used cost center is belongs to some other company code, said warning message should occure.
I tried user exit, field exit, also used std message control (KO-458). Nothing is working. -
Manual BOM selection at the time of order creation
Dear Experts,
Could you help me to understand if there is any provision to select BOM by user at the time of order creation without the help of production version.Is there any configuration required to make BOM selected manually.
Regards,
Krishna MohanHi karishna,
Please go to T-code OPL8 and in production version use( 1 )Manual selection of production version. Then user can select manually instead of automatic selection.
Regards
Muhammad Umar -
Sales Order Creation with reference to Contract
Hi all ,
Existing Setup in the System:
1) I have a contract created with a validity period of 30 days. When i create sales order with reference to contract, then i get a pop-up box, from the box i can select my contract.
2) I have a Lead time configured as 5 days for the Sales document type , I,e when I create sales order I can see my Requested delivery date is always system date + 5 days.
3) I have a Pricing date configured as Todays date. Therefore when I create sales order I can see pricing date becomes the system date.
Execution of Sales Order:
4) When I create Sales Order with reference to contract document. Always Requested Delivery date is compared with Contract Validity Dates.
Example: Contract Validity 01/03/2008 - 31/03/2008
Sales Order: Sales Order Creation date -> 19/03/2008, Pricing Date: 19/03/2008 Requested delivery date 24/03/2008.
REQUIREMENT IS:
But my requirement is when i create Sales Order it should consider System date or Pricing Date( since pricing date is today date) for to compare with contract validity dates.
Can it be done with standard config or do we need to some type of custom? Appreciate your help
ThanksHi ,
As said when I create Sales Order with reference to contract document. Always Requested Delivery date on Sales Order is checked against Contract Validity Dates.
But i want Pricing date in Sales Order should be checked against Contract Validity Dates.
Can someone suggest me on this? -
Want to change item category at the time of order creation
Hi Gurus,
Client require to implement individual PO scenario.
I was configured the same and working fine.
I am facing problem at the time of item category determination.
User using same material and order type and they are not ready to accept to create new order type.
Now My order type is OR and item category group is NORM and right now system determine item category TAN.
User not want to change manually at the time of order creation.
I have specific condition on which i want to apply this logic.
Now i want to determine TAB item category through some user exits or enhancement.
Can anyone suggest exact in which user exit or enhancement i have to change.
Thanks & Regards,
Chirag1. Use TCode 0VVW for creating a Z Item Usage, say, ZPO1
2. Do an item Cat determination in VOV4, as
Sales Doc type
Item Cat Group
Usage
Item Category
OR -
NORM -
ZPO1 -
TAB
3. Maintain Customer Materials Info Record by using VD51.
In item screen for Cust-Mat combination maintain Item usage
Regards
JP
Maybe you are looking for
-
How to implement reading data from a mat file on a cRIO?
Hi all! I am not even sure, this is plausible, but I'd rather ask before i start complicating. So far, I have not found any helpful info about reading in data to a RT device from a file (kind of a simulation test - the data is simulated). I have the
-
ABAP Development in multiple SAP versions
Greetings- I was wondering if there were people out there who had the need to maintain ABAP code in multiple versions of SAP simultaneously. If so, what is your approach to do this efficiently? Further explanation: My company is a software company th
-
If so, how would I do the following: I want to create a simple "jump box" that would take an entered keyword and link it with a subdirectory of the same name on my site. For example: If the keyword entered was "Blue," when you clicked on the go butto
-
Can we enhance the display fields of any iView?
Hi, I have developed ItemDetail iView in SAP Enterprise Portal In SAP MDM ItemDetail iView, we can display fields which are available from the MDM Template iView when it is connected with MDM System Object and MDM System alias. Now, once the iView is
-
Dumb Question about multiple BSSIDs
This is probably a dumb question, but enquiring minds want to know... When using Yosemite's built-in Wireless Diagnostics scan I see many unique WiFi BSSIDs (MAC addresses) associated with my Time Capsule: 5 for my Guest Network and 6 for my "main" n