Skip to Content
avatar image
Former Member

​ How to Create a drop down list for 3 or more tables & update other lists based on selection

Hi Experts,

I am new to SAP ABAP, My requirement is to create a drop down list for 3 or more db tables, where on selection of one value in first drop down list the second list should be updated based on first selection and same for third list, as all are dependent on each other.

Ex: 3 tables Tab1 Tab2 Tab3.

Tab1 has values A, B, C. when A is selected from list, all the values related to A in Tab2 list should be Populated and same for 3rd.

Can any expert please help me with some code for the same.

Thanks in Advance.

Thanveer

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 01, 2016 at 12:30 PM

    I hope i understood.

    Selection For Field 1: Create F4(Static nothing but fixed) From the Reference parameter of the table 1
    For Selection For Field 2: Here Create f4(dynamic) Using Query.

    Refer in Forum how to create f4.(By using Query, using Where Condition Which values you selected for First F4 you need pass it
    dynpro Values Get For getting the selecting screen values.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    For Selection For Field 3:Same logic apply

    Hope you understood.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Kali Charan

      Thanks a lot NewB To Abap..

      Being a new comer, this has helped me in a great way,

      I truly appreciate the effort from an expert.

      Regards,

      Tanveer

  • Nov 01, 2016 at 03:30 PM

    Hi,

    Also, you can try this code:

    BR,

    Parise

    SPAN {
    font-family: "Courier New";
    font-size: 10pt;
    color: #000000;
    background: #FFFFFF;
    }
    .L0S32 {
    color: #3399FF;
    }
    .L0S33 {
    color: #4DA619;
    }
    .L0S52 {
    color: #0000FF;
    }
    .L0S55 {
    color: #800080;
    }
    .L0S70 {
    color: #808080;
    }
    
    TABLES: t001w, t001l.
    
    
    
    DATA: lw_vrm TYPE vrm_values,
    
          ls_vrm TYPE vrm_value,
    
          lc_id  TYPE vrm_id.
    
    
    
    PARAMETERS p_werks  TYPE t001w-werks AS LISTBOX VISIBLE LENGTH 10
    
                                         USER-COMMAND fcode.
    
    
    
    PARAMETERS p_lgort  TYPE t001l-lgort AS LISTBOX VISIBLE LENGTH 20
    
                                         USER-COMMAND fcode.
    
    
    
    
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
    
    
    
      REFRESH lw_vrm.
    
    
    
      SELECT *
    
        FROM t001w.
    
        CLEAR ls_vrm.
    
        ls_vrm-key  = t001w-werks.
    
        ls_vrm-text = t001w-werks.
    
        APPEND ls_vrm TO lw_vrm.
    
      ENDSELECT.
    
    
    
      lc_id  = 'P_WERKS'.
    
    
    
      CALL FUNCTION 'VRM_SET_VALUES'
    
        EXPORTING
    
          id              = lc_id
    
          values          = lw_vrm
    
        EXCEPTIONS
    
          id_illegal_name = 1
    
          OTHERS          = 2.
    
    
    
    
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_lgort.
    
    
    
      REFRESH lw_vrm.
    
    
    
      SELECT *
    
        FROM t001l
    
          WHERE werks EQ p_werks.
    
        CLEAR ls_vrm.
    
        ls_vrm-key  = t001l-lgort.
    
        ls_vrm-text = t001l-lgort.
    
        APPEND ls_vrm TO lw_vrm.
    
      ENDSELECT.
    
    
    
      lc_id  = 'P_LGORT'.
    
    
    
      CALL FUNCTION 'VRM_SET_VALUES'
    
        EXPORTING
    
          id              = lc_id
    
          values          = lw_vrm
    
        EXCEPTIONS
    
          id_illegal_name = 1
    
          OTHERS          = 2.
    
    
    
    START-OF-SELECTION.
    Add comment
    10|10000 characters needed characters exceeded