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: 

F4 Help on Date Field after ALV is generated

former_member184657
Active Contributor
0 Kudos

Hi all,

Now this might sound very simple question, but Im having some difficulty in this.

My idea is to have an F4 on a date field after the ALV Grid report is executed. From the forum search, Ive got such answers as

l_fieldcat-edit         = 'X'.
l_fieldcat-F4AVAILABL = 'X'.

Now the problem with this is that Im getting an error saying:

The data object "l_fieldcat does not have a component called "F4AVAILABL".

And then I tried this:

l_fieldcat-fieldname    = 'DDATE'.
l_fieldcat-ref_tabname = 'ZCST001'.

Now at the report output when I press F4 on the date field it gives me a dump saying:

Field symbol has not yet been assigned.

Error in the ABAP Application Program

The current ABAP program "CL_GUI_ALV_GRID===============CP" had to be terminated because it has come across a statement that unfortunately cannot be executed.

So Im kinda stuck now. Appreciate your suggestions.

PS: Im on ECC6.

PPS:The intended F4 on field is a custom field in a custom table.

pk

1 ACCEPTED SOLUTION

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kishan,

Try this:

data ls_fieldcat type LVC_S_FCAT.

ls_fieldcat-ref_table = 'Custom table name '.

ls_fieldcat-ref_field = custom table-fieldname.

ls_fieldcat-rollname = data element name .

ls_fieldcat-F4AVAILABL = 'X' .

If any input help is avaialbale for this data element then the same can be displayed in the ALV.

6 REPLIES 6

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kishan,

Try this:

data ls_fieldcat type LVC_S_FCAT.

ls_fieldcat-ref_table = 'Custom table name '.

ls_fieldcat-ref_field = custom table-fieldname.

ls_fieldcat-rollname = data element name .

ls_fieldcat-F4AVAILABL = 'X' .

If any input help is avaialbale for this data element then the same can be displayed in the ALV.

Former Member
0 Kudos

Hi,

If i understood correctly,

DATA I_F_UCOMM LIKE SY-UCOMM.

DATA I_R_SELFIELD TYPE SLIS_SELFIELD.

----


  • AT LINE SELECTION

----


AT LINE-SELECTION.

PERFORM USER_COMMAND USING I_F_UCOMM I_R_SELFIELD.

&----


*& FORM USER_COMMAND

&----


  • TEXT

----


  • --> P1 TO CATCH THE MOUSE CLICK FOR SPECIFIED FIELDS IN THE

  • OUTCOME.

  • <-- P2 DRILL DOWN FUNCTIONALITY

----


FORM USER_COMMAND USING I_F_UCOMM I_R_SELFIELD TYPE SLIS_SELFIELD .

CASE I_F_UCOMM.

WHEN '&IC1'.

PERFORM FCODE_ITEM_LINES USING I_R_SELFIELD. " TYPE SLIS_SELFIELD .

ENDCASE.

ENDFORM. " USER_COMMAND

FORM FCODE_ITEM_LINES USING I_R_SELFIELD1 TYPE SLIS_SELFIELD .

IF I_R_SELFIELD1-FIELDNAME = 'BELNR'.

handle ur code to display f4 help.

ENDIF.

ENDFORM. "FCODE_ITEM_LINES

Regards,

Shekher

Former Member
0 Kudos

PPS:The intended F4 on field is a custom field in a custom table.

Check the data type of that field, If it is defined as DATS, there shouldn't be any extra efforts needed to get the F4 help for date field.

regards,

Advait

former_member181995
Active Contributor
0 Kudos

Run This:

report ztest.
TYPE-POOLS : slis.
tables:mara,makt.

data: begin of it_final occurs 0,
matnr like mara-matnr,
ERSDA like mara-ERSDA,
end of it_final.
DATA: it_fieldcat     TYPE slis_t_fieldcat_alv,
      wa_fieldcat     TYPE slis_fieldcat_alv,
      wa_layout       TYPE slis_layout_alv,
      g_repid         TYPE sy-repid.
START-OF-SELECTION.
select matnr ERSDA into table it_final from mara up to 10 rows.


  g_repid = sy-repid.
  PERFORM f_populate_fieldcat.
*  PERFORM fill_zpayroll.
  PERFORM f_call_alv.

*&---------------------------------------------------------------------*
*&      Form  f_populate_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form f_populate_fieldcat .
"Mat Number
  CLEAR wa_fieldcat.
  wa_fieldcat-tabname     = it_final.
  wa_fieldcat-fieldname   = 'MATNR'.
  wa_fieldcat-seltext_l   = 'MAT No.'.
  wa_fieldcat-outputlen   = 15.
  APPEND wa_fieldcat TO it_fieldcat.

  "Creation date
  CLEAR wa_fieldcat.
  wa_fieldcat-tabname     = it_final.
  wa_fieldcat-fieldname   = 'ERSDA'.
  wa_fieldcat-edit         = 'X'.
wa_fieldcat-REF_TABname = 'MARA'.
wa_fieldcat-REF_FIELDname = 'ERSDA'.
  wa_fieldcat-seltext_l   = 'Creation date '.
  wa_fieldcat-outputlen   = 15.
  APPEND wa_fieldcat TO it_fieldcat.
endform.                    " f_populate_fieldcat
*&---------------------------------------------------------------------*
*&      Form  f_call_alv
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form f_call_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program     = g_repid
      i_callback_top_of_page = 'TOP-OF-PAGE'
      is_layout              = wa_layout
      it_fieldcat            = it_fieldcat[]
      I_SAVE = 'A'
    TABLES
      t_outtab               = it_final
    EXCEPTIONS
      program_error          = 1
      OTHERS                 = 2.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
endform.                    " f_call_alv

In custom table date field must be referenced to DATS.

P.S.I hope you already solved

Cheers

0 Kudos

Thank you all for your help.

The problem is now resolved. Well, as on most occasions, it was a minor issue. I had forgotten to include the newly added Date field in the final internal table.

Rest everything was pretty much as it should have been.

pk

PS: Keeping the thread open for the time being, in that hope that there might be further questions on the same development.