Add parameters to an LSMW object and describe them.

Jimbo's picture

Often the behaviour of an LSMW object needs to change quickly to fit requirements as a project progresses. Modifying the source code in a development system and then transporting the LMSW object to a quality or production system takes time. Writing multiple LSMW objects for slightly different tasks is cumbersome and hard-to-manage and it duplicates effort.

LSMW ojbect are essentially ABAP report that can be customized in much the same way any other report can be customized. One way to change the way an LSMW object behaves is with parameters. Parameters are fields that can be filled with information when the LSMW program starts the conversion process. Setting up a checkbox to signify a certain behavior is great way to tell the program to skip records that have already been loaded or to convert records of only a specified type.

parameters: p_update as checkbox default 'X'. 

The above line produces on the screen no more than a checkbox with the word p_update next to it. This is enough for the developer, but to hand this object off to another team member to use unsupervised requires a little more effort. ABAP allows for some comments to be added to the line and even lets us decide where the comments go. By creating a line in the report the comment can be placed directly after the item. The comments are declared when painting the screen, but the text in the comment is added after the initialization statement. Below the bexists block is drawn and a variable called btitle1 is created. It's effectively a character variable that is assigned the value 'Existing Purchase Info Records' later in the code. The same thing happens when the selection-screen comment statement creates comm1, comm2 and comm3.

selection-screen begin of block bexists with frame title btitle1.
  selection-screen begin of line.
    PARAMETERS: p_Update AS CHECKBOX default ' '.
    selection-screen comment 3(60) comm1.
  selection-screen end of line.
  selection-screen begin of line.
    PARAMETERS: p_Verbos as CHECKBOX default ' '.
    selection-screen comment 3(60) comm2.
  selection-screen end of line.
selection-screen end of block bexists.
selection-screen begin of block breject with frame title btitle2.
  selection-screen begin of line.
    PARAMETERS: p_Reject as CHECKBOX default 'X'.
    selection-screen comment 3(60) comm3.
  selection-screen end of line.
selection-screen end of block breject.
initialization.
btitle1 = 'Existing Purchase Info Records'.
btitle2 = 'Validations.'.
comm1 = 'Update existing PIRs.'.
comm2 = 'Display existing PIRs even when they are not updated.'.
comm3 = 'Reject PIRs with misaligned UoM (MEINS).'.

Programming Language: 
ABAP