cancel
Showing results for 
Search instead for 
Did you mean: 

How to Restrict select options values

Former Member
0 Kudos

Hi All,

My requirement is to Restrict Select options.

i have To select options one for Selecting Country and second for selecting Customer.so in first select options if user selects Us as Country ,then in second Select options only customers of US only should come .

Thanks in Advance.

Ashish

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ashish,

You can do using the supply function attribute set. In the supply function method, pull the customers list based on the country field value.

Let me know if it helps.

Thanks

Bharadwaja

Piyushmatrixs
Participant
0 Kudos

Hello Ashish,

You can use below code to solve your issue. Please reward if it helps.

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

REPORT  ZDEMO_HELP.

TABLES: T005, KNA1.

*   TYPE DECLARATION

TYPES: BEGIN OF TY_KNA1,                      " INCLUDE FIELDS WHAT YOU WANT IN HELP LIST

                KUNNR TYPE KNA1-KUNNR,

                LAND1 TYPE KNA1-LAND1,

                NAME1 TYPE KNA1-NAME1,

                NAME2 TYPE KNA1-NAME2,

                ORT01 TYPE KNA1-ORT01,

        END OF TY_KNA1.

*   INTERNAL TABLE AND WORK AREA DECLARATION

DATA: IT_KNA1 TYPE TABLE OF TY_KNA1,

           WA_KNA1 TYPE TY_KNA1.

* DECLARATION

PARAMETERS: COUNTRY LIKE T001-LAND1,     " TO SELECT COUNTRY

                         CUSTOMER LIKE KNA1-KUNNR. " TO SELECT CUSTOMER BASED COUNTRY

*AT SELECTION-SCREEN VALUE REQUEST FOR CUSTOMER .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR CUSTOMER.

DATA: IT_DYNPFIELDS TYPE STANDARD TABLE OF DYNPREAD,

           WA_DYNPFIELDS TYPE DYNPREAD.

           WA_DYNPFIELDS-FIELDNAME = 'COUNTRY'.

           APPEND WA_DYNPFIELDS TO IT_DYNPFIELDS.

     CALL FUNCTION 'DYNP_VALUES_READ'

       EXPORTING

         DYNAME  = SY-REPID

         DYNUMB  = SY-DYNNR

       TABLES

         DYNPFIELDS  = IT_DYNPFIELDS.

READ TABLE IT_DYNPFIELDS INTO WA_DYNPFIELDS WITH KEY FIELDNAME = 'COUNTRY'.

IF SY-SUBRC = 0.

   COUNTRY = WA_DYNPFIELDS-FIELDVALUE.

ENDIF.

* SELECT QUIRES FOR CUSTOM FIELDS

SELECT KUNNR LAND1 NAME1 NAME2 ORT01

         INTO CORRESPONDING FIELDS OF TABLE IT_KNA1 FROM KNA1

              WHERE LAND1 EQ COUNTRY.

* FUNCTION MODULE TO POPULATE F4 HELP

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

   EXPORTING

     RETFIELD               = 'KUNNR'

     DYNPPROG               = SY-REPID

     DYNPNR                 = SY-DYNNR

     DYNPROFIELD            = 'CUSTOMER '

*   WINDOW_TITLE           = 'Select Customer' 

    VALUE_ORG              = 'S'

*   MULTIPLE_CHOICE        = ' '

* IMPORTING

*   USER_RESET             =

   TABLES

     VALUE_TAB              = IT_KNA1.

Thanks

Piyush Gupta

Piyushmatrixs
Participant
0 Kudos

Hello Ashish,

   You can remove "WA_KNA1 TYPE TY_KNA1." there is no need of it.

Thanks

Piyush Gupta

ramakrishnappa
Active Contributor
0 Kudos

Hi Ashish,

You can achieve your requirement as below


  • Use component WDR_OVS
  • For section select options,
    • set I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_OVS
    • set I_VALUE_HELP_ID = your ovs component
  • In ovs event handler method
    • Read the country field ( first select option ) range table and
    • Retrieve the customer information based on country value selected

Hope this helps you.

Regards,

Rama