DATA: return LIKE bapiret2,
ret TYPE TABLE OF bapiret2 WITH HEADER LINE,
orders LIKE bapi_order_key OCCURS 0,
ls_orders TYPE bapi_order_key,
detailreturn LIKE bapi_order_return OCCURS 0,
ls_ret LIKE bapi_order_return,
applicationlog LIKE bapi_order_application_log OCCURS 0.
LOOP AT lt_rows INTO ls_rows.
READ TABLE gt_mo INTO gs_mo INDEX ls_rows-index.
CHECK gs_mo-status IS INITIAL OR gs_mo-status EQ icon_red_light.
* REFRESH bdcdata[].
* PERFORM bdc_dynpro USING 'SAPLCOKO' '5400'.
* PERFORM bdc_field USING 'BDC_CURSOR' 'PRSEL-ANRVN'.
* PERFORM bdc_field USING 'BDC_OKCODE' '=AUSF'.
* PERFORM bdc_field USING 'PRSEL-WERKS' gs_mo-werks.
* PERFORM bdc_field USING 'PRSEL-ANRVN' gs_mo-aufnr.
*
* PERFORM bdc_dynpro USING 'SAPLCOKO' '5500'.
* PERFORM bdc_field USING 'BDC_CURSOR' 'PRSEL-WERKS'.
* PERFORM bdc_field USING 'BDC_OKCODE' '=FREL'.
*
* PERFORM bdc_dynpro USING 'SAPLCOKO' '5500'.
* PERFORM bdc_field USING 'BDC_CURSOR' 'SFC_CODRD-AUFNR(01)'.
* PERFORM bdc_field USING 'BDC_OKCODE' '=FREL'.
* PERFORM bdc_field USING 'SFC_CODRD-SEL(01)' 'X'.
*
* PERFORM bdc_transaction TABLES messtab
* USING 'COR5'
* 'X'
* 'A'
* 'L'.
CLEAR: return.
REFRESH: orders, detailreturn, applicationlog.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gs_mo-aufnr
IMPORTING
output = ls_orders-order_number.
APPEND ls_orders TO orders.
CALL FUNCTION 'BAPI_PROCORD_RELEASE'
IMPORTING
return = return
TABLES
orders = orders
detail_return = detailreturn
application_log = applicationlog
EXCEPTIONS
OTHERS = 01.
MOVE-CORRESPONDING return TO ls_ret.
INSERT ls_ret INTO detailreturn INDEX 1.
gs_mo-status = icon_green_light.
LOOP AT detailreturn INTO ls_ret.
IF ls_ret-type EQ 'A' OR ls_ret-type EQ 'E'.
gs_mo-status = icon_red_light.
ELSEIF ls_ret-type EQ 'W' OR ls_ret-type EQ 'S'.
gs_mo-status = icon_yellow_light.
ENDIF.
sy-msgid = ls_ret-id.
sy-msgty = ls_ret-type.
sy-msgno = ls_ret-number.
sy-msgv1 = ls_ret-message_v1.
sy-msgv2 = ls_ret-message_v2.
sy-msgv3 = ls_ret-message_v3.
sy-msgv4 = ls_ret-message_v4.
PERFORM add_message USING gs_mo-aufnr.
ENDLOOP.
LOOP AT detailreturn INTO ls_ret
WHERE type = 'A' OR type = 'E'.
EXIT.
ENDLOOP.
IF sy-subrc IS INITIAL. "Errors exist
REFRESH ret.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
return = ret.
ENDIF.
LOOP AT ret.
sy-msgid = ret-id.
sy-msgty = ret-type.
sy-msgno = ret-number.
sy-msgv1 = ret-message_v1.
sy-msgv2 = ret-message_v2.
sy-msgv3 = ret-message_v3.
sy-msgv4 = ret-message_v4.
PERFORM add_message USING gs_mo-aufnr.
ENDLOOP.
MODIFY gt_mo FROM gs_mo INDEX ls_rows-index TRANSPORTING status.
ENDLOOP.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.