2008 Mar 07 1:55 PM
bdc- call transaction or batch input session? which is more effective and widely used and why?
is the following command generally used in bdc
SPLIT ITAB-COMMA AT ',' INTO RECORD-MATNR_001 RECORD-MBRSH_002
RECORD-MTART_003 RECORD-KZSEL_01_004 RECORD-MAKTX_005 RECORD-MEINS_006.
*RECORD-MTPOS_MARA_007.
bdc- call transaction or batch input session? which is more effective and widely used and why?
is the following command generally used in bdc
SPLIT ITAB-COMMA AT ',' INTO RECORD-MATNR_001 RECORD-MBRSH_002
RECORD-MTART_003 RECORD-KZSEL_01_004 RECORD-MAKTX_005 RECORD-MEINS_006.
*RECORD-MTPOS_MARA_007.
2008 Mar 07 1:57 PM
Hi,
Use Call transaction method, if you got any error records then move those error records to the session, so here you need to write both.
and come to your code, you will get the data in an internal table(which will contain all the from the flat file) then splitiing the data and sending into the their own individuval feidls
Regards
Sudheer
2008 Mar 08 3:54 AM
sudhseer,
i couldnt understand your answer properly,could you please make more clear about that especially that splitting part
2008 Mar 08 4:26 AM
hi suja !
there is nothing to Confuse with Split Command.
see let us assume that you have one flat file.
ok.
in that flat file the data is like this..!
here am using COMMA as delimiter. ok
Gd : genral data for Customer or vendor master.
for each vendor let us assume having a couple of bank accounts.
BD : bank details
so while populating the particular customer we hav to populate the bank details alo.
GD,1000,0001,0002,mr.,xxx ......... etc
BD,1000,de,90998770,hdfc,atm .....etc
BD,1000,de,90998771,hdfc,atm .....etc
BD,1000,de,90998772,hdfc,atm .....etc
BD,1000,de,90998773,hdfc,atm .....etc
GD,1001,0001,0002,mr.,yyy ......... etc
BD,1001,de,90998779,hdfc,atm .....etc
BD,1001,de,90998778,hdfc,atm .....etc
BD,1001,de,90998777,hdfc,atm .....etc
BD,1001,de,90998776,hdfc,atm .....etc
ok this is my flat file.
now take one internal table like this :
data : begin of it_totaldata occurs 0,
dummy(200),
end of it_totaldata.
at first we have up load the data into it_totaldata by using GUI_UPLOAD
after uploading data into internal table it_totaldata ,
then we have to SPLIT the data with respect to the identifier.
see at start of each record i used GD and BD.
that is general data (General data) m Bank details (BD).
now am splinting the data ok.
put conditon:
loop at it_totaldata.
if it_totaldata+0(2) = 'GD'.
split it_totaldata at ',' into VAR " this is variable to hold identifier
it_gd_data-lifnr
it_gd_data-bukrs
.
.
.
.
.
append it_gd_data.
elseif it_totaldata+0(2) = 'BD'
split it_totaldata at ',' into VAR " this is variable to hold identifier
it_bd_Data-banks
it_bd_Data-bankl
it_bd_Data-bankn
.
.
.
append it_bd_data.
endloop.
any further Queries regarding let me know ok.!
if useful reward me,
Cheers ,
Rajesh!
Edited by: rajesh k on Mar 8, 2008 9:57 AM
2008 Mar 11 6:41 AM
hi rajesh,
thank you for explaining about the split command.that is clear. now tell me is it possible to do bdc for an excelfile as your source file.
what else can be your source files
Edited by: suja thomas on Mar 11, 2008 7:42 AM
2008 Mar 11 9:02 AM
Hi
SEE THIS PROGRAM WHERE i had uploaded the data from excel sheet to internal table and then to application sever
&----
*& Report ZSD_EXCEL_INT_APP
*&
&----
*&
*&
&----
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
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.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
2008 Mar 12 6:11 AM
hi eshwar,
usually we create the flatfile on presentation server. does creating it on application server has any significance?does using the flat file on A.S for bdc require anycode different from the usual bdc ?please answer me.
"if it_totaldata+0(2) = 'GD'." what does this code mean?
Edited by: suja thomas on Mar 12, 2008 7:13 AM
2008 Mar 07 7:38 PM
Hi
The use of the upload method majorly depends on the application and the volume of the data need to be handled and also the corectness of teh data.
Generally call transaction is much faster than teh session method but in BDC's performance comes next to Accuracy of the upload.
In call transaction you error handling need to be handled explicitly, which is little difficlut.
In session we have many advantages over the call transaction, for example in call transaction if there are 100 transactions are failed, then you need to correct these 100 records and prepare a new file and again run the complete program where as in session, in SM35 you can run the session in error mode and correct the transactions.
for further clarity refer SAP documentation
BR
Sree
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |