Application Development 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: 

How to Upload Data without Recording

Former Member
0 Kudos

Hi Experts,

Can u answer how to upload master data without recording(excluding BAPI)?

5 REPLIES 5

Sougata
Active Contributor
0 Kudos

1. You can use a related IDoc to upload master data.

2. You can use SAP standard Direct Input programs, if any provided by SAP for the master data you are trying to upload.

What is the context of this question?

Message was edited by:

Sougata Chatterjee

Former Member
0 Kudos

Hi Sourav,

Check the sample code below.

<b>BDC:</b>

<b>Batch Data Communication (BDC)</b> 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.

Differences between Call Transaction and Sessions Method:

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.

6) generally used for back ground jobs.

7) at atime we can update to more than one screens.

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

6) for background n fore ground jobs.

7) at atime we can update to a single screen.

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

Sample BDC

report ZABSALES_ORDER no standard page heading line-size 255.

TABLES: vbak, vbap.

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.

SELECTION-SCREEN BEGIN OF BLOCK salesblock WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP 1.

PARAMETERS : Order_ty LIKE vbak-auart DEFAULT 'OR'

modif id SC1,

Customer LIKE kuagv-kunnr OBLIGATORY VALUE CHECK,

Purchase LIKE vbkd-bstkd OBLIGATORY VALUE CHECK,

Material LIKE vbap-matnr OBLIGATORY VALUE CHECK,

Quantity LIKE rv45a-kwmeng OBLIGATORY VALUE CHECK.

SELECTION-SCREEN END OF BLOCK salesblock.

SELECTION-SCREEN END OF SCREEN 500.

CALL SELECTION-SCREEN 500.

*At selection-screen on Order_ty.

*IF Order_ty <> 'OR'.

  • MESSAGE E080(ZVIKALP).

  • ENDIF.

start-of-selection.

perform bdc_dynpro using 'SAPMV45A' '0101'.

perform bdc_field using 'BDC_CURSOR'

'VBAK-AUART'.

perform bdc_field using 'BDC_OKCODE'

'=UER1'.

perform bdc_field using 'VBAK-AUART'

Order_ty.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=SICH'.

perform bdc_field using 'VBKD-BSTKD'

Purchase.

perform bdc_field using 'KUAGV-KUNNR'

Customer.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'04/05'.

perform bdc_field using 'BDC_OKCODE'

'SICH'.

perform bdc_field using 'RV45A-KETDAT'

'06-05-2005'.

perform bdc_field using 'RV45A-KPRGBZ'

'D'.

perform bdc_field using 'VBKD-PRSDT'

'05-29-2005'.

perform bdc_field using 'BDC_CURSOR'

'RV45A-KWMENG(01)'.

perform bdc_field using 'RV45A-MABNR(01)'

Material.

perform bdc_field using 'RV45A-KWMENG(01)'

Quantity.

perform bdc_dynpro using 'SAPLSPO2' '0101'.

perform bdc_field using 'BDC_OKCODE'

'=OPT1'.

CALL TRANSACTION 'VA01' USING bdcdata

MODE 'N'

UPDATE 'A'

MESSAGES INTO messtab.

loop at messtab.

if messtab-msgtyp = 'S'.

FORMAT COLOR 5.

elseif messtab-msgtyp = 'E'.

FORMAT COLOR 6.

ENDIF.

write: / messtab-msgtyp, messtab-msgnr.

endloop.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> ' '.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

***********By session method

report ZAB_PURCHASE no standard page heading line-size 255.

tables: ekko, ekpo, t100.

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF T_MSG OCCURS 0.

INCLUDE STRUCTURE T100.

DATA: END OF T_MSG.

*include bdcrecx1.

*SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.

SELECTION-SCREEN BEGIN OF BLOCK salesblock WITH FRAME TITLE text-001.

PARAMETERS : Vendor like Ekko-lifnr OBLIGATORY,

Order_ty like RM06E-BSART obligatory,

Pur_org like ekko-ekorg obligatory value check,

Pur_grp like ekko-ekgrp obligatory value check,

Material like ekpo-ematn obligatory value check,

Quantity(13) type n,

Plant like ekpo-werks obligatory value check.

SELECTION-SCREEN END OF BLOCK salesblock.

*SELECTION-SCREEN END OF SCREEN 500.

*CALL SELECTION-SCREEN 500.

TOP-OF-PAGE.

WRITE :/40 'Creating Purchase Order' COLOR 4 INTENSIFIED ON INVERSE ON

.

ULINE.

FORMAT COLOR 7 INVERSE ON.

WRITE :/1(20) 'Mesaage Type',

25(20) 'Message'.

ULINE.

start-of-selection.

*perform open_group.

perform bdc_dynpro using 'SAPMM06E' '0100'.

perform bdc_field using 'BDC_CURSOR'

'EKKO-EKGRP'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'EKKO-LIFNR'

Vendor.

perform bdc_field using 'RM06E-BSART'

Order_ty.

perform bdc_field using 'RM06E-BEDAT'

'05-30-2005'.

perform bdc_field using 'EKKO-EKORG'

Pur_org.

perform bdc_field using 'EKKO-EKGRP'

Pur_grp.

perform bdc_field using 'RM06E-LPEIN'

'T'.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR'

'EKPO-WERKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'EKPO-EMATN(01)'

Material.

perform bdc_field using 'EKPO-MENGE(01)'

Quantity.

perform bdc_field using 'EKPO-WERKS(01)'

Plant.

*perform bdc_transaction using 'ME21'.

*CALL TRANSACTION 'ME21' USING BDCDATA

  • MODE 'A'

  • UPDATE 'A'

  • MESSAGES INTO MESSTAB.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'ZAP3'

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = SY-UNAME

  • RECORD = FILLER1

  • IMPORTING

  • QID =

  • 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

.

IF sy-subrc <> 0.

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

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

ENDIF.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'ME21'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

TABLES

dynprotab = BDCDATA

  • EXCEPTIONS

  • INTERNAL_ERROR = 1

  • NOT_OPEN = 2

  • QUEUE_ERROR = 3

  • TCODE_INVALID = 4

  • PRINTING_INVALID = 5

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

CALL FUNCTION 'BDC_CLOSE_GROUP'

  • EXCEPTIONS

  • NOT_OPEN = 1

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

end-of-selection.

loop at messtab.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = messtab-MSGID

LANG = 'EN'

NO = messtab-msgnr

V1 = messtab-MSGV1

V2 = messtab-MSGV2

V3 = messtab-MSGV3

V4 = messtab-MSGV4

IMPORTING

MSG = T_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.

if messtab-msgtyp = 'S'.

FORMAT COLOR 5 inverse on.

elseif messtab-msgtyp = 'E'.

FORMAT COLOR 6 inverse on.

else.

FORMAT COLOR 3 inverse on.

ENDIF.

WRITE : /1(20) messtab-msgtyp ,

25(60) t_msg.

endloop.

*perform close_group.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> ' '.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

<b>Reward points if Useful</b>

Regards

Gokul

Former Member
0 Kudos

Hi Sourav,

U can use BDC/lsmw (direct input method)..

Thanks

Naveen khan

Former Member
0 Kudos

Hello I suggest to use LSMW tool, it's quite easy to use, it's possible to use different upload techniques there (Direct Input, Idoc, BAPI) you can also add your programming code there.

Former Member
0 Kudos

BDC can also be done using Idoc's and Direct Input methods!

regards,

srinivas

<b>*reward for useful answers*</b>