Application Development and Automation 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: 
Read only

F4 Value Request FM Using Fieldnames

Former Member
0 Likes
3,743

Is there any for F4 value request function module using Field name as input? For example BUKRS

15 REPLIES 15
Read only

former_member209217
Active Contributor
0 Likes
2,744

Hi Marc,

Try this function modules.

/EACC/F4HELP_FIELDNAME

ACE_BUKRS_F4_VALUES_GET

Hope it will be useful.

Regards,

Lakshman.

Edited by: Lakshman N on Mar 16, 2009 7:59 AM

Read only

kamesh_g
Contributor
0 Likes
2,744

Hi use following ...

1)

PARAMETERS: p_ccgrp LIKE rkpln-ksgru. "Cost Center Group

*Input help for Cost Center Group

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ccgrp.

TYPES: BEGIN OF ty_ccenter_group,

setname TYPE setnamenew,

descript TYPE settext,

END OF ty_ccenter_group.

DATA: it_ccenter_group TYPE TABLE OF ty_ccenter_group.

CLEAR it_ccenter_group.

SELECT a~setname

b~descript

INTO TABLE it_ccenter_group

FROM setheader AS a INNER JOIN

setheadert AS b ON

asubclass EQ bsubclass AND

asetname EQ bsetname

WHERE a~setclass EQ '0101' AND

b~langu EQ sy-langu.

CALL FUNCTION

'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

ret field = 'SETNAME'

dynpprog = v_repid

dynpnr = SY-DYNR

dynprofield = 'P_CCGRP'

value_org = 'S'

TABLES

value_tab = it_ccenter_group.

2) This FM is used to display value help or input from ABAP dictionary. We have to pass the name of the structure or table (TABNAME) along with the field name (FIELDNAME). The selection can be returned to the specified screen field if three

parameters DYNPNR, DYNPPROG, DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

TABNAME = table/structure

FIELDNAME = 'field name'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNR

DYNPROFIELD = 'screen field'

IMPORTING

RETURN_TAB = table of type DYNPREAD

Read only

Former Member
0 Likes
2,744

Hi,

F4_IF_FIELD_VALUE_REQUEST:Use values from a DDIC table to provide a list of possible values. TABNAME and FIELDNAME are required fields, and when MULTIPLE_CHOICE is selected, more than one value can be returned

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield =

value_org =

tables

value_tab =

return_tab =

exceptions

parameter_error = 1

no_values_found = 2

others = 3.

Regards,

NNR.

Read only

Former Member
0 Likes
2,744

Hi MArc,

Try this FM F4IF_INT_TABLE_VALUE_REQUEST or F4IF_FIELD_VALUE_REQUEST

Regards,

Sachin

Read only

Former Member
0 Likes
2,744

Hi Marg,

You can use Function Module:

F4IF_FIELD_VALUE_REQUEST

Hope it helps

Regrds

Mansi

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,744

Hi,

Use:


PARAMETERS : p_bukrs TYPE bukrs.

DATA : BEGIN OF itab OCCURS 0,
         bukrs TYPE bukrs,
       END OF itab.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.

  PERFORM f4_bukrs_help USING p_bukrs.

*&---------------------------------------------------------------------*
*&      Form  f4_bukrs_help
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_BUKRS text
*----------------------------------------------------------------------*
FORM f4_bukrs_help USING p_bukrs.

  SELECT bukrs from <db_table> INTO TABLE itab.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield               = 'BURKS' "internal table field
      dynpprog               = 'Z_F4' "program name
      dynpnr                 = '1000' "screen number
      dynprofield            = 'P_BUKRS' "screen field name
      value_org              = 'S'
    TABLES
      value_tab              = itab "internal table
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3.

  IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " f4_bukrs_help

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
2,744

Hi,

Yes the FM 'F4IF_INT_TABLE_VALUE_REQUEST' takes the field name and the table name as input parameter for F4 help.

Search the forum for the good code snippet.

Pooja

Read only

0 Likes
2,744

