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: 

ALV list - User Command

Former Member
0 Kudos

hi frnd's,

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = GT_FIELDCAT[]

is_layout = GS_LAYOUT

i_save = 'A'

IT_EVENTS = GT_EVENTS[]

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

I_CALLBACK_USER_COMMAND = 'ALV_UCOMM'

TABLES

t_outtab = IT_ORDERS.

Using this I am displaying the alvlist , I had given my own pf-status and ucomm.

From alvlist i am calling the dialog program screen using call screen.

Then when i click back in dialog screen it leaves to alvlist , but when i click back in alvlist it again goes to dialog screen.

but i want to leave form that program.

hlp me pls.

9 REPLIES 9

hymavathi_oruganti
Active Contributor
0 Kudos

FOR THE back BUTTON IN ALV LIST, U WRITE LEAVE PROGRAM

Former Member
0 Kudos

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = L_LAYOUT

I_CALLBACK_PF_STATUS_SET = 'STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IT_FIELDCAT = IT_FIELDCAT

it_events = it_events

TABLES

T_OUTTAB = ITAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

FORM TOP_OF_PAGE.

  • BREAK-POINT.

WRITE: / 'TOP_OF_PAGE'.

ENDFORM.

FORM END_OF_PAGE.

  • BREAK-POINT.

WRITE: / 'END_OF_PAGE'.

ENDFORM.

&----


*& Form STATUS

&----


  • text

----


  • -->P_EXTAB text

----


FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.

*- Pf status

SET PF-STATUS 'STATUS'.

ENDFORM. " STATUS

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->RS_SELFIELD text

----


FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

case r_ucomm.

when 'BACK' or 'CANC' or 'EXIT'.

<b>leave to screen 0.</b>

when '&IC1'.

set parameter id 'AUN' field rs_selfield-value.

call transaction 'VA03' and skip first screen.

endcase.

ENDFORM. "USER_COMMAND

Former Member
0 Kudos

Hi suganya,

Are u checking the function code 'BACK'.

Check sy-ucomm.

If 'BACK'.

exit.

leave to selection-screen or your previous screen.

Endif.

Regards,

Tanveer.

Please mark helpful answers.

0 Kudos

The Back ucomm button itself not getting triggered.

Former Member
0 Kudos

Hi,

what is the Fcode you have assigned for that back button.

Also when comparing use caps letters,

ie

sy-ucomm = 'BACK'

and not 'Back'.

Regards,

Tanveer.

0 Kudos

I had given in Caps only.This is the user-command .

FORM ALV_UCOMM USING UCOMM LIKE sy-ucomm

SELFIELD TYPE SLIS_SELFIELD.

ENDFROM.

This routine itself doesn't get called when i leave the ALV LIST and come back and when i use F3-BACK.It works for other icons in toolbar.

0 Kudos

For ALV LIST the user command itself not getting triggered for the back button.

0 Kudos

ru activated pf status?. first go to pf-status and activate it....

Former Member
0 Kudos

Hi Suganya,

refer this :

https://www.sdn.sap.com/irj/sdn/collaboration

Topic : User command in ALV

you will get the solution.

and also you can use this :

case sy-ucomm.

When 'BACK'.

Leave Program.

endcase.

regards,

kunal.