‎2009 May 18 2:29 PM
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
‎2009 May 18 2:55 PM
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.
‎2009 May 19 10:23 AM
Hello,
SUBMIT report RSBDCSUB from your Z report and pass the session name.
This is the standard procedure followed.
Regards
Arindam
‎2009 May 20 7:15 AM
Going for a BAPI. So, issue is resolved.
Thanks and Regards,
Venkata Phani Prasad K
‎2009 May 20 9:56 AM
Check if this link can help you out : http://www.sap-img.com/ab001.htm