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

Table Control - Dropdown List

Former Member
0 Likes
2,961

Hi,

I have a Table Control Element on a Dynpro. Some colums are displayed as a Dropdown List (Listbox).

How can I put values into this listbox? I have looked at this thread http://scn.sap.com/thread/764416 and tried to use the FB F4IF_INT_TABLE_VALUE_REQUES. But it did not work. The Dropdown Box is still empty.

Every example I looked at, used a reference to DDIC Objects. But my table structure has no DDIC Referenz. I is defined in the report by TYPE statements. How can I build the DropDown List with a structure without any DDIC Reference?

Thank you very much in advance!

Best regards.

7 REPLIES 7
Read only

Former Member
0 Likes
1,574

Hi Daniel,

Can you try this code?

Global Data Def.

DATA : GT_VALUES TYPE VRM_VALUES.

DATA : GS_VALUES LIKE LINE OF GT_VALUES.

in  PROCESS BEFORE OUTPUT.

loop at gc_control.

MODULE INIT_LISTBOX.

endloop.


*&---------------------------------------------------------------------*

*&      Module  INIT_LISTBOX  OUTPUT

*&---------------------------------------------------------------------*

MODULE INIT_LISTBOX OUTPUT.

  REFRESH GT_VALUES.

  LOOP AT GT_APACT  INTO GS_APACT.

    MOVE : GS_APACT-VALUE TO GS_VALUES-KEY,

           GS_APACT-TEXT  TO GS_VALUES-TEXT.

    APPEND GS_VALUES TO GT_VALUES.

  ENDLOOP.

  PERFORM VRM_SET_VALUES

              USING

                 'G_APACT' " Screen element name

                 GT_VALUES.

ENDMODULE.                 " INIT_LISTBOX  OUTPUT

*&---------------------------------------------------------------------*

*&      Form  vrm_set_values

*&---------------------------------------------------------------------*

form vrm_set_values using id values.

  call function 'VRM_SET_VALUES'

    exporting

      id                    = id

      values                = values

* EXCEPTIONS

*   ID_ILLEGAL_NAME       = 1

*   OTHERS                = 2

            .

  if sy-subrc <> 0.

* Implement suitable error handling here

  endif.

endform.                    "vrm_set_values

Read only

Former Member
0 Likes
1,572

some sample code

* datas

DATA: it_dropdown TYPE lvc_t_drop,
       ty_dropdown TYPE lvc_s_drop.


*set

ty_dropdown-handle = '1'.

  ty_dropdown-value = ' '.

  APPEND ty_dropdown TO it_dropdown.

  ty_dropdown-handle = '1'.

  ty_dropdown-value = '1 kalite'.

  APPEND ty_dropdown TO it_dropdown.

  ty_dropdown-handle = '1'.

  ty_dropdown-value = '2 kalite'.

  APPEND ty_dropdown TO it_dropdown.

  ty_dropdown-handle = '1'.

  ty_dropdown-value = '3 kalite'.

  APPEND ty_dropdown TO it_dropdown.

  CALL METHOD alv_con->set_drop_down_table

    EXPORTING

      it_drop_down = it_dropdown.

LOOP AT fcat .

  CASE fcat-fieldname .

    WHEN 'KALITE'.

     fcat-drdn_hndl = '1'.

     fcat-outputlen = '10'.

     MODIFY fcat.

  ENDCASE.

ENDLOOP.

Read only

former_member220538
Active Participant
0 Likes
1,572

Hi,

In the PBO create a module for the  listbox.Use the FM VRM_SET_VALUES to set initial values to list.

MODULE LISTBOX.

x_drop-KEY = '001'.

x_drop-TEXT = 'Test1'.

append  x_drop  to t_drop.

x_drop-KEY = '002'.

x_drop-TEXT = 'Test2'.

append  x_drop  to t_drop.

CALL FUNCTION 'VRM_SET_VALUES'

  EXPORTING

    id                    = 'X_TAB-TYPE'      --->Table Control fieldName

    values                = t_drop

EXCEPTIONS

   ID_ILLEGAL_NAME       = 1

   OTHERS                = 2.

ENDMODULE.

Read only

0 Likes
1,572

Hi Daniel,

           Please post the properties of your table control.Specially for what field(Properties list) you want drop down list.

Read only

0 Likes
1,572

Hi!

Thanks for your reply!

Here are the properties of the table control and the field, which should get DropDown. I'm working in a German system, unfortunantelly se80 don't show me the english property labels even if I log in with english. Therefore I have translated the Properties by my own, hope you can see which one I mean.

Table Control TC_KRITERIEN

Type of Table:
X With Column Heading
X Configurable
No Title

Resizing:
X Vertical
X Horizontal

Separator:
X Vertical
X Horizontal

Row Markers:
Multiple

Column Markers:
No

With Marking Column:
WA_SEL_KRITERIEN-LFD_NR

Fixed Columns:
0

Input/Output Field for DropDown WA_SEL_KRITERIEN-QUELLSYSTEM
Dropdown: Listbox

FktCode: empty

Format: Char; No DDIC
No SET/GET Parameter

Inputfield: Yes
Outputfield: Yes

Input Assistance: Yes
Value List: Space (From Dict. / Flow Control)

Best regards,

Daniel

Read only

Former Member
0 Likes
1,572

Hi Daniel,

In the top include of the program declare internal table and workarea like this.

TYPES : BEGIN OF ty_value_tab,
          TEXT TYPE char100,
        END OF ty_value_tab.



DATA : return_tab TYPE STANDARD TABLE OF  ddshretval,
       t_itab     TYPE STANDARD TABLE OF ty_value_tab,
       x_itab     TYPE  ty_value_tab.


And in the flow logic of your screen write the code like this.


"New event

PROCESS ON VALUE-REQUEST.

FIELD LV_LIST MODULE f4_help_test.


"LV_LIST is a input field that we declared it in the layout.


"f4_help_test is a module that we are going to create in which we are going to write the logic.


Double click on the ""f4_help_test" and create a new module


Inside the module write code like .



  x_itab-TEXT  = 'alen'.
   APPEND x_itab TO t_itab.

   x_itab-TEXT  = 'lee'.
   APPEND x_itab TO t_itab.


   x_itab-TEXT  = 'mj'.
   APPEND x_itab TO t_itab.

   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
   EXPORTING
     retfield        = 'LV_LIST'
     value_org       = 'S'
     dynprofield     = 'LV_LIST'
   TABLES
     value_tab       = t_itab
     return_tab      = return_tab
   EXCEPTIONS
     parameter_error = 1
     no_values_found = 2
     OTHERS          = 3.


"Hope this helps.

"Change the code according to requirement. I am saying about the internal table and all.


Regards,

Alenlee MJ



Read only

hiriyappa_myageri
Participant
0 Likes
1,572

Make Use of VRM_SET_VALUES.

Follow the Alenlee and oldun.