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: 

Complete step by step Tutorial on BDC

Former Member
0 Kudos

Hi Experts,

Can I get any link to a complete step by step guide for learning BDC all by myself.Please send one link at a time which you feel is the most suitable . Please give a complete document in all respects.

I will give marks for all the good links.

Regards

Abhishek

6 REPLIES 6

Former Member
0 Kudos

Hi,

BDC - batch data communication

there are 3 methods:

->session method

steps:->BDC_OPEN_GROUP

->POPPULATE BDC DATA STRUCTURE

->BDC_INDERT

->BDC_CLOSE_GROUP

->call transaction method

steps:->POPPULATE BDC DATA STRUCTURE

->CALL TRANSACTION

SYNTAX:

CALL TRANSACTION <TRANSACTION NAME> USING <TCODE>

MODE N (NO SCREEN)

A (ALL SCREEN)

E (ERROR)

UPDATE S (SYNCHRONOUS)

A (ASYNCHRONOUS)

L (LOCAL)

MESSAGE INTO <MESSAGE>

->direct method

check these links:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d62292b3-0301-0010-df98-aaac31cd...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d62292b3-0301-0010-df98-aaac31cd...

<b>REWARD POINTS IF USEFUL.</b>

regards,

Vinod Samuel.

Former Member
0 Kudos

hello abhishek,

BDC or Batch Input Program Tips and Tricks

Batch Data Communication or BDC is a batch interfacing technique that SAP developed. It is mainly used for uploading data into the SAP R/3 system. BDC works by simulating the user input from transactional screen via an ABAP program.

The data input data file will come in the form of a flat file which the user save as file type txt file or prn file from the Microsoft Excel program. An Abaper will create a program to read the text file and upload into the SAP system.

Normally, the tcode SHDB will be used to record the transaction code the user used. After, the simulation, the Abaper can generate a sample program and modify from there. It makes the programming easier and faster.

Learning BDC Programming

I want to learn how to upload data using BDC. If I have a excel data file how will upload it using BDC. I don't know the full process of doing it, if someone help me in this. I want it using BDC session process and processing that session. I was trying to upload material master other day. But could not follow the process of uploading using BDC though I know LSMW. Please explain me the BDC process in details with examples.

For a BDC upload you need to write a program which created BDC sessions.

Steps:

1. Work out the transaction you would use to create the data manually.

2. Use transaction SHDB to record the creation of one material master data.

Click the New recording button or the Menu - Recording - Create

3. Save the recording, and then go back a screen and go to the overview.

4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.

5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:

5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).

5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.

5.3. After perform bdc_transaction, add the endloop.

Execute the program. It will have options to create a batch session or to process directly.

These are all my finds . Might be it will be useful to you.

Direct call of transactions, session handling:

/nxxxx This terminates the current transaction, and starts transaction xxxx

/n This terminates the transaction. This generally corresponds to pressing F15 to go back.

/nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).

/nex This terminates all separate sessions and logs off immediately (without any warning!).

/oxxxx This opens a new session and starts transaction xxxx in This session.

/o This lists existing sessions and allows deletion or opening of a new session.

/i This terminates the current session (corresponds to System End

/i1, /i2,... This terminates the session with the number given.

.xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).

Batch

The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:

/n This terminates the current batch input transaction and characterizes it as

/bdel This deletes the current batch input transaction.

/bend This terminates batch input processing and sets the session to Failed

/bda This switches from Display errors only to Process in foreground

/bde This switches from Process in foreground to Display errors only

ABAP/4

/h This switches into debugging mode.

/hs This switches into debugging mode and activates the debugging of system functions.

Buffer

WARNING: Resetting buffers can significantly change the performance of the entire system for a long time.

It should therefore only be used where there is a good reason tdso. As of release 3.0B system administator authorization is required (authorization object (S_ADMI_FCD). The action is noted in the system log.

/$SYNC This resets all buffers of the application server

/$CUA This resets the CUA buffer of the application server

/$TAB This resets the TABLE buffers of the application server

/$NAM This resets the nametab buffer of the application server

/$DYNP This resets the screen buffer of the application server

and also see these following links.

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.sap-img.com/abap/learning-bdc-

http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

reward if useful.

Former Member
0 Kudos

Hi,

<b>BDC (Batch Data Communication)</b> is a technology used for data transfer. it is meant for transferring data thru SAP transactions itself. when u use BDC for data transfer, the sequence of steps is the same as when u use standard sap transaction screens for data upload. the only difference is that u can use different options for foreground/background processing.

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 a BDC upload you need to write a program which created BDC sessions.

<b>Steps:</b>

1. Work out the transaction you would use to create the data manually.

2. Use transaction SHDB to record the creation of one material master data.

Click the New recording button or the Menu - Recording - Create

3. Save the recording, and then go back a screen and go to the overview.

4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.

5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:

5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).

