Skip to Content
author's profile photo Former Member
Former Member

Populating data to second filed when first field has F4-help(without enter)

Hi Abap gurus,

we hv a requirement that automatically populating the data into second field when the first field has F4-Help.

ex:

parameter: p_matnr like makt-matnr,

p_maktx like makt-maktx.

p_matnr has F4-Help. and when we are selecting data from F4 help and WITH OUT PRESSING ENTER

the Discription of the material automatically should populate into p_maktx..

I expecting a better solution from you .. Thanks in Advance..

Regards,

GSANA

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 17, 2009 at 05:41 AM

    Hi Gsana,

    Try below code. Will exactly meet ur requirement.

    REPORT ztest.

    TABLES: mara, makt.

    PARAMETER: p_matnr LIKE makt-matnr,

    p_maktx LIKE makt-maktx.

    DATA: itab TYPE STANDARD TABLE OF dynpread,

    wa TYPE dynpread.

    DATA: BEGIN OF mara_itab OCCURS 0,

    matnr TYPE matnr,

    END OF mara_itab,

    rettab TYPE STANDARD TABLE OF ddshretval,

    wa_rettab TYPE ddshretval,

    f_maktx TYPE makt-maktx,

    f_matnr TYPE mara-matnr,

    f_matnr1 TYPE mara-matnr.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

    clear itab[].

    SELECT matnr FROM mara INTO TABLE mara_itab.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = 'P_MATNR'

    dynpprog = sy-repid

    dynpnr = sy-dynnr

    dynprofield = 'P_MATNR'

    value_org = 'S'

    TABLES

    value_tab = mara_itab

    return_tab = rettab.

    READ TABLE rettab INTO wa_rettab INDEX 1.

    f_matnr = wa_rettab-fieldval.

    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

    EXPORTING

    input = f_matnr

    IMPORTING

    output = f_matnr1.

    wa-fieldname = 'P_MATNR'.

    wa-fieldvalue = f_matnr.

    APPEND wa TO itab.

    clear wa.

    SELECT SINGLE maktx FROM makt INTO f_maktx WHERE matnr = f_matnr1.

    IF sy-subrc = 0.

    wa-fieldname = 'P_MAKTX'.

    wa-fieldvalue = f_maktx.

    APPEND wa TO itab.

    ENDIF.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'

    EXPORTING

    dyname = sy-repid

    dynumb = sy-dynnr

    TABLES

    dynpfields = itab.

    Thanks..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 17, 2009 at 04:19 AM

    Hi

    Just assign the first field vaue to second field in the AT SELECTION SCREEN EVENT

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 17, 2009 at 04:51 AM

    Hi GSANA,

    Try this in your code.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_info.

    g_t_dynp-fieldname = 'P_INFO'.

    APPEND g_t_dynp.

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    dyname = 'ZAB_SCM_DP_LISTCUBE_DATA'

    dynumb = '1000'

    translate_to_upper = 'X'

    TABLES

    dynpfields = g_t_dynp

    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

    OTHERS = 9.

    I hope this is useful for you.

    Regards,

    Vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 17, 2009 at 04:55 AM

    Hi, Try this way.

     REPORT ZVENKAT_F4_FOR_PARAMETERS MESSAGE-ID ZMSG .
    TYPES:BEGIN OF T_T001W,
           WERKS       TYPE T001W-WERKS,
           NAME1       TYPE T001W-NAME1,
          END OF T_T001W,
          T_RETURN_TAB  TYPE DDSHRETVAL.
    DATA:W_T001W      TYPE T_T001W,
         W_RETURN_TAB TYPE T_RETURN_TAB.
    DATA:I_T001W      TYPE STANDARD TABLE OF T_T001W,
         I_RETURN_TAB TYPE STANDARD TABLE OF T_RETURN_TAB.
    DATA:W_DYNPFIELDS TYPE DYNPREAD,
         I_DYNPFIELDS LIKE STANDARD TABLE OF DYNPREAD.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    PARAMETERS :P_WERKS TYPE T001W-WERKS,
                P_NAME1 TYPE T001W-NAME1.
    SELECTION-SCREEN END OF BLOCK B1.
    "F4 Help for Werks
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WERKS.
      IF I_T001W[] IS INITIAL.
        SELECT WERKS NAME1
        FROM T001W
        INTO TABLE I_T001W.
      ENDIF.
      "Function module for F4 help
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD    = 'WERKS'
          DYNPPROG    = SY-REPID
          DYNPNR      = SY-DYNNR
          DYNPROFIELD = 'P_WERKS'
          VALUE_ORG   = 'S'
        TABLES
          VALUE_TAB   = I_T001W
          RETURN_TAB  = I_RETURN_TAB.
      READ TABLE I_RETURN_TAB INTO W_RETURN_TAB INDEX 1.
      P_WERKS = W_RETURN_TAB-FIELDVAL.
      READ TABLE I_T001W INTO W_T001W WITH KEY WERKS = P_WERKS.
      IF SY-SUBRC = 0.
        W_DYNPFIELDS-FIELDNAME    = 'P_NAME1'.
        W_DYNPFIELDS-FIELDVALUE   = W_T001W-NAME1.
        APPEND W_DYNPFIELDS TO I_DYNPFIELDS.
        CLEAR W_DYNPFIELDS.
        "DYNP_VALUES_UPDATE
        CALL FUNCTION 'DYNP_VALUES_UPDATE'
          EXPORTING
            DYNAME     = SY-REPID
            DYNUMB     = SY-DYNNR
          TABLES
            DYNPFIELDS = I_DYNPFIELDS.
      ENDIF.
    Thanks Venkat.O

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.