cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering a report after the completion of processing the session

Former Member
0 Kudos

Hi Friends,

I want to know how to trigger an report after the completion of processing the session.

Thanks,

Raj

Accepted Solutions (0)

Answers (1)

Answers (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

what session, batch input session?

Regards,

Rich Heilman

Former Member
0 Kudos

Yes. This session is being created by BDC program (Session method)

suresh_datti
Active Contributor
0 Kudos

Hi Raj,

In the custom program that creates the session, you can use SUBMIT RSBDCSUB and RETURN to process the session and then SUBMIT the report you want to trigger upon completion of the session.

Regards,

Suresh Datti

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yep, just like Suresh said.

Regards,

Rich Heilman

Former Member
0 Kudos

I'm not 100% sure but won't this cause the report to be submitted and run while the session is running, rather than after it has completed?

Rob

Former Member
0 Kudos

I am facing the same problem mentioned by Rob.

Thanks,

Raj

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Will the RSBDCSUB program not run the BDC to completion? If not, then no this will not work.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi guy

I think a little problem can occur: the program RSBDCSUB creates a new job runs the bdc session, so the submit for RSBDCSUB doesn't mean the BDC session is elaborated, but the job for it is scheduled.

So you make sure that job has ended, RSBDCSUB usually creates a job with the same name of BDC session.

After calling RSBDCSUB you should check the status of job.

Max

suresh_datti
Active Contributor
0 Kudos

In that case, you will have to create an EVENT & use BP_EVENT_RAISE or similar stuff to trigger the report after the BDC session..

Regards,

Suresh Datti

Former Member
0 Kudos

I'm pretty sure that it just initiates the BDC and then quits. We had this issue when we went live years ago and never resolved it.

I suppuse you could write a program that would run after RSBDCSUB finishes that examines the session log and tries to determine if the session is running and checks every so often to see if it's done, but I don't know if it would be worth it.

Rob

Former Member
0 Kudos

Hi

I did a flow like this:

- Create a job (for a certain REPORT-A) is triggered by certain event;

- Cretate a REPORT-B runs RSBDCSUB to submit my BDC session and after my REPORT-C to check the status of job session.

- The REPORT-C actives the event (if job has ended) to trigger REPORT-A

Max

Former Member
0 Kudos

Max,

Do you have code for REPORT-C.

Thanks,

Raj

Former Member
0 Kudos

Hi

----


  • SELECTION-SCREEN *

----


PARAMETERS: p_name LIKE apqi-groupid,

p_datum LIKE apqi-credate,

p_time LIKE apqi-cretime,

p_event LIKE tbtco-eventid.

----


  • DATA *

----


DATA: fl_job_ok TYPE c,

fl_event TYPE c,

cont_sysubrc_6 TYPE i.

DATA: start_time LIKE sy-uzeit,

start_date LIKE sy-datum,

time LIKE sy-uzeit,

delta_time TYPE i.

DATA: apqitab LIKE STANDARD TABLE OF apqi WITH HEADER LINE.

DATA:

btc_running LIKE tbtco-status VALUE 'R',

btc_ready LIKE tbtco-status VALUE 'Y',

btc_scheduled LIKE tbtco-status VALUE 'P',

btc_released LIKE tbtco-status VALUE 'S',

btc_aborted LIKE tbtco-status VALUE 'A',

btc_finished LIKE tbtco-status VALUE 'F',

btc_put_active LIKE tbtco-status VALUE 'Z',

btc_unknown_state LIKE tbtco-status VALUE 'X'.

______________________________________________________________________

  • START-OF-SELECTION *

______________________________________________________________________

START-OF-SELECTION.

DATA: a VALUE '1', b.

  • Controllo esistenza job:

start_time = sy-uzeit.

start_date = sy-datum.

DO.

apqitab-creator = sy-uname.

CALL FUNCTION 'BDC_OBJECT_SELECT'

EXPORTING

name = p_name

datatype = 'BDC'

  • CLIENT = SY-MANDT

date_from = p_datum

  • DATE_TO =

time_from = p_time

  • TIME_TO =

  • QSTATE = 'F'

session_creator = apqitab-creator

TABLES

apqitab = apqitab

EXCEPTIONS

invalid_datatype = 1

OTHERS = 2.

IF sy-subrc <> 0.

fl_job_ok = space.

ELSE.

LOOP AT apqitab.

CASE apqitab-qstate.

WHEN 'F'. fl_job_ok = 'X'. EXIT.

WHEN 'E'. fl_job_ok = 'E'. EXIT.

WHEN OTHERS. fl_job_ok = space.

ENDCASE.

ENDLOOP.

IF fl_job_ok = 'X' OR fl_job_ok = 'E'.

EXIT.

ENDIF.

ENDIF.

IF start_date <> sy-datum.

start_time = sy-uzeit.

ENDIF.

time = sy-uzeit.

delta_time = time - start_time.

IF delta_time > 1800.

EXIT.

ENDIF.

REFRESH apqitab.

ENDDO.

IF fl_job_ok = 'X'. " Trovato JOB

fl_event = 'X'.

IF fl_event = 'X'.

  • Attiva evento

CALL FUNCTION 'BP_EVENT_RAISE'

EXPORTING

eventid = p_event

EXCEPTIONS

bad_eventid = 1

eventid_does_not_exist = 2

eventid_missing = 3

raise_failed = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE e999(zfagm) WITH p_event 'is not actived'(002).

ELSE.

MESSAGE i999(zfagm) WITH p_event 'is successfully actived'(002).

ENDIF.

ELSE.

MESSAGE e999(zfagm) WITH p_event 'is not actived'(002).

ENDIF.

ELSE.

IF fl_job_ok = space.

MESSAGE e999(zfagm) WITH p_event 'is successfully actived'(002).

ELSE.

MESSAGE e999(zfagm) WITH p_event 'is successfully actived'(002).

ENDIF.

ENDIF.

Max

Former Member
0 Kudos

Why doesn't REPORT-C simply submit the other report?

Rob

Former Member
0 Kudos

Hi Rob

Because in my situation the other report had to be scheduled before BDC session was created, so I need a report controlled the job and raised the event.

Anyway REPORT-C can submit the report as you say.

Max

Former Member
0 Kudos

Max,

So if I give the session name, date, time and the event, will your report check the status and then trigger the next report?

Thanks,

Raj

Former Member
0 Kudos

Yes it is.

Just I said, the report RSBDCSUB create a job with the name of the session, so you can find and check a job has the same name of the session and it's created after the session was created (you should know the date and the time of your session).

In my example I used a validation to force the exit from loop DO/ENDO because I was afraid my job (Z-REPORTC) could work infinitely.

Max