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: 

HOW TO AVOID DUPLICATES WHILE USING VRM FM

Former Member
0 Kudos
600

HI EXPERTS,

I AM USING VRM FM TO PASS VALUES INTO LISTBOX IN SCREENS.FIRST TIME IT IS WORKING PROPERLY WHEN I USE IT FOR THE SECOND TIME IT IS SHOWING THE PREVIOUS DATAS ENTRIES ALSO .HOW TO DELETE THE DUPLICATE ENTRIES OF IT .

THIS IS MY CODE.

when 'ENTER'.

select POSNR ARKTX from LIPS into corresponding fields of table i_pstyp WHERE VBELN EQ VBELN.

LOOP AT I_PSTYP .

W_DDLIST-KEY = I_PSTYP-POSNR.

W_DDLIST-TEXT = I_PSTYP-POSNR.

APPEND W_DDLIST TO POSNR1.

CLEAR W_DDLIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'POSNR'

VALUES = POSNR1.

IN THIS IF I SELECT NEXT VBELN WITHOUT EXITING FROM THE SCREEN THE PREVIOUS VBELN'S LINE ITEMS ALSO ARE DISPLAYING .WHAT SHALL I DO .

MANI

5 REPLIES 5

gopi_narendra
Active Contributor
210
when 'ENTER'.

select POSNR ARKTX from LIPS 
       into corresponding fields of table i_pstyp
       WHERE VBELN EQ VBELN.

LOOP AT I_PSTYP .
W_DDLIST-KEY = I_PSTYP-POSNR.
W_DDLIST-TEXT = I_PSTYP-POSNR.
APPEND W_DDLIST TO POSNR1.
CLEAR W_DDLIST.
ENDLOOP. " Endloop here. the FM should not be called inside the loop

CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'POSNR' " hope you are using the fieldname correctly
VALUES = POSNR1.
CLEAR : POSNR1. " this will stop repeating the values in your drop down list

Regards

Gopi

Former Member
0 Kudos
210

<b>refresh POSNR1.</b>

LOOP AT I_PSTYP .

W_DDLIST-KEY = I_PSTYP-POSNR.

W_DDLIST-TEXT = I_PSTYP-POSNR.

APPEND W_DDLIST TO POSNR1.

CLEAR W_DDLIST.

endloop.

regards

shiba dutta

varma_narayana
Active Contributor
0 Kudos
210

Hi ...

This is bcoz the Values in the internal Table are retained.

So you have to remove the entries before calling the function module

Like:

REFRESH POSNR1.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'POSNR'

TABLES

VALUES = POSNR1.

<b>Reward if Helpful.</b>

Former Member
0 Kudos
210

Hi,

Try this.....

use REFRESH posnr1 after fm.Using this stmt the previous body contents will be deleted.So for the next time new contents gets displayed.

regards,

lakshmi

varma_narayana
Active Contributor
0 Kudos
210

Hi..

I m sorry.

You have to Use the REFRESH before the LOOP where you are APPENDing the values. Not before calling the FM.

Plz correct.

Regards.