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: 

BDC question

Former Member
0 Kudos

Hi!

I have a program that creates two bdc sessions and executes them.

The user wants the program to run the first bdc and waits for its processing. If the execution was successful, then run the next one.

Is it possible to check the status of bdc session in a program?

Thanks in advance,

Cristian

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I don't think that would be possible with the BDC session method. You can use the CALL TRANSACTION method for the first one and then for second the session method depending on the success of the first one.

Regards,

Ravi

Note : Please mark the helpful answers

8 REPLIES 8

Former Member
0 Kudos

I don't think that would be possible with the BDC session method. You can use the CALL TRANSACTION method for the first one and then for second the session method depending on the success of the first one.

Regards,

Ravi

Note : Please mark the helpful answers

0 Kudos

HI,

I have a requirement to call 2 Tcodes in BCD pgrogram using session method.

(1) Do i need to create 2 session Id'd i mean 2 group Id's for each Tcode ?

(2) eg: if a record in flat file is '1' then it sd go to TCODE1 else if '2' it sd got TCODE2 n update .

plz help me on the same.

Thanks

former_member181962
Active Contributor
0 Kudos

Pass the session name to the function module job_submit tfor processing .

If it return a sy-subrc = 6, "JOB_SUBMIT_FAILED

then its a failure.

Regards,

ravi

Former Member
0 Kudos

Hi

It's not easy to check the status,because the std RBDCSUB create a job to run the session, when the job is finished doesn't mean the session is correctly ended, but only the job is finished, so:

- u should check the job is finished

- u should check the session status in the table APQI.

Max

Former Member
0 Kudos

Hi Cristian,

Its not possible to check the status of BDC program before calling the transaction. You can do this only after calling the transaction and then proceed with the next transaction.

Consider this sample code.


DATA: bdcdata_1 TYPE TABLE OF bdcdata,
      bdcdata_2 TYPE TABLE OF bdcdata.

DATA: itab_1 TYPE TABLE OF bdcmsgcoll,
      itab_2 TYPE TABLE OF bdcmsgcoll.

CALL TRANSACTION 'VA21'  USING bdcdata_1
                         MODE 'N'
                         UPDATE 'S'
                         MESSAGES INTO itab_1.
COMMIT WORK AND WAIT.

or

 <i>We can use Ravi's suggestion</i> 
CALL FUNCTION <b>'JOB_SUBMIT'</b>
  EXPORTING
    authcknam                         =
    jobcount                          =
    jobname                           =
    language                          = sy-langu
 EXCEPTIONS
   bad_priparams                     = 1
   bad_xpgflags                      = 2
   invalid_jobdata                   = 3
   jobname_missing                   = 4
   job_notex                         = 5
   job_submit_failed                 = 6
   lock_failed                       = 7
   program_missing                   = 8
   prog_abap_and_extpg_set           = 9
   OTHERS                            = 10.
IF sy-subrc EQ 0.

  CALL TRANSACTION 'VA22'  USING bdcdata_1
                           MODE 'N'
                           UPDATE 'S'
                           MESSAGES INTO itab_2.


ENDIF.

Regards,

Arun Sambargi.

Message was edited by: Arun Sambargi

Message was edited by: Arun Sambargi

Message was edited by: Arun Sambargi

Former Member
0 Kudos

Use function module BDC_RUNNING to find out if the the session is still active. Based on that you can run the second one.

Former Member
0 Kudos

Thanks for your replies! Rewards points for everyone!

Cristian

Former Member
0 Kudos

Hi,

please use (SM36), then press on "start condition" and select your 2nd BDC to be executed after the 1st event. But please be advise that the 2nd BDC, will start regardless of any error in the 1st BDC. Hope this will help you to solve your BDC issue.

Regards,

Saeed

Message was edited by: Saeed ALi