Call transaction FB01 vs submit RSBDCSUB
Hi guys,
I would like to know how I can get the message log when I execute
SUBMIT RSBDCSUB WITH MAPPE EQ G_GROUP "batch input name
WITH Z_VERARB EQ 'X'
WITH FEHLER EQ SPACE
WITH LOGALL EQ SPACE
EXPORTING LIST TO MEMORY
AND RETURN.
instead of :
CALL TRANSACTION 'FB01' USING BDCDATA
MODE 'N' UPDATE 'S'
MESSAGES INTO MESSTAB.
I would like get the same information of MESSTAB but using submit RSBDCSUB
I try it with :
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = LISTOBJECT
EXCEPTIONS
NOT_FOUND = 4
OTHERS = 8.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1
TABLES
LISTASCI = VLIST
LISTOBJECT = LISTOBJECT
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
LISTOBJECT = LISTOBJECT.
And in VLIST I only get the number of folder with G_GROUP batch info.
for example " 2 folder get it". I would like to know for example if there are errors in my batch input.
Thanks a lot in advance.
Best regards.
Ana
I'd not suggest your solution.
better use RFBIBL00 ( or BAPI_ACC_DOCUMENT_POST - read docu)
for rfbibl00 you can use
SUBMIT RFBIBL00 WITH callmode = 'D'....
A.
Similar Messages
-
Batch-Input/CALL TRANSACTION FB01: Trading Partner cannot be filled in
Dear experts,
I have the following problem with performing an FB01 booking on the basis of
CALL TRANSACTION USING:
In the customizing of the FI document type you can mark several fields that
are supposed to appear when you perform an FB01 posting, among them
the "Trading partner". But this field only seems to show in Non-BTCI-mode.
There are SAP Notes treating the phenomenon of the additional COBL-data
screen being always brought up with all available fields in BTCI mode
(which is fine for me, since I actually want to fill in some fields there, too),
but this screen does not contain the trading partner and I can't find any hint
why fields like BSEG-VBUND (trading partner) apparently cannot be reached
at all in BTCI-Mode.
Does anybody know this problem, or better yet: have a solution ?
Thanks in advance
AndreasHello Akanksha,
I suppose you're interested in how you make the fields available/visible
in the posting transactions ?
BSEG-VBUND/Trading partner for instance belongs to the
supposed-to-be-available checkbox-selection in customizing of the
document type you are going to use for your posting.
The availability of the additional controlling fields (cost center, order no. etc.)
depends on the cost accounting being active and on the field status group
that is chosen for your account.
In the booking/posting transactions you reach the fields with the button
"further data".
Best regards
Andreas -
Is it possible to change user in call transaction ??
Hi experts,
There is a custom RFC FM wich makes some call transacion (for example to ME21N) and is invoked from .NET. The user logged in that moment is 'USER1' but the client wants user 'USER2' to appear in standard tables (EKKO...) and in ME23N. It's not possible that the client loggs on with USER2 as he needs the password and we don't like to share it whith them.
I found this:
l_Fecha = sy-datum - 1.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'maria'
user = 'USER2'
keep = space
holddate = l_fecha.
(code for the batch input)
CALL TRANSACTION 'ME21N' USING i_bdcdata
MODE w_mode UPDATE 'S'
MESSAGES INTO i_messtab.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
SUBMIT rsbdcsub
WITH bis = sy-datum
WITH fehler = space
WITH logall = space
WITH mappe = 'maria'
WITH von = sy-datum
WITH z_verarb = 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
But when the PO is created, the user is still USER1.
Is it possible to change the user at any moment ??
Thanks in advance !!
Regards,
MaríHi
You are using ME21n which is and ENJOY transaction.
To update ENJOY Transactions use BAPIs instead of BDC.
because ENJOY transactions are built on control framework which use ActiveX controls (like Grid).
These new transactions should make life for the end user a bit easier, since SAP transactions not always accelerate in design, logic, etc. That's why SAP has introduced these new transactions which in the end, will have the same result. In these socalled 'Enjoy' transactions, SAP started using these 'new' enjoy sap controls like ALV grid, text editor, HTML viewer etc.
For 'updating' Enjoy transaction (BTW: You are NOT updating the transactions, but rather the purchase order or whatever) you will have to use BAPI's (or FM for that matter) in stead of BDC since Enjoy Controls work with a different framework in which you can not call a certain screen and field. Like in an ALV grid, not every field has it's own screen field name. So you cannot use them in BDC.
Hope this makes any sense for your question. As BDC is not reliable for your tcode.
Thanks DP -
What is the diffreence between call transaction and session method
hi gurus
can any one suggest me
what is the difference between call transaction and session methods
in which cases we have to use teh call transaction and
in which cases we have to use session method.
thank you
regards
kals.CLASSICAL BATCH INPUT (Session Method)
CALL TRANSACTION
BATCH INPUT METHOD:
This method is also called as ‘CLASSICAL METHOD’.
Features:
Asynchronous processing.
Synchronous Processing in database update.
Transfer data for more than one transaction.
Batch input processing log will be generated.
During processing, no transaction is started until the previous transaction has been written to the database.
CALL TRANSACTION METHOD :
This is another method to transfer data from the legacy system.
Features:
Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
Updating the database can be either synchronous or asynchronous. The program specifies the update type.
Transfer data for a single transaction.
Transfers data for a sequence of dialog screens.
No batch input processing log is generated.
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
Among the two methods call transaction is better compared to session bcoz data transfer is faster in it.
Differences between call transaction and session.
Session Method:
1) Data is not updated in the database table until the session is processed.
2) No sy-subrc is returned.
3) Error log is created for error records.
4) Updation is always synchronous.
Call Transaction Method:
1) Immediate updation in the database table.
2) sy-subrc is returned.
3)Error need to be handled explicitly.
4) updation can be synchronous as well as asynchronous.
2) ya u can use using the N mode no screen.
3)u can't handle multiple transaction in call transaction.
4) u can handle multiple transaction in session using the BDC_INSERT fm.
5)When u go to SM35 u can able to see the error records.
Which is best?
That depends on your requirement. Both of them have there advantages.
According to the situation u can choose any one of these.
difference between batch input and call transaction in BDC Session method.
1) synchronous processing.
2) can tranfer large amount of data.
3) processing is slower.
4) error log is created
5) data is not updated until session is processed.
Call transaction.
1) asynchronous processing
2) can transfer small amount of data
3) processing is faster.
4) errors need to be handled explicitly
5) data is updated automatically
For session method,these are the function modules to b used.
BDC_OPEN_GROUP
BDC_INSERT
BDC_CLOSE_GROUP
For call transaction,this is the syntax.
CALL TRANSACTION TCODE USING BDCDATA
MODE A or E or N
UPDATE A or S
MESSAGES INTO MESSTAB.
Take a scenario where we need to post documents in FB01 and the input file has say 2000 records (2000 documents, not line items in FB01 but 2000 records)
In the BDC call transaction method
We call the transaction FB01 2000 times (once for each record posting) and if the processing fails in record no 3 it can be captured and start with reocord 4.
Eg: Loop at itab.
call transaction FB01
capture errors
endloop.
In the session method.
We do not explicity call the transaction 2000 times, but all the records are appeneded into a session and this session is stored. The processinf of the session is done wwhenever the user wants it to be done. Hence the errors cannot be captured in the program itself
Check these link:
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
http://www.planetsap.com/bdc_main_page.htm
Batch Input Session method is asynchronous as told by others here. But the advantage of this is that you have all the error messages and the data for each transaction held persistantly. You don't have to code anything for processing them or writing the logs.
But at the same time, the same feature can be disadvantageous if you need to react to an error or if there are too many errors to manually correct in a session. Since the session are created in the program and its execution is done seperately, you loose the trackability of such transactions.
With a call transaction, what was a disadvantage above will become an advantage. Call transaction immediately gives you messages back and you can react to it in your program. But the disadvantage is that, if you have several hundreds of transactions to run, running them from within the program can be resource crunching affair. It will hamper the system performance and you cannot really distribute the load. Of course, you have some mechanisms with which you can overcome this, but you will have to code for it. Also, storing the messages and storing the errored transaction data etc will have to be handled by you in the program. Whereas, in batch input session, your program's job is to just create the session, after that everything is standard SAP system's responsibility.
Ideally, you should do a call transaction if the resources are not a problem and if it fails, put the errored transaction into a session.
You can decide based on the data volume that your BDC is processing. If data volume is high go for session else call transaction will do.The call transaction updates will be instantaneous where as session needs to be processed explictly after creation.
Session Method
1) Session method supports both small amount of data aswell as large amount of data
2) data processing is asynchronus and data updation is synchronus.
3) it process multiple apllication while perfomaning validations.
4) in session method data will be updated in data base only after processing session only.
5) system provide by default logfile for handling error records.
6) it supports both foreground aswell as background process
in bdc we use FM ...
bdc_open_group " for creating Session
bdc_insert " adding transaction and bdcdata table for updating database
bdc_close_group " for closing Session
Call Transaction
1) Call transaction exclusively for small amout of data
2) it supports only one apllication while perfoming validations
3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.
we can create logfile by using structure....BDCMSGCOLL
4) it doesn't support background processing.
5) data processing is synchronous and Data updation is Synchronous( default), in
this method also supports daya updation in asynchronus process also.
syntax:
Call transaction <transaction-name> using BDCDATA
mode <A/N/E>
update <L/A/S>
messages into BDCMSGCOLL.
BDC:
Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.
Features :
BDC is an automatic procedure.
This method is used to transfer large amount of data that is available in electronic medium.
BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).
BDC uses normal transaction codes to transfer data.
Types of BDC :
CLASSICAL BATCH INPUT (Session Method)
CALL TRANSACTION
BATCH INPUT METHOD:
This method is also called as ‘CLASSICAL METHOD’.
Features:
Asynchronous processing.
Synchronous Processing in database update.
Transfer data for more than one transaction.
Batch input processing log will be generated.
During processing, no transaction is started until the previous transaction has been written to the database.
CALL TRANSACTION METHOD :
This is another method to transfer data from the legacy system.
Features:
Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
Updating the database can be either synchronous or asynchronous. The program specifies the update type.
Transfer data for a single transaction.
Transfers data for a sequence of dialog screens.
No batch input processing log is generated.
For BDC:
http://myweb.dal.ca/hchinni/sap/bdc_home.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
http://www.sap-img.com/abap/learning-bdc-programming.htm
http://www.sapdevelopment.co.uk/bdc/bdchome.htm
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
Check these link:
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
http://www.planetsap.com/bdc_main_page.htm
call Transaction or session method ?
Check the following links:
http://www.sap-img.com/bdc.htm
See below example code :
Call three FM : BDC_OPEN_GROUP,BDC_INSERT and BDC_CLOSE_GROUP.
Once you execute the program and it creates the session at SM35 Transaction.
Report : ZMPPC011
Type : Data upload
Author : Chetan Shah
Date : 05/05/2005
Transport : DV3K919557
Transaction: ??
Description: This ABAP/4 Program creates new Production Versions
(C223). It accepts tab-delimited spreadsheet input and
creates BDC sessions.
Modification Log
Date Programmer Request # Description
06/10/2005 Chetan Shah DV3K919557 Initial coding
report zmppc011 no standard page heading line-size 120 line-count 55
message-id zz.
pool of form routines
include zmppn001.
Define BDC Table Structure
data: begin of itab_bdc_tab occurs 0.
include structure bdcdata.
data: end of itab_bdc_tab.
Input record layout of Leagcy File
data: begin of itab_xcel occurs 0,
matnr(18) type c,
werks(4) type c,
alnag(2) type c,
verid(4) type c,
text1(40) type c,
bstmi like mkal-bstmi,
bstma like mkal-bstma,
adatu(10) type c,
bdatu(10) type c,
stlal(2) type c,
stlan(1) type c,
serkz(1) type c,
mdv01(8) type c,
elpro(4) type c,
alort(4) type c,
end of itab_xcel.
data: begin of lt_pp04_cache occurs 0,
matnr like itab_xcel-matnr,
werks like itab_xcel-werks,
alnag like itab_xcel-alnag,
plnnr like mapl-plnnr,
arbpl like crhd-arbpl,
ktext like crtx-ktext,
end of lt_pp04_cache.
data: v_ssnnr(4) type n,
v_lines_in_xcel like sy-tabix,
v_ssnname like apqi-groupid,
v_trans_in_ssn type i,
wa_xcel LIKE itab_xcel,
l_tabix like sy-tabix,
v_matnr like rc27m-matnr,
v_plnnr like mapl-plnnr,
v_plnal like mapl-plnal,
v_tcode like sy-tcode value 'C223',
v_plnty like plas-plnty value 'R',
v_objty like crhd-objty value 'A',
v_plpo_steus like plpo-steus value 'PP04',
v_verwe like crhd-verwe value '0007'.
Parameters
selection-screen: skip 3.
selection-screen: begin of block 1 with frame.
parameters: p_name like rlgrap-filename
default 'C:\My Documents\InputFile.txt'
obligatory,
bdc session name prefix
p_bdcpfx(6) default 'ZPVCRT'
obligatory,
number for transction per BDC session
p_trnssn type i
default 2000 obligatory,
retain the BDC session after successfull execution
p_keep like apqi-qerase
default 'X',
user who will be executing BDC session
p_uname like apqi-userid
default sy-uname
obligatory.
selection-screen: end of block 1.
possible entry list (F4 dropdown) for input file name
at selection-screen on value-request for p_name.
*-SELECT FILE FROM USERS LOCAL PC
call function 'WS_FILENAME_GET'
exporting
DEF_FILENAME = ' '
def_path = 'C:\Temp\'
mask = ',.,..'
mode = 'O'
title = 'Select File '(007)
importing
filename = p_name
RC =
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
if sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
begin the show
start-of-selection.
read data from input file
perform transfer_xcel_to_itab.
loop at itab_xcel.
hang on to xcel line num
l_tabix = sy-tabix.
each line in the xcel file marks begining of new prod.version defn
if num-of-trnas-in-session = 0, create new BDC session
if v_trans_in_ssn is initial.
perform bdc_session_open.
endif.
begin new bdc script for rtg create trans
fill in bdc-data for prod.version maintenance screens
perform bdc_build_script.
insert the bdc script as a BDC transaction
perform bdc_submit_transaction.
keep track of how many BDC transactions were inserted in the BDC
session
add 1 to v_trans_in_ssn.
if the user-specified num of trans in BDC session is reached OR
if end of input file is reached, close the BDC session
if v_trans_in_ssn = p_trnssn or
l_tabix = v_lines_in_xcel.
perform bdc_session_close.
clear v_trans_in_ssn.
endif.
endloop.
top-of-page.
call function 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
FORM TRANSFER_XCEL_TO_ITAB *
Transfer Xcel Spreadsheet to SAP Internal Table *
form transfer_xcel_to_itab.
Read the tab-delimited file into itab
call function 'WS_UPLOAD'
exporting
filename = p_name
filetype = 'DAT'
IMPORTING
filelength = flength
tables
data_tab = itab_xcel
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
others = 8.
if sy-subrc = 0.
sort the data
sort itab_xcel by matnr werks.
clear v_lines_in_xcel.
if no data in the file - error out
describe table itab_xcel lines v_lines_in_xcel.
if v_lines_in_xcel is initial.
write: / 'No data in input file'.
stop.
endif.
else.
if file upload failed - error out
write: / 'Error reading input file'.
stop.
endif.
endform.
FORM BDC_SESSION_OPEN *
Open BDC Session *
form bdc_session_open.
create bdc session name = prefix-from-selectn-screen + nnnn
add 1 to v_ssnnr.
concatenate p_bdcpfx v_ssnnr into v_ssnname.
open new bdc session
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = v_ssnname
keep = p_keep
user = p_uname
exceptions
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
others = 11.
endform.
FORM BDC_BUILD_SCRIPT *
Build BDC *
form bdc_build_script.
data: l_arbpl like crhd-arbpl,
l_text1 like mkal-text1,
l_mdv01 like mkal-mdv01,
l_mapl like mapl.
clear bdc-data itab - begin of new bdc transaction
clear itab_bdc_tab.
refresh itab_bdc_tab.
read material cross reference tables to determine sap part#
clear : v_matnr, v_plnnr, v_plnal.
perform read_matnr_cross_ref using itab_xcel-matnr
itab_xcel-werks
changing v_matnr.
determine the version description to use
if itab_xcel-text1 is initial.
l_text1 = itab_xcel-verid.
else.
l_text1 = itab_xcel-text1.
endif.
determine the routing group# and group ctr# to use
perform read_routing .
determine the production line to use
if itab_xcel-mdv01 is initial.
if not provided in the file then:
prod line = work ctr on the last PP04 op of the rtg determined above
perform read_wc_on_last_pp04 using v_plnnr v_plnal
changing l_mdv01.
NOTE: when executing the above form\routine, if v_plnnr is initial
or v_plnal is initial, THEN l_mdv01 will automatically be
returned blank (ie initial)
else.
l_mdv01 = itab_xcel-mdv01.
endif.
build bdc script
perform bdc_build_script_record
fill in initial screen
using: 'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=ENTE',
' ' 'MKAL-WERKS' itab_xcel-werks,
' ' 'MKAL-MATNR' v_matnr,
' ' 'MKAL_ADMIN-DISPO' space,
' ' 'MKAL-PLNNR' space,
' ' 'MKAL_ADMIN-STTAG' space,
' ' 'MKAL-PLNNG' space,
' ' 'MKAL-MDV01' space,
' ' 'MKAL-PLNNM' space,
click create button on initial screen and go to detail screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=CREA',
fill in the detail screen and go back to initial screen
'X' 'SAPLCMFV' '2000',
' ' 'BDC_OKCODE' '=CLOS',
' ' 'MKAL_EXPAND-MATNR' v_matnr,
' ' 'MKAL_EXPAND-VERID' itab_xcel-verid,
' ' 'MKAL_EXPAND-TEXT1' l_text1,
' ' 'MKAL_EXPAND-BSTMI' itab_xcel-bstmi,
' ' 'MKAL_EXPAND-BSTMA' itab_xcel-bstma,
' ' 'MKAL_EXPAND-ADATU' itab_xcel-adatu,
' ' 'MKAL_EXPAND-BDATU' itab_xcel-bdatu,
' ' 'MKAL_EXPAND-PLTYG' v_plnty,
' ' 'MKAL_EXPAND-PLNNG' v_plnnr,
' ' 'MKAL_EXPAND-ALNAG' v_plnal,
' ' 'MKAL_EXPAND-STLAL' itab_xcel-stlal,
' ' 'MKAL_EXPAND-STLAN' itab_xcel-stlan,
' ' 'MKAL_EXPAND-SERKZ' itab_xcel-serkz,
' ' 'MKAL_EXPAND-MDV01' l_mdv01,
' ' 'MKAL_EXPAND-ELPRO' itab_xcel-elpro,
' ' 'MKAL_EXPAND-ALORT' itab_xcel-alort,
save the production version from initial screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=SAVE'.
endform.
FORM BDC_SUBMIT_TRANSACTION *
Submit BDC Session *
form bdc_submit_transaction.
Load BDC script as a trqansction in BDC session
call function 'BDC_INSERT'
exporting
tcode = v_tcode
tables
dynprotab = itab_bdc_tab
exceptions
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
endform.
FORM BDC_BUILD_SCRIPT_RECORD *
form bdc_build_script_record using dynbegin name value.
clear itab_bdc_tab.
if dynbegin = 'X'.
move: name to itab_bdc_tab-program,
value to itab_bdc_tab-dynpro,
'X' to itab_bdc_tab-dynbegin.
else.
move: name to itab_bdc_tab-fnam,
value to itab_bdc_tab-fval.
shift itab_bdc_tab-fval left deleting leading space.
endif.
append itab_bdc_tab.
endform.
FORM BDC_SESSION_CLOSE *
Close BDC Session *
form bdc_session_close.
close the session
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 1
queue_error = 2
others = 3.
skip 2.
if sy-subrc ne 0.
write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.
else.
write : / 'Session created:', v_ssnname,
50 '# of transactions:', v_trans_in_ssn.
endif.
endform.
*& Form read_routing_cache
*FORM read_routing_cache USING pi_matnr
pi_werks
pi_alnag
pi_verid
pi_mdv01.
DATA: BEGIN OF lt_plpo OCCURS 0,
vornr LIKE plpo-vornr,
objty LIKE crhd-objty,
objid LIKE crhd-objid,
arbpl LIKE crhd-arbpl,
END OF lt_plpo,
l_mapl_plnnr LIKE mapl-plnnr.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
SELECT plnnr INTO l_mapl_plnnr
FROM mapl UP TO 1 ROWS
WHERE matnr = pi_matnr AND
werks = pi_werks AND
plnty = 'R' AND
plnal = pi_alnag AND
loekz = space.
ENDSELECT.
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
the work center was not determined yet AND
work center was really needed for this line in the input file
then
read the work center from last PP04 operation on the routing
update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
*ENDFORM. " read_last_pp04_operation_cache
*& Form read_routing
form read_routing.
data: begin of lt_mapl occurs 0,
plnnr like mapl-plnnr,
plnal like mapl-plnal,
end of lt_mapl,
l_arbpl like crhd-arbpl.
get all the rtg# and grp ctr# from MAPL
select plnnr plnal
into corresponding fields of table lt_mapl
from mapl
where matnr = v_matnr and
werks = itab_xcel-werks and
plnty = v_plnty and "Rate Routing
loekz = space. "with del flag = OFF
sort lt_mapl by plnal.
if not itab_xcel-verid is initial.
if the verid=0001 then use the 1st good rtg-grp# and grp-ctr#
if itab_xcel-verid = '0001'.
read table lt_mapl index 1.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
else.
if the verid0001 then use the rtg-grp# and grp-ctr# of the routing
whose work center on the last PP04 operation matches the given verid
loop at lt_mapl.
clear l_arbpl.
get the work center from the last PP04 operation
perform read_wc_on_last_pp04 using lt_mapl-plnnr
lt_mapl-plnal
changing l_arbpl.
if itab_xcel-verid = l_arbpl.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
exit.
endif.
endloop.
endif.
else.
do nothing
endif.
For version IDs that are other then '0000' or 'ZWIP' :--
if itab_xcel-verid NE '0000' and
itab_xcel-verid NE 'ZWIP'.
if routing group# or group counter was not determined, make the
valid-to date 99/99/9999 so that the BDC, on execution, errors out.
if v_plnnr is initial or
v_plnal is initial.
itab_xcel-bdatu = '99/99/9999'.
endif.
endif.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
the work center was not determined yet AND
work center was really needed for this line in the input file
then
read the work center from last PP04 operation on the routing
update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
endform. " read_last_pp04_operation_cache
*& Form read_wc_on_last_pp04
form read_wc_on_last_pp04 using pi_plnnr
pi_plnal
changing pe_arbpl.
data: begin of lt_plpo occurs 0,
vornr like plpo-vornr,
objty like crhd-objty,
objid like crhd-objid,
arbpl like crhd-arbpl,
end of lt_plpo.
get all the PP04 operations for the given rtg# & grp-ctr#
select vornr eobjty eobjid e~arbpl
into corresponding fields of table lt_plpo
from plas as b
inner join plpo as c
on bplnty = cplnty and
bplnnr = cplnnr and
bzaehl = czaehl
inner join crhd as e
on carbid = eobjid
where b~plnty = v_plnty and "Rate Routing
b~plnnr = pi_plnnr and
b~plnal = pi_plnal and
c~loekz = space and "Oper Del Flag = OFF
c~steus = v_plpo_steus and "PP04
e~objty = v_objty. "WC Obj Type = 'A'
read the last operation
sort lt_plpo by vornr descending.
read table lt_plpo index 1.
pe_arbpl = lt_plpo-arbpl.
endform. " read_wc_on_last_pp04
Goto LSMW-> Select Direct Input method in 1st step. These are the standard programs for data transfer.
Otherwise goto SPRO->SAP Reference IMG-> Under this you'll find standard data transfer programs module wise.
Regards,
Sunil Kumar Mutyala -
Difference between Session method and call transaction
Hi,
please give me the differences between session method and call transaction,
briefly explaining synchronus , asynchronus, process, update.
Thanks in advanceHi Vijay Kumar
CLASSICAL BATCH INPUT (Session Method)
CALL TRANSACTION
BATCH INPUT METHOD:
This method is also called as CLASSICAL METHOD.
Features:
Asynchronous processing.
Synchronous Processing in database update.
Transfer data for more than one transaction.
Batch input processing log will be generated.
During processing, no transaction is started until the previous transaction has been written to the database.
CALL TRANSACTION METHOD :
This is another method to transfer data from the legacy system.
Features:
Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
Updating the database can be either synchronous or asynchronous. The program specifies the update type.
Transfer data for a single transaction.
Transfers data for a sequence of dialog screens.
No batch input processing log is generated.
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
Among the two methods call transaction is better compared to session bcoz data transfer is faster in it.
Differences between call transaction and session.
Session Method:
1) Data is not updated in the database table until the session is processed.
2) No sy-subrc is returned.
3) Error log is created for error records.
4) Updation is always synchronous.
Call Transaction Method:
1) Immediate updation in the database table.
2) sy-subrc is returned.
3)Error need to be handled explicitly.
4) updation can be synchronous as well as asynchronous.
2) ya u can use using the N mode no screen.
3)u can't handle multiple transaction in call transaction.
4) u can handle multiple transaction in session using the BDC_INSERT fm.
5)When u go to SM35 u can able to see the error records.
Which is best?
That depends on your requirement. Both of them have there advantages.
According to the situation u can choose any one of these.
difference between batch input and call transaction in BDC Session method.
1) synchronous processing.
2) can tranfer large amount of data.
3) processing is slower.
4) error log is created
5) data is not updated until session is processed.
Call transaction.
1) asynchronous processing
2) can transfer small amount of data
3) processing is faster.
4) errors need to be handled explicitly
5) data is updated automatically
For session method,these are the function modules to b used.
BDC_OPEN_GROUP
BDC_INSERT
BDC_CLOSE_GROUP
For call transaction,this is the syntax.
CALL TRANSACTION TCODE USING BDCDATA
MODE A or E or N
UPDATE A or S
MESSAGES INTO MESSTAB.
Take a scenario where we need to post documents in FB01 and the input file has say 2000 records (2000 documents, not line items in FB01 but 2000 records)
In the BDC call transaction method
We call the transaction FB01 2000 times (once for each record posting) and if the processing fails in record no 3 it can be captured and start with reocord 4.
Eg: Loop at itab.
call transaction FB01
capture errors
endloop.
In the session method.
We do not explicity call the transaction 2000 times, but all the records are appeneded into a session and this session is stored. The processinf of the session is done wwhenever the user wants it to be done. Hence the errors cannot be captured in the program itself
Check these link:
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
http://www.planetsap.com/bdc_main_page.htm
Batch Input Session method is asynchronous as told by others here. But the advantage of this is that you have all the error messages and the data for each transaction held persistantly. You don't have to code anything for processing them or writing the logs.
But at the same time, the same feature can be disadvantageous if you need to react to an error or if there are too many errors to manually correct in a session. Since the session are created in the program and its execution is done seperately, you loose the trackability of such transactions.
With a call transaction, what was a disadvantage above will become an advantage. Call transaction immediately gives you messages back and you can react to it in your program. But the disadvantage is that, if you have several hundreds of transactions to run, running them from within the program can be resource crunching affair. It will hamper the system performance and you cannot really distribute the load. Of course, you have some mechanisms with which you can overcome this, but you will have to code for it. Also, storing the messages and storing the errored transaction data etc will have to be handled by you in the program. Whereas, in batch input session, your program's job is to just create the session, after that everything is standard SAP system's responsibility.
Ideally, you should do a call transaction if the resources are not a problem and if it fails, put the errored transaction into a session.
You can decide based on the data volume that your BDC is processing. If data volume is high go for session else call transaction will do.The call transaction updates will be instantaneous where as session needs to be processed explictly after creation.
Session Method
1) Session method supports both small amount of data aswell as large amount of data
2) data processing is asynchronus and data updation is synchronus.
3) it process multiple apllication while perfomaning validations.
4) in session method data will be updated in data base only after processing session only.
5) system provide by default logfile for handling error records.
6) it supports both foreground aswell as background process
in bdc we use FM ...
bdc_open_group " for creating Session
bdc_insert " adding transaction and bdcdata table for updating database
bdc_close_group " for closing Session
Call Transaction
1) Call transaction exclusively for small amout of data
2) it supports only one apllication while perfoming validations
3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.
we can create logfile by using structure....BDCMSGCOLL
4) it doesn't support background processing.
5) data processing is synchronous and Data updation is Synchronous( default), in
this method also supports daya updation in asynchronus process also.
syntax:
Call transaction <transaction-name> using BDCDATA
mode <A/N/E>
update <L/A/S>
messages into BDCMSGCOLL.
BDC:
Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.
Features :
BDC is an automatic procedure.
This method is used to transfer large amount of data that is available in electronic medium.
BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).
BDC uses normal transaction codes to transfer data.
Types of BDC :
CLASSICAL BATCH INPUT (Session Method)
CALL TRANSACTION
BATCH INPUT METHOD:
This method is also called as CLASSICAL METHOD.
Features:
Asynchronous processing.
Synchronous Processing in database update.
Transfer data for more than one transaction.
Batch input processing log will be generated.
During processing, no transaction is started until the previous transaction has been written to the database.
CALL TRANSACTION METHOD :
This is another method to transfer data from the legacy system.
Features:
Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
Updating the database can be either synchronous or asynchronous. The program specifies the update type.
Transfer data for a single transaction.
Transfers data for a sequence of dialog screens.
No batch input processing log is generated.
For BDC:
http://myweb.dal.ca/hchinni/sap/bdc_home.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
http://www.sap-img.com/abap/learning-bdc-programming.htm
http://www.sapdevelopment.co.uk/bdc/bdchome.htm
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
Check these link:
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
http://www.planetsap.com/bdc_main_page.htm
call Transaction or session method ?
Check the following links:
http://www.sap-img.com/bdc.htm
See below example code :
Call three FM : BDC_OPEN_GROUP,BDC_INSERT and BDC_CLOSE_GROUP.
Once you execute the program and it creates the session at SM35 Transaction.
Report : ZMPPC011
Type : Data upload
Author : Chetan Shah
Date : 05/05/2005
Transport : DV3K919557
Transaction: ??
Description: This ABAP/4 Program creates new Production Versions
(C223). It accepts tab-delimited spreadsheet input and
creates BDC sessions.
Modification Log
Date Programmer Request # Description
06/10/2005 Chetan Shah DV3K919557 Initial coding
report zmppc011 no standard page heading line-size 120 line-count 55
message-id zz.
pool of form routines
include zmppn001.
Define BDC Table Structure
data: begin of itab_bdc_tab occurs 0.
include structure bdcdata.
data: end of itab_bdc_tab.
Input record layout of Leagcy File
data: begin of itab_xcel occurs 0,
matnr(18) type c,
werks(4) type c,
alnag(2) type c,
verid(4) type c,
text1(40) type c,
bstmi like mkal-bstmi,
bstma like mkal-bstma,
adatu(10) type c,
bdatu(10) type c,
stlal(2) type c,
stlan(1) type c,
serkz(1) type c,
mdv01(8) type c,
elpro(4) type c,
alort(4) type c,
end of itab_xcel.
data: begin of lt_pp04_cache occurs 0,
matnr like itab_xcel-matnr,
werks like itab_xcel-werks,
alnag like itab_xcel-alnag,
plnnr like mapl-plnnr,
arbpl like crhd-arbpl,
ktext like crtx-ktext,
end of lt_pp04_cache.
data: v_ssnnr(4) type n,
v_lines_in_xcel like sy-tabix,
v_ssnname like apqi-groupid,
v_trans_in_ssn type i,
wa_xcel LIKE itab_xcel,
l_tabix like sy-tabix,
v_matnr like rc27m-matnr,
v_plnnr like mapl-plnnr,
v_plnal like mapl-plnal,
v_tcode like sy-tcode value 'C223',
v_plnty like plas-plnty value 'R',
v_objty like crhd-objty value 'A',
v_plpo_steus like plpo-steus value 'PP04',
v_verwe like crhd-verwe value '0007'.
Parameters
selection-screen: skip 3.
selection-screen: begin of block 1 with frame.
parameters: p_name like rlgrap-filename
default 'C:\My Documents\InputFile.txt'
obligatory,
bdc session name prefix
p_bdcpfx(6) default 'ZPVCRT'
obligatory,
number for transction per BDC session
p_trnssn type i
default 2000 obligatory,
retain the BDC session after successfull execution
p_keep like apqi-qerase
default 'X',
user who will be executing BDC session
p_uname like apqi-userid
default sy-uname
obligatory.
selection-screen: end of block 1.
possible entry list (F4 dropdown) for input file name
at selection-screen on value-request for p_name.
*-SELECT FILE FROM USERS LOCAL PC
call function 'WS_FILENAME_GET'
exporting
DEF_FILENAME = ' '
def_path = 'C:\Temp\'
mask = ',.,..'
mode = 'O'
title = 'Select File '(007)
importing
filename = p_name
RC =
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
if sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
begin the show
start-of-selection.
read data from input file
perform transfer_xcel_to_itab.
loop at itab_xcel.
hang on to xcel line num
l_tabix = sy-tabix.
each line in the xcel file marks begining of new prod.version defn
if num-of-trnas-in-session = 0, create new BDC session
if v_trans_in_ssn is initial.
perform bdc_session_open.
endif.
begin new bdc script for rtg create trans
fill in bdc-data for prod.version maintenance screens
perform bdc_build_script.
insert the bdc script as a BDC transaction
perform bdc_submit_transaction.
keep track of how many BDC transactions were inserted in the BDC
session
add 1 to v_trans_in_ssn.
if the user-specified num of trans in BDC session is reached OR
if end of input file is reached, close the BDC session
if v_trans_in_ssn = p_trnssn or
l_tabix = v_lines_in_xcel.
perform bdc_session_close.
clear v_trans_in_ssn.
endif.
endloop.
top-of-page.
call function 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
FORM TRANSFER_XCEL_TO_ITAB *
Transfer Xcel Spreadsheet to SAP Internal Table *
form transfer_xcel_to_itab.
Read the tab-delimited file into itab
call function 'WS_UPLOAD'
exporting
filename = p_name
filetype = 'DAT'
IMPORTING
filelength = flength
tables
data_tab = itab_xcel
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
others = 8.
if sy-subrc = 0.
sort the data
sort itab_xcel by matnr werks.
clear v_lines_in_xcel.
if no data in the file - error out
describe table itab_xcel lines v_lines_in_xcel.
if v_lines_in_xcel is initial.
write: / 'No data in input file'.
stop.
endif.
else.
if file upload failed - error out
write: / 'Error reading input file'.
stop.
endif.
endform.
FORM BDC_SESSION_OPEN *
Open BDC Session *
form bdc_session_open.
create bdc session name = prefix-from-selectn-screen + nnnn
add 1 to v_ssnnr.
concatenate p_bdcpfx v_ssnnr into v_ssnname.
open new bdc session
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = v_ssnname
keep = p_keep
user = p_uname
exceptions
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
others = 11.
endform.
FORM BDC_BUILD_SCRIPT *
Build BDC *
form bdc_build_script.
data: l_arbpl like crhd-arbpl,
l_text1 like mkal-text1,
l_mdv01 like mkal-mdv01,
l_mapl like mapl.
clear bdc-data itab - begin of new bdc transaction
clear itab_bdc_tab.
refresh itab_bdc_tab.
read material cross reference tables to determine sap part#
clear : v_matnr, v_plnnr, v_plnal.
perform read_matnr_cross_ref using itab_xcel-matnr
itab_xcel-werks
changing v_matnr.
determine the version description to use
if itab_xcel-text1 is initial.
l_text1 = itab_xcel-verid.
else.
l_text1 = itab_xcel-text1.
endif.
determine the routing group# and group ctr# to use
perform read_routing .
determine the production line to use
if itab_xcel-mdv01 is initial.
if not provided in the file then:
prod line = work ctr on the last PP04 op of the rtg determined above
perform read_wc_on_last_pp04 using v_plnnr v_plnal
changing l_mdv01.
NOTE: when executing the above form\routine, if v_plnnr is initial
or v_plnal is initial, THEN l_mdv01 will automatically be
returned blank (ie initial)
else.
l_mdv01 = itab_xcel-mdv01.
endif.
build bdc script
perform bdc_build_script_record
fill in initial screen
using: 'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=ENTE',
' ' 'MKAL-WERKS' itab_xcel-werks,
' ' 'MKAL-MATNR' v_matnr,
' ' 'MKAL_ADMIN-DISPO' space,
' ' 'MKAL-PLNNR' space,
' ' 'MKAL_ADMIN-STTAG' space,
' ' 'MKAL-PLNNG' space,
' ' 'MKAL-MDV01' space,
' ' 'MKAL-PLNNM' space,
click create button on initial screen and go to detail screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=CREA',
fill in the detail screen and go back to initial screen
'X' 'SAPLCMFV' '2000',
' ' 'BDC_OKCODE' '=CLOS',
' ' 'MKAL_EXPAND-MATNR' v_matnr,
' ' 'MKAL_EXPAND-VERID' itab_xcel-verid,
' ' 'MKAL_EXPAND-TEXT1' l_text1,
' ' 'MKAL_EXPAND-BSTMI' itab_xcel-bstmi,
' ' 'MKAL_EXPAND-BSTMA' itab_xcel-bstma,
' ' 'MKAL_EXPAND-ADATU' itab_xcel-adatu,
' ' 'MKAL_EXPAND-BDATU' itab_xcel-bdatu,
' ' 'MKAL_EXPAND-PLTYG' v_plnty,
' ' 'MKAL_EXPAND-PLNNG' v_plnnr,
' ' 'MKAL_EXPAND-ALNAG' v_plnal,
' ' 'MKAL_EXPAND-STLAL' itab_xcel-stlal,
' ' 'MKAL_EXPAND-STLAN' itab_xcel-stlan,
' ' 'MKAL_EXPAND-SERKZ' itab_xcel-serkz,
' ' 'MKAL_EXPAND-MDV01' l_mdv01,
' ' 'MKAL_EXPAND-ELPRO' itab_xcel-elpro,
' ' 'MKAL_EXPAND-ALORT' itab_xcel-alort,
save the production version from initial screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=SAVE'.
endform.
FORM BDC_SUBMIT_TRANSACTION *
Submit BDC Session *
form bdc_submit_transaction.
Load BDC script as a trqansction in BDC session
call function 'BDC_INSERT'
exporting
tcode = v_tcode
tables
dynprotab = itab_bdc_tab
exceptions
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
endform.
FORM BDC_BUILD_SCRIPT_RECORD *
form bdc_build_script_record using dynbegin name value.
clear itab_bdc_tab.
if dynbegin = 'X'.
move: name to itab_bdc_tab-program,
value to itab_bdc_tab-dynpro,
'X' to itab_bdc_tab-dynbegin.
else.
move: name to itab_bdc_tab-fnam,
value to itab_bdc_tab-fval.
shift itab_bdc_tab-fval left deleting leading space.
endif.
append itab_bdc_tab.
endform.
FORM BDC_SESSION_CLOSE *
Close BDC Session *
form bdc_session_close.
close the session
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 1
queue_error = 2
others = 3.
skip 2.
if sy-subrc ne 0.
write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.
else.
write : / 'Session created:', v_ssnname,
50 '# of transactions:', v_trans_in_ssn.
endif.
endform.
*& Form read_routing_cache
*FORM read_routing_cache USING pi_matnr
pi_werks
pi_alnag
pi_verid
pi_mdv01.
DATA: BEGIN OF lt_plpo OCCURS 0,
vornr LIKE plpo-vornr,
objty LIKE crhd-objty,
objid LIKE crhd-objid,
arbpl LIKE crhd-arbpl,
END OF lt_plpo,
l_mapl_plnnr LIKE mapl-plnnr.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
SELECT plnnr INTO l_mapl_plnnr
FROM mapl UP TO 1 ROWS
WHERE matnr = pi_matnr AND
werks = pi_werks AND
plnty = 'R' AND
plnal = pi_alnag AND
loekz = space.
ENDSELECT.
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
-- the work center was not determined yet AND
-- work center was really needed for this line in the input file
then
-- read the work center from last PP04 operation on the routing
-- update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
*ENDFORM. " read_last_pp04_operation_cache
*& Form read_routing
form read_routing.
data: begin of lt_mapl occurs 0,
plnnr like mapl-plnnr,
plnal like mapl-plnal,
end of lt_mapl,
l_arbpl like crhd-arbpl.
get all the rtg# and grp ctr# from MAPL
select plnnr plnal
into corresponding fields of table lt_mapl
from mapl
where matnr = v_matnr and
werks = itab_xcel-werks and
plnty = v_plnty and "Rate Routing
loekz = space. "with del flag = OFF
sort lt_mapl by plnal.
if not itab_xcel-verid is initial.
if the verid=0001 then use the 1st good rtg-grp# and grp-ctr#
if itab_xcel-verid = '0001'.
read table lt_mapl index 1.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
else.
if the verid0001 then use the rtg-grp# and grp-ctr# of the routing
whose work center on the last PP04 operation matches the given verid
loop at lt_mapl.
clear l_arbpl.
get the work center from the last PP04 operation
perform read_wc_on_last_pp04 using lt_mapl-plnnr
lt_mapl-plnal
changing l_arbpl.
if itab_xcel-verid = l_arbpl.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
exit.
endif.
endloop.
endif.
else.
do nothing
endif.
For version IDs that are other then '0000' or 'ZWIP' :--
if itab_xcel-verid NE '0000' and
itab_xcel-verid NE 'ZWIP'.
if routing group# or group counter was not determined, make the
valid-to date 99/99/9999 so that the BDC, on execution, errors out.
if v_plnnr is initial or
v_plnal is initial.
itab_xcel-bdatu = '99/99/9999'.
endif.
endif.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
-- the work center was not determined yet AND
-- work center was really needed for this line in the input file
then
-- read the work center from last PP04 operation on the routing
-- update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
endform. " read_last_pp04_operation_cache
*& Form read_wc_on_last_pp04
form read_wc_on_last_pp04 using pi_plnnr
pi_plnal
changing pe_arbpl.
data: begin of lt_plpo occurs 0,
vornr like plpo-vornr,
objty like crhd-objty,
objid like crhd-objid,
arbpl like crhd-arbpl,
end of lt_plpo.
get all the PP04 operations for the given rtg# & grp-ctr#
select vornr eobjty eobjid e~arbpl
into corresponding fields of table lt_plpo
from plas as b
inner join plpo as c
on bplnty = cplnty and
bplnnr = cplnnr and
bzaehl = czaehl
inner join crhd as e
on carbid = eobjid
where b~plnty = v_plnty and "Rate Routing
b~plnnr = pi_plnnr and
b~plnal = pi_plnal and
c~loekz = space and "Oper Del Flag = OFF
c~steus = v_plpo_steus and "PP04
e~objty = v_objty. "WC Obj Type = 'A'
read the last operation
sort lt_plpo by vornr descending.
read table lt_plpo index 1.
pe_arbpl = lt_plpo-arbpl.
endform. " read_wc_on_last_pp04
Goto LSMW-> Select Direct Input method in 1st step. These are the standard programs for data transfer.
Otherwise goto SPRO->SAP Reference IMG-> Under this you'll find standard data transfer programs module wise.
Reward points,
Shakir -
Call transaction error handling
how to maintain the log i.e sucess/failures like below.
Line No. Success/ Failure Document No Error Details
1 S Doc 740000001
2 S Doc 740000002
3 F Co- code does not exist
4 F GL Account does not exist
I'm getting only one last document no: but i need all the documents to be displayed i.e either success/failures.
below is my code.
TYPES: BEGIN OF ty_filedata,
bukrs TYPE bukrs, "Company code
blart TYPE blart, "Document type
bldat TYPE char10, "Document Date
budat TYPE char10, "Posting date
xblnr TYPE xblnr, "Reference
bktxt TYPE bktxt, "Document Header text
waers TYPE waers, "Currency
newbs TYPE bschl, "Posting Key for the next line item
wrbtr TYPE char10, "Amount
zuonr LIKE bsik-zuonr, "Assignment
sgtxt TYPE sgtxt, "Text
newko TYPE hkont, "Account for the next line item
END OF ty_filedata.
TYPES: BEGIN OF ty_detail_log,
item_no TYPE i, " Item line no.
status(1) TYPE c, " Status - success/failure
doc_no TYPE bkpf-belnr," Document No.
message TYPE string, " Message
END OF ty_detail_log.
*& DATA declaration of internal tables
Internal Table declaration for excel data
DATA: it_itab TYPE STANDARD TABLE OF alsmex_tabline INITIAL SIZE 0,
Internal Table declaration for upload data
it_upload TYPE STANDARD TABLE OF ty_filedata INITIAL SIZE 0,
Internal Table Declaration for BDCDATA
it_bdcdata TYPE STANDARD TABLE OF bdcdata,
Internal Table Declaration for BDCMSGCOLL
it_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll,
Internal Table Declaration for FILENMAE
lf_fname TYPE rlgrap-filename.
t_err_log TYPE STANDARD TABLE OF ty_err
INITIAL SIZE 0, " table for validation error log
t_DETAIL_LOG TYPE STANDARD TABLE OF TY_DETAIL_LOG.
C_MSGNO TYPE BDC_MNR VALUE '312',
*& DATA declaration of work area
Work Area declaration for Excel Data
DATA: w_itab TYPE alsmex_tabline,
Work Area declaration for upload data
w_upload TYPE ty_filedata,
Work Area declaration for upload data
w_upload_n TYPE ty_filedata,
Work Area declaration for upload data
w_bdcdata TYPE bdcdata,
Work Area declaration for upload data
w_bdcmsgcoll TYPE bdcmsgcoll,
w_detail_log TYPE ty_detail_log.
*& SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
PARAMETERS:p_file TYPE rlgrap-filename. " MODIF ID G1.
SELECTION-SCREEN: END OF BLOCK bk1.
*& AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
dynpro_number = syst-dynnr
CHANGING
file_name = p_file
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*& START-OF-SELECTION
START-OF-SELECTION.
DATA: lw_itab TYPE alsmex_tabline.
lf_fname = p_file.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = lf_fname
i_begin_col = '1'
i_begin_row = '6'
i_end_col = '12'
i_end_row = '999'
TABLES
intern = it_itab[]
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
*MESSAGE S205(ZF_COMMON_MSGS_FIN1) DISPLAY LIKE C_E.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
IF it_itab IS NOT INITIAL.
SORT it_itab BY row col.
DELETE it_itab WHERE row LT 6.
LOOP AT it_itab INTO lw_itab.
w_itab = lw_itab.
AT NEW row.
CLEAR: w_upload.
ENDAT.
CASE w_itab-col.
WHEN '0001'.
w_upload-bukrs = w_itab-value.
WHEN '0002'.
w_upload-blart = w_itab-value.
WHEN '0003'.
w_upload-bldat = w_itab-value.
WHEN '0004'.
w_upload-budat = w_itab-value.
WHEN '0005'.
w_upload-xblnr = w_itab-value.
WHEN '0006'.
w_upload-bktxt = w_itab-value.
WHEN '0007'.
w_upload-waers = w_itab-value.
WHEN '0008'.
w_upload-newbs = w_itab-value.
WHEN '0009'.
w_upload-wrbtr = w_itab-value.
WHEN '0010'..
w_upload-zuonr = w_itab-value.
WHEN '0011'.
w_upload-sgtxt = w_itab-value.
WHEN '0012'.
w_upload-newko = w_itab-value.
ENDCASE.
AT END OF row.
APPEND w_upload TO it_upload.
CLEAR: w_upload.
ENDAT.
ENDLOOP.
*endif.
ENDIF.
DATA: lw_upload TYPE ty_filedata,
lv_lines TYPE sy-tabix,
lv_index TYPE sy-tabix.
DESCRIBE TABLE it_upload LINES lv_lines.
LOOP AT it_upload INTO lw_upload.
lv_index = sy-tabix.
w_upload = lw_upload.
IF NOT w_upload-bukrs IS INITIAL.
IF lv_index GT 1.
CALL TRANSACTION 'FB01' USING it_bdcdata
MODE 'N' UPDATE 'S' MESSAGES INTO it_bdcmsgcoll.
PERFORM fr_format_message_text.
REFRESH: it_bdcdata.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMF05A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BKPF-XBLNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BKPF-BLDAT'
w_upload-bldat.
PERFORM bdc_field USING 'BKPF-BLART'
w_upload-blart.
PERFORM bdc_field USING 'BKPF-BUKRS'
w_upload-bukrs.
PERFORM bdc_field USING 'BKPF-BUDAT'
w_upload-budat.
PERFORM bdc_field USING 'BKPF-WAERS'
w_upload-waers.
PERFORM bdc_field USING 'BKPF-XBLNR'
w_upload-xblnr.
*perform bdc_field using 'FS006-DOCID'
PERFORM bdc_field USING 'RF05A-NEWBS'
w_upload-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
w_upload-newko.
ENDIF.
IF lv_index NE lv_lines.
lv_index = lv_index + 1.
READ TABLE it_upload INTO w_upload_n INDEX lv_index.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-WRBTR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
w_upload-wrbtr.
PERFORM bdc_field USING 'RF05A-NEWBS'
w_upload_n-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
w_upload_n-newko.
ELSE.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-WRBTR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING 'BSEG-WRBTR'
w_upload-wrbtr.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-ANLN1'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDLOOP.
CALL TRANSACTION 'FB01' USING it_bdcdata
MODE 'N' UPDATE 'S' MESSAGES INTO it_bdcmsgcoll.
PERFORM fr_format_message_text .
REFRESH: it_bdcdata.
*& Form BDC_DYNPRO
FORM bdc_dynpro USING program dynpro.
CLEAR w_bdcdata.
w_bdcdata-program = program.
w_bdcdata-dynpro = dynpro.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO it_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF fval <> space.
CLEAR w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
APPEND w_bdcdata TO it_bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form fr_format_message_text
FORM fr_format_message_text.
DATA: lf_msg TYPE string.
WRITE:/ sy-uline(125).
FORMAT COLOR 1 INTENSIFIED ON.
WRITE : /1 sy-vline,
2 text-041 , "'record Number',
16 sy-vline,
17 text-042 , " 'success/failure',
35 sy-vline,
36 text-043, " 'document no',
55 sy-vline,
56 text-044, "'Error details',
125 sy-vline.
WRITE:/ sy-uline(125).
LOOP AT it_bdcmsgcoll INTO w_bdcmsgcoll.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = w_bdcmsgcoll-msgid
lang = sy-langu
no = w_bdcmsgcoll-msgnr
v1 = w_bdcmsgcoll-msgv1
v2 = w_bdcmsgcoll-msgv2
v3 = w_bdcmsgcoll-msgv3
v4 = w_bdcmsgcoll-msgv4
IMPORTING
msg = lf_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc EQ 0.
WRITE:/01 sy-vline,
02 sy-tabix,
16 sy-vline,
17 w_bdcmsgcoll-msgtyp,
35 sy-vline,
36 w_bdcmsgcoll-msgv1,
55 sy-vline,
56 lf_msg,
125 sy-vline.
WRITE:/ sy-uline(125).
ENDIF.
ENDLOOP.
ENDFORM. "fr_format_message_text
Thanks in advance.Hi Neelima,
Just put the following code within that LOOP...ENDLOOP statement.
LOOP AT it_upload INTO lw_upload.
CALL TRANSACTION 'FB01' USING it_bdcdata
MODE 'N' UPDATE 'S' MESSAGES INTO it_bdcmsgcoll.
PERFORM fr_format_message_text .
REFRESH: it_bdcdata.
ENDLOOP.
Regards,
R.Nagarajan.
We can - -
How to track error message when calling Transaction: va02
Hi all,
As we all know, when we change an order through T-Code: VA02, system will update modified data to corresponding database. Meanwhile, if our operate is not legal or incorrect on T-code: VA02, system will call corresponding error messages to us.
Now I want to know:
1. how to track the error messages
2. Is there any Tcode such as: SM21 that we can see the message logs after our operation?
Thanks.Hi ,
message table for call transaction
DATA: BEGIN OF G_T_MSG OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF G_T_MSG.
Exucute transaction via Call Transaction
CALL TRANSACTION 'FB01'
USING g_t_bdcdata
MODE g_l_mode
UPDATE 'S'
MESSAGES INTO g_t_msg .
errors will be stpored in the table g_t_msg ..
Thanks . -
How do I pass SELECT-OPTIONS to another screen via CALL TRANSACTION?
Good day, everyone!
I am writing a program that will be passing PARAMETERS and SELECT-OPTIONS values to another transaction via the CALL TRANSACTION statement. I'm new at this, and I've run into a problem. I have several fields that are defined as SELECT-OPTIONS, like so:
SELECT-OPTIONS so_ccode FOR fkkop-bukrs.
The user may select multiple values, enter a range, exclude certain values, etc. -- the things a SELECT-OPTIONS allows.
But how do I pass all of this to a field on another screen using CALL TRANSACTION when I only have two fields (BDCDATA-FNAM and BDCDATA-FVAL) available to me? That works fine for PARAMETERS, but I can send low/high values, different signs/options, etc. for the SELECT-OPTIONS variables.
Please help!! Points awarded for all helpful answers.
Thank you,
DaveDon't use CALL TRANSACTION. Use SUBMIT instead.
Rob -
hi expert,
I have called a program using submit from my program.
and i passed some value through it.
for example
SUBMIT ZRME222
WITH PRINTER# = ztca001-zz_gchr2
WITH P_QTYLBL = v_lifmg
WITH S_KUNNR = v_kunnr
WITH S_MATNR = i_zvsd006-matnr
and return.
but in place of this i have to use a call transcation to call this program.
my problem is how to pass the screen variable through CALL TRANSATION , I have not to create any BDC for this.
Is there any syntax which can perform this task.
thanks in advance.Well, first if this program is a REPORT program, you should always call it using the SUBMIT statement rather than a CALL TRANSACTION. If your program is a module pool program, then you should use CALL TRANSACTION instead of SUBMIT. In the case where you have no control over the CALLED program, meaning you can't change it, then you would need to do a BDC to pass the values to this transaction. If you do have control over this program you could use memory to pass the values, for example, in the calling program, use the EXPORT statement to pass the values to memory, and in the called program, use IMPORT to get the values. And of course, this is just one approach.
Regards,
Rich Heilman -
Alternatine to call Transaction.
Hi All,
Need a Solution to call se38 with a program name 'ZTEST' which skips the first screen.
I tried using
SET PARAMETER ID 'RID' FIELD 'ZTEST'
CALL transaction 'SE38' AND SKIP FIRST SCREEN .
But unable to skip the first screen and display the report.
Thanks & Regards,
SantoshHI ,
i think for call transaction alternative is SUBMIT so
y can;t u try using SUBMIT if any doubt let me know .
SUBMIT
Basic forms:
1. SUBMIT rep.
2. SUBMIT (name).
Extras:
1. ... LINE-SIZE col
2. ... LINE-COUNT line
3. ... TO SAP-SPOOL List output to the SAP spool database
4. ... USING SELECTION-SCREEN scr
5. ... VIA SELECTION-SCREEN
6. ... AND RETURN
7. ... EXPORTING LIST TO MEMORY
8. ... USER user VIA JOB job NUMBER n
9. ...Various additions for passing parameters to rep
10. ... USING SELECTION-SETS OF PROGRAM prog
Effect
Calls report rep.
The system leaves the active program and starts the new report rep. In basic form 2, you can specify the name of the report in the field name. You must specify the name in uppercase, otherwise a runtime error occurs.
Note
· You can only start programs with type '1' using SUBMIT. If the program has a different type, the system triggers a runtime error.
Please consult Data Area and Modularization Unit Organization documentation as well.
Addition 1
... LINE-SIZE col
Effect
The list generated by the report has the line width col.
Addition 2
... LINE-COUNT line
Effect
The list generated by the report has line lines per page.
Addition 4
... USING SELECTION-SCREEN scr
Effect
When you execute the report, the system uses the selection screen number that you specify in the scr field. This must be a selection screen defined using the SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statements.If you omit the addition, the system uses the standard selection screen 1000.
This addition allows you to start the same report in different situations, using a different selection screen each time.
Notes
1. The addition VIA SELECTION SCREEN determines whether the report is processed in the foreground or the background.
2. What happens if the required screen does not exist or is not a selection screen?
Screen 1000:
If you want to use the standard selection screen (... USING SELECTION-SCREEN 1000 or do not specify a ... USING SELECTION-SCREEN) addition, the system does not process a selection screen.
Other selection screens:
The system triggers a runtime error.
Addition 5
... VIA SELECTION-SCREEN
Effect
The selection screen is displayed. In this case, the selection screen is displayed again after the report list has been displayed. The values entered by the user remain displayed.
Addition 6
... AND RETURN
Effect
Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal session.
Addition 7
... EXPORTING LIST TO MEMORY
Effect
Does not display the output list of the called report, but saves it in ABAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. In addition, you must not assign a function code to the ENTER key in the current GUI status. The saved list is read from the SAP memory using the function module 'LIST_FROM_MEMORY' and can then be saved to the database using EXPORT, for example. You can process this list further with the function modules 'WRITE_LIST', 'DISPLAY_LIST' ... of the function group "SLST".
Addition 8
... USER user VIA JOB job NUMBER n
Effect
Schedules the specified report in the job specified by the job name job and the job number n. The job runs under the user name user and you can omit the addition USER user. The assignment of the job number occurs via the function module JOB_OPEN (see also the documentation for the function modules JOB_CLOSE and JOB_SUBMIT). This addition can only be used with the addition ...AND RETURN.
Note
When scheduling a report with the SUBMIT ... VIA JOB job NUMBER n statement, you should always use the addition ...TO SAP-SPOOL to pass print and/or archive parameters. Otherwise, default values are used to generate the list and this disturbs operations in a production environment.
SY-SUBRC = 0:
Job scheduled successfully
SY-SUBRC = 4:
Job scheduling terminated by user
SY-SUBRC = 8:
Error in job scheduling (JOB_SUBMIT)
SY-SUBRC = 12:
Error in internal number assignment
Addition 10
... USING SELECTION-SETS OF PROGRAM prog
Effect
Uses variants of the program prog when executing the program rep.
Note
Important
The programs prog and rep must have the same SELECT-OPTIONS and PARAMETERs. Otherwise, variants of the program prog may be destroyed.
Note
When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari. On the other hand, all variant-related actions on the selection screen of rep (Get, Save as variant, Display, Delete) refer to the variants of prog.
Example
SUBMIT REPORT01
VIA SELECTION-SCREEN
USING SELECTION-SET 'VARIANT1'
USING SELECTION-SETS OF PROGRAM 'REPORT00'
AND RETURN.
Effect
Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00.
Exceptions
Non-Catchable Exceptions
· Cause: The specified program was not found.
Runtime Error: LOAD_PROGRAM_NOT_FOUND
· Cause: Invalid value passed to a selection with SIGN.
Runtime Error: SUBMIT_WRONG_SIGN
· Cause: The specified program is not a report.
Runtime Error: SUBMIT_WRONG_TYPE
· Cause: More than one value passed to a report parameter.
Runtime Error: SUBMIT_IMPORT_ONLY_PARAMETER
· Cause: Table passed to a selection with WITH sel IN itab that has an unexpected structure.
Runtime Error: SUBMIT_IN_ITAB_ILL_STRUCTURE
Additional help
Starting Executable Programs (Reports)
THx -
Hello,
I have several Call Transactions in bach input program that generate documents.
The problem is that if one Call not run I have to eliminate the others documents.
for example:
Step 1 call transaction 'ke21n'
Step 2 call transaction 'KB15N'
Step 3 call transaction 'fb01' -
> this fall down or not run
Step 4 call transaction 'ko02'
The Step 1 and Step 2 must to be restaured and no generate the documentsHi!
During the Batch run (in SM35), you can't withdraw the documents, which was posted.
You have 2 choices:
- write into the program which creates the batch input, and examine the data, which cause problems in the transaction FB01. If this transaction will have bad or missing data, you can withdraw from your batch input table the previous transactions also.
- look for BAPI-s, and re-program the whole thing. Luckily with BAPI-s you can examine the errors.
Regards
Tamá -
Hello
My intention is to make a call transaction or a SUBMIT to t.code TRIP, does anyone know how?Thanks for the reply, but ...
My intention is to access the trip t.code an employee and a particular journey
Can you come do? -
Hi guys,
I have a problem with calling a program(or transaction code).
I want to call a program with a variant by "CALL TRANSACTION" or "SUBMIT".
I checked that "SUBMIT" is possible by using "SELECTION-SET" but I can't use it because it doesn't allow calling a program with a variable which has the program name like below.
'SUBMIT gv_program SELECTION-SET gv_variant.'
Is there a solution for this?
Thanks.No, it is not possible to call a program/transaction using a variable in place of program name.
As SUBMIT statement executes a report. Can only execute reports of type '1'.And the ways that it could be used are :-
*Code used to execute a report
SUBMIT Zreport.
*Code used to populate 'select-options' & execute report
SUBMIT zreport with selection-table seltab
via selection-screen.
*Code used to populate 'parameters' & execute report
SUBMIT zreport with p_param1 = 'value'
with p_param2 = 'value'.
*Submit report and return to current program afterwards
SUBMIT zreport AND RETURN.
*Submit report via its own selection screen
SUBMIT zreport VIA SELECTION-SCREEN.
*Submit report using selection screen variant
SUBMIT zreport USING SELECTION-SET 'VARIANT1'.
*Submit report but export resultant list to memory, rather than
*it being displayed on screen
SUBMIT zreport EXPORTING LIST TO MEMORY.
And CALL TRANSACTION statement calls the transaction whose transaction code is contained in data object ta.
CALL TRANSACTION ta
{ [AND SKIP FIRST SCREEN] ---- suppresses the display of a screen of the initial dynpro
| [USING bdc_tab [bdc_options]] }. ----- enables the transaction to be executed using a batch input table. This requires an internal table bdc_tab of row type BDCDATA to be passed from ABAP Dictionary to a dialog transaction
Wish this helps you...
Regards,
Bishwajit -
Call Transaction / Submit Program
Hello All,
I have two ABAP reports : Report A & Report B.
Report A has selection screen similar to Report B, where report A needs to send data to selection screen of Report B.
Report B should be processed displaying its list display & should return its control back to Report B.
This can be easily achieved by using SUBMIT program(Report B) with values from Report A.
But my report B is made to run only via a TCode(ZEXECUTE) & hence when i submit program it is not executed
as sy-tcode value in such case comes as SE38 .
Further , Call Transaction (ZEXECUTE) using bdc_tab helps in passing the TCode & respective selection screen values
correctly to Report B , but i am not able to see the outputs of the same.
Please Note : I am not authorized to do any changes in Report B , so whatever i can try is from Report A itself.
Kindly Help,
SudeepHI Suhas ,
Firstly thanks for replying.
1) Do you mean there is a hardcoding in Report B to check the t-code?
Yes.
2) What is the display mode you're using when doing via CALL TRANSACTION?
Currently i am passing it as "A" , but still not able to get any output.
Report A provides report B all the required values along with 'BDC_OKCODE' '=ONLI'
for executing the same. The report gets processed , but i am not able to see any list display.
Thanks,
Sudeep -
Use call transaction or submit statement
Hi, i have a complex transaction, it has two control programs, a Z program and a standard program. I need execute it by call transaction or submit statement. In this transaction there are some select-options that i want fill with specific values.
Can you help me with it?Hi Robin, the SHDB transaction was very useful. Now i have other problem. This transaction execute a jobs set.I already have filled all of fields in the transaction, i saved the parameters for the execution by SAVE button (BDC_OKCODE=SAVE), but the transaction don't release the jobs and must do it. The last action (to release the jobs set) is executed by the OK button(BDC_OKCODE=OK).
This is the code that i'm implementing:
REPORT ZPRUEBA_SALDOS_ANTERIORES .
DATA: BDCDATA TYPE TABLE OF BDCDATA.
DATA: ITAB TYPE TABLE OF BDCMSGCOLL.
DATA: WA_ITAB TYPE BDCMSGCOLL.
DATA: PROGRAM LIKE SY-REPID ,
WA_BDCDATA TYPE BDCDATA.
DATA: DATE_ID(10).
DATA: DATE_CONV(11).
DATA: T_ID(6).
DATA: DES_ERROR(500).
*"parametro zdo(para tipo de documentos)
*RANGES: R_BLART FOR DFKKOP-BLART,
* R_VKONT FOR FKKVKP-VKONT.
*INITIALIZATION.
START-OF-SELECTION.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
INPUT = SY-DATUM
IMPORTING
OUTPUT = DATE_CONV.
DATE_ID = SY-DATUM.
CONCATENATE DATE_ID+6(2) '.' DATE_ID+4(2) '.' DATE_ID+0(4) INTO DATE_ID.
CONCATENATE DATE_CONV+3(3) '_' DATE_CONV+0(2) INTO T_ID.
WA_BDCDATA-PROGRAM = 'SAPLFKKAKTIV2'.
WA_BDCDATA-DYNPRO = '1000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'FKKAKTIV2_DYNP_1000-LAUFD'.
WA_BDCDATA-FVAL = '11.06.2008'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'FKKAKTIV2_DYNP_1000-LAUFI'.
WA_BDCDATA-FVAL = 'MAR_38'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
* WA_BDCDATA-PROGRAM = 'SAPLZ_CL_PROCESOS_EN_MASA'.
WA_BDCDATA-PROGRAM = 'SAPLFKKAKTIV2'.
* WA_BDCDATA-DYNPRO = '1001'.
WA_BDCDATA-DYNPRO = '1000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'P_STICHT'.
WA_BDCDATA-FVAL = DATE_ID.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'S_BUKRS-LOW'.
WA_BDCDATA-FVAL = 'PCS'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'S_VKONT-LOW'.
WA_BDCDATA-FVAL = '0'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'S_VKONT-HIGH'.
WA_BDCDATA-FVAL = '999999999999'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=%01410010001580545'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPLALDB'.
WA_BDCDATA-DYNPRO = '3000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
* CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(01)'.
WA_BDCDATA-FVAL = 'BS'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(02)'.
WA_BDCDATA-FVAL = 'FS'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(03)'.
WA_BDCDATA-FVAL = 'CD'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(04)'.
WA_BDCDATA-FVAL = 'EF'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(05)'.
WA_BDCDATA-FVAL = 'TR'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(06)'.
WA_BDCDATA-FVAL = 'TF'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(07)'.
WA_BDCDATA-FVAL = 'TC'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(08)'.
WA_BDCDATA-FVAL = 'LP'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'RSCSEL-SLOW_I(09)'.
WA_BDCDATA-FVAL = 'NC'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=ACPT'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
* WA_BDCDATA-PROGRAM = 'SAPLZ_CL_PROCESOS_EN_MASA'.
WA_BDCDATA-PROGRAM = 'SAPLFKKAKTIV2'.
* WA_BDCDATA-DYNPRO = '1001'.
WA_BDCDATA-DYNPRO = '1000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=TAB03'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=PRPRN'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPLSPRI'.
WA_BDCDATA-DYNPRO = '0100'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'PRI_PARAMS-PDEST'.
WA_BDCDATA-FVAL = 'LOCAL'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'PRI_PARAMS-PLIST'.
WA_BDCDATA-FVAL = '1604_SA_16'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=SAVE'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPLFKKAKTIV2'.
WA_BDCDATA-DYNPRO = '1000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
* CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=TAB04'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'FKKAKTIV2_DYNP_1190-VARI'.
WA_BDCDATA-FVAL = 'INTERES'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'FKKAKTIV2_DYNP_1200-JOBS_LOAD_BALA'.
WA_BDCDATA-FVAL = '6'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=SAVE'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=DISP'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPLFKJO_JOB'.
WA_BDCDATA-DYNPRO = '0100'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'D100_FIELDS-XBACKGR'.
WA_BDCDATA-FVAL = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'D100_FIELDS-XIMMEDIATE'.
WA_BDCDATA-FVAL = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '=OK'.
APPEND WA_BDCDATA TO BDCDATA.
CALL TRANSACTION 'ZPSA' USING BDCDATA MODE 'A'
MESSAGES INTO ITAB.
Edited by: Marcel ochoa on Jun 12, 2008 5:01 PM
Edited by: Marcel ochoa on Jun 12, 2008 5:03 PM
Edited by: Marcel ochoa on Jun 12, 2008 5:06 PM
Edited by: Marcel ochoa on Jun 12, 2008 10:43 PM
Edited by: Marcel ochoa on Jun 12, 2008 10:45 PM
Edited by: Marcel ochoa on Jun 12, 2008 11:37 PM
Maybe you are looking for
-
Problems with After Effects/Premiere CS3 in Vista
I have read through a bundle of solutions to this problem and haven't found anything that has worked yet. I ran After Effects and Premiere Pro on Vista up until two days ago when it refused to open. When I try to open Premiere, it gives the message "
-
Hi I have imported about 20 CDs into iTunes but I cannot get the album artwork to show. If I right-click the album in cover flow there's even an option that says "clear downloaded artwork" but I can't see the artwork! Please help........
-
What are diskcache and voicefiles exactly for? can...
Hi, just in the phone's Memory card I have folder "cities" having 2 folders "diskcache" and "voicefiles"; they both are about 200 MB. voicefiles include voice files e.g. "take the tenth exit".."half a mile" diskcahe includes several folders from a to
-
Creating objects in a second instance
I have created a second instance through the console of a directory server, which has been configured with the same rootdn as the original. When I open up the console why in the new instance does it show the rootdn on the config tab but the original
-
Passing parms to sql query in dbadapter
I have a simple query to a sql server db set of tables. I have 2 parms that I will use coming from an external site using my service created in BPEL. How do I incorporate these parms in my query. ie syntax. I know what I need to do just do not know t