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

CL_GUI_ALV_GRID some function codes don't work

Former Member
0 Likes
1,614

Hi,

I used CL_GUI_ALV_GRID to build a ALV. At the PAI of ALV, I capture function codes to process the action. But all function codes bring me back to the selection screen. But I only want to show the selection screen when I press BACK or CANCEL.

   GV_FCODE = SY-UCOMM.

   CASE GV_FCODE.

     WHEN 'BACK' OR 'CANCEL'.

       CALL SELECTION-SCREEN 1000.

*      CLEAR: GV_FCODE.

     WHEN 'EXIT'.

       CLEAR: GV_FCODE.

       LEAVE PROGRAM.

     WHEN 'EDIT'.

       PERFORM SHOW_EDITCELL.

     WHEN OTHERS.

   ENDCASE.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,444

Check "next screen" value of the main dynpro, should be the same dynpro, if initial, end of PAI go to code after CALL SCREEN. (Static Next Dynpro)

And don't

- use sy-ucomm but an OK_CODE variable in the dynpro definition, (Reading Function Codes)

- use CALL SELECTION-SCREEN 1000 to get back to selection screen, try a LEAVE TO SCREEN 0 or a LEAVE TO CURRENT TRANSACTION (You are stacking screens over screens, Screens, Screen Sequences)

Regards,

Raymond

11 REPLIES 11
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,445

Check "next screen" value of the main dynpro, should be the same dynpro, if initial, end of PAI go to code after CALL SCREEN. (Static Next Dynpro)

And don't

- use sy-ucomm but an OK_CODE variable in the dynpro definition, (Reading Function Codes)

- use CALL SELECTION-SCREEN 1000 to get back to selection screen, try a LEAVE TO SCREEN 0 or a LEAVE TO CURRENT TRANSACTION (You are stacking screens over screens, Screens, Screen Sequences)

Regards,

Raymond

Read only

0 Likes
1,444

Hi Raymond,

Thank you for your reply.

I replace CALL SELECTION-SCREEN 1000 with LEAVE TO SCREEN 0. But it won't go back to the selection screen, it stays in the same screen.

Regards,

ts

Read only

0 Likes
1,444

Is there code in the USER_COMMAND form/module after the CASE/ENDCASE, and is there code after the CALL SCREEN nnnn, where nnnn screen contains the ALV grid container ?

Regards,

Raymond

Read only

Former Member
0 Likes
1,444

Change the CALL SELECTION-SCREEN 1000

to LEAVE TO SCREEN 0.

Regards,

Ikrar

Read only

0 Likes
1,444

Hi Ikara,

I've made the change and but it doesn't go back to the selection-screen but stay at the current screen.

Best regards,

ts

Read only

0 Likes
1,444

Hiii,

        Use set screen 0. see my sample code -

REPORT  TEST.

TABLES : t001.

SELECT-OPTIONS : so FOR t001-BUKRS.


START-OF_SELECTION.

call screen 0100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.

SAVE_OK = SY-UCOMM.
CLEAR OK_CODE.

CASE SAVE_OK.
WHEN 'CANCEL' OR 'BACK'.
SET SCREEN 0.
*LEAVE PROGRAM.
when 'CREATE'.
CALL SCREEN 200.
ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Read only

0 Likes
1,444

Hi Ashish,

The selection-screen is created using SELECT-OPTIONS. It seems that SET SCREEN 0 doesn't work.

Regards,

ts

Read only

0 Likes
1,444

Hiii,

       Just copy paste and try it'll work more info press f1 or help.sap.com. Here select-options - taking input and in PBO of screen 100 getting data based on that input and just create object of container and show ALV and in PAI write logic of back button so you can again view your selection main screen.

you can use call screen also but it totally depends on requirement .

Read only

Jay_Kamdar
Participant
0 Likes
1,444

Use the following logic :


   DATA: v_ok_code TYPE sy-ucomm,
         v_save_ok TYPE sy-ucomm.
   v_ok_code = sy-ucomm.
   v_save_ok = v_ok_code.
   CASE sy-ucomm.
     WHEN 'BACK'.
       SET SCREEN 1000.

     WHEN 'CANCEL'.

SET SCREEN 1000.
     WHEN OTHERS.

       SET SCREEN 1000.
   ENDCASE.
   CLEAR v_save_ok.

   SET SCREEN 0.
   LEAVE SCREEN.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,444

HI,

Use the below for Back.

set screen '0'.    
leave screen.

Read only

Former Member
0 Likes
1,444

Hi,

Use SUBMIT <your program name> via selection-screen.

it will also work....

Thanks,

Satya.