Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

bdc

Former Member
0 Likes
616

hi,

how to find a suitable method for uploading data.

1.lsmw

2.batch input

3.calltransaction.

how to select a particular method.

kindly help.

rgds

thi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
588

Hi,

1. If any one who dont know the ABAP programming then they will use the LSMW.

Also if to upload data by IDOC or etc.

2. If there is large data with lot of errors and it is to upload to database then due to it consumes most of CPU resources we can use session method where background scheduling is done at offpeak times and also u can once again run same session in error mode also.

and frequent upload of data(daily, Monthly, weekly etc)

3. if data is low and load on production is less then u can use Call transaction method.

Here data consist less errors can uploaded

4 REPLIES 4
Read only

Former Member
0 Likes
589

Hi,

1. If any one who dont know the ABAP programming then they will use the LSMW.

Also if to upload data by IDOC or etc.

2. If there is large data with lot of errors and it is to upload to database then due to it consumes most of CPU resources we can use session method where background scheduling is done at offpeak times and also u can once again run same session in error mode also.

and frequent upload of data(daily, Monthly, weekly etc)

3. if data is low and load on production is less then u can use Call transaction method.

Here data consist less errors can uploaded

Read only

Former Member
0 Likes
588

Hi,

use of methods depending upon amount;

if you have run time validation while updating the data into SAP R/3 Transaction,then use BDC Call Transaction.

example : when you load the data into Sales order then you need to load the into Header text of sales order.

for this ,you have to use Update Mode 'S'.

it is online update and if you small amount of data ,then prefer this one

2. If you have huge amount of data and then prefer Session Method.

we have one more advantage in session method...

suppose file has 1,00,000 records and the if you use all the records at time,then you will get short dump like system time exceed .

then you can split the each 10,000 records into one session and will process.

3. Direct Input method : we prefer this method only few Transaction ,

this will not applicable to when system has customer fields .

LSMW is used by functional people.Lsmw is used to upload large amount of data.Almost 60% logic will be provided by system and error handling is also very easy.

LSMW supports Session method and Direct Input only.It doesn't support all Transaction method.We can use BAPI's and IDoc's also.

Read only

Former Member
0 Likes
588

Hello,

Batch Input or session is one and the same (Batch input is a method to upload mass data in batch)

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

Session method provides errorl log by default

goto SM35->error log.

In call transaction we have to handle error records using BDCMSGCOLL and FORMAT_MESSAGES.

after calltrnsaction logic check for sy-subrc 0.

then loop at bdcmsg.

error msgs.

endloop.

check below example.

REPORT ZSR_BDC_CT_ERROR.

DATA: BEGIN OF ITAB OCCURS 0,

LIFNR LIKE RF02K-LIFNR,

KTOKK LIKE RF02K-KTOKK,

NAME1 LIKE LFA1-NAME1,

SORTL LIKE LFA1-SORTL,

LAND1 LIKE LFA1-LAND1,

SPRAS LIKE LFA1-SPRAS,

END OF ITAB.

DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

it_error like itab occurs 0 with header line,

BDCMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'z:\ct.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

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 ITAB.

REFRESH BDCTAB.

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-LIFNR'

ITAB-LIFNR.

PERFORM BDC_FIELD USING 'RF02K-KTOKK'

ITAB-KTOKK.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFA1-SPRAS'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'LFA1-NAME1'

ITAB-NAME1.

PERFORM BDC_FIELD USING 'LFA1-SORTL'

ITAB-SORTL.

PERFORM BDC_FIELD USING 'LFA1-LAND1'

ITAB-LAND1.

PERFORM BDC_FIELD USING 'LFA1-SPRAS'

