‎2011 Jun 24 6:39 AM
Hi Experts,
May I know if there is any way to execute the GR55 Report Painter reports, and get the report result back as a table?
I need this to write a program to export the result to a external system.
Many thanks!!!
Regards,
Chris
‎2011 Jun 25 10:12 PM
Hi,
There is one option. Execute the report with the transaction GR55. Then, export the report to excel (Report -- > Export --- > Export format Spreadsheet). A window will appear (select Change and continue button). The file will be saved as a DAT file format.
Then, you can pass the Excel file to an internal table in ABAP with the function ALSM_EXCEL_TO_INTERNAL_TABLE
Regards,
David Z.
‎2011 Jul 14 7:30 AM
I am actually expecting a ABAP way to do so, but not to do that in foreground manually.
I found the solution anyway by using the below sample code:
&----
*& Form frm_retrieve_data
&----
text:Get report painter Result
----
FORM frm_retrieve_data .
DATA:lt_params TYPE STANDARD TABLE OF alv_s_param_wp,
lwa_params TYPE alv_s_param_wp,
lwa_msg LIKE LINE OF gt_msg,
lv_dcpfm TYPE xudcpfm.
CLEAR:gt_data,gt_msg.
Set report painter Paramters
lwa_params-pname = '$PARAMETER[$ZRYEAR0'.
lwa_params-pvalue = sy-datum+0(4).
APPEND lwa_params TO lt_params .
lwa_params-pname = '$PARAMETER[$ZBUKRS0'.
lwa_params-pvalue = 'JNPC'.
APPEND lwa_params TO lt_params .
lwa_params-pname = '$PARAMETER[$ZBUKRS1'.
lwa_params-pvalue = 'JNPC'.
APPEND lwa_params TO lt_params .
lwa_params-pname = '$PARAMETER[$ZF-RP00'.
lwa_params-pvalue = sy-datum+4(2).
APPEND lwa_params TO lt_params .
CALL FUNCTION 'CRIF_RW_WEB_CALL_REPORT'
EXPORTING
i_report_group = 'JNZ1'
TABLES
it_params = lt_params
et_data = gt_data
et_messages = gt_msg.
LOOP AT gt_msg INTO lwa_msg
WHERE type = 'E' OR type = 'A'.
gv_flg = cns_yes.
EXIT.
ENDLOOP.
IF gv_flg IS INITIAL AND
gt_data IS INITIAL.
gv_flg = cns_nodata.
ENDIF.
ENDFORM. " frm_retrieve_data