06-30-2016 8:22 AM
HI Experts,
I have a requirement of displaying a Dynamic internal Table in CL_GUI_ALV_GRID_DISPLAY,
Its Done , BUT I want F4 HELP for some fields which are displayed in the ALV . How can i do that ?
Thanks in advance.
Regards,
Srikanth.
06-30-2016 9:10 AM
Hi Srikanth,
If you are using Fieldcat then you can do as following provided that the search help is attached in field level or data element level.
wa_fcat-F4AVAILABL = 'X'.
Regards,
Junas Pious.
06-30-2016 9:18 AM
Hi Junas,
Thanks for replying. But here i want F4 help also Dynamically ie.. taking the value in the first field
I want the F4 HELP for second field, and taking the value in the second field i should populate the third field F4 HELP, and so on..
Regards,
Srikanth.
06-30-2016 9:36 AM
Hi Srikanth,
You need to consider event ONF4 of class CL_GUI_ALV_GRID : this way you can have have a dynamic value-request where you could take particular values into account.
Regards,
William
06-30-2016 10:27 AM
06-30-2016 11:07 AM
Hi,
There is an event 'ONF4' in cl_gui_alv_grid class.
Use this event, write your code to handle the event.
Search the other posts for code implementation for the event. I believe this will solve your issue.
06-30-2016 11:31 AM
Your requirement seems weird, so I guess I didn't understand what you said. Can you explain again please, with a little scheme if possible?
06-30-2016 12:10 PM
HI,
I should display a dynamic internal table in ALV. This was done.
now i want F4 Help for 2nd and 3rd fields .
For this :
if the first field is kunnr, i want F4 help for the second field ( eg: sales order ) in the F4 help of second field i want only the corresponding records ( sales in this eg ) . likewise third field F4 help depends on 2nd field input.
Here filling the table LVC_T_F4 is the problem for me. What should assigned to the field 'FIELDNAME'. I have hard coded the second field name and tried, and also tried to assign the component. but nothing is working.
06-30-2016 12:20 PM
Is your internal table actually dynamic, in this case use ONF4 (*) to manage the F4.
Regards,
Raymond
(*) as already suggested by William.
06-30-2016 12:20 PM
In the table for LVC_T_F4 create multiple records for all those fields which you want to assign help for.
We get the ROW_NO as a parameter for the event. Read your internal table with that index.
Good thing is that we have the field names .
Just take the value of those fields, and do a query or whatever you want to do to get the data based on that field value.
06-30-2016 12:26 PM
Thanks. So, let's say your 2 columns are named KUNNR, VBELN. In the internal table of type LVC_T_F4, you must add one line with FIELDNAME = 'KUNNR', and one line with FIELDNAME = 'VBELN'. For this you set a Handler on event ONF4 (+ parameter E_FIELDNAME to know on which field KUNNR or VBELN F4 is pressed) + call method REGISTER_F4_FOR_FIELDS with the itab of type LVC_T_F4.
EDIT: Refer to demo program BCALV_TEST_GRID_F4_HELP for real code example.
06-30-2016 12:34 PM
Hi,
I have tried this. but not working
field = 'FIELD'.
ASSIGN COMPONENT field OF STRUCTURE workarea TO <fs_vall>.
IF lit_f4[] IS INITIAL.
CLEAR wa_f4.
wa_f4-fieldname = <fs_vall>.
wa_f4-register = 'X'.
wa_f4-chngeafter = 'X'.
APPEND lwa_f4 TO lit_f4.
( ASSIGN COMPONENT 2 OF STRUCTURE workarea TO <fs_vall>. also tried this )
06-30-2016 12:42 PM
Did you put this statement - er_event_data->m_event_handled = 'X'. After filling the table lit_f4.
I am also having a doubt that what value will the field-symbol <fs_val1> will get. Did you check the value in debugging.?
06-30-2016 9:17 AM
06-30-2016 9:35 AM
Hi,
I have a DB table with table names and field names, i have fetched the records and using that data i have filed the FIELDCAT through which i created the Dynamic table
07-02-2016 7:32 AM
hi , see below sample report for ur idea REPORT ZDEMO2. DATA:GO_CON TYPE REF TO CL_GUI_CUSTOM_CONTAINER, GO_ALV TYPE REF TO CL_GUI_ALV_GRID. DATA:LT_VBAK TYPE STANDARD TABLE OF VBAK. DATA:LT_FCAT TYPE LVC_T_FCAT, LS_FCAT TYPE LVC_S_FCAT. DATA:LT_F4 TYPE LVC_T_F4, LS_F4 TYPE LVC_S_F4. CLASS LCL_F4HAND DEFINITION. PUBLIC SECTION. METHODS:HAND_F4 FOR EVENT ONF4 OF CL_GUI_ALV_GRID IMPORTING E_FIELDNAME E_FIELDVALUE ES_ROW_NO ER_EVENT_DATA ET_BAD_CELLS E_DISPLAY. ENDCLASS. CLASS LCL_F4HAND IMPLEMENTATION. METHOD HAND_F4. * write here u own f4 help code. IF 1 = 3. ENDIF. ENDMETHOD. ENDCLASS. DATA:LO_F4 TYPE REF TO LCL_F4HAND. START-OF-SELECTION. CREATE OBJECT GO_CON EXPORTING CONTAINER_NAME = 'CON' EXCEPTIONS CNTL_ERROR = 1 CNTL_SYSTEM_ERROR = 2 CREATE_ERROR = 3 LIFETIME_ERROR = 4 LIFETIME_DYNPRO_DYNPRO_LINK = 5 OTHERS = 6. CREATE OBJECT GO_ALV EXPORTING I_PARENT = GO_CON EXCEPTIONS ERROR_CNTL_CREATE = 1 ERROR_CNTL_INIT = 2 ERROR_CNTL_LINK = 3 ERROR_DP_CREATE = 4 OTHERS = 5. CREATE OBJECT LO_F4. SET HANDLER LO_F4->HAND_F4 FOR GO_ALV. CLEAR LS_F4. LS_F4-FIELDNAME = 'VBELN'. LS_F4-REGISTER = 'X'. APPEND LS_F4 TO LT_F4. CALL METHOD GO_ALV->REGISTER_F4_FOR_FIELDS EXPORTING IT_F4 = LT_F4. SELECT * FROM VBAK INTO TABLE LT_VBAK WHERE KUNNR = '0000020028'. CLEAR LS_FCAT. LS_FCAT-FIELDNAME = 'VBELN'. LS_FCAT-SCRTEXT_L = 'Sales Order'. LS_FCAT-F4AVAILABL = 'X'. LS_FCAT-EDIT = 'X'. APPEND LS_FCAT TO LT_FCAT. CALL METHOD GO_ALV->SET_TABLE_FOR_FIRST_DISPLAY CHANGING IT_OUTTAB = LT_VBAK IT_FIELDCATALOG = LT_FCAT EXCEPTIONS INVALID_PARAMETER_COMBINATION = 1 PROGRAM_ERROR = 2 TOO_MANY_LINES = 3 OTHERS = 4. CALL SCREEN 100.
07-02-2016 7:32 AM
REPORT ZDEMO2. DATA:GO_CON TYPE REF TO CL_GUI_CUSTOM_CONTAINER, GO_ALV TYPE REF TO CL_GUI_ALV_GRID. DATA:LT_VBAK TYPE STANDARD TABLE OF VBAK. DATA:LT_FCAT TYPE LVC_T_FCAT, LS_FCAT TYPE LVC_S_FCAT. DATA:LT_F4 TYPE LVC_T_F4, LS_F4 TYPE LVC_S_F4. CLASS LCL_F4HAND DEFINITION. PUBLIC SECTION. METHODS:HAND_F4 FOR EVENT ONF4 OF CL_GUI_ALV_GRID IMPORTING E_FIELDNAME E_FIELDVALUE ES_ROW_NO ER_EVENT_DATA ET_BAD_CELLS E_DISPLAY. ENDCLASS. CLASS LCL_F4HAND IMPLEMENTATION. METHOD HAND_F4. IF 1 = 3. ENDIF. ENDMETHOD. ENDCLASS. DATA:LO_F4 TYPE REF TO LCL_F4HAND. START-OF-SELECTION. CREATE OBJECT GO_CON EXPORTING CONTAINER_NAME = 'CON' EXCEPTIONS CNTL_ERROR = 1 CNTL_SYSTEM_ERROR = 2 CREATE_ERROR = 3 LIFETIME_ERROR = 4 LIFETIME_DYNPRO_DYNPRO_LINK = 5 OTHERS = 6. CREATE OBJECT GO_ALV EXPORTING I_PARENT = GO_CON EXCEPTIONS ERROR_CNTL_CREATE = 1 ERROR_CNTL_INIT = 2 ERROR_CNTL_LINK = 3 ERROR_DP_CREATE = 4 OTHERS = 5. CREATE OBJECT LO_F4. SET HANDLER LO_F4->HAND_F4 FOR GO_ALV. CLEAR LS_F4. LS_F4-FIELDNAME = 'VBELN'. LS_F4-REGISTER = 'X'. APPEND LS_F4 TO LT_F4. CALL METHOD GO_ALV->REGISTER_F4_FOR_FIELDS EXPORTING IT_F4 = LT_F4. SELECT * FROM VBAK INTO TABLE LT_VBAK WHERE KUNNR = '0000020028'. CLEAR LS_FCAT. LS_FCAT-FIELDNAME = 'VBELN'. LS_FCAT-SCRTEXT_L = 'Sales Order'. LS_FCAT-F4AVAILABL = 'X'. LS_FCAT-EDIT = 'X'. APPEND LS_FCAT TO LT_FCAT. CALL METHOD GO_ALV->SET_TABLE_FOR_FIRST_DISPLAY CHANGING IT_OUTTAB = LT_VBAK IT_FIELDCATALOG = LT_FCAT EXCEPTIONS INVALID_PARAMETER_COMBINATION = 1 PROGRAM_ERROR = 2 TOO_MANY_LINES = 3 OTHERS = 4. CALL SCREEN 100.