Skip to Content
avatar image
Former Member

Issue reagrding selection-screen

Hi,

I have a requiremnt like

ihave 2 fields in selction screen

material material description

we have f4 for material selction

if material is selected we need to populate material description also automatically into material desc field without any user interaction like click or enter.

like

material material desc...

209 tyres

Thanks,

Phani.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Sep 04, 2008 at 06:08 AM

    Hi,

    Just try the following code:

    selection-screen begin of block b1 with frame.

    parameter: p_matnr like mara-matnr.

    parameter: p_text like makt-maktx.

    selection-screen end of block b1.

    at selection-screen.

    select single maktx from makt into p_text where matnr = p_matnr.

    Hope this will help.

    Regards,

    Nitin.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 04, 2008 at 06:09 AM

    hi,

    try this.

    at selection-screen output.

    if not p_matnr is initial.

    select single maktx

    from makt

    into p_maktx

    where matnr eq p_matnr.

    endif.

    regards,

    Peter

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      The code sample given above are giving the description only if enter or some user action happens,my requiremtn if to get it automatically when material is seleted into material field.

  • avatar image
    Former Member
    Sep 04, 2008 at 06:16 AM

    Hi,

    You can also try this:

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR <material_number>

    After calling the FM for F4 value, write the query for fetching the material description into the description parameter.

    I hope it will serve your purpose.

    Regards

    Natasha Garg

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      no we dont have requirent for any f4 selction for material desc

      just on material selection automatically desc must be populated

  • avatar image
    Former Member
    Sep 04, 2008 at 06:20 AM

    hii

    use following program for getting values automatically.

    DATA:
    ret_table LIKE STANDARD TABLE OF ddshretval,
    wa_ret_table TYPE ddshretval,
    dynp_fields LIKE STANDARD TABLE OF dynpread,
    wa_dynp_fields TYPE dynpread.
    
    PARAMETER : p_matnr LIKE mara-matnr.
    PARAMETER : p_mtart LIKE mara-mtart MEMORY ID mta.
    
    AT SELECTION-SCREEN OUTPUT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
    
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
      EXPORTING
       tabname = 'MARA'
    fieldname = 'MATNR'
    searchhelp = 'MAT1'
    *SHLPPARAM = ' '
    dynpprog = sy-repid
    dynpnr = sy-dynnr
    dynprofield = 'P_MATNR'
    **   STEPL                     = 0
    **   VALUE                     = ' '
    **   MULTIPLE_CHOICE           = ' '
    **   DISPLAY                   = ' '
    **   SUPPRESS_RECORDLIST       = ' '
    **   CALLBACK_PROGRAM          = ' '
    **   CALLBACK_FORM             = ' '
    **   SELECTION_SCREEN          = ' '
    * IMPORTING
    *   USER_RESET                = USER_RESET
     TABLES
    return_tab = ret_table
     EXCEPTIONS
       FIELD_NOT_FOUND           = 1
       NO_HELP_FOR_FIELD         = 2
       INCONSISTENT_HELP         = 3
       NO_VALUES_FOUND           = 4
              .
    .
    IF sy-subrc EQ 0.
    
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    
    READ TABLE ret_table INTO wa_ret_table INDEX 1.
    
    CLEAR dynp_fields.
    wa_dynp_fields-fieldname = 'P_MATNR'.
    wa_dynp_fields-fieldvalue = wa_ret_table-fieldval.
    APPEND wa_dynp_fields TO dynp_fields.
    clear wa_dynp_fields.
    
    wa_dynp_fields-fieldname = 'P_MTART'.
    
    SELECT SINGLE mtart FROM mara INTO wa_dynp_fields-fieldvalue WHERE matnr
     EQ wa_ret_table-fieldval.
    
    
    *fs_dynp_fields-fieldvalue =
    
    APPEND wa_dynp_fields TO dynp_fields.
    
    CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
    dyname = sy-repid
    dynumb = sy-dynnr
    TABLES
    dynpfields = dynp_fields
    
    EXCEPTIONS
    INVALID_ABAPWORKAREA = 1
    INVALID_DYNPROFIELD = 2
    INVALID_DYNPRONAME = 3
    INVALID_DYNPRONUMMER = 4
    INVALID_REQUEST = 5
    NO_FIELDDESCRIPTION = 6
    UNDEFIND_ERROR = 7
    OTHERS = 8

    .

    regards

    twinkal

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 04, 2008 at 06:22 AM

    You can't do it without clicking ENTER.

    PARAMETER: p_matnr LIKE mara-matnr.

    PARAMETER: p_text LIKE makt-maktx.

    AT SELECTION-SCREEN.

    SELECT SINGLE maktx FROM makt INTO p_text WHERE matnr = p_matnr.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 06:26 AM

    Hi,

    Let's say the selection screen has two input fields. One is plant i.e., PA_WERKS and other one is object(PA_OBJ). While executing the report, User will first enter the plant name in the WERKS field. Then, he will press F4 at the PA_OBJ field. It should dynamically take the value from PA_WERKS and display the possible values on F4 dialog box by searching in the table ZAIS_MMG.

    Below is the subroutine that needs to be called at seelction screenAT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_obj.

    &----


    *& Form object_f4help

    &----


    • Provides the possible values for pa_obj

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM object_f4help.

    • Refresh the internal table. This helps in reusing these tables and variables in * other subroutines.

    CLEAR: tb_dynpfields,

    tb_object_range.

    REFRESH: tb_dynpfields,

    tb_object_range.

    • Define Internal tables.

    DATA: tb_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE.

    • Define constants.

    CONSTANTS: co_retfield TYPE dfies-fieldname VALUE 'OBJECT',

    co_dynprog LIKE sy-repid

    VALUE '/DCSEA/Z_AIS_NUM_RESET_PAJERO',

    co_s TYPE c VALUE 'S',

    co_field(27) TYPE c VALUE 'PA_OBJ'.

    • Assigning the values of program name and screen to the variables.

    wf_dyname = sy-repid. " PROGRAM NAME

    wf_dynumb = sy-dynnr. " SCREEN NUMBER

    wf_dynpro = co_field.

    • Move the field name to tb_dynpfields.

    MOVE 'PA_WERKS' TO

    tb_dynpfields-fieldname.

    APPEND tb_dynpfields.

    • Read screen field values before PAI field transport. This FM is used for dynamically * reading a value from the selection screen field .

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    dyname = wf_dyname

    dynumb = wf_dynumb

    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 the tbale tb_dynpfields to read the dynamic value of pa_werks

    READ TABLE tb_dynpfields INDEX 1.

    IF sy-subrc = 0.

    wf_werks = tb_dynpfields-fieldvalue.

    ENDIF.

    • Populate the table tb_object_range. Make sure that we filter out null values as it * might appear on the screen.

    SELECT werks object

    INTO TABLE tb_object_range

    FROM zais_mmg

    WHERE werks EQ wf_werks

    and object NE ' '.

    • Sorting is always done before dlete adjacent duplicate.

    sort tb_object_range.

    • This will delete all duplicate entries. Or else when you press F4, it will display * the duplicates also.

    delete adjacent duplicates from tb_object_range comparing object.

    • F4 help also returning the value to be displayed in internal table. If the internal table is empty, it will display the message saying 'Values are not found'.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = co_retfield

    dynpprog = co_dynprog

    dynpnr = sy-dynnr

    dynprofield = wf_dynpro

    value_org = co_s

    TABLES

    value_tab = tb_object_range

    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. " object_f4help

    reference : Wiki.

    thanx.

    Add comment
    10|10000 characters needed characters exceeded