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: 

Internal table contents are f4 help values

Former Member
0 Kudos

can i have internal table values as f4 help value for

a particular field on the screen

2 REPLIES 2

0 Kudos

Try this FM F4IF_INT_TABLE_VALUE_REQUEST.

Regards,

Srini S

ssimsekler
Active Contributor
0 Kudos

Hi Kaushik

This is a renowned subject here. Srini's suggestion is OK. And here is an example I have posted in this forum before.


*--Screen 100:
...

PROCESS ON VALUE-REQUEST.

  FIELD gv_user MODULE f4_user .

*-------------------------------
MODULE gv_user INPUT.

*--Branching to a form since the variables are defined 
*-as global when you define here...
  PERFORM f4_user CHANGING gv_user .

ENDMODULE .
*-------------------------------

FORM f4_user CHANGING ep_user LIKE sy-uname .

*--You can have this internal table as you want
  DATA: BEGIN OF lt_users OCCURS 1 ,
    bname LIKE usr21-bname ,
    kostl LIKE usr21-kostl ,
  END OF lt_users .

  DATA lt_return LIKE ddshretval OCCURS 0 
       WITH HEADER LINE .

*--You can get the internal table content from any  
*--table you want. Here I use "USR21" 
  SELECT bname kostl FROM usr21
         INTO TABLE lt_users .

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*--retfield must contain the name of the field of  
*--the internal table which will be assigned to   
*--your screen field in case you select it. 
      retfield = 'BNAME'
      window_title = 'User Selection'
      value_org = 'S' "Use this value"
    TABLES
*--your int. tab holding values to be selected
      value_tab = lt_users 
*--int table having your selection(s)
      return_tab = lt_return 
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS = 3.

  IF sy-subrc = 0 .
    READ TABLE lt_return INDEX 1 .
    IF sy-subrc = 0 .
*--Here is the assignment
      ep_user = lt_return-fieldval . 
    ENDIF .
  ENDIF.

ENDFORM .

*--Serdar