I know some of you as ABAPER must have gotten some job to get data from report painter whether standard or custom.

For some reason it is something complicated job to fiddle with original SAP Report painter standard, in other side you need some important data for your custom report.

There are 2 solution for that’s problem :

  1. You can use JOB_OPEN .. SUBMIT .. JOB_CLOSE then read and parsing spool.
  2. You can use function module CRIF_RW_WEB_CALL_REPORT.

First method, you need to create job then read spool. please refer to this ABAP code below:

CALL FUNCTION 'GRW_JOB_SUBMIT_PREPARE'
EXPORTING
i_report_group = 'Z001'
IMPORTING
e_program_name = lv_program
EXCEPTIONS
report_group_invalid = 1
no_authority = 2
report_group_locked = 3
program_type_invalid = 4
OTHERS = 5.


REFRESH : isel, li_bufferz.

CALL FUNCTION 'CONVERSION_EXIT_AUFNR_INPUT'
EXPORTING
input = im_aufnr
IMPORTING
output = lv_aufnr.

mc_xsel : '_6ORDGRP' 'EQ' lv_aufnr ''.

mc_pxsel : '$6-KOKRS' '1000',
'$FFGJAHR' im_year.


CONCATENATE 'H2HBUDGET' sy-datum sy-uzeit INTO gv_jobname.

CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = gv_jobname
IMPORTING
jobcount = gv_jobcount
EXCEPTIONS
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03
OTHERS = 4.


SUBMIT (lv_program) WITH SELECTION-TABLE isel
VIA JOB gv_jobname
NUMBER gv_jobcount AND RETURN .


CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = gv_jobcount
jobname = gv_jobname
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.

CLEAR lv_finish.
WHILE lv_finish = ''.
SELECT SINGLE * FROM tbtcp INTO lw_tbtcp WHERE jobname = gv_jobname
AND jobcount = gv_jobcount
AND status = 'F'.
IF sy-subrc EQ 0.
lv_finish = 'X'.
EXIT.
ENDIF.

ENDWHILE.

"REad RAW Spool
lv_rqident = lw_tbtcp-listident .
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = lv_rqident
last_line = 999999999
desired_type = 'RAW'
TABLES
buffer = li_bufferz
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
OTHERS = 8.

The second way, you can use function module CRIF_RW_WEB_CALL_REPORT

 DATA: lt_params  TYPE STANDARD TABLE OF alv_s_param_wp,
        lwa_params TYPE alv_s_param_wp,
        lwa_msg    TYPE bapiret2,
        gt_msg     TYPE TABLE OF bapiret2,
        lv_dcpfm   TYPE xudcpfm,
        gt_data    TYPE STANDARD TABLE OF grwwebdata.

  CLEAR:gt_data.
  REFRESH : gt_data, gt_msg.
* SET REPORT painter paramters

  lwa_params-pname = '$SELECT-OPTION[_6ORDGRP'.
  lwa_params-pvalue = 'I[EQ[1101500003'.
  APPEND lwa_params TO lt_params .

  lwa_params-pname = '$PARAMETER[$FFGJAHR'.
  lwa_params-pvalue = im_year.
  APPEND lwa_params TO lt_params .

  lwa_params-pname = '$PARAMETER[$6-KOKRS'.
  lwa_params-pvalue = '1000'.
  APPEND lwa_params TO lt_params .

  CALL FUNCTION 'CRIF_RW_WEB_CALL_REPORT'
    EXPORTING
      i_report_group = 'Z001'
*     I_PERS_APPL    =
*     I_NEW_SELECTION =
*     I_DISPLAY_LIST =
*     I_APPL_ID      =
*     I_VAR          =
    TABLES
      it_params      = lt_params
      et_data        = gt_data
      et_messages    = gt_msg.