Application Development 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: 

submit_report error during submitted report

Former Member
0 Kudos

Hi,

I want to ask if there is any option how to "catch" error messages which occurs when report is submitted via function module submit_report?

Result of the report is read from memory, but when the submitted report calls some message (which will originally be displayed on screen (bottom line in SAPGui)) I do not know how to catch it and handle it my way. In this case show to web dynpro message area.

Is it even possible or should I change the way report is submitted? Condition is that result will be put to memory.

Thanks

Every little help will appreciated.

Martin

3 REPLIES 3

Former Member
0 Kudos

Hi,

try this way.

there are two options to catch the Errors or Ouput of the report..



*   Submit report in background and creating spool
  SUBMIT (w_rname) USING SELECTION-SET p_var
      TO SAP-SPOOL WITHOUT SPOOL DYNPRO
      SPOOL PARAMETERS wa_pri_params AND RETURN.
  COMMIT WORK AND WAIT.
*   To fetch the spool number from TSP01 table
  IF sy-subrc EQ 0.
    SELECT rqident
           FROM tsp01
           INTO p_spool
*             UP TO 1 ROWS
           WHERE rq2name = wa_pri_params-plist.
    ENDSELECT.
  ENDIF.

* Fetching Spool data into internal table
  CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
    EXPORTING
      rqident              = p_spool
    TABLES
      buffer               = t_data                    "This will hold the all errors or Ouput or all steps of the Report 

PrabhuD@s

Former Member
0 Kudos

Hi,

MESSAGE <message text> TYPE I DISPLAY LIKE E

STOP.

or

If your program is not dependent on the SUBMITTED program i.e..,Some thing like that standard program doesn't have any output.

CALL JOB_OPEN

SUBMIT standard program

CALL JOB_CLOSE.

This creates a batch job for standard program.

If your program is dependent, then i don't see any possibility

Regards,

Sekhar

0 Kudos

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = v_name

IMPORTING

jobcount = v_number.

IF sy-subrc EQ 0.

SUBMIT rm06ibi0 WITH ds_name = c_logfile

AND RETURN.

SUBMIT rsbdcsub VIA JOB v_name NUMBER v_number

WITH mappe = v_name

WITH z_verarb = c_x

WITH fehler = space

TO SAP-SPOOL

SPOOL PARAMETERS v_print_parameters

WITHOUT SPOOL DYNPRO

USER lc_p2p_batch

AND RETURN.

IF sy-subrc EQ 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = v_number

jobname = v_name

strtimmed = c_x.

IF sy-subrc <> 0.

MESSAGE s000 WITH text-001.

ENDIF.

ENDIF.

ENDIF.

*--To check the status of background job if completed or not

DO 100 TIMES.

CALL FUNCTION 'BDC_OBJECT_SELECT'

EXPORTING

name = lv_name

datatype = 'BDC'

client = sy-mandt

date_from = sy-datum

TABLES

apqitab = lt_apqi.

SORT lt_apqi BY credate DESCENDING cretime DESCENDING.

READ TABLE lt_apqi INTO lx_apqi INDEX 1.

IF sy-subrc EQ 0.

IF lx_apqi-qstate EQ c_qstate_f " processing completed

OR lx_apqi-qstate EQ c_qstate_e." processing ended in error

EXIT.

ELSE. " still processing

WAIT UP TO 5 SECONDS.

ENDIF.

ENDIF.

ENDDO.

COMMIT WORK.

TYPES: BEGIN OF ty_apql,

temseid TYPE rstsoname,

credate TYPE apq_crda,

cretime TYPE apq_crti,

END OF ty_apql.

CONSTANTS: lc_asc TYPE char3 VALUE 'ASC',

lc_mes TYPE char10 VALUE 'LV_MESSAGE'.

FIELD-SYMBOLS: <lfs_var> TYPE ANY.

DATA: lt_apql TYPE STANDARD TABLE OF ty_apql,

lx_apql TYPE ty_apql,

lx_logfile TYPE btctle,

lv_charco TYPE cpcodepage VALUE '0000',

lv_number TYPE symsgno,

lv_message1 TYPE symsgv,

lv_message2 TYPE symsgv,

