Skip to Content
author's profile photo
Former Member

F4 help

Hi Experts,

I have to give f4 to one field based on the value given in the previous field in selection-screen,

Ex:

<b>country</b> and <b>state</b>

if i select india in country field then in stete fiels it should display only states of india.

Regards,

Saleem

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

8 Answers

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 05:49 AM

    hi,

    use the function module:

    F4IF_INT_TABLE_VALUE_REQUEST

    In the documenttaion of this fm u can see a sample code

    regards,

    Navneeth K.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 05:49 AM

    hi saleem,

    u need to assign a fn code to the country field.

    The fn code gets triggered after u give input in the country field.

    SO using sy-ucomm, use select statement to fetch states according to country.

    If u have doubts ask me. its simple.

    <b>Pls reward ppints if helpful.</b>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 05:50 AM

    HI,

    see this code.

    PARAMETERS:i_ernam type mara-matnr,

    i_matnr type mara-matnr.

    data:BEGIN OF itab OCCURS 0,

    matnr type mara-matnr,

    END OF itab.

    AT SELECTION-SCREEN on VALUE-REQUEST FOR i_matnr.

    refresh itab.

    SELECT * from mara into CORRESPONDING FIELDS OF TABLE itab

    where ernam = i_ernam.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    RETFIELD = 'MATNR'

    DYNPROFIELD = 'I_MATNR'

    VALUE_ORG = 'S'

    TABLES

    VALUE_TAB = itab.

    rgds,

    bharat.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:15 AM

    Hi saleem,

    Refer to the below program for search help,

    In this program for the selection screen field arktx i have used search help concept.So based upon the value of vbeln it will display values in F4 help.

    But in this after giving value to VBELN we have click <b>ENTER</b> button .

    i am sure it will help u..

    report zpractice_43_022.

    *tables

    tables:vbap.

    *decleration

    data:begin of t_vbap occurs 0,

    vbeln like vbap-vbeln,

    matnr like vbap-matnr,

    posnr like vbap-posnr,

    arktx like vbap-arktx,

    pstyv like vbap-pstyv,

    end of t_vbap.

    *selection scren

    selection-screen:begin of block a with frame title text-001.

    select-options:s_vbeln for vbap-vbeln.

    parameters:p_arktx like vbap-arktx.

    selection-screen:end of block a.

    initialization.

    • p_pstyv = 'TAQ'.

    s_vbeln-low = '0000004900'.

    s_vbeln-high = '0000004970'.

    append s_vbeln.

    clear s_vbeln.

    at selection-screen on value-request for p_arktx.

    data : begin of itab occurs 0,

    vbeln like vbap-vbeln,

    arktx like vbap-arktx,

    end of itab.

    select vbeln arktx

    from vbap

    into table itab

    where vbeln in s_vbeln.

    if not itab[] is initial.

    sort itab.

    endif.

    call function 'F4IF_INT_TABLE_VALUE_REQUEST'

    exporting

    • DDIC_STRUCTURE = ' ''

    • RETFIELD --field in internal table.

    retfield = 'ARKTX'

    • PVALKEY = ' '

    • DYNPPROG -- program name

    dynpprog = 'ZPRACTICE_43_022'

    • DYNPNR -- selection screen number

    dynpnr = '1000'

    • DYNPROFIELD --field name in selection screen

    dynprofield = 'P_ARKTX'

    • STEPL = 0

    • WINDOW_TITLE =

    • VALUE = ' '

    value_org = 'S'

    • MULTIPLE_CHOICE = ' '

    • DISPLAY = ' '

    • CALLBACK_PROGRAM = ' '

    • CALLBACK_FORM = ' '

    • MARK_TAB =

    • IMPORTING

    • USER_RESET =

    tables

    • itab-internal table which gets value

    value_tab = itab

    • FIELD_TAB =

    • RETURN_TAB =

    • DYNPFLD_MAPPING =

    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.

    Reward points if it s useful.

    With Regards,

    Thasneem

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:19 AM

    Hi

    use like this

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.

    • IF S_OBJID IS NOT INITIAL.

    SELECT OTYPE OBJID FROM HRP1000

    INTO TABLE IT_OBJID_SH

    WHERE OTYPE = 'D'.

    IF SY-SUBRC EQ 0.

    • SEARCH HELP FOR QUALIFICATION.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    • DDIC_STRUCTURE = ' '

    RETFIELD = 'OBJID'

    • PVALKEY = ' '

    DYNPPROG = SY-REPID

    DYNPNR = SY-DYNNR

    DYNPROFIELD = 'S_OBJID'

    • STEPL = 0

    • WINDOW_TITLE =

    • VALUE = ' '

    VALUE_ORG = 'S'

    • MULTIPLE_CHOICE = ' '

    • DISPLAY = ' '

    • CALLBACK_PROGRAM = ' '

    • CALLBACK_FORM = ' '

    • MARK_TAB =

    • IMPORTING

    • USER_RESET =

    TABLES

    VALUE_TAB = IT_OBJID_SH

    • FIELD_TAB =

    • RETURN_TAB = RETURN_TAB

    • DYNPFLD_MAPPING =

    • 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.

    ENDIF.

    <b> .reward if usefull</b>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:22 AM

    hi,

    can you specify the fields where you need the help to be attached,

    so that i can suggest you if there is any standard help or BADI available for it.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:41 AM

    Hi Saleem,

    Use the below code.

    tables: t005U.

    • For Identification Number

    DATA: BEGIN OF it_country OCCURS 0,

    land1 LIKE t005t-land1,

    landx LIKE t005t-landx,

    END OF it_country.

    data: v_land1 like t005u-land1.

    • For Run date

    DATA: BEGIN OF it_state OCCURS 0,

    bezei LIKE t005U-bezei,

    END OF it_state.

    DATA it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE.

    SELECTION-SCREEN: BEGIN OF BLOCK main WITH FRAME TITLE text-001.

    SELECTION-SCREEN SKIP.

    PARAMETERS: p_land1 like t005U-land1,

    p_state like t005U-bezei.

    SELECTION-SCREEN END OF BLOCK main.

    *----


    • Validation Section

    *----


    INITIALIZATION.

    SELECT DISTINCT land1 landx FROM t005t INTO TABLE it_country where spras = 'E'.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_land1.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = 'LAND1'

    dynpprog = sy-repid

    dynpnr = sy-dynnr

    dynprofield = 'P_LAND1'

    value_org = 'S'

    TABLES

    value_tab = it_country

    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.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_state.

    TABLES: t130r.

    DATA: BEGIN OF dynpfields OCCURS 0. "Hilfsstruktur zum auslesen des

    INCLUDE STRUCTURE dynpread. "Feldwertes vom Dynpro bei >F4<

    DATA: END OF dynpfields.

    DATA : sy_repid LIKE sy-repid,

    sy_dynnr LIKE sy-dynnr.

    CLEAR dynpfields.

    REFRESH dynpfields.

    dynpfields-fieldname = 'P_LAND1'.

    APPEND dynpfields.

      • Lesen des akt. Wertes von Dynpro

      sy_repid = sy-repid.

      sy_dynnr = sy-dynnr.

      CALL FUNCTION 'DYNP_VALUES_READ'

      EXPORTING

      dyname = sy_repid

      dynumb = sy_dynnr

      TABLES

      dynpfields = dynpfields

      EXCEPTIONS

      OTHERS = 01.

      IF sy-subrc = 0.

      READ TABLE dynpfields WITH KEY fieldname = 'P_LAND1'.

      IF sy-subrc = 0.

      v_land1 = dynpfields-fieldvalue.

      ENDIF.

      ENDIF.

      SELECT bezei FROM t005u

      INTO TABLE it_state

      WHERE spras = 'E' and

      land1 = v_land1.

      DELETE ADJACENT DUPLICATES FROM it_state.

      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

      EXPORTING

      retfield = 'BEZEI'

      dynpprog = sy-repid

      dynpnr = sy-dynnr

      dynprofield = 'P_STATE'

      value_org = 'S'

      TABLES

      value_tab = it_state

      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.

      Message was edited by:

      Velangini Showry Maria Kumar Bandanadham

      Add comment
      10|10000 characters needed characters exceeded

    • author's profile photo
      Former Member
      Posted on Sep 28, 2007 at 06:42 AM

      Please have a search through SDN for function module DYNP_VALUES_READ -> this will allow you to read the value of "field A" when F4 is selected on "field B" in a dynpro.

      For your particular requirement, you may find that if you set up your two fields like LFA1-LAND1 and LFA1-REGIO, then the automatic search default for LFA1-REGIO will be context sensitive anyhow (as it has T005S as the checktable).

      Jonathan

      Add comment
      10|10000 characters needed characters exceeded