2013 Oct 14 10:48 AM
Hi there,
I am new to SAP and ABAP and this is my first time using SCN so hopefully someone can help me!
I am trying to change the standard buttons on an ALV grid. There seem to be a few different ways of doing this but the way I have been trying to implement involves copying the GUI Status from another program (I have tried using SAPLKKBL)
After successfully copying the GUI status I have added some code to set the status within my Z program (Z_CHANGE_ICONS_TEST).
I have followed the instructions in other discussions which advise to include a form to set the pf status and then to call the pf status using the parameter - i_callback_pf_status_set = 'ZSTANDARD' within the 'REUSE_ALV_GRID_DISPLAY'.
I have done all this but when I execute, the ALV toolbar disappears as does the standard SAP toolbar so I can't even back out to return to my code.
If i remove the i_callback_pf_status_set then the toolbar comes back but I have no control over the icons.
I'm sure there is a simple solution to my problem but a bit of help/advice would be much appreciated as I am rather stuck.
My code is copied below.
*&---------------------------------------------------------------------*
*& Report Z_ALV_CHANGE_ICONS_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_ALV_CHANGE_ICONS_TEST.
*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: it_sflight TYPE TABLE OF sflight,
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
*****************************************************************
* Form Set_pf_status
* Notes: Called by FM REUSE_ALV_GRID_DISPLAY
*****************************************************************
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. "Set_pf_status
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
*Fetch data from the database
SELECT * FROM sflight INTO TABLE it_sflight.
*Build field catalog
wa_fieldcat-fieldname = 'CARRID'. " Fieldname in the data table
wa_fieldcat-seltext_m = 'Airline Code'. " Column description in the output
APPEND wa_fieldcat TO it_fieldcat.
*Pass data and field catalog to ALV function module to display ALV list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = it_fieldcat
i_callback_pf_status_set = 'ZSTANDARD'
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
2013 Oct 14 7:11 PM
hi steven
you can write in that i_call_back_pf_status form name(set_pf_status) not pf_status(zstandard) name and also u can write form pf_status at the end of program i.e after call fm reuse_alv_grid_display
thanks®arrds
naveen
hi steven
you can write in that i_call_back_pf_status form name(set_pf_status) not pf_status(zstandard) name and also u can write form pf_status at the end of program i.e after call fm reuse_alv_grid_display
thanks®arrds
naveen
2013 Oct 14 10:58 AM
Read this (old) FM documentation, you forgot to pass parameter I_CALLBACK_PROGRAM with the program name containing the FORM for I_CALLBACK_PF_STATUS_SET, I_CALLBACK_USER_COMMAND (for your function codes), etc. (Don't use sy-repid here but move it first to another variable) - so ALV look for ZSTANDARD status of standard program, not much success.
Also the documentation suggested to use a copy of status STANDARD from function group SALV. (or program SAPLSALV) (very similar to the one you copied)
Regards,
Raymond
2013 Oct 14 11:20 AM
Hi Raymond,
Thank you for your reply. I have tried using the status STANDARD from SAPALV also but having the same problem.
Could you possibly give me an example of how I should use the I_CALLBACK_PROGRAM and the I_CALLBACK_USER_COMMAND functions or post a link...I really am new to this and so I don't really understand your response.
Thanks in advance.
Steven
2013 Oct 14 1:05 PM
Regards,
Raymond
2013 Oct 14 3:21 PM
Hallo Steve Allant:
Try this:
1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'USER_COMMAND' FORM
2. Create 'USER_COMMAND' FORM
in your progrma this should look like this:
*&---------------------------------------------------------------------*
*& Report Z_ALV_CHANGE_ICONS_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_ALV_CHANGE_ICONS_TEST.
*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: it_sflight TYPE TABLE OF sflight,
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
*****************************************************************
* Form Set_pf_status
* Notes: Called by FM REUSE_ALV_GRID_DISPLAY
*****************************************************************
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. "Set_pf_status
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
*Fetch data from the database
SELECT * FROM sflight INTO TABLE it_sflight.
*Build field catalog
wa_fieldcat-fieldname = 'CARRID'. " Fieldname in the data table
wa_fieldcat-seltext_m = 'Airline Code'. " Column description in the output
APPEND wa_fieldcat TO it_fieldcat.
*Pass data and field catalog to ALV function module to display ALV list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = it_fieldcat
i_callback_program = gd_repid ( this is your program in global_variable )
I_callback_user_command = 'USER_COMMAND' ( your form in your Report )
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
Then your report make so:
FORM 'USER_COMMAND'
case sy-ucomm
when 'xyz'
then something.
when 'abc'
the something'
endcase
ENDFORM.
Set break-point on case sy-ucomm. Sy-ucomm have the "ABAP" cod of ALV button.
Please reward if helpful
Kind Regards.
Marek.
2013 Oct 14 7:11 PM
hi steven
you can write in that i_call_back_pf_status form name(set_pf_status) not pf_status(zstandard) name and also u can write form pf_status at the end of program i.e after call fm reuse_alv_grid_display
thanks®arrds
naveen
2013 Oct 15 11:32 AM
Hall naven,
you can write in that i_call_back_pf_status form name(set_pf_status) not pf_status(zstandard) name and also u can write form pf_status at the end of program i.e after call fm reuse_alv_grid_display.
but form should be "set_pf_status" if i good understand. Not "pf_status". The same name , what is in i_call_back_pf_status ??
Regards,
Marek.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |