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

Screen painter

Former Member
0 Likes
1,424

How to get the Dropdown list values in Screen painter.

Regards,

MARK K

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
1,357

Hi Mark,

To get Drop Drown Box on screen .

Follow these steps.

<b>1</b>.

Go to T.Code SE51 and Select Laypout for the Screen.

<b>2</b>.

Double click on the field for which u want Dropdown box.

<b>3</b>.

Then U will see Name ,Text ,<b>DROPDOWN</b>.Click on that and select List Box or ListBox with key . Better to to select first one.

<b>4</b>.

Save and Activate ur screen .

<b>5</b>.

Enter the following peice of code in the PBO of the screen.(Change for ur requirement).

<b> TYPE-POOLS :vrm.</b>

DATA:i_natio TYPE vrm_values,

w_natio LIKE LINE OF i_natio.

DATA: BEGIN OF i_t005t OCCURS 0,

land1 TYPE t005t-land1,

natio TYPE t005t-natio,

END OF i_t005t.

IF i_t005t[] IS INITIAL.

SELECT land1 natio

FROM t005t

INTO TABLE i_t005t

WHERE spras = sy-langu.

IF sy-subrc = 0.

LOOP AT i_t005t .

w_natio-key = i_t005t-land1.

w_natio-text = i_t005t-natio.

APPEND w_natio TO i_natio.

CLEAR w_natio.

ENDLOOP.

ENDIF.

ENDIF.

CALL FUNCTION <b>'VRM_SET_VALUES'</b>

EXPORTING

id = 'I_IT0002-NATIO'

values = i_natio

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.

<b>6</b>.

Observe the above code and change as for ur requirement.

I think it helps a lot.

Let me know ,if u have any problem creating Dropdownbox.

<b>Thanks,

Venkat.O</b>

12 REPLIES 12
Read only

Former Member
0 Likes
1,357

In the screen painter, create an i/o element, in the elements attributes select the value 'Listbox with key' for the field DROPDOWN, you will get a the field having a list of values in your screen.

Read only

Former Member
0 Likes
1,357

Hi,

Assign an dictionary field field for that input field.

You can also try triggering the event

(PROCESS ON VALUE-REQUEST) for F4 help values in the PAI.

If its useful, award points pls..

Regards,

Bharadwaj

Read only

venkat_o
Active Contributor
0 Likes
1,358

Hi Mark,

To get Drop Drown Box on screen .

Follow these steps.

<b>1</b>.

Go to T.Code SE51 and Select Laypout for the Screen.

<b>2</b>.

Double click on the field for which u want Dropdown box.

<b>3</b>.

Then U will see Name ,Text ,<b>DROPDOWN</b>.Click on that and select List Box or ListBox with key . Better to to select first one.

<b>4</b>.

Save and Activate ur screen .

<b>5</b>.

Enter the following peice of code in the PBO of the screen.(Change for ur requirement).

<b> TYPE-POOLS :vrm.</b>

DATA:i_natio TYPE vrm_values,

w_natio LIKE LINE OF i_natio.

DATA: BEGIN OF i_t005t OCCURS 0,

land1 TYPE t005t-land1,

natio TYPE t005t-natio,

END OF i_t005t.

IF i_t005t[] IS INITIAL.

SELECT land1 natio

FROM t005t

INTO TABLE i_t005t

WHERE spras = sy-langu.

IF sy-subrc = 0.

LOOP AT i_t005t .

w_natio-key = i_t005t-land1.

w_natio-text = i_t005t-natio.

APPEND w_natio TO i_natio.

CLEAR w_natio.

ENDLOOP.

ENDIF.

ENDIF.

CALL FUNCTION <b>'VRM_SET_VALUES'</b>

EXPORTING

id = 'I_IT0002-NATIO'

values = i_natio

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.

<b>6</b>.

Observe the above code and change as for ur requirement.

I think it helps a lot.

Let me know ,if u have any problem creating Dropdownbox.

<b>Thanks,

Venkat.O</b>

Read only

Former Member
0 Likes
1,357

Hi Venkat,

I have done exactly like your code, but I am not getting the list in the field.

I have reproduced the code what I have written.

*&----


*& Module STATUS_0100 OUTPUT

*&----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI0100'.

  • SET TITLEBAR 'xxx'.

TYPE-POOLS :VRM.

DATA:I_DDLIST TYPE VRM_VALUES,

W_DDLIST LIKE LINE OF I_DDLIST.

DATA: BEGIN OF I_PSTYP OCCURS 0,

PKEY(1) TYPE C,

PVAL(10) TYPE C,

END OF I_PSTYP.

I_PSTYP-PKEY = 'P'.

