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

List Box

Former Member
0 Likes
1,065

I have 2 list box in the second page. I used 'VRM_SET_VALUES' to set the values of drop down.Depending the values selected of the first list box , the second list box will be populated.  Now My problem is i have used 'USER COMMAND'. the list box is not returning any values .The parameter is not holding the selected value..

9 REPLIES 9
Read only

0 Likes
1,032

Hi,

At run time Parameter will not hold the user selected value.

You have to get the dynamic screen value of the first list box using FM  'DYNP_READ_VALUES'.

This will return you the user selected value.

Regards,

Vishwa..

Read only

0 Likes
1,032

i used that FM'DYNP_VALUES_READ'.But what will be my screen number

( dynumb) in this case.

Read only

0 Likes
1,032

HI,

You can pass SY-DYNNR..

    and for program SY-REPID.

Read only

0 Likes
1,032

I have added this.. but on selecting the first list box .. i_dynp_read is null.

data:  i_dynp_read type table of dynpread.

   at SELECTION-SCREEN.
if sy-ucomm = 'AA'.
   CALL FUNCTION 'DYNP_VALUES_READ'
     EXPORTING
       dyname                               = sy-repid
       dynumb                               = sy-dynnr
     TABLES
       dynpfields                           = i_dynp_read
    EXCEPTIONS
      INVALID_ABAPWORKAREA                 = 1
      INVALID_DYNPROFIELD                  = 2
      INVALID_DYNPRONAME                   = 3
      INVALID_DYNPRONUMMER                 = 4
      INVALID_REQUEST                      = 5
      NO_FIELDDESCRIPTION                  = 6
      INVALID_PARAMETER                    = 7
      UNDEFIND_ERROR                       = 8
      DOUBLE_CONVERSION                    = 9
      STEPL_NOT_FOUND                      = 10
      OTHERS                               = 11
             .
please guide what to do now ..

Thanx a lot for reply.

Read only

0 Likes
1,032

HI please find below sample code

DATA:   lt_dynp_values     TYPE TABLE OF  dynpread,

            ls_dynp_values     LIKE LINE OF lt_dynp_values.

  ls_dynp_values-fieldname = 'Parameter_name'  " Your parameter name in CAPS.
  APPEND ls_dynp_values1 TO it_dynp_values.

   CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname             = iv_dynname
      dynumb             = iv_dynnr
      translate_to_upper = 'X'
    TABLES
      dynpfields         = it_dynp_values.

   READ TABLE lt_dynp_values INTO ls_dynp_values INDEX 1.

seleted-value = ls_dynp_values-fieldvalue.

Regards,

Viswamurthy

Read only

Former Member
0 Likes
1,032

Hello Prabhatirani,

Refer following

http://www.se80.co.uk/sapfms/d/dynp/dynp_values_read.htm

If your problem is resolved, mark the discussion as closed.

Thanks

Katrice    

Read only

Former Member
0 Likes
1,032

I have used both.. But again I am unable to get the the selected value .The fieldvalue is coming blank.

Read only

0 Likes
1,032

HI

Did you pass screen field name of list box at below

ls_dynp_values-fieldname = 'Parameter_name'  " Your parameter name in CAPS.

Can you place your code here..

THanks & Regards,

Viswamurthy

Read only

Former Member
0 Likes
1,032

Check this code

   REPORT  ztest22.
TYPE-POOLS: vrm.
TABLES spfli.
TABLES sscrfields.
DATA flag.
DATA: name TYPE vrm_id,
      list TYPE vrm_values,
      value LIKE LINE OF list.
PARAMETERS ps_parm LIKE spfli-carrid  AS LISTBOX  VISIBLE LENGTH 10 USER-COMMAND fcodex.
DATA: i_spfli TYPE spfli OCCURS 0 WITH HEADER LINE.
PARAMETERS pq_param LIKE spfli-connid AS LISTBOX VISIBLE LENGTH 15 USER-COMMAND fcodey.

INITIALIZATION.
  name = 'PS_PARM'.
  DATA t TYPE i VALUE 0.
  SELECT DISTINCT carrid INTO CORRESPONDING FIELDS OF TABLE i_spfli FROM spfli.
  LOOP AT i_spfli.
    value-key = i_spfli-carrid.
    value-text = i_spfli-carrid.
    APPEND value TO list.
  ENDLOOP.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = name
      values = list.

AT SELECTION-SCREEN.

if sy-ucomm eq 'FCODEX'.

    REFRESH LIST.

    CLEAR LIST.

    PQ_PARAM = ' '.

    NAME = 'PQ_PARAM'.

    SELECT  * FROM SPFLI WHERE CARRID = PS_PARM.

      VALUE-KEY = SPFLI-connid.

      VALUE-TEXT = SPFLI-connid.

      APPEND VALUE TO LIST.

    ENDSELECT.

  endif.



AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF sy-ucomm NE 'FCODEX' OR sy-ucomm NE 'FCODEY'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id     = name
          values = list.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

START-OF-SELECTION.
  CLEAR i_spfli.
  REFRESH i_spfli.
  SELECT * INTO TABLE i_spfli FROM spfli WHERE carrid = ps_parm AND connid = pq_param.

  LOOP AT i_spfli.
    WRITE: / 'CITY FROM:', i_spfli-cityfrom, 'CITY TO :',i_spfli-cityto,
   'DEPARTURE TIME :', i_spfli-deptime.
  ENDLOOP.