‎2009 May 19 6:52 AM
Hi,
As per my requirement, i need to perform batch determination while converting the Planned order to Production order.
I should convert only if Suitable Batch is available. But once we prepare the session in BDC, we won't be having any control to determine whether batch is assigned or not . So i have to perform the Batch determination before preparing & processing the session.
Do we have any standard function modules or available programs to cater this requirement.
Thanks,
Surya
‎2009 May 19 7:45 AM
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 7:54 AM
Thanks for the reply
Batch -
> not BDC batch session, Batch (CHARG) is an Attribute of Material
Edited by: Surya chowdary on May 19, 2009 8:54 AM
‎2009 May 26 6:35 AM
I got the Answer,
Use VB_BATCH_DETERMINATION Function module
Edited by: Surya chowdary on May 26, 2009 7:35 AM