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

Conditional call to a subscreen in module pool program.

Former Member
0 Likes
2,094

Hi,

Could anybody please let me know how i will be able to call a subscreen conditionally in a module pool program?

Example: I have to call a subscreen XXXX if a FLAG = X. How will I achieve this?

I tried to write the below code in PAI

if flag = 'X'.
call subscreen XXXX.
endif.

This produced an error.

Regards,

Smithesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,270

Hi

In TOP Include
data repid type sy-repid,
        dynnr type sy-dynnr.


In PBO of main screen
module status_100. " First Call This Module to provide the SubScreen Number to below Code
call subscreen sub including repid dynnr. " This serves the purpose of calling subscreen based on condition


in Program.

module status_100.
repid = sy-repid.
if your_condition = 'X'. " This also can be implemented in any PAI logi as its purpose is just to pass a value to DYNNR 
dynnr = '200'. " The SUB Screen  Number you want to pass
else.
dynnr = '300'. " Dummy Sub Screen Screen or any other (Make Sure these are of SUB SCREEN type )
endif.
endmodule

Cheerz

Ram

6 REPLIES 6
Read only

gerd_rother
Active Participant
0 Likes
1,270

Hi,

Just define 2 subscreens - one is your actual subscreen, the other is an empty screen.

In the flow logic of the main screen do:

module determine_subscreen.   " determines global variable 'subscreen_number' number depending on condition
call subscreen <subscreen_area> including sy-repid subscreen_number.

Regards, Gerd Rother

Read only

Former Member
0 Likes
1,270

Hi,

You can do conditionally but in other way , u will have to disable the elemnts of the subscreen based on the flag in the PBO of the screen

Read only

Former Member
0 Likes
1,270

Hi,

In PAI Module you cannot write IF and ENDIF statements.

You cannot call Subscreen area based on conditions.

Because the statement, Call Subscreen <area> must be in PAI event

otherwise it gives syntax error.

Regards,

Raghava Channooru

Read only

former_member233090
Active Contributor
0 Likes
1,270

Hi,

when ur condition satisfies call an empty screen on the subscreen

i.e if r_but eq 'X'.

call screen 100. (empty screen)

endif.

cheers,

Bhavana

Read only

Former Member
0 Likes
1,271

Hi

In TOP Include
data repid type sy-repid,
        dynnr type sy-dynnr.


In PBO of main screen
module status_100. " First Call This Module to provide the SubScreen Number to below Code
call subscreen sub including repid dynnr. " This serves the purpose of calling subscreen based on condition


in Program.

module status_100.
repid = sy-repid.
if your_condition = 'X'. " This also can be implemented in any PAI logi as its purpose is just to pass a value to DYNNR 
dynnr = '200'. " The SUB Screen  Number you want to pass
else.
dynnr = '300'. " Dummy Sub Screen Screen or any other (Make Sure these are of SUB SCREEN type )
endif.
endmodule

Cheerz

Ram

Read only

Former Member
0 Likes
1,270

You can do it for user commands.

like :

Case ok_cdoe

When 'ABCD'.

Call subscreen ....

Endcase.