Wednesday 2 December 2020

PLPO - PLFL link

Okay,  I know the Select * s are inefficient, but makes the code more readable.
Had been struggling to work out what made the Sequence Items in CA02 disappear when we "Delete" one of the lines. Not sure why PLPO doesn't get it's own LOEKZ updated, but hey...

This finds ACTIVE sequence lines for Routings.


PARAMETERSp_plnnr type plnnr DEFAULT '51000070',

            p_vornr type vornr DEFAULT '0010'.

select from plfl into TABLE lt_plfl where plnnr p_plnnr
                                        and loekz ' '.

select from plas into TABLE lt_plas where plnnr p_plnnr .

select from plpo into TABLE lt_plpo where plnnr p_plnnr
                                        and vornr p_vornr.

if lt_plpo is not INITIAL.
  select from crhd into table lt_crhd FOR ALL ENTRIES IN lt_plpo
     where crhd~objid lt_plpo-arbid.
endif.

  loop at lt_plfl into ls_plfl.
     READ TABLE lt_plas into ls_plas with key plnnr ls_plfl-plnnr
                                              plnfl ls_plfl-plnfl.
     if sy-subrc 0.
       READ TABLE lt_plpo into ls_plpo with key plnnr ls_plas-plnnr
                                                plnkn ls_plas-plnkn.
       if sy-subrc 0.
         READ TABLE lt_crhd into ls_crhd with key objid ls_plpo-arbid.
         if sy-subrc 0.
           write:/ ls_plpo-plnnr':' ls_plpo-vornr':' ls_plfl-plnfl':'ls_crhd-arbpl.
         endif.
       endif.
     endif.
  endloop.

No comments:

Post a Comment