Application Development and Automation 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: 
Read only

Executing a BDC Session using a Function Module from a Custom Z-Report

Former Member
0 Likes
874

Hello,

I have a requirement where I need to Create a BDC Session for the given Transaction Code. But instead of executing the Session from SM35 manually, I need to Execute the Session Immediately from my Custom Z-Report itself.

Is there any Function Module for this Activity? Please let me know.

Thanks and Regards,

Venkata Phani Prasad K

4 REPLIES 4
Read only

Former Member
0 Likes
679

1) fm job_open

2) submit report

3) fm job_close

4) finally select table TBTCO

example:

DATA: jobcount_test LIKE tbtcjob-jobcount,

job_released LIKE btch0000-char1,

rcode(2),

strtimmed LIKE btch0000-char1 VALUE 'X'.

DATA jobname LIKE tbtcjob-jobname.

CONCATENATE 'TEST_' sy-repid '_' sy-datum INTO jobname.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = jobname

IMPORTING

jobcount = jobcount_test

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc NE 0.

MESSAGE x000(yp) WITH 'JOB-START ' jobname ' failed !!!'.

ELSE.

*--Step insert

SUBMIT rsbdcsub

USER sy-uname VIA JOB jobname NUMBER jobcount_test

WITH mappe = map

WITH von = pdatum

WITH z_verarb = 'X'

AND RETURN .

*

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = jobcount_test

jobname = jobname

strtimmed = strtimmed

targetsystem = sy-host

IMPORTING

job_was_released = job_released

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.

IF sy-subrc > 1.

MESSAGE x000(yp) WITH 'JOB-CLOSE ' jobname ' failed!!!'.

ENDIF.

ENDIF.

Read only

Former Member
0 Likes
679

Hello,

SUBMIT report RSBDCSUB from your Z report and pass the session name.

This is the standard procedure followed.

Regards

Arindam

Read only

Former Member
0 Likes
679

Going for a BAPI. So, issue is resolved.

Thanks and Regards,

Venkata Phani Prasad K

Read only

Former Member
0 Likes
679

Check if this link can help you out : http://www.sap-img.com/ab001.htm