ITAB-SPRAS.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFA1-KUNNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFBK-BANKS(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=YES'.

CALL TRANSACTION 'XK01' USING BDCTAB MODE 'A' UPDATE 'A' MESSAGES INTO BDCMSG.

*LOOP AT BDCMSG.

if sy-subrc 0.

move-corresponding itab to it_error.

endif.

READ TABLE BDCMSG WITH KEY MSGTYP = 'E'.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = BDCMSG-MSGID

LANG = 'EN'

NO = BDCMSG-MSGNR

V1 = BDCMSG-MSGV1

V2 = BDCMSG-MSGV2

V3 = BDCMSG-MSGV3

V4 = BDCMSG-MSGV4

IMPORTING

MSG = BDCMSG-MSGV1

  • 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.

WRITE 😕 BDCMSG-MSGNR,BDCMSG-MSGV1.

ENDLOOP.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = BIN_FILESIZE

filename = 'z:\cerror.txt'

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH = FILELENGTH

TABLES

data_tab = it_error

  • FIELDNAMES = FIELDNAMES

  • EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

  • OTHERS = 22

.

IF sy-subrc 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

&----


*& Form dynpro

&----


FORM BDC_DYNPRO USING P_P1

P_P2.

CLEAR BDCTAB.

BDCTAB-PROGRAM = P_P1.

BDCTAB-DYNPRO = P_P2.

BDCTAB-DYNBEGIN = 'X'.

APPEND BDCTAB.

ENDFORM. " dynpro

&----


*& Form bdc_field

&----


FORM BDC_FIELD USING P_P3

P_P4.

CLEAR BDCTAB.

BDCTAB-FNAM = P_P3.

BDCTAB-FVAL = P_P4.

APPEND BDCTAB.

ENDFORM. " bdc_field

BDC is the way to transfer data by writing a batch input program which can use either session or call transaction method.

LSMW used to transfer data without/less code.

What type of data we transfer using LSMW?

LSMW is best suited for transferring master data.

Actually BDC and LSMW are not comparable at all.

for example LSMW itself can use BDC as a way of mass data transfer.

BDC is a mass data transfer technique via screen logic of existing SAP Data entry transactions. It behaves as if you are manually making thousand of entires into sap system as a background job. And that is probably the reason why BAPI's are preffered over BDC's.

On the other hand LSMW is a tool to facilitate DATA migration from other legacy systems ... It contains step by step procedure for data migration.

Like Managing Data Migration Projects , Creating Source Structures , Mapping Source structures wid Target structures , etc etc

LSMW internally might well be using the following techniqes for data transfer..

1. IDOX

2. Direct Input / BDC

4. BAPI's

LSMW is an encapsulated data transfer tool. It can provide the same functionality as BDC infact much more but when coming to techinical perspective most the parameters are encapulated. To listout some of the differences :

LSMW is basicaly designed for a fuctional consultant who do not do much coding but need to explore the fuctionality while BDC is designed for a technical consultant.

LSMW offers different techinque for migrating data: Direct input ,BAPI,Idoc,Batch input recording. While bdc basically uses recording.

LSMW mapping is done by SAP while in BDC we have to do it explicitly .

LSMW is basically for standard SAP application while bdc basically for customized application.

Coding can be done flexibly in BDC when compared to LSMW

if helpful reward points

plz reward points if helpful or if it solves ur query.

Read only

Former Member
0 Likes
588

hi,

Which data transfer technique will be used for the individual business object types?

The following three standard techniques are available for the data transfer:

· BAPIs

Calling a BAPI in the appropriate application transfers the data to the SAP System. If BAPIs are used as interfaces to the SAP system, the same technique is used as for the continuous data transfer between SAP Systems or between non-SAP systems and SAP Systems with ALE.

For more information on data transfer using BAPIs, see Process Flow of Mass Data Transfer Using BAPIs.

· Batch input

Batch input is a standard technique for transferring large volumes of data into the SAP System. In the process, the transaction flow is simulated, and the data is transferred as if it were entered online. The advantage of this procedure is that all the transaction checks are performed, which guarantees data consistency.

For detailed information on batch input, please refer to the documentation on batch input sessions under Data Transfer: Overview of Batch Input.

· Direct input

During direct input, the data in the data transfer file is first subjected to various checks, and is then imported directly into the SAP System. The SAP database is updated directly with the transferred data.

Hope this is helpful, Do rewrd.