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

Calling modules on screen flow logic based on some condition

Former Member
0 Likes
1,218

Dear All,

I am developing a function module with few screens. My busienss requirement is such that i need to use some standard Module code, not this call should be conditional, and should be called only for the first time when screen is loaded.

I can not use chain end chain conditions as i am not giving any field open to users to load data.

Please sugegst.

Thanks for your help.

Regards,

Sudhir

1 ACCEPTED SOLUTION
Read only

former_member632991
Active Contributor
0 Likes
1,076

Hi,

As per my understanding, u can write those nodules in PBO of the screen and then set a flag variable 'Y', in the end of that modules.

and check a condition that if flag <> 'Y', then only that code is executed.

So firset time when the screen will be loaded , flag will not be y and that modules will be executed, but nest time those will not be executed.

Hope it helps.

Regards,

Sonika

10 REPLIES 10
Read only

former_member632991
Active Contributor
0 Likes
1,077

Hi,

As per my understanding, u can write those nodules in PBO of the screen and then set a flag variable 'Y', in the end of that modules.

and check a condition that if flag <> 'Y', then only that code is executed.

So firset time when the screen will be loaded , flag will not be y and that modules will be executed, but nest time those will not be executed.

Hope it helps.

Regards,

Sonika

Read only

0 Likes
1,076

Can we out any logical (comparison statement ) expression on screen flow logic.

?

Read only

0 Likes
1,076

Hi,

we can write out any logical (comparison statement ) expression on screen flow logic.we can only write modules i that but in that module u can put the condition to execute that code.

for example

PROCESS BEFORE OUTPUT.

MODULE STATUS_1000.

MODULE SELECT.

MODULE SELECT OUTPUT.

IF FLAG <> 'Y'.

SELECT AMATNR AEBELN EBELP MENGE LIFNR A~WERKS

FROM EKPO AS A INNER JOIN EKKO AS B

ON AEBELN = BEBELN

INNER JOIN MARC AS C

ON AMATNR = CMATNR

AND AWERKS = CWERKS

INTO TABLE ITAB_TC

WHERE A~EBELN = EKPO-EBELN

AND BSART IN ('ZIMP' , 'ZPO')

AND A~LOEKZ = ' '

AND A~RETPO <> 'X'

AND SERNP = 'Z003'

.

flag = 'Y'.

ENDIF.

ENDLOOP.

Hope it helps.

Regards,

Sonika

Read only

0 Likes
1,076

Thanks Sonika,

but when i Put If statement in PBO or PAI i am getting error that.

statement IF is not defined.

any clue

Read only

0 Likes
1,076

Hi,

Have u written the if in statement in the module only or some where else?

i have written that in module and its not giving any error.

pls ckeck ur code or send ur code.

Regards,

Sonika

Read only

0 Likes
1,076

Please look at the code. i have to call module test1 based on a flag condition.

PROCESS BEFORE OUTPUT.

field TEST_VAR.

module status_modelling.

IF TEST_VAR '0'.

module test1 .

ENDIF.

but i am gettign error for this

Read only

0 Likes
1,076

Hi,

it will give error like this,

write the if condition in the module.

instead of this

<b>IF TEST_VAR '0'.

module test1 .

ENDIF</b>.

write like this.

<b>module test1 .</b>

IF TEST_VAR '0'.

<b>write ur code here.</b>

ENDIF.

<b>endmodule.</b>

Regards,

Sonika

Read only

0 Likes
1,076

I want to call Module tes1 only and only when condition is successful..

Not sure if this will help.

cause i can not modify these modules,(part of standard program)

Message was edited by:

Sudhir

Read only

0 Likes
1,076

To call the module only once you will have to set a Flag inside your module. This cannot be done in the screen flow logic as IF conditions dont work there.

So Basically

<b>MODULE Screen_100 Output.

if flag is initial or if condition is successful.

Write ur code here.

flag = 'X'.

endif.

ENDMODULE.</b>

Read only

0 Likes
1,076

Thnaks guys.. but infortunately i was trying to use standard SAP modules hence can not copy them. I Copied the modules as Z and then used them..

thanks for your help.

Regards,

Sudhir