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

Dynamic parameter output in Selection Screen

Former Member
0 Likes
1,560

Suppose I have a selection-screen block with two parameters, as shown below.


SELECTION-SCREEN:

     BEGIN OF BLOCK bl WITH FRAME TITLE text-001.

PARAMETERS:

   s_matnr    TYPE matnr        OBLIGATORY,     " Material Number

   s_matkl    TYPE matkl        OBLIGATORY.     " Material Group

SELECTION-SCREEN:

   END OF BLOCK bl.



I want to dynamically fill the second parameter 'S_MATKL'

based on what the user inputs in the first parameter 'S_MATNR'

If the value changes for the first parameter, dynamically the value

must also change in second parameter.

Thanks

Satpathy

13 REPLIES 13
Read only

Former Member
0 Likes
1,507

Hi,

     U Can achieve this by using AT Selection Screen Event

Read only

0 Likes
1,507

Dear Mr. Shukla

I tried it using various EVENTS but it could not stand up to mark,

Please see if it is possible.

Reply me the code.

Thanks

Read only

Former Member
0 Likes
1,507

Hi

You need to use the AT SELECTION-SCREEN ON VALUE-REQUEST event, here you need to call the search help for MATNR (S_MAT1) by yourself and then move the value for MATKL based on material code selected.

Max

Read only

0 Likes
1,507

Dear Max

I tried the same, please c if I am wrong and correct it.

************************

SELECTION-SCREEN:

     BEGIN OF BLOCK bl WITH FRAME TITLE text-001.

PARAMETERS:

     s_matnr    TYPE matnr        OBLIGATORY,     " Material Number

    s_matkl      TYPE matkl        OBLIGATORY.     " Material Group

SELECTION-SCREEN:

   END OF BLOCK bl.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_matnr.

   PERFORM f4_help_for_material USING 'S_MATNR'.     " Search Help Working Fine

   s_matkl = '1001'.          " Not showing



****************************

FORM f4_help_for_material USING  l_dynprofield.

   TYPES: BEGIN OF str_mat_oper,

             matnr  TYPE zpp_oper_master-matnr,

             slno  TYPE zpp_oper_master-slno,

             opern  TYPE zpp_oper_master-opern,

             preht  TYPE zpp_oper_master-preht,

          END OF str_mat_oper.

   DATA: it_mat_oper TYPE STANDARD TABLE OF str_mat_oper INITIAL SIZE 0,

         wa_mat_oper TYPE str_mat_oper.

   SELECT * FROM zpp_oper_master

   CLIENT SPECIFIED INTO CORRESPONDING FIELDS OF TABLE it_mat_oper

   WHERE mandt = sy-mandt

   ORDER BY matnr slno ASCENDING.

   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

     EXPORTING

       retfield    = 'MATNR'

       dynpprog    = sy-repid

       dynpnr      = sy-dynnr

       dynprofield = l_dynprofield

       value_org   = 'S'

     TABLES

       value_tab   = it_mat_oper.

ENDFORM.                    " F4_HELP_FOR_MATERIAL

Read only

0 Likes
1,507

Hi


AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_matnr.

   PERFORM f4_help_for_material USING 'S_MATNR'.     " Search Help Working Fine

   s_matkl = '1001'.          " Not showing

your code is ok except when you fill the parameter S_MATKL: you're in event defined for S_MATNR only, so the others parameters of selection-screen can't be seen by the program.

You need to use the fm DYNP_VALUES_UPDATE in order to fill S_MATKL

Max

Read only

0 Likes
1,507

Hi Debdutta,

Please remove the obligatory for Material Group, in the above code, values are filling in Matnr, but we have to specify the fetch and assign the values to MATKL. Please find the below code.


DATA: l_matkl TYPE matkl.

PARAMETERSs_matnr    TYPE matnr  OBLIGATORY,     " Material Number

              s_matkl    TYPE matkl.     " Material Group

AT SELECTION-SCREEN.

   IF s_matnr is NOT INITIAL.

     SELECT SINGLE matkl

            FROM mara

            into l_matkl

            WHERE matnr = s_matnr.

       IF sy-subrc = 0.

         s_matkl = l_matkl.

       ENDIF.

   ENDIF.

   IF s_matkl is INITIAL.

     Message 'Material Group is Mandatory' TYPE 'E'.

   ENDIF.


Regards


Rajkumar Narasimman

Read only

0 Likes
1,507

I've changed you sample because there isn't the Z-table zpp_oper_maste, anyway you can see the logic:

