Application Development 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: 

How do I limit 'pop up' options for one parameter based on entry of another parameter

Former Member
0 Kudos

My end goal is to get a plant and storage location to pass to a program. In looking for what tables to link to the parameter fields, I went into SE16 and went to table T001L

On the selection screen for doing this, it just so happens it does exactly what i need my program to do. When I select the very first option for plant (WERKS), it brings up a list of plants. If I select a plant, the very next parameter (Storage Locations - LGORT) brings up a limited list. It is limited to the storage locations available to the plant that was selected in the first field. This is perfect for me!

Furthermore, if I were to go to the second field first, it will give me a large selection of all of the storage locations. The first column is plant followed by the storage locations. If I select the storage location, it automatically fills in the first parameter for me with the matching plant. Even nicer!

How do I do this? How are these two parameters tied to each other for this functionality to work that if I select one, it will populate the other. I want my report/program to do the exact same thing.

All help appreciated!

Thanks

1 ACCEPTED SOLUTION

former_member215344
Contributor
0 Kudos

Hi Richard,

You can achieve this through search help attachment.

Take for example the search help, H_LGOBE which has the following import/export parameters:

This search help is assigned to the structure field MEPO1211-LGOBE and this is the structure which is used in the item table control of ME22N screen. Now if you see the search help attachement you can see that the parameter WERKS is an import parameter from the structure. Display the structure MEPO1211 in SE11 and select the field LGOBE and click the button Search help next to foreign key button. You can see the assignment as below:

Here we can see that the assignment is made in such a way to import data from the parameter WERKS from the structure at runtime. Hope this helps you.

Thanks,

Ajay Bose

6 REPLIES 6

former_member215344
Contributor
0 Kudos

Hi Richard,

You can achieve this through search help attachment.

Take for example the search help, H_LGOBE which has the following import/export parameters:

This search help is assigned to the structure field MEPO1211-LGOBE and this is the structure which is used in the item table control of ME22N screen. Now if you see the search help attachement you can see that the parameter WERKS is an import parameter from the structure. Display the structure MEPO1211 in SE11 and select the field LGOBE and click the button Search help next to foreign key button. You can see the assignment as below:

Here we can see that the assignment is made in such a way to import data from the parameter WERKS from the structure at runtime. Hope this helps you.

Thanks,

Ajay Bose

0 Kudos

Hi ajay,

For getting the same functionality in your report program , You have to write the following code in POV event.

But the problem is if there are multiple storage locations to a single plant then you cannot assign your idea.. Instead you can do your idea like if you select a storage location , then plant gets updated automatically.

Consider you write a POV for storage location.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

       EXPORTING

         tabname                   = 'T001L'

         fieldname                 = 'STORAGE'

         searchhelp                = 'H_T001L'

*     SHLPPARAM                 = ''

*     DYNPPROG                  = ' '

*     DYNPNR                    = ' '

*     DYNPROFIELD               = ''

*     STEPL                     = 0

*     VALUE                     = ' '

*     MULTIPLE_CHOICE           = 'X'

*     DISPLAY                   = ' '

*     SUPPRESS_RECORDLIST       = ' '

*     CALLBACK_PROGRAM          = ' '

*     CALLBACK_FORM             = ' '

*     CALLBACK_METHOD           =

*     SELECTION_SCREEN          = ' '

*   IMPORTING

*     USER_RESET                =

      TABLES

        return_tab                it_return

*   EXCEPTIONS

*     field_not_found           = 1

*     no_help_for_field         = 2

*     inconsistent_help         = 3

*     no_values_found           = 4

*     OTHERS                    = 5

               .

   LOOP AT it_return INTO x_ty.

   ENDLOOP.

   SELECT single WERKS                 

     FROM T001L

     INTO variable

     WHERE LGORT EQ x_ty-fieldval .

if sy-subrc EQ 0.

x_dynpfields-fieldname = 'PLANT' .

   x_dynpfields-fieldvalue = variable.

   x_dynpfields-stepl = 0.

   APPEND x_dynpfields TO dynpfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

     EXPORTING

       dyname                     = sy-cprog

       dynumb                     = sy-dynnr

     TABLES

       dynpfields                 = dynpfields

*   EXCEPTIONS

*     INVALID_ABAPWORKAREA       = 1

*     INVALID_DYNPROFIELD        = 2

*     INVALID_DYNPRONAME         = 3

*     INVALID_DYNPRONUMMER       = 4

*     INVALID_REQUEST            = 5

*     NO_FIELDDESCRIPTION        = 6

*     UNDEFIND_ERROR             = 7

*     OTHERS                     = 8

             .

endif.

Regards,

Sivaganesh

0 Kudos

I will try this out and see how it works and report back. I am working on a couple of different projects at the moment but will try to get to this one today. Thank you all for you help.

0 Kudos

Hi Richard -

You can achieve the functionality by using the follwoing two FM :
1. F4IF_FIELD_VALUE_REQUEST

2. DYNP_VALUES_READ

Let us know, if you need the sample code for the same.

Regards,

Atul Mohanty

ronaldo_aparecido
Contributor
0 Kudos

Hi

1-Use the FM 'HELP_VALUES_GET_WITH_TABLE'  to create a first matchcode then when the user

