Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Default parameter value if tcode is value

RomyA
Explorer
0 Kudos
149

Hi!

I have a program that is used for two t-codes, and for a few of the parameters, the user wants to put the value to TRUE, but only for one of the t-codes. 

So far, I have something along the lines of this in the selection screen:

  SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE TEXT-t06.
    PARAMETERS p_param TYPE param. 
  SELECTION-SCREEN END OF BLOCK b5.

AT SELECTION-SCREEN OUTPUT.
  IF sy-tcode = 'T_CODE'
    LOOP AT SCREEN INTO ls_screen.
CASE ls_screen-name.
        WHEN 'P_PARAM'.
          p_param = 'X'.
          MODIFY SCREEN FROM ls_screen.
    ENDLOOP.
ENDCASE. 

But when I debug it, I see that even if I set the parameter to FALSE, in the debugger it sets it to TRUE again. Does anyone know how to deal with this? Or would the only option be making a whole new screen? 

2 REPLIES 2

FabioPagoti
Active Contributor
0 Kudos
126

In this case you are not trying to modify the selection screen. You are only filling default values.

Use "INITIALIZATION" instead

 

INITIALIZATION.
IF sy-tcode = 'T_CODE'    
    p_param = abap_true.    
ENDIF. 

 

 

RaymondGiuseppi
Active Contributor
0 Kudos
115

You put our code in the PBO, AT SELECTION-SCREEN OUTPUT, so if user press Enter, your code will be executed again, if they uncheck the field and press Execute (F8, F9) their value will be correct, but reset by your code as soon the initial selection-screen is displayed.

  • So move your code to INITIALIZATION or LOAD-OF-PROGRAM block, so code only executed at start
     

     

loiod28510ea1e4a45639308eac09d7efdfd_LowRes.png