Skip to Content
avatar image
Former Member

Leave to previous screen

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • avatar image
    Former Member
    Sep 19, 2008 at 07:39 AM

    Hi,

    Try using

    LEAVE TO SCREEN scrn-number

    Thanks,

    Ruthra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 07:40 AM

    Hi,

    Use 'leave to screen 0'.

    Regards,

    Raju.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 07:47 AM

    Hi Leo,

    Try using RETURN.

    RETURN.

    It will take you back to the called program.

    Regards

    Karthik D

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 07:55 AM

    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'.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 08:12 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 08:22 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 08:45 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2008 at 08:50 AM

    Hi Leo,

    leave screen 'screen number'

    Add comment
    10|10000 characters needed characters exceeded