Multiple Row Transaction and prepareForDML method
Hi
I want to create dept and employees record on the same page. For each employee record I created I want to update the average salary field on dept table and create some employee related records. For this I override the prepareForDML method on EmployeeImpl class and do updates and creations depending on the post state of the employee object. Say that I created one department record and and 10 employee record. If employee record passes validation its prepareForDMl method executed, if not it's not executed and entire transaction fails. If I correct the invalid employee records and press commit, for all employees prepareForDMl method is executed again and all with POSTSTATE STATUS_NEW even the ones that passed validation and executed prepareForDML in the first trial. So my update regarding average salary would be wrong and I would be creating more than one employee related record which is also wrong. How can I undo the changes made in prepareForDML? is the prepareForDML the wrong method to implement such things? I tried setclearcacheonRollback(false|true), jbo.txn.handleafterpostexc(true|false) parameters to no avail. I appreciate your helps?
Best Regards,
Salim
Hi
I want to create dept and employees record on the same page. For each employee record I created I want to update the average salary field on dept table and create some employee related records. For this I override the prepareForDML method on EmployeeImpl class and do updates and creations depending on the post state of the employee object. Say that I created one department record and and 10 employee record. If employee record passes validation its prepareForDMl method executed, if not it's not executed and entire transaction fails. If I correct the invalid employee records and press commit, for all employees prepareForDMl method is executed again and all with POSTSTATE STATUS_NEW even the ones that passed validation and executed prepareForDML in the first trial. So my update regarding average salary would be wrong and I would be creating more than one employee related record which is also wrong. How can I undo the changes made in prepareForDML? is the prepareForDML the wrong method to implement such things? I tried setclearcacheonRollback(false|true), jbo.txn.handleafterpostexc(true|false) parameters to no avail. I appreciate your helps?
Best Regards,
Salim
Similar Messages
-
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 -
I want to use both call transaction and session method in the same
Hi,
1. I want to use call transaction and session method in a single trans..how to do?
2. I have 1000 records in it 500 records is updated using call transaction remaining 500 i hve to update with session how to do?
3. Multiple transaction is possible in call transaction how?I suggest you try fulfilling your requirements yourself and come back with specific problems along the way.
-
Can we use Call transaction and session method in same program ?
Hi experts,
Is it suggested to use call Transaction and session method in the same Program ?
i have a doubt , why cant we use multiple call transactions in same program instead of session method if we have multiple transaction updations ?Hi Dengyong Zhang,
we can use the call transation and session method in same program.
However for better performance it's benificial to use call trasaction method of BDC. but if u want to upload very large amount of data then Session method is more preferable to use.
Session method is one of the method of BDC.
U can also use BAPI to upload the data in SAP but it's a different concept than BDC. Performance wise BAPI is more advantageous than BDC. -
Call transaction and session method -urgent
Hi,
can anybody tell me the diffence between call transaction and session method .
what are the advantage of each method and when we go for it.
how to see log file in session method.
i will really appricitatehi,
check this code,
REPORT ZTEST_ABCD NO STANDARD PAGE HEADING LINE-SIZE 255.
*REPORT zabzon_bdc
NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPES: BEGIN OF record,
xbanl LIKE raifp3-xbanl,
anln1 LIKE raifp2-anln1,
anln2 LIKE raifp2-anln2,
anbtr TYPE string,
bldat TYPE string,
budat TYPE string,
bzdat TYPE string,
sgtxt LIKE raifp2-sgtxt,
monat LIKE raifp2-monat,
blart LIKE raifp1-blart,
gkont LIKE raifp2-gkont,
bwasl LIKE raifp1-bwasl,
xblnr LIKE raifp1-xblnr,
END OF record.
TYPES :BEGIN OF x_messages,
index TYPE i,
msgtyp(1),
message(120),
END OF x_messages.
DATA: it_record TYPE STANDARD TABLE OF record,
wa_record TYPE record.
DATA : it_messages TYPE STANDARD TABLE OF x_messages,
wa_messages TYPE x_messages.
DATA : it_bdcmsg TYPE STANDARD TABLE OF bdcmsgcoll,
wa_bdcmsg TYPE bdcmsgcoll.
DATA : bdcdata TYPE STANDARD TABLE OF bdcdata,
wa_bdcdata TYPE bdcdata.
DATA : it_excel TYPE STANDARD TABLE OF alsmex_tabline,
wa_excel TYPE alsmex_tabline.
DATA : fname TYPE string.
DATA :l_index LIKE sy-tabix.
data : str type string.
*Selection screen.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file1 TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
*Selction-Screen F4 Help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'p_file1'
IMPORTING
file_name = p_file1.
*START-OF-SELECTION.
START-OF-SELECTION.
PERFORM process_f1data.
PERFORM execute_bdc.
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO bdcdata.
CLEAR wa_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval .
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO bdcdata.
CLEAR wa_bdcdata.
ENDFORM. "BDC_FIELD
*& Form process_f1data
text
--> p1 text
<-- p2 text
FORM process_f1data.
REFRESH it_excel.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = 1
i_begin_row = 1
i_end_col = 99
i_end_row = 1000
TABLES
intern = it_excel.
LOOP AT it_excel INTO wa_excel.
CASE wa_excel-col .
WHEN '1' .
wa_record-xbanl = wa_excel-value.
WHEN '1' .
wa_record-anln1 = wa_excel-value.
WHEN '2'.
wa_record-anln2 = wa_excel-value.
WHEN '3'.
wa_record-anbtr = wa_excel-value.
WHEN '4'.
wa_record-bldat = wa_excel-value.
WHEN '5'.
wa_record-budat = wa_excel-value.
WHEN '6'.
wa_record-bzdat = wa_excel-value.
WHEN '7'.
wa_record-sgtxt = wa_excel-value.
WHEN '8'.
wa_record-monat = wa_excel-value.
WHEN '9'.
wa_record-blart = wa_excel-value.
WHEN '10'.
wa_record-gkont = wa_excel-value.
WHEN '11'.
wa_record-bwasl = wa_excel-value.
WHEN '12'.
wa_record-xblnr = wa_excel-value.
ENDCASE.
AT END OF row.
CONDENSE : wa_record-anln1,wa_record-anln2,
wa_record-anbtr,wa_record-bldat,wa_record-budat,
wa_record-bzdat,wa_record-sgtxt,wa_record-monat,
wa_record-blart,wa_record-gkont,wa_record-bwasl,
wa_record-xblnr.
APPEND wa_record TO it_record.
CLEAR wa_record.
ENDAT.
ENDLOOP.
ENDFORM. " process_f1data
*& Form execute_bdc
text
--> p1 text
<-- p2 text
FORM execute_bdc.
LOOP AT it_record INTO wa_record.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NEWA'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP3-XBANL'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN1'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
wa_record-anln1. "'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN2'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
wa_record-anln2. "'0'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANBTR'.
str = wa_record-anbtr.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
wa_record-anbtr. "'45000'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BLDAT'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
wa_record-bldat. "'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BUDAT'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
wa_record-budat. "'01.04.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'01.04.2008'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BZDAT'.
PERFORM bdc_field USING 'RAIFP1-BZDAT'
wa_record-bzdat. "'01.04.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BZDAT'
'01.04.2008'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-SGTXT'.
PERFORM bdc_field USING 'RAIFP2-SGTXT'
wa_record-sgtxt. "'test01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=TAB02'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN1'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BZDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP2-SGTXT'
'test01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-MONAT'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
wa_record-monat. "'01'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BLART'.
PERFORM bdc_field USING 'RAIFP1-BLART'
wa_record-blart. " 'AA'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-GKONT'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-GKONT'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
wa_record-gkont. "'1600'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
'1600'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BWASL'.
PERFORM bdc_field USING 'RAIFP1-BWASL'
wa_record-bwasl. "'100'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
'1600'.
PERFORM bdc_field USING 'RAIFP1-BWASL'
'100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-XBLNR'.
PERFORM bdc_field USING 'RAIFP1-XBLNR'
wa_record-xblnr. "'TEST01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN1'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
'1600'.
PERFORM bdc_field USING 'RAIFP1-BWASL'
'100'.
PERFORM bdc_field USING 'RAIFP1-XBLNR'
'TEST01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SHWD'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
CALL TRANSACTION 'ABZON' USING bdcdata
MODE 'A'
MESSAGES INTO it_bdcmsg.
PERFORM collect_bdc_messages.
ENDLOOP.
ENDFORM. " execute_bdc
*& Form collect_bdc_messages
text
--> p1 text
<-- p2 text
FORM collect_bdc_messages.
DATA: l_msg(100).
LOOP AT it_bdcmsg INTO wa_bdcmsg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_bdcmsg-msgid
lang = wa_bdcmsg-msgspra
no = wa_bdcmsg-msgnr
v1 = wa_bdcmsg-msgv1
v2 = wa_bdcmsg-msgv2
IMPORTING
msg = l_msg
EXCEPTIONS
not_found = 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.
CONDENSE l_msg.
CLEAR wa_bdcmsg.
wa_messages-index = l_index.
wa_messages-msgtyp = wa_bdcmsg-msgtyp.
wa_messages-message = l_msg.
APPEND wa_messages TO it_messages.
WRITE:/ wa_messages-message.
ENDLOOP.
l_index = l_index + 1.
REFRESH it_bdcmsg.
ENDFORM. " collect_bdc_messages
regards
siva -
Regarding Call Transaction and Session Method in BDC.
Hi,
If there are 50 records and 25th row data is having error.
What will happen when we run it in Call Transaction and Session Method in both Foreground and Background methods ? Can anybody explain me in details ?Hi Naresh,
If you are using call transaction,
if executed in Foreground, 24 records will be posted and for 25th you will have option to correct data or skip.
if executed in background,
if mode is N, 24 records are processed 25th is skipped and 26th onwards is processed again.
if mode is E, 24 records will be posted and for 25th you will have option to correct data or skip.
For Session also it should be same the difference is that the error would be there in sessionlog and you can re-process it.
Hope it helps.
Regards,
Komal. -
MULTIPLE-ROW drag and drop between 2 ALV grids
Hi,
Can anybody help me with acheiving MULTIPLE-ROW drag and drop functionality between 2 ALV grids.hi Prakash,
Actually I'm trying to develop multiple drag and drop between 2 ALV's. To understand the events properly, I started working on this sample program where it uses 1 ALV and splits it into 2 and uses single row drag and drop between them. Now I'm making it to work for multiple drag and drop, so that I can use it on my application. This is the code which I'm working on..
*& Report Z_ALV_GRID_CONTROLS_DRAG_DROP *
REPORT z_alv_grid_controls_drag_drop.
DATA : i_ztransactions TYPE TABLE OF ztransactions
WITH HEADER LINE.
DATA : i_ztransactions2 TYPE TABLE OF ztransactions
WITH HEADER LINE.
DATA : ok_code LIKE sy-ucomm .
DATA : mcontainer TYPE REF TO cl_gui_custom_container .
DATA : mcontleft TYPE REF TO cl_gui_container .
DATA : mcontright TYPE REF TO cl_gui_container .
DATA : msplitcont TYPE REF TO
cl_gui_easy_splitter_container .
DATA : malv_left TYPE REF TO cl_gui_alv_grid .
DATA : malv_right TYPE REF TO cl_gui_alv_grid .
DATA : mrow TYPE lvc_s_row .
DATA : gt_outtab_source TYPE ztransactions.
DATA : gt_outtab_target TYPE ztransactions.
DATA : g_repid LIKE sy-repid.
DATA: gs_layout TYPE lvc_s_layo ,
g_behaviour_alv TYPE REF TO cl_dragdrop .
DATA : mlines TYPE i .
CLASS lcl_dragdropobj DEFINITION
This is the Class of Drag Drop Object .
This Object is used as a temporary storage means
of the information extracted with drag
CLASS lcl_dragdropobj DEFINITION.
PUBLIC SECTION.
DATA: i_ztransactions TYPE ztransactions ,
index TYPE i ,
original_table(5) TYPE c ,
proceed_trans(1) TYPE c .
ENDCLASS. "lcl_dragdropobj DEFINITION
DATA : mdata TYPE REF TO lcl_dragdropobj .
CLASS DND_TOOLS DEFINITION
This class contains the methods responding to the
events ONDRAG , ONDROP , ONDROPCOMPLETE
of the ALV Grid Controls
CLASS dnd_tools DEFINITION .
PUBLIC SECTION .
METHODS:handle_user_command
FOR EVENT user_command OF
cl_gui_alv_grid
IMPORTING
e_ucomm.
METHODS : handle_drag_from_left
FOR EVENT ondrag OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_dropcomplete_from_left
FOR EVENT ondropcomplete OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_drag_from_right
FOR EVENT ondrag OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_dropcomplete_from_right
FOR EVENT ondropcomplete OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_drop_to_left
FOR EVENT ondrop OF
cl_gui_alv_grid
IMPORTING
e_dragdropobj .
METHODS : handle_drop_to_right
FOR EVENT ondrop OF
cl_gui_alv_grid
IMPORTING
e_dragdropobj .
ENDCLASS . "DND_TOOLS DEFINITION
CLASS DND_TOOLS IMPLEMENTATION
CLASS dnd_tools IMPLEMENTATION .
METHOD handle_drag_from_left .
METHOD handle_user_command.
DATA: lt_rows TYPE lvc_t_row.
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
DATA: mdata TYPE REF TO lcl_dragdropobj .
DATA: dragdropobj TYPE REF TO lcl_dragdropobj .
get selected row
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
CREATE OBJECT mdata.
LOOP AT lt_rows INTO lt_row.
mrow = lt_row .
READ TABLE i_ztransactions INDEX lt_row-row_id INTO
i_ztransactions.
MOVE i_ztransactions TO mdata->i_ztransactions .
MOVE lt_row-row_id TO mdata->index.
MOVE 'LEFT' TO mdata->original_table .
e_dragdropobj->object = mdata .
ENDLOOP.
ENDMETHOD. "handle_user_command
METHOD handle_dropcomplete_from_left .
NB : the following data object MDATA is local to
the method and contains the information from the
import parameter of the method E_DRAGDROPOBJ
DATA : mdata TYPE REF TO lcl_dragdropobj .
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LOOP AT lt_rows INTO lt_row.
mdata ?= e_dragdropobj->object .
CHECK mdata->proceed_trans = 'X' .
mrow = mdata->index.
DELETE i_ztransactions INDEX mrow .
APPEND mdata->i_ztransactions TO i_ztransactions2 .
SORT i_ztransactions2 BY kunnr belnr .
DELETE i_ztransactions2 WHERE kunnr IS INITIAL .
DESCRIBE TABLE i_ztransactions LINES mlines .
IF mlines EQ 0 .
CLEAR i_ztransactions .
APPEND i_ztransactions TO i_ztransactions .
ENDIF .
ENDLOOP.
CALL METHOD malv_left->refresh_table_display.
CALL METHOD malv_right->refresh_table_display.
ENDMETHOD . "HANDLE_DROPCOMPLETE_FROM_LEFT
METHOD handle_drag_from_right.
mrow = e_row-index .
READ TABLE i_ztransactions2 INDEX mrow INTO
i_ztransactions2 .
CREATE OBJECT mdata .
MOVE i_ztransactions2 TO mdata->i_ztransactions .
MOVE mrow TO mdata->index .
MOVE 'RIGHT' TO mdata->original_table .
e_dragdropobj->object = mdata .
ENDMETHOD . "HANDLE_DRAG_FROM_RIGHT
METHOD handle_dropcomplete_from_right .
DATA : mdata TYPE REF TO lcl_dragdropobj .
mdata ?= e_dragdropobj->object .
CHECK mdata->proceed_trans = 'X' .
mrow = mdata->index .
DELETE i_ztransactions2 INDEX mrow .
APPEND mdata->i_ztransactions TO i_ztransactions .
SORT i_ztransactions BY kunnr belnr .
DELETE i_ztransactions WHERE kunnr IS INITIAL .
DESCRIBE TABLE i_ztransactions2 LINES mlines .
IF mlines EQ 0 .
CLEAR i_ztransactions2 .
APPEND i_ztransactions2 TO i_ztransactions2 .
ENDIF .
CALL METHOD malv_left->refresh_table_display.
CALL METHOD malv_right->refresh_table_display.
ENDMETHOD . "HANDLE_DROPCOMPLETE_FROM_RIGHT
METHOD handle_drop_to_left .
DATA : mdata TYPE REF TO lcl_dragdropobj .
mdata ?= e_dragdropobj->object .
IF mdata->original_table = 'RIGHT' .
mdata->proceed_trans = 'X' .
ELSE .
mdata->proceed_trans = ' ' .
ENDIF .
e_dragdropobj->object = mdata .
ENDMETHOD . "HANDLE_DROP_TO_LEFT
METHOD handle_drop_to_right .
DATA : mdata TYPE REF TO lcl_dragdropobj .
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LOOP AT lt_rows INTO lt_row.
mdata ?= e_dragdropobj->object .
IF mdata->original_table = 'LEFT' .
mdata->proceed_trans = 'X' .
ELSE .
mdata->proceed_trans = ' ' .
ENDIF .
e_dragdropobj->object = mdata .
ENDLOOP.
ENDMETHOD . "HANDLE_DROP_TO_RIGHT
ENDCLASS . "DND_TOOLS IMPLEMENTATION
DATA : mlistener TYPE REF TO dnd_tools .
======================================================
START OF SELECTION
======================================================
START-OF-SELECTION .
PERFORM get_data .
CALL SCREEN 100 .
The screen 100 has the custom control MCONTAINER and
on the flow logic has the following modules :
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE PREPARE_SCREEN .
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
(Off course not commented out in the real flow logic)
FORM GET_DATA *
FOR THIS EXAMPLE THE DATA SELECTION IS HARD CODED
FORM get_data .
CLEAR : i_ztransactions , i_ztransactions[] .
i_ztransactions-mandt = sy-mandt .
i_ztransactions-waers = 'EUR ' .
i_ztransactions-kunnr = '0000000001' .
i_ztransactions-belnr = '0000000001' .
i_ztransactions-bldat = '20030101' .
i_ztransactions-dmbtr = '1000' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000002' .
i_ztransactions-bldat = '20030202' .
i_ztransactions-dmbtr = '1010' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000003' .
i_ztransactions-bldat = '20030323' .
i_ztransactions-dmbtr = '1020' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000004' .
i_ztransactions-bldat = '20030404' .
i_ztransactions-dmbtr = '1030' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000005' .
i_ztransactions-bldat = '20030505' .
i_ztransactions-dmbtr = '1040' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000006' .
i_ztransactions-bldat = '20030606' .
i_ztransactions-dmbtr = '1050' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000007' .
i_ztransactions-bldat = '20030707' .
i_ztransactions-dmbtr = '1060' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000008' .
i_ztransactions-bldat = '20030808' .
i_ztransactions-dmbtr = '1070' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000009' .
i_ztransactions-bldat = '20030909' .
i_ztransactions-dmbtr = '1080' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000010' .
i_ztransactions-bldat = '20031010' .
i_ztransactions-dmbtr = '1090' .
APPEND i_ztransactions .
CLEAR : i_ztransactions2 , i_ztransactions2[] .
APPEND i_ztransactions2 .
ENDFORM . "GET_DATA
*& Module STATUS_0100 OUTPUT
The PF STATUS STATUS100 called from the module below,
has on the Standard toolbar the buttons
BACK , EXIT and CANCEL .
These buttons are provided with function code = 'EXIT'
MODULE status_0100 OUTPUT.
SET TITLEBAR 'TITLEDRAGDROP' .
SET PF-STATUS 'STATUS100'.
ENDMODULE. " STATUS_0100 OUTPUT
Module USER_COMMAND_0100 INPUT
The following module checks the User Command and ends
the program
MODULE user_command_0100 INPUT.
IF ok_code = 'EXIT' .
CLEAR : mcontainer ,
mcontleft ,
mcontright ,
msplitcont ,
malv_left ,
malv_right .
LEAVE TO SCREEN 0 .
ENDIF .
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module PREPARE_SCREEN OUTPUT
MODULE prepare_screen OUTPUT.
IF mcontainer IS INITIAL .
CREATE OBJECT mcontainer
EXPORTING
container_name = 'MCONTAINER' .
CREATE OBJECT msplitcont
EXPORTING
parent = mcontainer
orientation = 1 .
mcontleft = msplitcont->top_left_container .
mcontright = msplitcont->bottom_right_container .
CREATE OBJECT malv_left
EXPORTING i_parent = mcontleft .
gs_layout-sel_mode = 'D'.
CREATE OBJECT malv_right
EXPORTING i_parent = mcontright .
gs_layout-sel_mode = 'D'.
PERFORM set_layout_capable_of_drag_dro
USING 'X' 'X' .
CALL METHOD malv_left->set_table_for_first_display
EXPORTING
i_structure_name = 'ZTRANSACTIONS'
is_layout = gs_layout
CHANGING
it_outtab = i_ztransactions[].
CALL METHOD malv_right->set_table_for_first_display
EXPORTING
i_structure_name = 'ZTRANSACTIONS'
is_layout = gs_layout
CHANGING
it_outtab = i_ztransactions2[].
CREATE OBJECT mlistener .
CALL METHOD malv_left->set_toolbar_interactive.
SET HANDLER mlistener->handle_drag_from_left
FOR malv_left .
SET HANDLER mlistener->handle_dropcomplete_from_left
FOR malv_left .
SET HANDLER mlistener->handle_drag_from_right
FOR malv_right.
SET HANDLER mlistener->handle_dropcomplete_from_right
FOR malv_right .
SET HANDLER mlistener->handle_drop_to_right
FOR malv_right .
SET HANDLER mlistener->handle_drop_to_left
FOR malv_left .
ENDIF .
ENDMODULE. " PREPARE_SCREEN OUTPUT
Form SET_LAYOUT_CAPABLE_OF_DRAG_DRO
Definition of a Drag & Drop behaviour for the ALV
grid
FORM set_layout_capable_of_drag_dro USING drag drop.
DATA : effect TYPE i ,
handle_alv TYPE i .
CREATE OBJECT g_behaviour_alv.
effect = cl_dragdrop=>move + cl_dragdrop=>copy .
CALL METHOD g_behaviour_alv->add
EXPORTING
flavor = 'Line'
dragsrc = drag
droptarget = drop
effect = effect.
CALL METHOD g_behaviour_alv->get_handle
IMPORTING
handle = handle_alv.
gs_layout-s_dragdrop-row_ddid = handle_alv.
ENDFORM. " SET_LAYOUT_CAPABLE_OF_DRAG_DRO -
Error in CALL TRANSACTION and SESSION Method
I have 8 records (1,2,3,4,5,6,7,8) to update into SAP database using CALL TRANSACTION and SESSION Method. If there is a error in 6th record. What happens in both call transaction and session method.
Please let me know which records will process and what about the error record. How to process only the error record if all other records have updated into database.Hi Patil_sumeet,
if your code for this is not protected secret of some federal agency, you may read [How to post code in SCN, and some things NOT to do...|How to post code in SCN, and some things NOT to do...; and then post relevant lines here.
According to the facts presented until know it may have been better to ask Radio Eriwan
Regards
Clemens -
Can we hav call transaction and session method for an application
can we hav call transaction and session method for an application ?if yes how?
Hi ,
You can. If Call Transaction fails, a batch input session can be created.
Check this example-
Call the transaction. Messages from Call Transaction are stored in the
internal table messtab
CALL TRANSACTION 'LT01' USING bdc_tab MODE 'N' UPDATE 'S'
MESSAGES INTO messtab.
IF sy-subrc = 0.
Call transaction successfull, get the number of the Transfer Order that
was created
LOOP AT messtab.
IF messtab-dynumb = '0104' AND messtab-msgnr = '016'.
w_transportorderno = messtab-msgv1.
ENDIF.
ENDLOOP.
ELSE.
Call transaction failed, create a batch input session instead.
PERFORM open_group.
PERFORM bdc_insert USING 'LT01'.
PERFORM close_group.
ENDIF.
Regards,
Sookshma -
Difference b/w call transaction and session method
hi there,
whatz the major difference b/w call transaction and session method in BDC.
thanks in advance
dattuVijay,
Welcome to SDN
<b>SESSION METHOD</b>
Data is not updated in database table unless Session is processed.
No sy-subrc is returned.
Error log is created for error records.
Updation in database table is always synchronous
<b>CALL TRANSACTION</b>
Immediate updation in database table.
Sy-subrc is returned.
Errors need to be handled explicitly
Updation in database table can be synchronous Or Asynchronous.
Chandra. -
Decision between call transaction and session method:BDC
Hi,
Kindly guide how to take decision between call transaction and session method?
Thanks,
SanjayHello Sanjay,
here are some links which discuss the difference between them:
http://scn.sap.com/thread/721344
http://scn.sap.com/thread/166845
Best regards,
Laszlo -
Bdc(call transaction and session method)
hi experts,
i want to write for bdc program in which i have used call transaction and session method.please help me.
thank you
with regards,
santoshHi,
See the Sample BDc Code for Vendor Master Upload:
Look at the Include BDCRECX1 for Seesion and Call Transaction types:
REPORT zmm_vendor_master_upload
NO STANDARD PAGE HEADING
LINE-SIZE 255.
ABAP Name : ZMM_VENDOR_MASTER_UPLOAD
Description : This Program is used to Upload the Vendor Master.
Modification Log:
Date Programmer Correction Description
Standard Include for Selection Screen
INCLUDE bdcrecx1.
Internal Table for Upload Data
DATA: BEGIN OF i_vendor OCCURS 0,
bukrs(004), " Company Code
ekorg(004), " Purchase Orgn
ktokk(004), " Account Group
Address Screen
anred(015), " Title
name1(035), " Name1
sortl(010), " Sort Field
name2(035), " Name2
name3(035), " Contact Person1
name4(035), " Contact Person 2
stras(035), " Street
pfach(010), " PO Box
ort01(035), " City
pstlz(010), " Postal Code
land1(003), " Country
spras(002), " Language
telf1(016), " Telephone No
telfx(031), " Fax Number
lfurl(132), " URL-Mail Id
Material Group Characteristics
klart(003), " Class Type '010'
class(018), " Class 'Vendor'
mname_01(030), " Characteristic
mname_02(030), " Characteristic
mname_03(030), " Characteristic
mwert_01(030), " Charct.Value
mwert_02(030), " Charct.Value
mwert_03(030), " Charct.Value
Control Data
emnfr(010), " Manufact.Part No
Bank Details
banks_01(003), " Country of Bank1
banks_02(003), " Country of Bank2
bankl_01(015), " Bank Key of 1
bankl_02(015), " Bank Key of 2
bankn_01(018), " Account No Bank1
bankn_02(018), " Account No Bank2
Accounting Info
akont(010), " Reconcillation Account
zuawa(003), " Sort Key
fdgrv(010), " Cash Management Group
Payment Transactions
zterm(004), " Payment terms
reprf(001), " Check Double Inv.
zwels(010), " Payment Method
hbkid(005), " House Bank
xpore(001), " Individ.Payment
Correspondence
mahns(001), " Dunning Level
xausz(001), " Account Statement
Withholding Tax Details
qland(003), " Withholding Tax Country
witht_01(002), " WH tax Type
wt_withcd(002), " WH Tax Code
wt_subjct(001), " Indicator:WH Tax
Purchasing Data
waers(005), " Currency
zterm1(004), " Payment Terms
END OF i_vendor.
Data Variables & Constants
CONSTANTS : c_x VALUE 'X'. " Flag
Paramters
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start of Selection
START-OF-SELECTION.
Open the BDC Session
PERFORM open_group.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_vendor
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Upload the Data from Internal Table
LOOP AT i_vendor.
PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02K-BUKRS'
i_vendor-bukrs.
PERFORM bdc_field USING 'RF02K-EKORG'
i_vendor-ekorg.
PERFORM bdc_field USING 'RF02K-KTOKK'
i_vendor-ktokk.
PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=KLAS'.
PERFORM bdc_field USING 'LFA1-ANRED'
i_vendor-anred.
PERFORM bdc_field USING 'LFA1-NAME1'
i_vendor-name1.
PERFORM bdc_field USING 'LFA1-SORTL'
i_vendor-sortl.
PERFORM bdc_field USING 'LFA1-NAME2'
i_vendor-name2.
PERFORM bdc_field USING 'LFA1-NAME3'
i_vendor-name3.
PERFORM bdc_field USING 'LFA1-NAME4'
i_vendor-name4.
PERFORM bdc_field USING 'LFA1-STRAS'
i_vendor-stras.
PERFORM bdc_field USING 'LFA1-PFACH'
i_vendor-pfach.
PERFORM bdc_field USING 'LFA1-ORT01'
i_vendor-ort01.
PERFORM bdc_field USING 'LFA1-PSTLZ'
i_vendor-pstlz.
PERFORM bdc_field USING 'LFA1-LAND1'
i_vendor-land1.
PERFORM bdc_field USING 'LFA1-SPRAS'
i_vendor-spras.
PERFORM bdc_field USING 'LFA1-TELF1'
i_vendor-telf1.
PERFORM bdc_field USING 'LFA1-TELFX'
i_vendor-telfx.
PERFORM bdc_field USING 'LFA1-LFURL'
i_vendor-lfurl.
PERFORM bdc_dynpro USING 'SAPLCLCA' '0602'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMCLF-KLART'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'RMCLF-KLART'
'010'. "i_vendor-klart.
PERFORM bdc_dynpro USING 'SAPLCLFM' '0500'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMCLF-CLASS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=AUSW'.
PERFORM bdc_field USING 'RMCLF-CLASS(01)'
'Vendor'."i_vendor-class.
PERFORM bdc_dynpro USING 'SAPLCTMS' '0109'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RCTMS-MWERT(03)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RCTMS-MNAME(01)'
'MATERIALGROUP'." i_vendor-mname_01.
PERFORM bdc_field USING 'RCTMS-MNAME(02)'
'MATERIALGROUP'." i_vendor-mname_02.
PERFORM bdc_field USING 'RCTMS-MNAME(03)'
'MATERIALGROUP'." i_vendor-mname_03.
PERFORM bdc_field USING 'RCTMS-MWERT(01)'
i_vendor-mwert_01.
PERFORM bdc_field USING 'RCTMS-MWERT(02)'
i_vendor-mwert_02.
PERFORM bdc_field USING 'RCTMS-MWERT(03)'
i_vendor-mwert_03.
PERFORM bdc_dynpro USING 'SAPLCLFM' '0500'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMCLF-CLASS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENDE'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-ANRED'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-EMNFR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFA1-EMNFR'
i_vendor-emnfr.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFBK-BANKS(01)'
i_vendor-banks_01.
PERFORM bdc_field USING 'LFBK-BANKS(02)'
i_vendor-banks_02.
PERFORM bdc_field USING 'LFBK-BANKL(01)'
i_vendor-bankl_01.
PERFORM bdc_field USING 'LFBK-BANKL(02)'
i_vendor-bankl_02.
PERFORM bdc_field USING 'LFBK-BANKN(01)'
i_vendor-bankn_01.
PERFORM bdc_field USING 'LFBK-BANKN(02)'
i_vendor-bankn_02.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-FDGRV'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFB1-AKONT'
i_vendor-akont.
PERFORM bdc_field USING 'LFB1-ZUAWA'
i_vendor-zuawa.
PERFORM bdc_field USING 'LFB1-FDGRV'
i_vendor-fdgrv.
PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-XPORE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFB1-ZTERM'
i_vendor-zterm.
PERFORM bdc_field USING 'LFB1-REPRF'
c_x. "i_vendor-reprf.
PERFORM bdc_field USING 'LFB1-ZWELS'
i_vendor-zwels.
PERFORM bdc_field USING 'LFB1-HBKID'
i_vendor-hbkid.
PERFORM bdc_field USING 'LFB1-XPORE'
c_x. "i_vendor-xpore.
PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB5-MAHNS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFB5-MAHNS'
i_vendor-mahns.
PERFORM bdc_field USING 'LFB1-XAUSZ'
i_vendor-xausz.
PERFORM bdc_dynpro USING 'SAPMF02K' '0610'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBW-WT_SUBJCT(01)'.
PERFORM bdc_field USING 'LFB1-QLAND'
i_vendor-qland.
PERFORM bdc_field USING 'LFBW-WITHT(01)'
i_vendor-witht_01.
PERFORM bdc_field USING 'LFBW-WT_WITHCD(01)'
i_vendor-wt_withcd.
PERFORM bdc_field USING 'LFBW-WT_SUBJCT(01)'
c_x.
PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFM1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFM1-WAERS'
i_vendor-waers.
PERFORM bdc_field USING 'LFM1-ZTERM'
i_vendor-zterm1.
PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
Call the Transaction
PERFORM bdc_transaction USING 'XK01'.
ENDLOOP.
Close the BDc Session
PERFORM close_group.
Regards,
Anji -
What is difference bet call transaction and session method in BDC
hi
what is difference bet call transaction and session method in BDC
thanks.Hi,
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
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 ?
Thanks,
Reward If Helpful. -
Call transaction , and session method in the same program
hi experts,
Can anybody tell me in which cases we will use both call transaction and session methods in same program
if possible send me example code.
Regards
TrinadhHi Dengyong Zhang,
we can use the call transation and session method in same program.
However for better performance it's benificial to use call trasaction method of BDC. but if u want to upload very large amount of data then Session method is more preferable to use.
Session method is one of the method of BDC.
U can also use BAPI to upload the data in SAP but it's a different concept than BDC. Performance wise BAPI is more advantageous than BDC. -
BDC - Difference bw Transaction and Batch method
Hi
How we can handle the error messages in transaction and batch method?.
Regards
Nikhil V Kumarhi Nikhil,
WELCOME TO SDN
these are some of the differences between the two
The major differences between Session method and Call transaction are as follows:
<b>SESSION METHOD</b>
1.Data is not updated in database table unless Session is processed.
2. No sy-subrc is returned.
3.Error log is created for error records.
4.Updation in database table is always synchronous
<b>CALL TRANSACTION</b>
1. Immediate updation in database table.
2. Sy-subrc is returned.
3. Errors need to be handled explicitly
4. Updation in database table can be synchronous Or Asynchronous.
<b>Error Handling in CALL TRANSACTION</b>
When Session Method updates the records in database table, error records are stored in the log file. In Call transaction there is no such log file available and error record is lost unless handled. Usually you need to give report of all the error records i.e., records which are not inserted or updated in the database table. This can be done by the following method:
<b>Steps for the error handling in CALL TRANSACTION</b>
1. Internal table for the data (structure similar to your local file)
2. BDCTAB like BDCDATA
3. Internal table BDCMSG like BDCMSGCOLL
4. Internal table similar to Ist internal table
(Third and fourth steps are for error handling)
5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)
6. Loop at itab.
Populate BDCTAB table.
Call transaction <tr.code> using <Bdctab>
Mode <A/N/E>
Update <S/A>
Messages <BDCMSG>.
Perform check.
Refresh BDCTAB.
Endloop.
7 Form check.
IF sy-subrc <> 0. (Call transaction returns the sy-subrc if updating is not successful).
Call function Format_message.
(This function is called to store the message given by system and to display it along with record)
Append itab2.
Display the record and message.
Regards,
Santosh
Maybe you are looking for
-
Hi, I have an ipod 4th gen. It has firmware 4.3.1. I have a very annoying problem that my wifi gets disconnected randomly with no particular reason. The signal strength is excellent in my laptop. Also, when I see safari not responding, and then when
-
Utf-8 filename characters in Motif applications
Hello, 1) my Xpdf/Xdvi apps work quite well, but unable to save files with non-latin characters in filenames. 2) in addition Xpdf fails to search non-latin characters/words in pdf files. Unfortunately I can't google appropriate way to solve this. Any
-
Want to connect HDMI from ATV to DVI on projector, does this work for movie rentals or does DRM stop it?
-
11.1.4 and 11.1.5 not working in windows 7 64bit
I updated to 11.1.4 and experienced the same problems as many others- uninstalling and re installing eradicated the error messages but the store never opened and my phone would not sync. I've up graded to 11.1.5 and now it is freezing, crashing- incl
-
Adobe Acrobat 7 printer not recognized.
Need to be able to print to PDF. Used this feature in Win XP just fine. New computer with Win 8 does not recognize the PDF printer. No download available from Adobe website for the distiller (yes, there is an Adobe Distiller "server" but this will