Thursday, September 6, 2012
BAPI_PRODORDCONF_CREATE_TT Activity Confirmation
DATA :
lt_timeticket TYPE TABLE OF bapi_pp_timeticket,
lt_goodsmovements TYPE TABLE OF bapi2017_gm_item_create,
lt_link_conf_goods_mov TYPE TABLE OF bapi_link_conf_goodsmov,
lt_detail_return TYPE TABLE OF bapi_coru_return WITH HEADER LINE.
DATA :
ls_timeticket TYPE bapi_pp_timeticket,
ls_goodsmovements TYPE bapi2017_gm_item_create,
ls_link_conf_goods_mov TYPE bapi_link_conf_goodsmov,
ls_bapi_propose TYPE bapi_pp_conf_prop,
ls_bapi_return TYPE bapiret1,
ls_detail_return TYPE bapi_coru_return.
ls_timeticket-orderid = i_aufnr. " Order
ls_timeticket-operation = i_vornr. " Order Item
* ls_timeticket-fin_conf = 'X'. " Finish Confirmation
* ls_timeticket-clear_res = 'X'.
ls_timeticket-postg_date = sy-datum.
* ls_timeticket-yield = ''.
ls_timeticket-conf_acti_unit1 =
ls_timeticket-conf_acti_unit1_iso = ''. " First UOM
ls_timeticket-conf_activity1 = ''. " First Quantity
ls_timeticket-conf_acti_unit2 =
ls_timeticket-conf_acti_unit2_iso = ''. " Second UOM
ls_timeticket-conf_activity2 = ''. " Second Quantity
APPEND ls_timeticket TO lt_timeticket.
LOOP AT et_list WHERE erfmg > 0.
CLEAR ls_goodsmovements.
ls_goodsmovements-material = et_list-matnr.
ls_goodsmovements-plant = i_plant.
ls_goodsmovements-stge_loc = et_list-lgort.
ls_goodsmovements-batch = et_list-charg.
ls_goodsmovements-move_type = '261'.
ls_goodsmovements-stck_type = ''.
ls_goodsmovements-spec_stock = ''.
ls_goodsmovements-entry_qnt = et_list-erfmg.
ls_goodsmovements-entry_uom = et_list-erfme.
APPEND ls_goodsmovements TO lt_goodsmovements.
CLEAR ls_link_conf_goods_mov.
ls_link_conf_goods_mov-index_confirm = 1.
ls_link_conf_goods_mov-index_goodsmov = sy-tabix.
APPEND ls_link_conf_goods_mov TO lt_link_conf_goods_mov.
ENDLOOP.
*** BAPI
CALL FUNCTION 'BAPI_PRODORDCONF_CREATE_TT'
IMPORTING
return = ls_bapi_return
TABLES
timetickets = lt_timeticket
goodsmovements = lt_goodsmovements
link_conf_goodsmov = lt_link_conf_goods_mov
detail_return = lt_detail_return.
IF ls_bapi_return IS INITIAL.
*** Commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
*** Get Confirmation Number
LOOP AT lt_detail_return WHERE type = 'I'
AND id = 'RU'
AND number = '100'.
ENDLOOP.
IF sy-subrc NE 0.
LOOP AT lt_detail_return.
ENDLOOP.
ENDIF.
*** Check COGI
DATA : lt_affw TYPE TABLE OF affw WITH HEADER LINE.
DATA : lv_mes_text TYPE string.
SELECT * FROM affw INTO TABLE lt_affw
WHERE aufnr = i_aufnr
AND rueck = lt_detail_return-conf_no
AND rmzhl = lt_detail_return-conf_cnt.
IF sy-subrc EQ 0.
CONCATENATE gv_temp_message '-' '------- COGI warning message'
INTO gv_temp_message SEPARATED BY ' '.
ENDIF.
LOOP AT lt_affw.
PERFORM get_text_from_message USING lt_affw-msgid
lt_affw-msgno
lt_affw-msgv1
lt_affw-msgv2
lt_affw-msgv3
lt_affw-msgv4
CHANGING lv_mes_text.
ENDLOOP.
*** Set Message OK
ELSE.
LOOP AT lt_detail_return.
ENDLOOP.
*** Set Message ERROR
ENDIF.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment