Skip to Content
0
Former Member
Jun 12, 2007 at 08:17 PM

Probelm with FM GET_COMPONENT_LIST

221 Views

I try to use GET_COMPONENT_LIST sending sy-repid for the prog name. When I use this function in a report program, it works fine. When I try to use it in a function group, it does not work properly. Any suggestions?

Code same attached.

Your help is greatly appreciated.

Kind Regards, Jason

FORM specify_columns  CHANGING p_lt_requ_columns TYPE crmt_report_requ_columns_ta .
  DATA: ls_requ_columns TYPE crmt_report_requ_columns,

        lt_components   TYPE TABLE OF rstrucinfo with header line,
        lv_components   LIKE LINE OF lt_components,

        lt_result          TYPE crmt_report_locatorlist_ta,
        ls_result          TYPE crmt_report_locatorlist.



  DATA: r_comp TYPE RANGE OF sychar30 WITH HEADER LINE.

*Build Param List of Fields We Want to Send Data
  r_comp-sign = 'I'.
  r_comp-option = 'EQ'.
  r_comp-low  = 'PERSON_RESP'.
  APPEND r_comp.

  r_comp-sign = 'I'.
  r_comp-option = 'EQ'.
  r_comp-low  = 'PERSON_RESP_LIST'.
  APPEND r_comp.
*
  CALL FUNCTION 'GET_COMPONENT_LIST'
    EXPORTING
      program    = sy-repid
      fieldname  = 'LS_RESULT'
    TABLES
      components = lt_components.

  IF sy-subrc = 0.
    LOOP AT lt_components INTO lv_components WHERE compname NOT IN r_comp.
      ls_requ_columns-column    = lv_components-compname.
      ls_requ_columns-requested = ''.
      APPEND ls_requ_columns TO p_lt_requ_columns.
    ENDLOOP.
  ENDIF.