Create routings with recordings. Part 4 of 4.

Jimbo's picture

Manipulating the details of individual operations with a recording can be very simple when one knows how to navigate through the routing using a recording. Selecting the appropriate operation from a specific sequence can be very difficult when there are more than 15 of either on a screen because the selection block for sequences and operations after the first 15 do not appear on the screen without a page-down.

An easy-to-use work around is scrolling the selection screen down so that the desired sequence is at the top of the list and then selecting the first sequence for manipulation. The same workaround is applied to the operations in that sequence. Here is how it works.

Start by making a recording. Naming it something related to the transaction is a great idea. Some organizations have requirements for Routing history turned on in the configuration, but this can be sidestepped by utilizing the CA01 transaction instead of CA02.
Create a recording

Select the routing to be modified. If the business uses just one group code per routing then an easy way to select the routing is by using the group code. If materials have more than one task list then use the material number, plant and group number to ensure that the correct task list is opened. Follow all seven of the steps below to create the recording.

Steps:
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7

These steps produce a recording that looks like this. Click the "Default All" button to get the system to assign names to the fields in the recording. Notice how the fields for entry and selection on the Sequence screen have the same name as the entry and selection fields on the Operation screen. These can be changed by double clicking and replacing them with meaningful names so that it looks like this recording.
Customize the recording

With the recording created we can edit the source code for the entry and selection fields in the Field Mapping and Conversion Rules. Start by adding this snippet of code to the GLOBAL DATA section. This provides a framework for determining the values used in the Entry fields for Sequences and then Operations.

data: nSequence type i, nOperation type i,
 lPLFL like PLFL, lPLAS like PLAS, lPLPO like PLPO.

In the SEQ_SEL_01 add this code to make the determination and populate the Entry and Selection fields. It is very simple code that requires only the Routing Group, Sequence number and Operation number. Additionally, it validates the source data and identifies errors before attempting to load the data which is always a bonus.

 shift CA01O-PLNFL right deleting trailing space.
 overlay CA01O-PLNFL with '000000'.
 shift CA01o-VORNR right deleting trailing space.
 overlay CA01O-VORNR with '0000'.
 move 0 to nSequence. move 0 to nOperation.
 select * from PLFL into lPLFL where PLNNR eq CA01O-PLNNR_NEW.
   if lPLFL-PLNFL eq CA01O-PLNFL.
     move lPLFL-ZAEHL to nSequence.
     select * from PLAS into lPLAS
      where PLNNR eq lPLFL-PLNNR and PLNFL eq lPLFL-PLNFL.
       select * from PLPO into lPLPO
        where PLNNR eq lPLAS-PLNNR and PLNKN eq lPLAS-PLNKN
        order by VORNR.
         if lPLPO-VORNR le CA01O-VORNR.
           add 1 to nOperation.
         endif.
       endselect. "Select * from PLPO...
     endselect. "Select * from PLAS...
   endif.
 endselect. "Select * from PLFL...
 if nSequence eq 0.
   write: / CA01O-PLNNR_NEW, CA01O-PLNFL, 'Missing Sequence.' color 6.
   skip_transaction.
 elseif nOperation eq 0.
   write: / CA01o-PLNNR_NEW, CA01o-PLNFL, CA01o-VORNR,
    'Missing Operation.' color 6.
   skip_transaction.
 else.
   CA01T-SEQ_SEL_01 = 'X'.
   CA01T-SEQ_ENTRY_ACT = nSequence.
   CA01T-OP_SEL_01 = 'X'.
   CA01T-OP_ENTRY_ACT = nOperation.
 endif.

The rest of the source code is very straightforward and does not need further elaboration. The complete LSMW object is available here to be downloaded and recycled.

LSMW_ROUTINGS.txt