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: 

drop down from data dictionary.

Former Member
0 Kudos

hello

i have made a form in which i want the value of dropdown2 filtered based on value selected in dropdown1.although it is working if i am giving the values manually but when i am retrieving it from data dictionary values are not filtered.kindly suggest me how to proceed.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello

I think you have passed wrong internal table in  VRM_SET_VALUES as a value parameter.

As you are fetching records in internal table itab1 using select statement

See the following lines of code published by you

      SELECT state FROM zbs_state INTO

           corresponding fields of itab1 WHERE ZONE1 = 'NORTH'.

CALL FUNCTION 'VRM_SET_VALUES'

            EXPORTING

              id                    = zbs_state-state1

              values                = etab1

Check the bold part in above code . You will clearly find the error

Collect the records in etab1 internal table not in itab1 as you are passing etab1 in FM VRM_SET_VALUES

After fetching from SELECT Statement check sy-subrc whether records have been fecthed or not Accordingly take a call .

Enjoy Coding

Regards

Sandeep

10 REPLIES 10

former_member193464
Contributor
0 Kudos

Although i could not get what you meant but debug and check when selecting from dictionary the values are updated in dropdown1. Paste that part of code if the problem is still persisting.

0 Kudos

i am attaching the modules in which i have defined values for dropdown and den the module in which coding is done.

MODULE get OUTPUT.

  zbs1_brand-zone = 'ZBS1_BRAND-ZONE1'.

  zbs_state-state1 = 'ZBS_STATE-STATE'.

  IF etab IS INITIAL.

*    wa-text = 'NORTH'.

    wa-key = 'NORTH'.

    APPEND wa TO etab.

*    wa-text = 'EAST'.

    wa-key = 'EAST'.

    APPEND wa TO etab.

*    wa-text = 'SOUTH'.

    wa-key = 'SOUTH'.

    APPEND wa TO etab.

*    wa-text = 'WEST'.

    wa-key = 'WEST'.

    APPEND wa TO etab.

  ENDIF.

  CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

      id                    = zbs1_brand-zone

      values                = etab

*  EXCEPTIONS

*    ID_ILLEGAL_NAME       = 1

*    OTHERS                = 2

            .

  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 etab1 IS INITIAL.

    SELECT  state

          FROM  zbs_state

          INTO  CORRESPONDING FIELDS OF itab1.

          wa1-key  = itab1-state.

      APPEND wa1 TO etab1.

*      CLEAR wa1.

    ENDSELECT.

    CALL FUNCTION 'VRM_SET_VALUES'

      EXPORTING

        id                    = zbs_state-state1

        values                = etab1

*     EXCEPTIONS

*       ID_ILLEGAL_NAME       = 1

*       OTHERS                = 2

              .

    IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

  ENDIF.

MODULE user_command_0001 INPUT.

  save_code = ok_code.

  CASE save_code.

    WHEN 'SELECT'.

      CASE zbs1_BRAND-zone1.

        WHEN 'NORTH'.

               SELECT state FROM zbs_state INTO

           corresponding fields of itab1 WHERE ZONE1 = 'NORTH'.

endselect.

     ENDCASE.

CALL FUNCTION 'VRM_SET_VALUES'

            EXPORTING

              id                    = zbs_state-state1

              values                = etab1

.

where select is the function code given in dropdown1.

0 Kudos

put a breakpoint at PAI and check the condition WHEN 'NORTH' is it going inside and fetching the data to etab1 ?

0 Kudos

i have checked.it is taking only the last value of dropdown2 and not acc to the condition given.

0 Kudos

are you able to read your dropdown1 value inside PAI correctly ?

0 Kudos

while debugging,in itab1 it is taking last value from dropdown2 and in etab1 it is displaying all the values of dropdown2 irrespective of condition given.

0 Kudos

clear your etab1 , and then fill values from itab1  to etab1 based on the criteria you had given... and then call the function VRM_SET_VALUES

former_member194152
Contributor
0 Kudos

share your code for visibility.

Former Member
0 Kudos

Hello

I think you have passed wrong internal table in  VRM_SET_VALUES as a value parameter.

As you are fetching records in internal table itab1 using select statement

See the following lines of code published by you

      SELECT state FROM zbs_state INTO

           corresponding fields of itab1 WHERE ZONE1 = 'NORTH'.

CALL FUNCTION 'VRM_SET_VALUES'

            EXPORTING

              id                    = zbs_state-state1

              values                = etab1

Check the bold part in above code . You will clearly find the error

Collect the records in etab1 internal table not in itab1 as you are passing etab1 in FM VRM_SET_VALUES

After fetching from SELECT Statement check sy-subrc whether records have been fecthed or not Accordingly take a call .

Enjoy Coding

Regards

Sandeep

0 Kudos

thank you my form is complete.since i am a fresher i am learning a lot from you.thank you.