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

ALV with dropdown list

Former Member
0 Likes
369

I have a ALV ( OO, not function module ) . One of the columns are refer to a database table field, and I set some single value with text in the domain of this database table field. I wish to output this field with its text automaticlly ,as in table control I can make a field 'List with key'.

I know I can read the text from the database and set them in a internal table in each line of my alv table. but I want it get automaticlly~~ thanks~~

2 REPLIES 2
Read only

Former Member
0 Likes
336

Hi Lupin,

Assign search help to that field.

Create a search help having those values.assign it to that table field.

make that field editable in ALV.

Regards,

Hemant

Read only

Former Member
0 Likes
336

Hi,

in that case you have to provide rollname(data element) of that field which you created.check this example

REPORT ZTEST_ALV_OO1.

data: grid type ref to cl_gui_alv_grid,

G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1

G_CONTAINER TYPE SCRFNAME VALUE 'DEMO'.

data: it_fcat type lvc_t_fcat,

wa_fcat type lvc_s_fcat.

data: begin of itab occurs 0,

vbeln type vbeln,

posnr type posnr,

end of itab.

start-of-selection.

select vbeln posnr from vbap up to 10 rows into table itab .

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

*-Assign the container to Container Object

CREATE OBJECT G_CUSTOM_CONTAINER

EXPORTING

  • PARENT =

CONTAINER_NAME = G_CONTAINER

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

others = 6

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

CREATE OBJECT GRID

EXPORTING

I_PARENT = G_CUSTOM_CONTAINER

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

others = 5

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

wa_fcat-fieldname = 'VBELN'.

<b> wa_fcat-rollname = 'VBELN'.</b>

append wa_fcat to it_fcat.

wa_fcat-fieldname = 'POSNR'.

<b> wa_fcat-rollname = 'POSNR'.</b>

append wa_fcat to it_fcat.

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

CHANGING

IT_OUTTAB = ITab[]

IT_FIELDCATALOG = it_fcat

EXCEPTIONS

INVALID_PARAMETER_COMBINATION = 1

PROGRAM_ERROR = 2

TOO_MANY_LINES = 3

others = 4

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

ENDMODULE. " USER_COMMAND_0100 INPUT

regards

suman