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

Listbox weird behavior

Former Member
0 Likes
706

I have listbox DD1 and I populated that with SPFLI-CITYFROM data. I used SELECT DISTINCT statement so that it will not repeat same entry on my list box. It was successful but then on the 2nd time and on the succeeding times you click on the listbox (trying to select other item), the listbox shows all the city entries from the SPFLI-CITYFROM. The SELECT DISTINCT takes effect only at first because as I have said on the 2nd and succeeding times you click the listbox, it will show you all entries of SPFLI-CITYFROM data. why is that? i dont understand.

im sorry if i sound so dumb. im a newbie. big thanks to all.

_________________________________

TYPE-POOLS: VRM.
DATA: VALUE TYPE VRM_VALUES WITH HEADER LINE.

DATA: DD1(20).
DATA: INT_SPFLI TYPE STANDARD TABLE OF SPFLI WITH HEADER LINE.

SELECT DISTINCT CITYFROM FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE INT_SPFLI.

START-OF-SELECTION.
  SET SCREEN 100.

MODULE PBO OUTPUT.
  LOOP AT INT_SPFLI.
    VALUE-KEY = INT_SPFLI-CITYFROM.
    APPEND VALUE.
  ENDLOOP.

   CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
          ID     = 'DD1'
          VALUES = VALUE[].
ENDMODULE.

MODULE PAI INPUT.
  CASE SY-UCOMM.
    WHEN 'BTNEXIT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
675

Try this.



 
MODULE PBO OUTPUT.
 
 clear value.  refresh value.         " <-  RIGHT HERE

  LOOP AT INT_SPFLI.
    VALUE-KEY = INT_SPFLI-CITYFROM.
    APPEND VALUE.
  ENDLOOP.
 
   CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
          ID     = 'DD1'
          VALUES = VALUE[].
ENDMODULE.
 


Regarsd,

Rich Heilman

6 REPLIES 6
Read only

Former Member
0 Likes
675

Hello Jack,

Put he select

SELECT DISTINCT CITYFROM FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE INT_SPFLI.

In the PBO of the screen,,

Vasanth

Read only

0 Likes
675

I put it on the MODULE PBO OUTPUT but still the same. =(

thanks for the reply <b>Vasanth.</b> I appreciate it.

Read only

0 Likes
675

Actually if we want to be efficient, you should only get the data and build the value table once in the start of the program.



report zrich_0001.

type-pools: vrm.
data: value type vrm_values with header line.

data: dd1(20).
data: int_spfli type standard table of spfli with header line.

initialization.

select distinct cityfrom from spfli
        into corresponding fields of table int_spfli.
  loop at int_spfli.
    value-key = int_spfli-cityfrom.
    append value.
  endloop.

start-of-selection.
  set screen 100.

module pbo output.


   call function 'VRM_SET_VALUES'
    exporting
          id     = 'DD1'
          values = value[].
endmodule.

module pai input.
  case sy-ucomm.
    when 'BTNEXIT'.
      leave program.
  endcase.
endmodule.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
675

Refresh the table before selecting

<b>REFRESH INT_SPFLI.

clear INT_SPFLI.</b>

SELECT DISTINCT CITYFROM FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE INT_SPFLI.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
676

Try this.



 
MODULE PBO OUTPUT.
 
 clear value.  refresh value.         " <-  RIGHT HERE

  LOOP AT INT_SPFLI.
    VALUE-KEY = INT_SPFLI-CITYFROM.
    APPEND VALUE.
  ENDLOOP.
 
   CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
          ID     = 'DD1'
          VALUES = VALUE[].
ENDMODULE.
 


Regarsd,

Rich Heilman

Read only

0 Likes
675

thanks <b>Rich Heilman</b>. it solved my issue!

thanks also to <b>Chandrasekhar</b>. I appreciate your effort.

<b>thanks guys! </b> 😃