06-12-2007 9:17 PM
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.
06-12-2007 9:20 PM
Hello,
Pass the original program name instead of the sy-repid in the export parameter.
In FM, if you use the sy-repid, than system automatically takes the program name of the Function Group.
Regards,
Naimesh
06-12-2007 9:31 PM
Use SY-CPROG instead of SY-REPID. It should be work.
reward if helpful.
06-12-2007 10:04 PM
These suggestions do not work. I tried using the include program name, the function group program name (ie. SAPL...), the function group name, the function name, and sy-cprog. Any other ideas?
06-12-2007 10:11 PM
06-12-2007 10:17 PM
Hey Jason,
Hw r u? Well Jason...Have you declared all parameters correctly. I had used this FM in a function grp n it worked for me.
Here is the same code. Try giving the function group name in REPORT variable. Hope it helps.
<b>DATA: REPORT LIKE TRDIR-NAME</b>.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
PROGRAM = REPORT
FIELDNAME = FIELD1
TABLES
COMPONENTS = COMPONENTS
EXCEPTIONS
OTHERS = 1.
Hope it helps.
Rgds,
Naren
Message was edited by:
Somen
06-12-2007 10:18 PM
do not pass sy-cporg directly to FM
data v_prog type sy-cprog.
clear v_prog
v_prog = sy-cprog.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = v_prog
fieldname = 'LS_RESULT'
TABLES
components = lt_components.
see the results
06-12-2007 10:28 PM
Still not working. This code works properly in a report program using sy-repid. I am now trying to use it in a function module which calls a subroutine that resides in the same function group (different include of course). I have tried all these suggestions, as well as, the obvious stuff like making sure the var name is correct, etc. Any other functions like COMPONENT_LIST that I can try???
06-12-2007 10:35 PM
Okay guys, I got it. I had to use sy-repid, and declare the variable I am passing to fieldname as global.
Thanks for your efforts. I appreciate the help.
Kind Regards,
Jason