- your selection-screen:


selection-screen:

      begin of block bl with frame title text-001.

parameters:

      s_matnr    type matnr        obligatory,     " Material Number

      s_matkl    type matkl        obligatory.     " Material Group

selection-screen:

    end of block bl.

- Event definition:


at selection-screen on value-request for s_matnr.

   perform f4_help_for_material using 'S_MATNR'.     " Search Help Working Fine

*  S_MATKL = '001'.

here only S_MATNR can be filled directly, if you need to fill other field fm DYNP_VALUES_UPDATE has to be used:


form f4_help_for_material using  l_dynprofield.

   data: return_tab type standard table of  ddshretval with header line.

   data: user_reset type flag.

   data: dyname like  d020s-prog,

         dynumb like  d020s-dnum.

   data: dynpfields type standard table of  dynpread with header line.

   call function 'F4IF_FIELD_VALUE_REQUEST'

     exporting

       tabname           = 'MARA'

       fieldname         = 'MATNR'

     importing

       user_reset        = user_reset

     tables

       return_tab        = return_tab

     exceptions

       field_not_found   = 1

       no_help_for_field = 2

       inconsistent_help = 3

       no_values_found   = 4

       others            = 5.

   if sy-subrc <> 0.

     exit.

   endif.

   if user_reset is initial.

     read table return_tab index 1.

     if sy-subrc = 0.

* Fill S_MATNR     

       call function 'CONVERSION_EXIT_MATN1_INPUT'

         exporting

           input  = return_tab-fieldval

         importing

           output = s_matnr.

* Fill S_MATKL

       dynumb = sy-dynnr.

       dyname = sy-repid.

       dynpfields-fieldname  = 'S_MATKL'.

       select single matkl into dynpfields-fieldvalue

         from mara where matnr = s_matnr.

       append dynpfields.

       call function 'DYNP_VALUES_UPDATE'

         exporting

           dyname     = dyname

           dynumb     = dynumb

         tables

           dynpfields = dynpfields.

     endif.

   endif.

endform.                    " F4_HELP_FOR_MATERIAL

Max

Read only

0 Likes
1,507

Dear Rajkumar Narasimman

I am not interested to press Enter and get the value for MATKL.

The value should automatically be places in S_MATKL as soon as

a S_MATNR gets its value.

Thanks

Satpathy

Read only

0 Likes
1,507

Dear Max,

You are right , I think it will work.

But I have an issue.

I dont want the Help for MATNR from MARA

I want it from a Z Table. as shown below.

**************************************************

    SELECT * FROM zpp_oper_master

   CLIENT SPECIFIED INTO CORRESPONDING FIELDS OF TABLE it_mat_oper

   WHERE mandt = sy-mandt

   ORDER BY matnr slno ASCENDING.


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

     EXPORTING

       retfield    = 'MATNR'

       dynpprog    = sy-repid

       dynpnr      = sy-dynnr

       dynprofield = l_dynprofield

       value_org   = 'S'

     TABLES

       value_tab   = it_mat_oper.

**********************************************

Now here S_MATNR gets initialized after execution of

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_matmch.

Can I get the value of S_MATNR before the value gets into the parameter..?

Thanks

Satpathy

Read only

0 Likes
1,507

Hi Debdutta,

Please find the below link, it is same as your requirement,

Regards

Rajkumar Narasimman

Read only

0 Likes
1,507

Hi

I've seen you've opened another post for that issue, if you want a search help based on "zebra" yuo need to use fm: REUSE_ALV_POPUP_TO_SELECT.

Anyway if you want to use F4IF_INT_TABLE_VALUE_REQUEST, you need to use the table parameter  RETURN_TAB, here you can get the selected value.

but then I believe you need to move it in S_MATNR by yourself

Max

Read only

Former Member
0 Likes
1,507

Hi ,

Try This,

AT SELECTION-SCREEN ON s_matnr.

"" write the select Query for getting the material group
 
AT SELECTION-SCREEN.
s_maktl = pass the material group.

Best Regards,

Nitin

Read only

nagarjun_kalletla
Participant
0 Likes
1,507

In At Selection Screen you can write the logic .

DYNP_VALUES_READ to read the values  entered in the matnr (In you case no need to read because the parameter will already have the value)

And

DYNP_VALUES_UPDATE  is used to update the value of the parameter before calling this function module find the matkl (Material group from the material  and update)

Generally these Two function modules are used in Module-pool to read one Parameter and Update Other