Application Development 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: 

Defning parameters for selection at runtime...

Former Member
0 Kudos

Hello,

I am using a group of radio buttons as follows:

parameters: p_desk radiobutton group 1, "Desktop location

p_unix radiobutton group 1. "Unix location

Now if p_desk ='X', I want the file path to be set as follows and use function F4_FILENAME at value request

PARAMETERS: p_file LIKE rlgrap-filename.

AND if p_unix is 'X', then I want the filepath to be set as follows and use function F4_DXFILENAME_TOPRECURSION at avlue request

PARAMETERS: p_file LIKE filename-fileextern.

Is it possible to define parameters at runtime ? How can we do this.

Regards,

Rajesh,

1 ACCEPTED SOLUTION

former_member212653
Active Contributor
0 Kudos

Check out this code:


*&---------------------------------------------------------------------*
*& Report  ZTEST_SOURAV9
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ztest_sourav9.

PARAMETERS:
p_desk RADIOBUTTON GROUP 1 DEFAULT 'X' USER-COMMAND flag, "Desktop location
p_unix RADIOBUTTON GROUP 1 ,  "Unix location
p_file1 LIKE rlgrap-filename MODIF ID m1 DEFAULT 'File 1' ,
p_file2 LIKE filename-fileextern MODIF ID m2 DEFAULT 'File 2'.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF p_desk = 'X' AND
      screen-group1 = 'M2'.
      screen-active = '0'.
    ELSEIF p_unix = 'X' AND
       screen-group1 = 'M1'.
      screen-active = '0'.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
*....

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
*...

START-OF-SELECTION.
  IF p_desk = 'X'.
    WRITE: p_file1.
  ELSE.
    WRITE:  p_file2.
  ENDIF.

6 REPLIES 6

former_member212653
Active Contributor
0 Kudos

Don't define them in runtime...rather hide or unhide it at runtime in AT SELECTION SCREEN OUTPUT event.

0 Kudos

How can I do it, please explain ? Maybe a example will be nice.

0 Kudos

Why not use the ABAP Help for AT SELECTION SCREEN OUTPUT. You might get an answer faster and learn something on your own.

Former Member
0 Kudos

Hi Rajesh,

You define only a single parameter of type C lenght 1.

At selection-screen on Field even of that parameter you check the value whether it is '1' set the flag w_flag = 'X' else set it w_flag = ' '.

so check a condition depending on that flag and carry with your operation..

Hope this would help you.

Regards

Narin Nandivada

Former Member
0 Kudos

Try using a toggle in the AT SELECTION-SCREEN OUTPUT.

Constants:

c_mod_group1 type c value 'A',

c_mod_group2 type c value 'B',

c_hide type c value '0',

c_show type c value '1'.

Selection screen.....

Parameters: p_desk radiobutton group rad1 user-command uc1,

p_unix radiobutton group rad1 default 'X',

p_filedesk type......MODIF ID b Lower case,

p_fileunix type..... MODIF ID a lower case.

end of selection screen....

At selection-screen output.

Perform toggle.

FOrm toggle.

if p_unix = 'x'.

LOOP AT SCREEN.

CASE screen-group1.

WHEN c_mod_group1.

screen-active = c_hide. "show field

MODIFY SCREEN.

ENDCASE.

CASE screen-group1.

WHEN c_mod_group2.

screen-active = c_show.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ELSEIF p_desk = 'X'.

LOOP AT SCREEN.

CASE screen-group1.

WHEN c_mod_group1.

screen-active = c_show. "show field

MODIFY SCREEN.

ENDCASE.

CASE screen-group1.

WHEN c_mod_group2.

screen-active = c_hide.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ENDIF.

This will allow for the file to be input for only one option. Then when the user executes you can pull the data for the file based on the radiobutton selected.

or AT Selection-Screen output.

If p_desk = 'X'.

Perform ........

else.

Perform ......

Endif.

Hopes this helps

Regards,

C

former_member212653
Active Contributor
0 Kudos

Check out this code:


*&---------------------------------------------------------------------*
*& Report  ZTEST_SOURAV9
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ztest_sourav9.

PARAMETERS:
p_desk RADIOBUTTON GROUP 1 DEFAULT 'X' USER-COMMAND flag, "Desktop location
p_unix RADIOBUTTON GROUP 1 ,  "Unix location
p_file1 LIKE rlgrap-filename MODIF ID m1 DEFAULT 'File 1' ,
p_file2 LIKE filename-fileextern MODIF ID m2 DEFAULT 'File 2'.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF p_desk = 'X' AND
      screen-group1 = 'M2'.
      screen-active = '0'.
    ELSEIF p_unix = 'X' AND
       screen-group1 = 'M1'.
      screen-active = '0'.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
*....

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
*...

START-OF-SELECTION.
  IF p_desk = 'X'.
    WRITE: p_file1.
  ELSE.
    WRITE:  p_file2.
  ENDIF.