lv_message3 TYPE symsgv,

lv_message4 TYPE symsgv,

lv_mlen TYPE i,

lv_var TYPE char11,

lv_index TYPE n,

lx_bdclm TYPE bdclm.

DATA: lt_bdclm TYPE STANDARD TABLE OF bdclm.

CLEAR t_logfile.

SELECT temseid

credate

cretime

FROM apql

INTO TABLE lt_apql

WHERE mandant EQ sy-mandt

AND credate EQ sy-datum

AND groupid EQ v_name.

CHECK sy-subrc EQ 0.

SORT lt_apql BY credate DESCENDING

cretime DESCENDING.

READ TABLE lt_apql INTO lx_apql INDEX c_one.

CHECK sy-subrc EQ 0.

CALL FUNCTION 'RSTS_GET_ATTRIBUTES'

EXPORTING

authority = ' '

client = sy-mandt

name = lx_apql-temseid

IMPORTING

charco = lv_charco.

IF cl_abap_char_utilities=>charsize > 1.

lv_charco = '0000'.

ENDIF.

CALL FUNCTION 'RSTS_OPEN_RLC'

EXPORTING

name = lx_apql-temseid

client = sy-mandt

authority = 'BATCH'

prom = 'I'

rectyp = 'VNL----'

charco = lv_charco

EXCEPTIONS

fb_call_handle = 4

fb_error = 8

fb_rsts_noconv = 12

fb_rsts_other = 16

no_object = 20

OTHERS = 24.

IF sy-subrc NE 0.

EXIT.

ENDIF.

CALL FUNCTION 'RSTS_READ'

TABLES

datatab = t_logfile

EXCEPTIONS

fb_call_handle = 4

fb_error = 8

fb_rsts_noconv = 12

fb_rsts_other = 16

OTHERS = 16.

IF sy-subrc NE 0.

EXIT.

ENDIF.

CALL FUNCTION 'RSTS_CLOSE'

EXCEPTIONS

OTHERS = 4.

IF sy-subrc NE 0.

EXIT.

ENDIF.

LOOP AT t_logfile INTO lx_logfile.

lx_bdclm = lx_logfile.

APPEND lx_bdclm TO lt_bdclm.

CLEAR lx_bdclm.

ENDLOOP.

LOOP AT lt_bdclm INTO lx_bdclm WHERE mart NE c_warning.

CLEAR: lv_message1, lv_message2, lv_message3, lv_message4.

IF lx_bdclm-mparcnt > 0.

DO.

lv_mlen = lx_bdclm-mpar+0(2).

lx_bdclm-mpar = lx_bdclm-mpar+2.

lv_index = sy-index.

CONCATENATE lc_mes lv_index INTO lv_var.

ASSIGN (lv_var) TO <lfs_var>.

IF lv_mlen GT 0.

<lfs_var> = lx_bdclm-mpar+0(lv_mlen).

ELSE.

<lfs_var> = lx_bdclm-mpar.

ENDIF.

lx_bdclm-mpar = lx_bdclm-mpar+lv_mlen.

IF sy-index >= lx_bdclm-mparcnt.

EXIT.

ENDIF.

ENDDO.

ENDIF.

IF lv_message2 = '000000000000'.

lv_message2 = ' '.

ENDIF.

IF lv_message3 = '0000000000'.

lv_message3 = ' '.

ENDIF.

IF lv_message4 = '0000000'.

lv_message4 = ' '.

ENDIF.

lv_number = lx_bdclm-mnr.

CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'

EXPORTING

id = lx_bdclm-mid

number = lv_number

language = sy-langu

textformat = lc_asc

message_v1 = lv_message1

message_v2 = lv_message2

message_v3 = lv_message3

message_v4 = lv_message4

IMPORTING

message = x_session-message.

IF lx_bdclm-tcnt <> space .

x_session-zlineno = lx_bdclm-tcnt + 2 .

ELSE.

x_session-zlineno = ' '.

ENDIF.

APPEND x_session TO t_session.

CLEAR x_session.

ENDLOOP.

Edited by: Rahul Babukuttan on Mar 22, 2011 6:37 AM

Edited by: Rahul Babukuttan on Mar 22, 2011 6:39 AM