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
681

what is interface programming.? what is diff between bdc &bapi?

5 REPLIES 5
Read only

Former Member
0 Likes
600

Prakash,

Interface programming means working with the interfaces... its also kind of data transfer like bdc...but much different from bdc and bapi.

Here you create one data transfere medium ( interface) with ale or edi.. and with the use of Idocs or files you tranfer the data between multiple systems by sydicating the systems or with out syndication.

where as in case of bdc its entirely different you get the data in the form of flat files into your location either into apps server or onto presntation server you will pick the data from there n upload the data or download the data to local file....

In interface programming also u can make use of BAPI's for the data transfer....

Read only

Former Member
0 Likes
600

hi,

BDC : Batch data commuminication.

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

this likn will helps

http://www.sap-img.com/abap/learning-bdc-programming.htm

BAPI:

Methods

Parameters

Standardized BAPIs

Standardized Parameters

Important things to remember..

BAPI/ALE Integration

Methods

If the BAPI to be implemented is a standardized BAPI, use the generic names, for example, GetList, GetDetail.

The method name must be in English (maximum 30 characters).

The individual components of a BAPI name are separated by the use of upper and lower case.Example: GetList

Underscores ("_") are not allowed in BAPI names.

Each BAPI has a return parameter that is either an export parameter or an export table.

So that customers can enhance BAPIs, each BAPI must have an ExtensionIn and an ExtensionOut parameter.

Parameters

If standardized parameters are used, you have to use the names specified for standardized parameters.

BAPI parameter names should be as meaningful as possible. Poorly chosen names include abbreviations and technical names (e.g. "flag", table names, etc.).

The parameter and field names must be in English with a maximum of 30 characters.

The components of a parameter name in the BOR are separated by upper and lower case letters to make them easier to read. Example: CompanyCodeDetail

Values that belong to each other semantically should be grouped together in one structured parameter, instead of using several scalar parameters.

For ISO-relevant fields (country, language, unit of measure, currency), additional fields for ISO codes are provided.

Unit of measure fields must accompany all quantity fields and currency identifiers must accompany currency amount fields.

Standardized BAPIs

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.

The following standardized BAPIs are provided:

Reading instances of SAP business objects

GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.

The BAPI GetList() is a class method.

GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method.

BAPIs that can create, change or delete instances of a business object type

The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.

Create( ) and

CreateFromData( ) The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.

Change( ) The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.

Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.

The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.

Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.

Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object instance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.

BAPIs for Mass Data Processing

The BAPIs listed above for creating and changing data can also be used for mass processing. For more information see BAPIs for Mass Data Transfer [Extern]

BAPIs for Replicating Business Object Instances

Replicate( ) and SaveReplica( ) The BAPIs Replicate() and SaveReplica() are implemented as methods of replicable business object types. They enable specific instances of an object type to be copied to one or more different systems. These BAPIs are used mainly to transfer data between distributed systems within the context of Application Link Enabling (ALE). These BAPIs are class methods.

Other Less Used Standardized BAPIs

Programming GetStatus() BAPIs [Extern]

Programming ExistenceCheck() BAPIs [Extern]

Standardized Parameters

There are some parameters that can be created for various BAPIs because they contain the same or the equivalent data in all BAPIs. They should be implemented the same in all BAPIs.

Address parameters Specific reference structures are defined for address parameters in BAPIs. You should copy these structures to use in your BAPI, especially if the underlying object type uses the central address management (CAM).

Change Parameters In BAPIs that cause database changes (for example, Change() and Create() BAPIs) you must be able to distinguish between parameter fields that contain modified values and parameter fields that have not been modified. This distinction is made through the use of standardized parameters.

Extension parameters The parameters ExtensionIn and ExtensionOut provides customers with a mechanism that enables BAPIs to be enhanced without modifications.

Return Parameters Each BAPI must have an export return parameter for returning messages to the calling application. To provide application programmers with a consistent error handling process for BAPI calls, all return parameters must be implemented in the same, standardized way.

Selection Parameters Standardized selection parameters are used in BAPIs that can be used to search for specific instances of a business object type (e.g. in GetList() ). These parameters enable the BAPI caller to specify the relevant selection criteria.

Test Run Parameters The parameter TestRun is used in write BAPIs (Create() and Change() ), to check the entries for the object instance in the database before actually creating the object instance. The creation of the object instance is only simulated and data is not updated.

Text Transfer Parameters To transfer BAPI documentation texts (e.g. the documentation of a business object type), you have to create standardized text transfer parameters.

Important things to remember..

It is important to follow the guidelines below when develop9ng BAPIs:

BAPIs must not contain CALL TRANSACTIO or SUBMIT REPORT

BAPIs must not invoke a COMMIT WORK. instead use the BAPI TransactionCommit to execute the commit after the BAPI has executed.

BAPI structures must not use includes.

There should be no functional dependecies between two BAPIs

BAPIs must perform there own authorization check

BAPIs should not use dialogs

BAPIs must not cause the program to abort or terminate. re4levant messages must be communicated through the return parameter.

BAPI/ALE Integration

When you use the BAPIs for asynchronous messagning, the application in the sendig systen calls the generated ALE IDoc interface isntead of the BAPI.

Asynchronous BAPIs use the ALE interface this way:

Creates an IDOC from the BAPI data

Sends the IDOC to the target system

Receives the IDOC in trhe target system, crreates the BAPI data from the IDoc and calls the BAPI

An ALE interface for a BAPi is created in transaction BDBG.

Reward is usefull.

thanks.

Read only

Former Member
0 Likes
600

Hi Prakash,

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

<b>BDC:</b>

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.

<b>

Features :</b>

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

<b>BAPI

BAPI stands for Business API(Application Program Interface).</b>

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.

<b>Sample BDC - XD01</b>

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

Read only

Former Member
0 Likes
600

hI

In SAP, Interface means any program that provides the Communication with External (SAP or Non SAP) system.

Interface techniques are:

BAPI

RFC

ALE / IDOC

EDI

<b>bdc &bapi</b>

<b>BAPI</b>

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.

<b>Check these Links out</b>

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

Refer following SDN threads:

<b>BDC:</b>

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.

<b>Features :</b>

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.

<b>

Types of BDC :</b>

CLASSICAL BATCH INPUT (Session Method)

CALL TRANSACTION

<b>BATCH INPUT METHOD:</b>

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.

<b>Features:</b>

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.

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

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

<b>Reward if usefull</b>

Read only

Former Member
0 Likes
600

BDC is a simulation of ABAP Transaction (SAP object)..where as in BAPI we input data and entry for SAP object goes directly to SAP database..

in short BAPIS are APIs for SAP buisness object

regards...