Skip to Content
author's profile photo
Former Member

Regarding ON VALUE REQUEST

hI,

In selection -screen i have 3 fields,

<b> Plant

material number,

material group.</b>

If i input plant, how do i get the <b>material number and material group</b> based on <b>plant</b> dynamically...??

i know that we need to use<b> F4IF_INT_TABLE_VALUE_REQUEST</b> .. Please give me the code ??

thanks,

Suresh

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

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

    REPORT Z50651_F4 MESSAGE-ID ZMSG_50651.

    ******************TABLES DECLARATION*********************

    TABLES : VBAP.

    ******************DATA DECLARATIONS********************

    DATA : PGMNAME LIKE SY-REPID.

    DATA : DYNNO LIKE SY-DYNNR.

    *****************INTERNAL TABLES*************************

    DATA : BEGIN OF IT_VBAP OCCURS 0,

    VBELN LIKE VBAP-VBELN,

    POSNR LIKE VBAP-POSNR,

    END OF IT_VBAP.

    DATA : DYNVALUE TYPE TABLE OF DYNPREAD,

    FIELD_VALUE LIKE LINE OF DYNVALUE.

    ************INITIALIZATION*************************

    INITIALIZATION.

    PGMNAME = SY-REPID.

    DYNNO = SY-DYNNR.

    *************SELECTION SCREEN**********

    PARAMETERS : P_VBELN LIKE VBAP-VBELN,

    P_POSNR LIKE VBAP-POSNR.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_POSNR.

    PERFORM GET_ENTERED_VBELN.

    PERFORM POPULATE_IT_VBAP.

    PERFORM PROVIDE_F4_VBELN.

    &----


    *& Form PROVIDE_F4_VBELN

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM PROVIDE_F4_VBELN .

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    • DDIC_STRUCTURE = ' '

    RETFIELD = 'P_POSNR'

    • PVALKEY = ' '

    DYNPPROG = PGMNAME

    DYNPNR = DYNNO

    DYNPROFIELD = 'P_POSNR'

    • STEPL = 0

    • WINDOW_TITLE =

    • VALUE = ' '

    VALUE_ORG = 'S'

    • MULTIPLE_CHOICE = ' '

    • DISPLAY = ' '

    • CALLBACK_PROGRAM = ' '

    • CALLBACK_FORM = ' '

    • MARK_TAB =

    • IMPORTING

    • USER_RESET =

    TABLES

    VALUE_TAB = IT_VBAP

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

    ENDFORM. " PROVIDE_F4_VBELN

    &----


    *& Form POPULATE_IT_VBAP

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM POPULATE_IT_VBAP .

    READ TABLE DYNVALUE INDEX 1 INTO FIELD_VALUE.

    SELECT VBELN

    POSNR

    FROM VBAP

    INTO TABLE IT_VBAP

    WHERE VBELN = FIELD_VALUE-FIELDVALUE.

    ENDFORM. " POPULATE_IT_VBAP

    &----


    *& Form GET_ENTERED_VBELN

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_ENTERED_VBELN .

    CLEAR : DYNVALUE,FIELD_VALUE.

    FIELD_VALUE-FIELDNAME = 'P_VBELN'.

    APPEND FIELD_VALUE TO DYNVALUE.

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    DYNAME = PGMNAME

    DYNUMB = DYNNO

    TRANSLATE_TO_UPPER = 'X'

    • REQUEST = ' '

    • PERFORM_CONVERSION_EXITS = ' '

    • PERFORM_INPUT_CONVERSION = ' '

    • DETERMINE_LOOP_INDEX = ' '

    TABLES

    DYNPFIELDS = DYNVALUE

    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.

    ENDFORM. " GET_ENTERED_VBELN

    <b>**change tables and fields as per ur requiremnt.....logic is same....*******</b>

    Regards

    Vasu

    Add comment
    10|10000 characters needed characters exceeded

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

    Hi

    see this sample code

    See the following ex:

    TYPES: BEGIN OF TY_MBLNR,

    MBLNR LIKE MKPF-MBLNR,

    END OF TY_MBLNR.

    DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.

    data: it_ret like ddshretval occurs 0 with header line.

    At selection-screen on value-request for s_mat-low.

    Select MBLNR from mkpf into table it_mblnr.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    • DDIC_STRUCTURE = ' '

    RETFIELD = 'MBLNR'

    • PVALKEY = ' '

    • DYNPPROG = ' '

    • DYNPNR = ' '

    • DYNPROFIELD = ' '

    • STEPL = 0

    • WINDOW_TITLE =

    • VALUE = ' '

    VALUE_ORG = 'S'

    • MULTIPLE_CHOICE = ' '

    • DISPLAY = ' '

    • CALLBACK_PROGRAM = ' '

    • CALLBACK_FORM = ' '

    • MARK_TAB =

    • IMPORTING

    • USER_RESET =

    TABLES

    VALUE_TAB = IT_MBLNR

    • FIELD_TAB =

    RETURN_TAB = IT_RET

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

    IF SY-SUBRC = 0.

    read table it_ret index 1.

    move it_ret-fieldval to S_mat-low.

    ENDIF.

    Go through the test program.

    REPORT Ztest_HELP .

    TABLES : MARA.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    PARAMETERS : P_MATNR(10) TYPE C.

    SELECTION-SCREEN END OF BLOCK B1.

    DATA : BEGIN OF ITAB OCCURS 0,

    MATNR TYPE MATNR,

    END OF ITAB.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

    SELECT MATNR

    FROM MARA

    INTO TABLE ITAB

    UP TO 10 ROWS.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    RETFIELD = 'MATERIAL NUMBER'

    DYNPPROG = SY-REPID

    DYNPNR = SY-DYNNR

    DYNPROFIELD = 'P_MATNR'

    VALUE_ORG = 'S'

    TABLES

    VALUE_TAB = ITAB

    EXCEPTIONS

    PARAMETER_ERROR = 1

    NO_VALUES_FOUND = 2

    OTHERS = 3.

    Regards

    Anji

    Add comment
    10|10000 characters needed characters exceeded

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

    hi,

    try this.

    TYPES : BEGIN OF ty_kna1,

    kunnr TYPE kna1-kunnr, "CUstomer Code

    name1 TYPE kna1-name1, "Customer Code

    END OF ty_kna1.

    DATA : dyfields LIKE dynpread OCCURS 1 WITH HEADER LINE ,

    i_kna1 TYPE TABLE OF ty_kna1 WITH HEADER LINE.

    DATA : wa_value_tab TYPE ty_kna1.

    DATA : value_tab LIKE wa_value_tab OCCURS 0 WITH HEADER LINE.

    DATA : field_tab LIKE dfies OCCURS 0 WITH HEADER LINE.

    DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

    PARAMETERS:<b>bukrs</b> LIKE rbkp-bukrs OBLIGATORY.

    SELECTION-SCREEN BEGIN OF LINE.

    PARAMETERS : rad_but1 RADIOBUTTON GROUP one DEFAULT 'X' USER-COMMAND ucom.

    SELECTION-SCREEN COMMENT 3(26) text-003.

    SELECT-OPTIONS :<b> kunnr</b> FOR kna1-kunnr.

    SELECTION-SCREEN END OF LINE.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR kunnr-low.

    CHECK NOT bukrs IS INITIAL .

    SELECT kna1kunnr kna1name1

    INTO TABLE i_kna1

    FROM kna1 INNER JOIN vbrk

    ON kna1kunnr = vbrkkunag

    WHERE vbrk~bukrs = bukrs. "dyfields-fieldvalue.

    SORT i_kna1 BY kunnr.

    DELETE ADJACENT DUPLICATES FROM i_kna1.

    CLEAR : value_tab,field_tab,return_tab.

    REFRESH : value_tab,field_tab,return_tab.

    field_tab-fieldname = 'KUNNR'.

    field_tab-tabname = 'KNA1'.

    APPEND field_tab.

    field_tab-fieldname = 'NAME1'.

    field_tab-tabname = 'KNA1'.

    APPEND field_tab.

    field_tab-fieldname = 'KUNNR'.

    LOOP AT i_kna1 .

    value_tab-kunnr = i_kna1-kunnr.

    APPEND value_tab.

    CLEAR value_tab.

    value_tab-name1 = i_kna1-name1.

    APPEND value_tab.

    ENDLOOP.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = field_tab-fieldname

    TABLES

    value_tab = value_tab

    field_tab = field_tab

    return_tab = return_tab

    EXCEPTIONS

    parameter_error = 1

    no_values_found = 2

    OTHERS = 3.

    IF sy-subrc = 0.

    kunnr-low = return_tab-fieldval.

    ENDIF.

    Reward if useful.

    Add comment
    10|10000 characters needed characters exceeded