5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.

5.3. After perform bdc_transaction, add the endloop.

Execute the program. It will have options to create a batch session or to process directly.

These are all my finds . Might be it will be useful to you.

Direct call of transactions, session handling:

/nxxxx This terminates the current transaction, and starts transaction xxxx

/n This terminates the transaction. This generally corresponds to pressing F15 to go back.

/nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).

/nex This terminates all separate sessions and logs off immediately (without any warning!).

/oxxxx This opens a new session and starts transaction xxxx in This session.

/o This lists existing sessions and allows deletion or opening of a new session.

/i This terminates the current session (corresponds to System End

/i1, /i2,... This terminates the session with the number given.

.xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).

Batch

The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:

/n This terminates the current batch input transaction and characterizes it as

/bdel This deletes the current batch input transaction.

/bend This terminates batch input processing and sets the session to Failed

/bda This switches from Display errors only to Process in foreground

/bde This switches from Process in foreground to Display errors only

ABAP/4

/h This switches into debugging mode.

/hs This switches into debugging mode and activates the debugging of system functions.

Buffer

WARNING: Resetting buffers can significantly change the performance of the entire system for a long time.

It should therefore only be used where there is a good reason tdso. As of release 3.0B system administator authorization is required (authorization object (S_ADMI_FCD). The action is noted in the system log.

/$SYNC This resets all buffers of the application server

/$CUA This resets the CUA buffer of the application server

/$TAB This resets the TABLE buffers of the application server

/$NAM This resets the nametab buffer of the application server

/$DYNP This resets the screen buffer of the application server

<b>BDC Links</b>

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

BAPI

BAPI stands for Business API(Application Program Interface).

A BAPI is remotely enabled function module

ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..

You can make your function module remotely enabled in attributes of Function module but

A BAPI are standard SAP function modules provided by SAP for remote access.

Also they are part of Businees Objest Repository(BOR).

BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects.

You create business objects and those are then registered in your BOR (Business Object Repository)

which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA.

In this case u only specify the business object and its method from external system

in BAPI there is no direct system call. while RFC are direct system call.

Some BAPIs provide basic functions and can be used for most SAP business object types.

These BAPIs should be implemented the same for all business object types.

Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs.

Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.

check these links

http://searchsap.techtarget.com/ateQuestionNResponse/0,289625,sid21_cid558752_tax293481,00.html

http://www.sap-img.com/abap/interview-question-on-bapi-rfc-abap-objects-tables.htm

http://www.sap-img.com/fu033.htm

http://www.sap-img.com/abap/ale-bapi.htm

Check these sample programs below.

BAPI FMs

BAPI_CUSTOMER_CREATEFROMDATA

BAPI_CUSTOMER_CREATEFROMDATA1

SD_CUSTOMER_MAINTAIN_ALL.

BAPI_CUSTOMER_CREATE.

Sample BDC - XD01

REPORT ZJAYARAM_TABCTL_XD01 NO STANDARD PAGE HEADING LINE-SIZE 132

LINE-COUNT 60

MESSAGE-ID Z00.

----


  • Table/Structure declarations. *

----


TABLES : KNA1. "Customer master

----


  • Constants declarations. *

----


CONSTANTS : C_MODE VALUE 'A',

C_UPDATE VALUE 'S',

C_X VALUE 'X',

C_SESS TYPE APQI-GROUPID VALUE 'ZCUSTOMER', "Session Name

C_XD01 LIKE TSTC-TCODE VALUE 'XD01'.

----


  • Variable declarations. *

----


DATA : V_FNAME(15) VALUE SPACE, " Name of file to be created

V_FAILREC TYPE I, " No of failed records

V_MSG(255), " Message Text

V_ERRREC TYPE I, " No of failed records

V_LINES TYPE I, " No of records

V_BANKS(15), " Table column BANKS

V_BANKL(15), " Table column BANKL

V_BANKN(15), " Table column BANKN

V_TIDX(2) TYPE N. " Table row index

----


*-- FLAG DECLARATIONS

----


DATA : FG_DATA_EXIST VALUE 'X', " Check for data

FG_SESSION_OPEN VALUE ' '. " Check for Session Open

----


*-- MACRO DEFINITIONS

----


*-- Macro for BANKS

DEFINE BANKS.

CLEAR V_BANKS.

CONCATENATE 'KNBK-BANKS(' &1 ')' INTO V_BANKS.

CONDENSE V_BANKS.

END-OF-DEFINITION.

*-- Macro for BANKL

DEFINE BANKL.

CLEAR V_BANKL.

CONCATENATE 'KNBK-BANKL(' &1 ')' INTO V_BANKL.

CONDENSE V_BANKL.

END-OF-DEFINITION.

*-- Macro for BANKN

DEFINE BANKN.

CLEAR V_BANKN.

CONCATENATE 'KNBK-BANKN(' &1 ')' INTO V_BANKN.

CONDENSE V_BANKN.

END-OF-DEFINITION.

----


  • Structures / Internal table declarations *

----


*-- Structure to hold BDC data

TYPES : BEGIN OF T_BDCTABLE.

INCLUDE STRUCTURE BDCDATA.

TYPES END OF T_BDCTABLE.

*-- Structure to trap BDC messages

TYPES : BEGIN OF T_MSG.

INCLUDE STRUCTURE BDCMSGCOLL.

TYPES : END OF T_MSG.

*-- Structure to trap ERROR messages

TYPES : BEGIN OF T_ERR_MSG,

MESSAGE(255),

END OF T_ERR_MSG.

*--Internal table to store flat file data

DATA : BEGIN OF IT_KNA1 OCCURS 0,

KUNNR LIKE KNA1-KUNNR,

KTOKD LIKE T077D-KTOKD,

NAME1 LIKE KNA1-NAME1,

SORTL LIKE KNA1-SORTL,

ORT01 LIKE KNA1-ORT01,

PSTLZ LIKE KNA1-PSTLZ,

LAND1 LIKE KNA1-LAND1,

SPRAS LIKE KNA1-SPRAS,

LZONE LIKE KNA1-LZONE,

END OF IT_KNA1.

*--Internal table to store bank details

DATA : BEGIN OF IT_BANK OCCURS 0,

BANKS LIKE KNBK-BANKS,

BANKL LIKE KNBK-BANKL,

BANKN LIKE KNBK-BANKN,

END OF IT_BANK.

*-- Internal table to hold BDC data

DATA: IT_BDCDATA TYPE STANDARD TABLE OF T_BDCTABLE WITH HEADER LINE,

*-- Internal Table to store ALL messages

IT_MSG TYPE STANDARD TABLE OF T_MSG WITH HEADER LINE,

*-- Internal Table to store error messages

IT_ERR_MSG TYPE STANDARD TABLE OF T_ERR_MSG WITH HEADER LINE.

----


  • Selection Screen. *

----


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_FLNAME(15) OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : R_LIST RADIOBUTTON GROUP GRP1.

SELECTION-SCREEN COMMENT 5(20) TEXT-003.

PARAMETERS : R_SESS RADIOBUTTON GROUP GRP1.

SELECTION-SCREEN COMMENT 30(20) TEXT-004.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B2.

----


  • Event:Initialization *

----


INITIALIZATION.

----


  • AT Selection Screen. *

----


AT SELECTION-SCREEN.

----


  • Event: Start-of-Selection *

----


START-OF-SELECTION.

V_FNAME = P_FLNAME.

PERFORM GET_DATA.

PERFORM GET_BANKDATA.

PERFORM GENERATE_DATASET.

----


  • Event: End-of-Selection *

----


END-OF-SELECTION.

IF FG_DATA_EXIST = ' '.

MESSAGE I010 WITH TEXT-009.

EXIT.

ENDIF.

PERFORM GENERATE_BDCDATA.

PERFORM DISPLAY_ERR_RECS.

----


  • Event: top-of-page

----


TOP-OF-PAGE.

//////////////////////////////////////////////////////////////////////

*

  • FORM DEFINITIONS *

*

*//////////////////////////////////////////////////////////////////////

&----


*& Form get_data

&----


  • Subroutine to get the data from mard

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_DATA.

CALL FUNCTION 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'C:XD01.TXT'

FILETYPE = 'DAT'

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

DATA_TAB = IT_KNA1

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

IF IT_KNA1[] IS INITIAL.

FG_DATA_EXIST = ' '.

ENDIF.

ENDFORM. " get_data

&----


*& Form GENERATE_DATASET

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GENERATE_DATASET.

MESSAGE I010 WITH 'OPENING FILE IN APPLICATION SERVER'.

**--Creating a data set in application server

OPEN DATASET V_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

**---Transfering data from internal table to dataset

MESSAGE I010 WITH 'TRANSFERING DATA FROM INETERAL TABLE TO THE FILE'.

LOOP AT IT_KNA1.

TRANSFER IT_KNA1 TO V_FNAME.

ENDLOOP.

**--Closing the dataset

MESSAGE I010 WITH 'CLOSING THE FILE'.

CLOSE DATASET V_FNAME.

ENDFORM. " GENERATE_DATASET

&----


*& Form BDC_DYNPRO

&----


  • text

----


  • -->P_0467 text

  • -->P_0468 text

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR IT_BDCDATA.

IT_BDCDATA-PROGRAM = PROGRAM.

IT_BDCDATA-DYNPRO = DYNPRO.

IT_BDCDATA-DYNBEGIN = 'X'.

APPEND IT_BDCDATA.

ENDFORM.

&----


*& Form BDC_FIELD

&----


  • text

----


  • -->P_0472 text

  • -->P_0473 text

----


FORM BDC_FIELD USING FNAM FVAL.

IF NOT FVAL IS INITIAL.

CLEAR IT_BDCDATA.

IT_BDCDATA-FNAM = FNAM.

IT_BDCDATA-FVAL = FVAL.

APPEND IT_BDCDATA.

ENDIF.

ENDFORM.

&----


*& Form GENERATE_BDCDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GENERATE_BDCDATA.

REFRESH IT_KNA1.

  • Opening dataset for reading

OPEN DATASET V_FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.

        • Reading the file from application server

DO.

CLEAR: IT_KNA1,IT_BDCDATA.

REFRESH IT_BDCDATA.

READ DATASET V_FNAME INTO IT_KNA1.

IF SY-SUBRC <> 0.

EXIT.

ELSE.

  • Populate BDC Data for Initial Screen

PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0100',

BDC_FIELD USING 'BDC_CURSOR' 'RF02D-KUNNR',

BDC_FIELD USING 'BDC_OKCODE' '/00',

BDC_FIELD USING 'RF02D-KUNNR' IT_KNA1-KUNNR,

BDC_FIELD USING 'RF02D-KTOKD' IT_KNA1-KTOKD.

  • Populate BDC Data for Second Screen

PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0110',

BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NAME1',

BDC_FIELD USING 'BDC_OKCODE' '/00',

BDC_FIELD USING 'KNA1-NAME1' IT_KNA1-NAME1,

BDC_FIELD USING 'KNA1-SORTL' IT_KNA1-SORTL,

BDC_FIELD USING 'KNA1-ORT01' IT_KNA1-ORT01,

BDC_FIELD USING 'KNA1-PSTLZ' IT_KNA1-PSTLZ,

BDC_FIELD USING 'KNA1-LAND1' IT_KNA1-LAND1,

BDC_FIELD USING 'KNA1-SPRAS' IT_KNA1-SPRAS.

  • Populate BDC Data for Third Screen

PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0120',

BDC_FIELD USING 'BDC_CURSOR' 'KNA1-LZONE',

BDC_FIELD USING 'BDC_OKCODE' '/00',

BDC_FIELD USING 'KNA1-LZONE' IT_KNA1-LZONE.

  • Populate BDC Data for Fourth Screen

PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0125',

BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NIELS',

BDC_FIELD USING 'BDC_OKCODE' '/00'.

  • Populate BDC Data for Table control for bank details.

V_TIDX = '01'.

LOOP AT IT_BANK.

BANKS V_TIDX.

BANKL V_TIDX.

BANKN V_TIDX.

PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',

BDC_FIELD USING 'BDC_CURSOR' V_BANKN,

BDC_FIELD USING 'BDC_OKCODE' '=ENTR',

BDC_FIELD USING V_BANKS IT_BANK-BANKS,

BDC_FIELD USING V_BANKL IT_BANK-BANKL,

BDC_FIELD USING V_BANKN IT_BANK-BANKN.

V_TIDX = V_TIDX + 1.

ENDLOOP.

PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',

BDC_FIELD USING 'BDC_CURSOR' V_BANKS,

BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.

CALL TRANSACTION C_XD01 USING IT_BDCDATA

MODE C_MODE

UPDATE C_UPDATE

MESSAGES INTO IT_MSG.

IF SY-SUBRC <> 0.

*--In case of error list display

IF R_LIST = C_X.

V_ERRREC = V_ERRREC + 1.

PERFORM FORMAT_MESSAGE.

IT_ERR_MSG-MESSAGE = V_MSG.

APPEND IT_ERR_MSG.

CLEAR : V_MSG,IT_ERR_MSG.

ENDIF.

*--In case of session log

IF R_SESS = C_X.

*-- In case of transaction fails.

IF FG_SESSION_OPEN = ' '.

FG_SESSION_OPEN = C_X.

PERFORM BDC_OPEN_GROUP.

ENDIF. " IF FG_SESSION_OPEN = ' '.

*-- Insert BDC Data..

PERFORM BDC_INSERT_DATA.

ENDIF. " IF R_SESS = C_X.

ENDIF. " IF SY-SUBRC <> 0.

ENDIF. " IF SY-SUBRC <> 0.

ENDDO.

  • Closing the dataset

CLOSE DATASET V_FNAME.

*-- Close the session if opened

IF FG_SESSION_OPEN = C_X.

PERFORM BDC_CLOSE_GROUP.

CALL TRANSACTION 'SM35'.

ENDIF.

ENDFORM. " GENERATE_BDCDATA

&----


*& Form BDC_OPEN_GROUP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BDC_OPEN_GROUP.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = C_SESS

  • HOLDDATE = FILLER8

KEEP = C_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.

ENDFORM. " BDC_OPEN_GROUP

&----


*& Form BDC_INSERT_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BDC_INSERT_DATA.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = C_XD01

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

TABLES

DYNPROTAB = IT_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.

ENDFORM. " BDC_INSERT_DATA

&----


*& Form BDC_CLOSE_GROUP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BDC_CLOSE_GROUP.

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.

ENDFORM. " BDC_CLOSE_GROUP

&----


*& Form FORMAT_MESSAGE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FORMAT_MESSAGE.

CLEAR V_LINES.

DESCRIBE TABLE IT_MSG LINES V_LINES.

READ TABLE IT_MSG INDEX V_LINES.

CLEAR V_MSG.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = IT_MSG-MSGID

LANG = IT_MSG-MSGSPRA

NO = IT_MSG-MSGNR

V1 = IT_MSG-MSGV1

V2 = IT_MSG-MSGV2

V3 = IT_MSG-MSGV3

V4 = IT_MSG-MSGV4

IMPORTING

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

ENDFORM. " FORMAT_MESSAGE

&----


*& Form DISPLAY_ERR_RECS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_ERR_RECS.

LOOP AT IT_ERR_MSG.

WRITE: / IT_ERR_MSG-MESSAGE.

ENDLOOP.

ENDFORM. " DISPLAY_ERR_RECS

&----


*& Form GET_BANKDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_BANKDATA.

IT_BANK-BANKS = 'AD'.

IT_BANK-BANKL = '1000'.

IT_BANK-BANKN = 'S.B A/C'.

APPEND IT_BANK.

IT_BANK-BANKS = 'AD'.

IT_BANK-BANKL = 'CITY'.

IT_BANK-BANKN = 'CURR. A/C'.

APPEND IT_BANK.

IT_BANK-BANKS = 'AD'.

IT_BANK-BANKL = 'H001'.

IT_BANK-BANKN = 'S.B A/C'.

APPEND IT_BANK.

<b>

Reward Points if Useful</b>

Regards

Gokul

0 Kudos

Hi Siva my id is:"courage24883@hotmail.com"

Former Member
0 Kudos

Thanks a lot all of you.