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: 
Read only

Problem in at EXIT command?

Former Member
0 Likes
2,002

Hi i have a DP program  in which 10 select options(in sub screen ) out of which 2 are mandatory i used addition obligatory to select options.also for the exit button in the screen the  function code type E.i am using exit command module to exit the program even if the 2 mandatory fields are not filled.but problem is

When i click the extension button of the select options its asking me to input the required mandatory fields.

so i keep entering some dummy value in select options then click extension button how to resolve this problem

Note:in PAI of screen 1st the subscreen is called then the user command module then the exit module

5 REPLIES 5
Read only

iftah_peretz
Active Contributor
0 Likes
1,381

Hi Xmas

I think you should try of doing loop at screen command in the pai module and if the fields are initial leave the program.

And then you can take of the mandatory command.

Hope you got what I was saying, if you want snipp it,

Let me know.

Best,

Iftah

Read only

0 Likes
1,381

what your saying is to not to use obligatory keyword addition and just check for if fields are initial then raise a message.

Read only

0 Likes
1,381

Ok I see I wasn't helpfull otherwise my points would have increased

Any way nothing like a good snipp it to make it clear:

parameters:  para0(255) type c  modif id abc,
                     para1(255) type c  modif id abc,
                     para2(255) type c  modif id abc.

selection-screen comment /10(50) COMM.

LOAD-OF-PROGRAM.
     COMM = 'Para0 and Para1 are mandatory!'.

at selection-screen.
  if para0 IS INITIAL AND para1 IS INITIAL.
    LEAVE PROGRAM.
  endif.

You can copy and paste this code in a ztest report and it will work. As you will see if in selection screen para0 and para1 are initial then the program exits, other wise it dosen't, by doing so we made them mandatory. In order to make it clear to the user the screen says that 'Para0 and Para1 are mandatory!'

Hope this helps you and that I got what you want, if not let me know.

Best,

Iftah

Read only

0 Likes
1,381

This logic allows you to make the fields mandatory, yet you can add an IF statement there to handle the case where extention button was not pressed before the

if para0 IS INITIAL AND para1 IS INITIAL. statement.

Read only

Former Member
0 Likes
1,381

As far i understood your problem.

u are clicking on a pushbutton, extension (multiple selection )pushbutton beside select-options.

but the system is askign u to fill some summy value in select-options before clicking on multiple selection button.

also, system is not allowing u to navigate back while these select-options are vacant.

if the problem is similar to my understanding then

here is the simple sol'n.


u must set the back button in the pf-status as fuction code type E.(at exit command).

at screen logic u must code this back button in module

MODULE EXIT_COMMAND_0001 AT EXIT-COMMAND.

code snippet:( screen logic)

PROCESS BEFORE OUTPUT.

MODULE STATUS_0001.

   CALL SUBSCREEN SUB1 INCLUDING SY-REPID SUB_VAR.

PROCESS AFTER INPUT.

   CALL SUBSCREEN SUB1.

  MODULE USER_COMMAND_0001.

MODULE EXIT_COMMAND_0001 AT EXIT-COMMAND." this module will also be called if the select-options are vacant.

MODULE EXIT_COMMAND_0001 INPUT.

   IF SY-UCOMM EQ 'BACK'.

     LEAVE PROGRAM .

   ENDIF.

   IF SY-UCOMM EQ 'PUSH'. "this is the function code of the button on subscreen (button beside select-option).

     CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'  "this FM will raise the dialog for multiple selections

*   EXPORTING

*     TITLE                   = ' '

*     TEXT                    =

*     SIGNED                  = 'X'

*     LOWER_CASE              = ' '

*     NO_INTERVAL_CHECK       = ' '

*     JUST_DISPLAY            = ' '

*     JUST_INCL               = ' '

*     EXCLUDED_OPTIONS        =

*     DESCRIPTION             =

*     HELP_FIELD              =

*     SEARCH_HELP             =

*     TAB_AND_FIELD           =

       TABLES

         RANGE                   = IT_RANGE

*   EXCEPTIONS

*     NO_RANGE_TAB            = 1

*     CANCELLED               = 2

*     INTERNAL_ERROR          = 3

*     INVALID_FIELDNAME       = 4

*     OTHERS                  = 5

               .

ENDIF.

ENDMODULE" EXIT_COMMAND_0001  INPUT.

this is how the screen looks like.

i have created single field instead of select-options.