But I can have many fieldnames depending on what the user select. I have two fields, Field A has a list of fieldnames... for example, BUKRS, BELNR etc... Field B then will have the F4 value request that depends on the value of Field A. So my F4 value request for Field B is dynamic...

Read only

0 Likes
2,744

Yes, first you need to read the value selected in field A and then pass this selected value as the filedname in te FM for fieldB.

PS:For reading the value selected in the FieldA you need to use the FM 'DYNP_VALUES_READ' and then final value is then passed to F4 search help FM.

Provided above code is absolutely fine and are good for better understanding.

Pooja

Edited by: Pooja Gupta on Mar 16, 2009 8:22 AM

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,744

Hi,

Field A - BELNR

Field B - BUKRS (get f4 help based on field A)

Use:


PARAMETERS : p_belnr TYPE belnr,
             p_bukrs TYPE bukrs.
 
DATA : BEGIN OF itab OCCURS 0,
         bukrs TYPE bukrs,
       END OF itab.
 
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.
 
  PERFORM f4_bukrs_help USING p_bukrs.
 
*&---------------------------------------------------------------------*
*&      Form  f4_bukrs_help
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_BUKRS text
*----------------------------------------------------------------------*
FORM f4_bukrs_help USING p_bukrs.

  DATA : itab TYPE STANDARD TABLE OF it WITH HEADER LINE,
         tb_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE,
         v_belnr TYPE belnr.

  CLEAR:   tb_dynpfields.
  REFRESH: tb_dynpfields.

  MOVE 'P_BELNR' TO tb_dynpfields-fieldname.
  APPEND tb_dynpfields.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname                               = 'Z_F4' "program name
      dynumb                               = '1000' "screen number
    TABLES
      dynpfields                           = tb_dynpfields
    EXCEPTIONS
      INVALID_ABAPWORKAREA                 = 1
      INVALID_DYNPROFIELD                  = 2
      INVALID_DYNPRONAME                   = 3
      INVALID_DYNPRONUMMER                 = 4
      INVALID_REQUEST                      = 5
      NO_FIELDDESCRIPTION                  = 6
      INVALID_PARAMETER                    = 7
      UNDEFIND_ERROR                       = 8
      DOUBLE_CONVERSION                    = 9
      STEPL_NOT_FOUND                      = 10
      OTHERS                               = 11.

  IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  READ TABLE tb_dynpfields INDEX 1.
  IF sy-subrc EQ 0.
    v_belnr = tb_dynpfields-fieldvalue.
  ENDIF.
 
  SELECT bukrs from <db_table> INTO TABLE itab WHERE belnr = v_belnr.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield               = 'BURKS' "internal table field
      dynpprog               = 'Z_F4' "program name
      dynpnr                 = '1000' "screen number
      dynprofield            = 'P_BUKRS' "screen field name
      value_org              = 'S'
    TABLES
      value_tab              = itab "internal table
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3.
 
  IF sy-subrc  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
 
ENDFORM.                    " f4_bukrs_help

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
2,744

Hi , use the below FM.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BURKS' "internal table field

dynpprog = 'zprogram_demo' "program name

dynpnr = '1000' "screen number

dynprofield = 'P_BUKRS' "screen field name

value_org = 'S'

TABLES

value_tab = itab_demo "internal table

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

IF sy-subrc 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Read only

Former Member
0 Likes
2,744

Hi,

Check the below code

at selection-screen on value-request for s_bukrs-low.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'BUKRS'

dynprofield = 'S_BUKRS'

dynpprog = sy-cprog

dynpnr = sy-dynnr

value_org = 'S'

tables

value_tab = it001.

start-of-selection.

Regards,

Anki Reddy.

Read only

Former Member
0 Likes
2,744

Hi,

Also check the below link

Regards,

Anki Reddy

Read only

Former Member
0 Likes
2,744

hi,

check this function module

DISPLAY_BUKRS_MASKIERT_F4

Read only

Former Member
0 Likes
2,744

Hi,

Use this FM 'F4IF_FIELD_VALUE_REQUEST'

Regards,

Jyothi CH.