I_PSTYP-PVAL = 'Primary'.

APPEND I_PSTYP.

I_PSTYP-PKEY = 'S'.

I_PSTYP-PVAL = 'Secondary'.

APPEND I_PSTYP.

LOOP AT I_PSTYP .

W_DDLIST-KEY = I_PSTYP-PKEY.

W_DDLIST-TEXT = I_PSTYP-PVAL.

APPEND W_DDLIST TO I_DDLIST.

CLEAR W_DDLIST.

ENDLOOP.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'I_DDLIST'

VALUES = I_DDLIST

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.

*----


In the data element part, I have selected as 'List Box with Key'.

I also would like to know how the data from the internal will be linked to the field in the screen paiter.

Pls check this code and let me know where is the mistake.

Regards,

Read only

venkat_o
Active Contributor
0 Likes
1,357

Hi Mark,

I think u need to check here.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = '<b>Screen field name</b>' =><b>This is the Screen Field .If u give screen field name here in Caps.This is linked to the field in the screen</b>

VALUES = I_DDLIST

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.

I think u only need to give ur screen field for ID in the Function module VRM_SET_VALUES.

I am sure it works.

<b>Thanks

Venkat.O</b>

Read only

Former Member
0 Likes
1,357

Hi Vekat,

Thank u so much for your help. It is working now.

Regards,

Read only

Former Member
0 Likes
1,357

Hi Venkat,

The list gets duplicated after every save.

I have given clear statement, but still it duplicates.

How to avoid the duplicates in the list.

Pls guide me.

Regards,

Read only

Former Member
0 Likes
1,357

Hi Mark,

Can you just post your code...?

May be the clear will not be working at all or will be in the wrong place...

<b>Regarding the duplicates in the listbox, you can remove it in yet another method also.

use the statement

DELETE ADJACENT DUPLICATES FROM <itab_name>.

Use it in the place where you are appending it in the table.</b>

Hope your query is solved.

Regards,

SP.

Message was edited by: Sylendra Prasad

Read only

venkat_o
Active Contributor
0 Likes
1,357

Hi Mark,

<b>1</b>.

Write like this .

if I_PSTYP[] is initial.

I_PSTYP-PKEY = 'P'.

I_PSTYP-PVAL = 'Primary'.

APPEND I_PSTYP.

I_PSTYP-PKEY = 'S'.

I_PSTYP-PVAL = 'Secondary'.

APPEND I_PSTYP.

endif.

<b>2</b>.

So that that table is populated first time only.

It works.

<b>Thanks

Venkat.O</b>

Read only

Former Member
0 Likes
1,357

Hi Venkat,

Thanks for your suggestion. It is working fine.

Regards,

Read only

Former Member
0 Likes
1,357

Hi Mark,

In screen painter , go to the attributes of the screen element. You can see the dropdown section ,just select "Listbox" or "listbox with key"..

In the main program , append the value that you want to be displayed to a table. Then call teh Function Module,

<b>VRM_SET_VALUES</b> to display the listbox with the values.

Just go through this link.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm

Regards,

SP.

Read only

Former Member
0 Likes
1,357

Hi Mark,

Kindly reward the points

In screen painter SE51 Tcode, go to the attributes of the screen element. You can see the dropdown section ,just select "Listbox" or "listbox with key"..

In the main program , append the value that you want to be displayed to a table. Then call the Function Module,

VRM_SET_VALUES to display the listbox with the values or

call the Fm...

DATA : BEGIN OF it_zprojorg OCCURS 0,

areacd LIKE zprojorg-areacd,

areadesc LIKE zprojorg-areadesc,

END OF it_zprojorg.

DATA : IT_DYNPREAD LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = 'SAPMZDIN'

DYNUMB = SY-DYNNR

REQUEST = 'A'

TABLES

DYNPFIELDS = IT_DYNPREAD.

CHECK SY-SUBRC = 0.

READ TABLE IT_DYNPREAD WITH KEY FIELDNAME = 'ZPROJMAST-PROJCD'.

if not IT_DYNPREAD-FIELDVALUE is initial.

SELECT areacd areadesc FROM zprojorg

INTO TABLE it_zprojorg

WHERE projcd = it_dynpread-fieldvalue.

if sy-subrc <> 0.

  • MESSAGE E000(8I) WITH 'Invalid ArecCode, Please re-enter'.

STOP.

ELSE.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'AREACD'

dynpprog = 'SAPMZDIN'

dynpnr = sy-dynnr

dynprofield = 'IDINDTL-AREACD'

value_org = 'S'

TABLES

value_tab = it_zprojorg

RETURN_TAB = IDDSHRETVAL.

ENDIF.

endif.