Skip to Content
0
Apr 05, 2020 at 09:24 PM

Parllel cursor

100 Views

My requirment is to use parllel cursor with 4 or 5 loops. i want to convert this code how

LOOP AT it_mard INTO wa_mard.

wa_final-matnr = wa_mard-matnr.
wa_final-werks = wa_mard-werks.
wa_final-lgort = wa_mard-lgort.
wa_final-labst = wa_mard-labst.


CLEAR: wa_mseg, wa_ser03, wa_objk.
LOOP AT it_mseg INTO wa_mseg WHERE matnr = wa_mard-matnr
AND werks = wa_mard-werks
AND lgort = wa_mard-lgort.


wa_final-aufnr = wa_mseg-aufnr.


LOOP AT it_ser03 INTO wa_ser03 WHERE mblnr = wa_mseg-mblnr.
LOOP AT it_objk INTO wa_objk WHERE obknr = wa_ser03-obknr.

CLEAR: wa_final-status2.

IF wa_mseg-bwart = '261'. -----------------------
wa_final-status = 'Consumed'.---------------------
wa_final-status2 = 'active'.----------------------
CLEAR: wa_final-plnbez, wa_final-bldat.

READ TABLE it_afko INTO wa_afko WITH KEY aufnr = wa_mseg-aufnr.

IF sy-subrc = 0.
wa_final-plnbez = wa_afko-plnbez.
ENDIF.

READ TABLE it_mkpf INTO wa_mkpf WITH KEY mblnr = wa_mseg-mblnr.

IF sy-subrc = 0.
wa_final-bldat = wa_mkpf-bldat.
ENDIF.
-------------------------------------------------------------------------------------reaming to add
ELSEIF wa_mseg-bwart = '551'.
CLEAR: wa_final-status2.
wa_final-status = 'Scrap'.
wa_final-status2 = 'Inactive'.

IF wa_final-status = 'Scrap'.
CLEAR wa_final-aufnr.
ENDIF.
wa_final-date = ''.
ENDIF.

wa_final-sernr = wa_objk-sernr.
SHIFT wa_final-sernr LEFT DELETING LEADING '0'.
APPEND wa_final TO it_final.
ENDLOOP.
ENDLOOP.
ENDLOOP.


* -----------------------------------------------------------------

LOOP AT it_view INTO wa_view WHERE matnr = wa_mard-matnr
AND b_werk = wa_mard-werks
AND b_lager = wa_mard-lgort.

CLEAR: wa_final-plnbez,wa_final-bldat.

IF wa_view-b_lager = '112A' OR wa_view-b_lager = '113A' OR wa_view-b_lager = '114A' OR wa_view-b_lager = '111V'.
CLEAR: wa_final-status2.

wa_final-status = 'Issue To Production'.
wa_final-date = wa_view-aedat.
wa_final-status2 = ''.
IF wa_final-status = 'Issue To Production'.
CLEAR wa_final-aufnr.
ENDIF.
ELSE.
CLEAR: wa_final-status2.

wa_final-status = 'Available'.
wa_final-date = ''.
wa_final-status2 = ''.

IF wa_final-status = 'Available'.
CLEAR wa_final-aufnr.
ENDIF.
ENDIF.
wa_final-sernr = wa_view-sernr.
SHIFT wa_final-sernr LEFT DELETING LEADING '0'.
APPEND wa_final TO it_final.
ENDLOOP.
ENDLOOP.