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

Drop down not getting populated

Former Member
0 Likes
326

Hi All,

I have a reuirement that i have to populate the drop down values in a table based on the value of other row. For example, if i hvae a table row called fruits, the drop down in the next colun should give me list of all fruits. and if the next row is sports, the drop down will get populated accordnigly.I have to manyally add rows.

I am stuck with the part that the dropdown gets populated for only the first row.If i add the second row, the drop down values get populated in the first row.

Thanks,

Pris

1 REPLY 1
Read only

Former Member
0 Likes
283

Hi,

Better you implemnt dynamic F4 help at table row level than this as it is very easy

"In TOP include
TYPE-POOLS : vrm. " This is Tested Program Just Copy into a Local Program and Check
DATA : BEGIN OF itab OCCURS 0,
        main TYPE char15, " On screen both are type List Box without Key and for Main User Command at Screen Painter Level 
        item TYPE char20, " Been assigned and 
  END OF itab.
"" Better you implement an F4 Help using F4IF_INT_TABLE_VALUE_REQUEST
CONTROLS : tc TYPE TABLEVIEW USING SCREEN 100.
DATA : line.
DATA : cid TYPE vrm_id, " For List Box
       car TYPE vrm_values,
       wcar LIKE LINE OF car,
       carrid TYPE spfli-carrid,
       ok TYPE sy-ucomm,
       cid1 TYPE vrm_id, " For List Box
       car1 TYPE vrm_values,
       wcar1 LIKE LINE OF car.
"in Flow Logic
 MODULE status_0100.
  LOOP AT itab WITH CONTROL tc.
  ENDLOOP.
*
PROCESS AFTER INPUT.
  LOOP AT itab.
   MODULE MODIFY_TC.
  ENDLOOP.
  MODULE user_command_0100.
in Program
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'ABC'.
  REFRESH car.
  wcar-key = 'FRUIT'.
  wcar-text = 'FRUIT'.
  APPEND wcar TO car.
  wcar-key = 'VEG'.
  wcar-text = 'VEG'.
  APPEND wcar TO car.
  cid = 'ITAB-MAIN'.
  DESCRIBE TABLE itab LINES tc-lines.
  IF tc-lines <> 0.
    tc-lines = tc-lines + 1.
  ENDIF.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = cid
      values          = car
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
  READ TABLE itab INDEX line.
  IF sy-subrc = 0.
    IF itab-main = 'FRUIT'.
      REFRESH car1.

      wcar1-key = 'GUAVA'.
      wcar1-text = 'GUAVA'.
      APPEND wcar1 TO car1.
      wcar1-key = 'MANGO'.
      wcar1-text = 'MANGO'.
      APPEND wcar1 TO car1.
      cid1 = 'ITAB-ITEM'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = cid1
          values          = car1
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      ELSE.
      REFRESH car1.

      wcar1-key = 'TOMATO'.
      wcar1-text = 'TOMATO'.
      APPEND wcar1 TO car1.
      wcar1-key = 'ALOO'.
      wcar1-text = 'ALOO'.
      APPEND wcar1 TO car1.
      cid1 = 'ITAB-ITEM'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = cid1
          values          = car1
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.

    ENDIF.
  ENDIF.
ENDMODULE.                 " status_0100  OUTPUT
" In program
MODULE modify_tc INPUT.
  DESCRIBE TABLE itab LINES tc-lines.
  IF tc-lines < tc-current_line.
    APPEND itab.
  ELSE.
    MODIFY itab INDEX tc-current_line.
  ENDIF.
  GET CURSOR LINE line. " If you scroll down to middle of TC then the Current line you get with a formula
  READ TABLE itab INDEX line. " Like tc-lines - sy-stepl + 1 I am not Sure about this Formula Check this one
  IF sy-subrc = 0.
  ENDIF.
ENDMODULE.

Cheerz

Ram