‎2008 Jun 10 10:36 PM
Hi guru's
I got a additional button on the toolbar of the ALV. I got a logic under that. But in the program when that button is pushed, it is reaching the case statement and not going in further. i.e. it is not validating the user command. Please explain me how to resolve this issue. My code is given below.
REPORT ZUSALV MESSAGE-ID YMESS.
TYPE-POOLS: SLIS.
TABLES: SPFLI, SFLIGHT, SBOOK.
DATA: BEGIN OF T_SPFLI OCCURS 0,
CHECKBOX,
COLOR(3).
INCLUDE STRUCTURE SPFLI.
DATA: END OF T_SPFLI.
DATA: T_SSPFLI LIKE STANDARD TABLE OF T_SPFLI .
DATA: FS_SPFLI LIKE LINE OF T_SSPFLI.
DATA: BEGIN OF T_SFLIGHT OCCURS 0,
CHECKBOX,
COLOR(3).
INCLUDE STRUCTURE SFLIGHT.
DATA: END OF T_SFLIGHT.
DATA: T_SSFLIGHT LIKE STANDARD TABLE OF T_SFLIGHT.
DATA: FS_SFLIGHT LIKE LINE OF T_SSFLIGHT.
DATA: BEGIN OF T_SBOOK OCCURS 0.
INCLUDE STRUCTURE SBOOK.
DATA: END OF T_SBOOK.
DATA: FS_LAYOUT TYPE SLIS_LAYOUT_ALV,
W_PROGRAM TYPE SY-REPID.
SELECT * FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
W_PROGRAM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROGRAM
I_CALLBACK_PF_STATUS_SET = 'FLIGHT'
I_CALLBACK_USER_COMMAND = 'SPFLI_INFO'
I_STRUCTURE_NAME = 'SPFLI'
IS_LAYOUT = FS_LAYOUT
TABLES
T_OUTTAB = T_SPFLI
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
&----
*& Form FLIGHT
&----
text
----
-->RT_EXTAB text
----
FORM FLIGHT USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'FLIGHT' EXCLUDING RT_EXTAB.
ENDFORM. "FLIGHT
&----
*& Form SPFLI_INFO
&----
text
----
-->UCOMM text
-->SELFIELD text
----
FORM SPFLI_INFO USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
SELFIELD-REFRESH = 'X'.
CASE UCOMM.
WHEN 'FLIGHT'.
LOOP AT T_SPFLI.
IF T_SPFLI-CHECKBOX = 'X'.
T_SPFLI-CHECKBOX = ' '.
T_SPFLI-COLOR = 'C51'.
MODIFY T_SPFLI TRANSPORTING CHECKBOX COLOR.
FS_SPFLI = T_SPFLI.
APPEND FS_SPFLI TO T_SSPFLI.
ENDIF.
ENDLOOP.
LOOP AT T_SSPFLI INTO FS_SPFLI.
SELECT *
FROM SFLIGHT
APPENDING CORRESPONDING FIELDS OF TABLE T_SFLIGHT
WHERE CARRID EQ FS_SPFLI-CARRID
AND CONNID EQ FS_SPFLI-CONNID.
ENDLOOP.
ENDCASE.
REFRESH T_SSPFLI.
CLEAR FS_SPFLI.
FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
FS_LAYOUT-CONFIRMATION_PROMPT = 'X'.
FS_LAYOUT-KEY_HOTSPOT = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROGRAM
I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = FS_LAYOUT
TABLES
T_OUTTAB = T_SFLIGHT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
REFRESH T_SFLIGHT.
ENDFORM. "SPFLI_INFO
thanks in advance
sandeep
‎2008 Jun 11 12:20 AM
Hi,
are you sure that is not working. I copied your code, created a new GUI status with a button. everything is working fine and smooth. What function did you assign to your button? When you add a breakpoint at the beginning of the routine spfli_info what is in the variable ucomm.
‎2008 Jun 11 12:29 AM
hi martin,
When i am debugging the code...it skips the code under UCOMM. Its moving out of CASE Statement as soon as the control comes there. In the pf-status..do i need to maintain any functional type under function attributes..please help me out....
thanks
sandeep
Edited by: sandeep nadendla on Jun 11, 2008 1:30 AM
‎2008 Jun 11 12:33 AM
Which buttin did you press? What is function code for this button? What do you have in the variable ucomm? When you double click on the ucomm you will a value of this variable.
‎2008 Jun 11 3:00 AM
Hi Martin,
I pressed the button "FLIGHT" (Additional Button i added) for which i maintained the pf-status. And about the variable it is "&FLI". Please let me know if there are any issues with it.
Thanks,
Sandeep
‎2008 Jun 11 3:11 AM
Hi,
so instead of
WHEN 'FLIGHT'.
you should have
WHEN '&FLI'.
You set function code &FLI to your additional button. You can find the function code of the button in the variable ucomm, not the name of the button. You should check ABAP documentation for case statement as well.
‎2008 Jun 11 3:11 AM
Hi,
seems like the Fcode you gave to the Push Button is '&FLI' and the field name is 'FLIGHT'. Try this out Case '&FLI' and check and if you want to make it Field specific use the Field name from RSSELFIELD-fieldname , Hope this will help you.
Reward Points if useful
Raj