select the value sendo to memory by import.

2-Use the FM 'HELP_VALUES_GET_WITH_TABLE'  to create a second matchcode ,get the value from memory of fist matchcode and use to filter data for second matchcode.

If you need change values of scrren use the  DYNP_VALUES_UPDATE.

See this codes:

AT SELECTION-SCREEN OUTPUT.

   IF p_sisto = 'MVNO'.

     DATA:dyfields1   TYPE TABLE OF dynpread,

          w_dyfields1 LIKE LINE OF dyfields1.

     CLEAR p_arqui.

     CONCATENATE 'PGTOS_RECMVNO_' sy-datum+6(2)

                                  sy-datum+4(2)

                                  sy-datum(4sy-uzeit '.TXT' INTO p_arqui.

     w_dyfields1-fieldname  = 'P_ARQUI'.

     w_dyfields1-fieldvalue = p_arqui.

     APPEND w_dyfields1 TO dyfields1.

     CALL FUNCTION 'DYNP_VALUES_UPDATE'

       EXPORTING

         dyname     = sy-cprog

         dynumb     = sy-dynnr

       TABLES

         dynpfields = dyfields1.

     CLEAR: dyfields1[],

            w_dyfields1.

   ELSEIF p_sisto = 'NGIN'.

     CONCATENATE 'PGTOS_RECARGA_' sy-datum+6(2)

                                 sy-datum+4(2)

                                 sy-datum(4sy-uzeit '.TXT' INTO p_arqui.

     w_dyfields1-fieldname  = 'P_ARQUI'.

     w_dyfields1-fieldvalue = p_arqui.

     APPEND w_dyfields1 TO dyfields1.

     CALL FUNCTION 'DYNP_VALUES_UPDATE'

       EXPORTING

         dyname     = sy-cprog

         dynumb     = sy-dynnr

       TABLES

         dynpfields = dyfields1.

     CLEAR: dyfields1[],

            w_dyfields1.

   ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_sisto.

   TYPES: BEGIN OF ty_value,

           line(10) TYPE c,

         END OF ty_value.

   DATA:lt_hfields TYPE TABLE OF help_value,

        ls_hfields LIKE LINE OF lt_hfields,

        lt_value   TYPE TABLE OF ty_value,

        ls_value   LIKE LINE OF lt_value.

   ls_hfields-tabname    = 'ZFIT037'.

   ls_hfields-fieldname  = 'SISTEMA_ORIGEM'.

   ls_hfields-selectflag = 'X'.

   APPEND ls_hfields TO lt_hfields.

   ls_value-line = 'NGIN'.

   APPEND ls_value TO lt_value.

   ls_value-line = 'MVNO'.

   APPEND ls_value TO lt_value.

   CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'

     EXPORTING

       titel        = text-001

     IMPORTING

       select_value = p_sisto

     TABLES

       fields       = lt_hfields

       valuetab     = lt_value.

   REFRESH:lt_hfields,

           lt_value.

   IF p_sisto = 'MVNO'.

     DATA:dyfields   TYPE TABLE OF dynpread,

          w_dyfields LIKE LINE OF dyfields.

     CLEAR p_arqui.

     CONCATENATE 'PGTOS_RECMVNO_' sy-datum+6(2)

                                  sy-datum+4(2)

                                  sy-datum(4sy-uzeit '.TXT' INTO p_arqui.

     w_dyfields-fieldname  = 'P_ARQUI'.

     w_dyfields-fieldvalue = p_arqui.

     APPEND w_dyfields TO dyfields.

     CALL FUNCTION 'DYNP_VALUES_UPDATE'

       EXPORTING

         dyname     = sy-cprog

         dynumb     = sy-dynnr

       TABLES

         dynpfields = dyfields.

     CLEAR: dyfields[],

            w_dyfields.

Former Member
0 Kudos

Hi guys. I put many hours into this today and learned plenty. I thank you all for your help. Limiting the field was actually rather simple. What I am doing in this program is ultimately choosing the storage location. I discovered with even the simplest code...somehow or another SAP limited it for me. So this code here:


REPORT ZRK_SANDBOX2.

TABLES: T001L.

parameters: P_PLANT LIKE T001L-WERKS,

P_SLOC LIKE T001L-LGORT.

When the person picks the a plant with the first parameter, sure as heck when they go to select the storage location they are limited to the storage locations for that plant!!

The code really is that simple for this. I don't know how SAP knew to limit the second field choices but it simply works.

For the other chore, I wanted to to where I could choose the first field and it would automatically update the second field. For this I found and modified code for the following two function modules:

DDIF_FIELDINFO_GET

and

F4IF_INT_TABLE_VALUE_REQUEST using T001L.

It works as it should. I do have one small bug about how it works dealing with the labels it puts on top of the help colums and I am getting ready to post another question about that shortly. I've got to say that these two function modules have very very poor documentation with them in my opinion. I found many pieces of sample code and was able to make it work but there were more pieces of sample code that didn't work than anything.

The solution code actually used the older C designation in  F4IF_INT_TABLE_VALUE_REQUEST. Even after about 12+ hours working on this I still don't have a very clear understanding on either one of these function modules due to limited detailed explanation of them!

Thank you all again for your help.