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: 

Leave to previous screen

Former Member
0 Kudos

Hi Experts,

I have a function module that has its own screen. At the PAI upon pressing Exit or Cancel, I want to go back to the screen of the calling program that uses this function module. I think using the screen number alone of the calling program is not enough.

How can I go back to the screen of the calling program?

<removed_by_moderator>

Thanks,

LM

Edited by: Julius Bussche on Sep 19, 2008 10:46 AM

9 REPLIES 9

Former Member
0 Kudos

Hi,

Try using

LEAVE TO SCREEN scrn-number

Thanks,

Ruthra

Former Member
0 Kudos

Hi,

Use 'leave to screen 0'.

Regards,

Raju.

Former Member
0 Kudos

Hi Leo,

Try using RETURN.

RETURN.

It will take you back to the called program.

Regards

Karthik D

Former Member
0 Kudos

hi,

You can export the value 'A' to the memory and then import that in the screen program...

Export value to memory

Import value from memory

If you are using a global variable, which can be seen from both programs, then that's one solution.

The another solution, to use the global SAP memory.

EXPORT myvariable TO MEMORY ID 'MYVARIABLE'.

Then retrieve it like this:

EXPORT myvariable FROM MEMORY ID 'MYVARIABLE'.

Former Member

0 Kudos

Leo,

Use "Leave to Current Transcation".

Regards,

Karan

Former Member

Hi

Refer this example code which has been given in sap help

REPORT REP1 NO STANDARD PAGE HEADING.

DATA: ITAB TYPE I OCCURS 10,

NUM TYPE I.

SUBMIT REP2 AND RETURN.

IMPORT ITAB FROM MEMORY ID 'HK'.

LOOP AT ITAB INTO NUM.

WRITE / NUM.

ENDLOOP.

TOP-OF-PAGE.

WRITE 'Report 1'.

ULINE.

This program calls the following executable program (report):

REPORT REP2 NO STANDARD PAGE HEADING.

DATA: NUMBER TYPE I,

ITAB TYPE I OCCURS 10.

SET PF-STATUS 'MYBACK'.

DO 5 TIMES.

NUMBER = SY-INDEX.

APPEND NUMBER TO ITAB.

WRITE / NUMBER.

ENDDO.

TOP-OF-PAGE.

WRITE 'Report 2'.

ULINE.

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'MBCK'.

EXPORT ITAB TO MEMORY ID 'HK'.

LEAVE.

ENDCASE.

Regards,

Sravanthi

Former Member
0 Kudos

Hi,

*Define ok_code

DATA: ok_code LIKE sy-ucomm.

*In Module pai...do this....

MODULE pai INPUT.

  • to react on oi_custom_events:

CALL METHOD cl_gui_cfw=>dispatch.

CASE ok_code.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN 'BACK'.

LEAVE TO SCREEN 0. "this will take u back to previous screen

WHEN OTHERS.

  • do nothing

ENDCASE.

CLEAR ok_code.

ENDMODULE.

Hope this helps you.

Regards,

Rashmi

Former Member
0 Kudos

Hi Leo,

leave screen 'screen number'