bdc-abap _ scn

Upload: raky0369

Post on 11-Oct-2015

8 views

Category:

Documents


0 download

DESCRIPTION

sap data migration

TRANSCRIPT

  • Getting Started Newsletters Store

    Products Services & Support About SCN Downloads

    Industries Training & Education Partnership Developer Center

    Lines of Business University Alliances Events & Webinars Innovation

    Log On Join UsHi, Guest Search the Community

    Activity Communications Actions

    Brow se

    0 Tweet 0

    6 Replies Latest reply: Oct 11, 2007 8:31 AM by Harini Somaysula

    Share 0Like

    BDC-ABAPThis question has been Answered.

    What is BDC ? How do I do BDC program ? Please send me with an example ..

    Advantage Of BDC ?

    Dipankar DebRoy Oct 11, 2007 8:16 AM

    Correct Answer

    by ANONYMOUS ANONYMOUS on Oct 11, 2007 8:24 AM

    Hi

    BDC stand for BATCH DATA COMMUNICATION

    Through this concept we transfer the data into SAP R/3 System

    Legacy System -

    > R/3 System

    Batch input is used to transfer large amounts of data into the

    SAP system. In this topic, we will learn the basics of batch input.

    There are 2 types of transfers Conversions and interfaces.

    Conversions: This type of transfer refers to a one-time transfer from a legacy system to the SAP

    system. In this case, the legacy system is the old system that is being replaced by the SAP

    system.

    Interfaces: This type of transfer refers to an ongoing transfer from a complementary system to the

    SAP system. In this case, the complementary system is a system that will run along side the

    SAP system.

    the BDC program should be in this format

    Transaction Recorder (SHDB)

    How to Upload Presentation Server Flat file to SAP R/3 system???

    How to upload application server file to R/3 system?

    Definition

    Example - Call Transaction Method

    Transaction Recorder (SHDB)

    Before you work with the Batch Input methods, you should know the purpose of the tool

    Transaction Recorder.

    Use:

    You can use the transaction recorder to record a series of transactions and their screens.

    Features:

    You can use the recording to create

    Data transfer programs that use batch input or CALL TRANSACTION

    Batch input sessions

    Test data

    Function modules.

    Note: It doesnt record F1, F4 and Scrollbar movements

  • Upload Flat file from Presentation Server to SAP R/3

    CALL FUNCTION GUI_UPLOAD'

    EXPORTING

    CODEPAGE = IBM'

    FILENAME = P_UFILE

    FILETYPE = 'DAT'

    TABLES

    DATA_TAB = INT_TAB

    EXCEPTIONS

    CONVERSION_ERROR = 1

    FILE_OPEN_ERROR = 2

    FILE_READ_ERROR = 3

    INVALID_TYPE = 4

    NO_BATCH = 5

    UNKNOWN_ERROR = 6

    INVALID_TABLE_WIDTH = 7

    GUI_REFUSE_FILETRANSFER = 8

    CUSTOMER_ERROR = 9

    OTHERS = 10 .

    IF SY-SUBRC NE 0.

    MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.

    ENDIF.

    Upload file from application server to SAP R/3

    Open the the application server file

    OPEN DATASET FOR INPUT

    Read the data from application server file

    READ DATASET INTO

    And then close the application server file

    CLOSE DATASET

    Definition- Declaring BDC Table

    DATA: BDC_TAB LIKE STANDARD TABLE OF

    BDCDATA INITIAL SIZE 6

    WITH HEADER LINE .

    The internal table used to collect the transactions information must be declared LIKE BDCDATA.

    Filling BDC Table Method #1

    FORM FILL_BDC_TAB.

    REFRESH BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-PROGRAM = SAPMF02K.

    BDC_TAB-DYNPRO = 01016.

    BDC_TAB-DYNBEGIN = X.

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-FNAM = RF02K-LIFNR.

    BDC_TAB-FVAL = TEST1.

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-FNAM = RF02K-D0010.

    BDC_TAB-FVAL = X.

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-PROGRAM = SAPMF02K.

    BDC_TAB-DYNPRO = 0110.

    BDC_TAB-DYNBEGIN = X.

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-FNAM = LFA1-STRAS.

    BDC_TAB-FVAL = 123 Main St..

    APPEND BDC_TAB.

  • CLEAR BDC_TAB.

    BDC_TAB-FNAM = BDC_OKCODE.

    BDC_TAB-FVAL = /11.

    APPEND BDC_TAB.

    ENDFORM.

    Filling BDC Table Method #2

    FORM FILL_BDC_TAB.

    REFRESH BDC_TAB.

    PERFORM POPULATE_BDC_TAB

    USING:

    1 SAPMF02K 0106,

    RF02K-LIFNR TEST1,

    RF02K-D0010 X,

    1 SAPMF02K 0110,

    LFA1-STRAS, 123 Main St.,

    BDC_OKCODE, /11.

    ENDFORM.

    FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.

    CLEAR BDC_TAB.

    IF FLAG = 1.

    BDC_TAB-PROGRAM = VAR1.

    BDC_TAB-DYNPRO = VAR2..

    BDC_TAB-DYNBEGIN = X.

    ELSE.

    BDC_TAB-FNAM = VAR1.

    BDC_TAB-FVAL = VAR2.

    ENDIF.

    APPEND BDC_TAB.

    ENDFORM.

    This two subroutine method to fill the BDC table is preferable because the

    POPULATE_BDC_TABLE subroutine is reusable throughout all batch input programs.

    Example #1 - Change Vendor (Call Transaction Method)

    Example #1- Declaration Section

    REPORT Y180DM10.

    DATA: BDC_TAB LIKE STANDARD TABLE OF

    BDCDATA INITIAL SIZE 6 WITH HEADER LINE.

    INFILE(20) VALUE /tmp/bc180_file4.

    DATA: BEGIN OF INREC.

    VENDNUM LIKE LFA1-LIFNR.

    STREET LIKE LFA1-STRAS.

    END OF INREC.

    PARAMETERS: DISPMODE DEFAULT A,

    UPDAMODE DEFAULT S.

    START-OF-SELECTION.

    OPEN DATASET INFILE

    FOR INPUT IN TEXT MODE.

    DO.

    READ DATASET INFILE INTO INREC.

    IF SY-SUBRC < > 0. EXIT. ENDIF.

    PERFORM FILL_BDC_TAB.

    CALL TRANSACTION FK02

    USING BDC_TAB

    MODE DISPMODE

    UPDATE UPDAMODE.

    IF SY-SUBRC < > 0.

    WRITE: /ERROR.

    ENDIF.

    ENDDO.

    CLOSE DATASET INFILE.

  • synchronous updating

    DO.

    PERFORM FILL_BDC_TAB.

    CALL TRANSACTION FK02

    USING BDC_TAB

    MODE N

    UPDATE S.

    IF SY-SUBRC < > 0.

    WRITE: /ERROR.

    ENDIF.

    ENDDO.

    With synchronous updating, we can check SY-SUBRC to determine the success of the transaction

    and the actual update to the database.

    asynchronous updating

    DO.

    PERFORM FILL_BDC_TAB.

    CALL TRANSACTION FK02

    USING BDC_TAB

    MODE N

    UPDATE A.

    IF SY-SUBRC < > 0.

    WRITE: /ERROR.

    ENDIF.

    ENDDO.

    With asynchronous updating, we can check SY-SUBRC to determine the success of the

    transaction only, not the actual update to the database.

    Error Handling

    Write an error report.

    Send the record(s) in error to an error file.

    Create a batch input session with the record(s) in error.

    To store error messages ( CALL TRANSACTION )

    data: begin of Tab_Mess occurs 0.

    include structure bdcmsgcoll.

    data : end of Tab_Mess,

    CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S

    MESSAGES INTO TAB_MESS.

    IF SY-SUBRC NE 0.

    WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,

    Tab_MESS-MSGID.

    ENDIF.

    i am giving you example for Change Vendor you practice for ur tcode

    For our example, we will use the Change Vendor transaction (FK02) to add a street address to

    an already existing vendor.

    Step #1

    Use SystemStatus menu path to determine online program name (SAPMF02K),

    screen number (0110)

    Step #2

    Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field

    name.

    Step #3

    Determine how to proceed in the transaction

    (save the record by clicking on the Save pushbutton or pressing the F11 key).

    BDC Table Contents

    After researching the transaction we can determine the contents of the BDC table.

    PROGRAM DYNPRO DYNBEGIN FNAM FVAL

    SAMPF02K 0106 X

    RF02K-LIFNR TEST1

    RF02K-D0110 X

    SAMPF02K 0110 X

  • 687 View s Topics: abap

    Average User Rating

    (0 ratings)

    LFA1-STRAS 123 Main St.

    BDC_OKCODE /11

    Batch Input Methods

    CALL TRANSACTION USING

    STATEMENT

    Call transaction - for data transfer

    Processing batch input data with CALL TRANSACTION USING is the faster of the two

    recommended data transfer methods. In this method, legacy data is processed inline in your data

    transfer program.

    Syntax:

    CALL TRANSACTION

    USING

    MODE

    UPDATE

    A Display all

    E Display errors only

    N No display

    S Synchronous

    A Asynchronous

    L Local update

    The process flow of CALL TRANSACTION

    A program that uses CALL TRANSACTION USING to process legacy data should execute

    thefollowing steps:

    Prepare a BDCDATA structure for the transaction that you wish to run.

    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.

    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA

    structure. For example:

    CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO

    TAB_MESS.

    IF SY-SUBRC 0.

    .

    ENDIF.

    Overview of Batch Input Session

    The first batch input method is to create a batch input session. It is the processing of this batch

    input session that updates the database, not the execution of the batch input program.

    Reward if usefull

    Re: BDC-ABAP

    Hi,

    Batch Data Communication

    It is used to transfer data from Sap to Sap or from Non Sap to sap system. It uses the normal

    transaction codes to transfer the data.

    Data Transfer Methods

    You can use the following methods to transfer data:

    CALL TRANSACTION: Data consistency check with the help of screen logic.

    Batch input with batch input sessions: Data consistency check with the help of screen logic

    BDC

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

    Table control in BDC

    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

    BDC

    vijay kumar Oct 11, 2007 8:17 AM (in response to Dipankar DebRoy)

  • http://www.sap-img.com/bdc.htm

    http://www.sappoint.com/abap/bdcconcept.pdf

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

    http://www.sap-img.com/abap/question-about-bdc-program.htm

    http://www.sapdevelopment.co.uk/bdc/bdchome.htm

    http://www.planetsap.com/bdc_main_page.htm

    Re: bdc mm01

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

    Table control in BDC

    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

    thanks.

    Like (0)

    Re: BDC-ABAP

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

    Programming

    Easiest way is to record the transaction via SHDB and then generate a sample program and adapt it

    to your needs.

    There are also some standard SAP program that create BDC session. Look also for LSMW.

    Advantages

    Error are recorded in a protocol, and users can execute the erroneous transaction again and again

    from SM35.

    Regards

    PS: there are already many threads to read

    Like (0)

    Raymond Giuseppi Oct 11, 2007 8:22 AM (in response to Dipankar DebRoy)

    Re: BDC-ABAP

    Hi

    BDC stand for BATCH DATA COMMUNICATION

    Through this concept we transfer the data into SAP R/3 System

    Legacy System -

    > R/3 System

    Batch input is used to transfer large amounts of data into the

    SAP system. In this topic, we will learn the basics of batch input.

    There are 2 types of transfers Conversions and interfaces.

    Conversions: This type of transfer refers to a one-time transfer from a legacy system to the SAP

    system. In this case, the legacy system is the old system that is being replaced by the SAP system.

    Interfaces: This type of transfer refers to an ongoing transfer from a complementary system to the

    SAP system. In this case, the complementary system is a system that will run along side the SAP

    system.

    the BDC program should be in this format

    Transaction Recorder (SHDB)

    How to Upload Presentation Server Flat file to SAP R/3 system???

    How to upload application server file to R/3 system?

    Definition

    Example - Call Transaction Method

    Correct Answer

    Guest Oct 11, 2007 8:24 AM (in response to Dipankar DebRoy)

  • Transaction Recorder (SHDB)

    Before you work with the Batch Input methods, you should know the purpose of the tool

    Transaction Recorder.

    Use:

    You can use the transaction recorder to record a series of transactions and their screens.

    Features:

    You can use the recording to create

    Data transfer programs that use batch input or CALL TRANSACTION

    Batch input sessions

    Test data

    Function modules.

    Note: It doesnt record F1, F4 and Scrollbar movements

    Upload Flat file from Presentation Server to SAP R/3

    CALL FUNCTION GUI_UPLOAD'

    EXPORTING

    CODEPAGE = IBM'

    FILENAME = P_UFILE

    FILETYPE = 'DAT'

    TABLES

    DATA_TAB = INT_TAB

    EXCEPTIONS

    CONVERSION_ERROR = 1

    FILE_OPEN_ERROR = 2

    FILE_READ_ERROR = 3

    INVALID_TYPE = 4

    NO_BATCH = 5

    UNKNOWN_ERROR = 6

    INVALID_TABLE_WIDTH = 7

    GUI_REFUSE_FILETRANSFER = 8

    CUSTOMER_ERROR = 9

    OTHERS = 10 .

    IF SY-SUBRC NE 0.

    MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.

    ENDIF.

    Upload file from application server to SAP R/3

    Open the the application server file

    OPEN DATASET FOR INPUT

    Read the data from application server file

    READ DATASET INTO

    And then close the application server file

    CLOSE DATASET

    Definition- Declaring BDC Table

    DATA: BDC_TAB LIKE STANDARD TABLE OF

    BDCDATA INITIAL SIZE 6

    WITH HEADER LINE .

    The internal table used to collect the transactions information must be declared LIKE BDCDATA.

    Filling BDC Table Method #1

    FORM FILL_BDC_TAB.

    REFRESH BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-PROGRAM = SAPMF02K.

    BDC_TAB-DYNPRO = 01016.

    BDC_TAB-DYNBEGIN = X.

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-FNAM = RF02K-LIFNR.

    BDC_TAB-FVAL = TEST1.

    APPEND BDC_TAB.

  • CLEAR BDC_TAB.

    BDC_TAB-FNAM = RF02K-D0010.

    BDC_TAB-FVAL = X.

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-PROGRAM = SAPMF02K.

    BDC_TAB-DYNPRO = 0110.

    BDC_TAB-DYNBEGIN = X.

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-FNAM = LFA1-STRAS.

    BDC_TAB-FVAL = 123 Main St..

    APPEND BDC_TAB.

    CLEAR BDC_TAB.

    BDC_TAB-FNAM = BDC_OKCODE.

    BDC_TAB-FVAL = /11.

    APPEND BDC_TAB.

    ENDFORM.

    Filling BDC Table Method #2

    FORM FILL_BDC_TAB.

    REFRESH BDC_TAB.

    PERFORM POPULATE_BDC_TAB

    USING:

    1 SAPMF02K 0106,

    RF02K-LIFNR TEST1,

    RF02K-D0010 X,

    1 SAPMF02K 0110,

    LFA1-STRAS, 123 Main St.,

    BDC_OKCODE, /11.

    ENDFORM.

    FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.

    CLEAR BDC_TAB.

    IF FLAG = 1.

    BDC_TAB-PROGRAM = VAR1.

    BDC_TAB-DYNPRO = VAR2..

    BDC_TAB-DYNBEGIN = X.

    ELSE.

    BDC_TAB-FNAM = VAR1.

    BDC_TAB-FVAL = VAR2.

    ENDIF.

    APPEND BDC_TAB.

    ENDFORM.

    This two subroutine method to fill the BDC table is preferable because the

    POPULATE_BDC_TABLE subroutine is reusable throughout all batch input programs.

    Example #1 - Change Vendor (Call Transaction Method)

    Example #1- Declaration Section

    REPORT Y180DM10.

    DATA: BDC_TAB LIKE STANDARD TABLE OF

    BDCDATA INITIAL SIZE 6 WITH HEADER LINE.

    INFILE(20) VALUE /tmp/bc180_file4.

    DATA: BEGIN OF INREC.

    VENDNUM LIKE LFA1-LIFNR.

    STREET LIKE LFA1-STRAS.

    END OF INREC.

    PARAMETERS: DISPMODE DEFAULT A,

    UPDAMODE DEFAULT S.

  • START-OF-SELECTION.

    OPEN DATASET INFILE

    FOR INPUT IN TEXT MODE.

    DO.

    READ DATASET INFILE INTO INREC.

    IF SY-SUBRC < > 0. EXIT. ENDIF.

    PERFORM FILL_BDC_TAB.

    CALL TRANSACTION FK02

    USING BDC_TAB

    MODE DISPMODE

    UPDATE UPDAMODE.

    IF SY-SUBRC < > 0.

    WRITE: /ERROR.

    ENDIF.

    ENDDO.

    CLOSE DATASET INFILE.

    synchronous updating

    DO.

    PERFORM FILL_BDC_TAB.

    CALL TRANSACTION FK02

    USING BDC_TAB

    MODE N

    UPDATE S.

    IF SY-SUBRC < > 0.

    WRITE: /ERROR.

    ENDIF.

    ENDDO.

    With synchronous updating, we can check SY-SUBRC to determine the success of the transaction

    and the actual update to the database.

    asynchronous updating

    DO.

    PERFORM FILL_BDC_TAB.

    CALL TRANSACTION FK02

    USING BDC_TAB

    MODE N

    UPDATE A.

    IF SY-SUBRC < > 0.

    WRITE: /ERROR.

    ENDIF.

    ENDDO.

    With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction

    only, not the actual update to the database.

    Error Handling

    Write an error report.

    Send the record(s) in error to an error file.

    Create a batch input session with the record(s) in error.

    To store error messages ( CALL TRANSACTION )

    data: begin of Tab_Mess occurs 0.

    include structure bdcmsgcoll.

    data : end of Tab_Mess,

    CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S

    MESSAGES INTO TAB_MESS.

    IF SY-SUBRC NE 0.

    WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,

    Tab_MESS-MSGID.

    ENDIF.

    i am giving you example for Change Vendor you practice for ur tcode

    For our example, we will use the Change Vendor transaction (FK02) to add a street address to an

    already existing vendor.

    Step #1

    Use SystemStatus menu path to determine online program name (SAPMF02K), screen

    number (0110)

  • Step #2

    Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field

    name.

    Step #3

    Determine how to proceed in the transaction

    (save the record by clicking on the Save pushbutton or pressing the F11 key).

    BDC Table Contents

    After researching the transaction we can determine the contents of the BDC table.

    PROGRAM DYNPRO DYNBEGIN FNAM FVAL

    SAMPF02K 0106 X

    RF02K-LIFNR TEST1

    RF02K-D0110 X

    SAMPF02K 0110 X

    LFA1-STRAS 123 Main St.

    BDC_OKCODE /11

    Batch Input Methods

    CALL TRANSACTION USING

    STATEMENT

    Call transaction - for data transfer

    Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended

    data transfer methods. In this method, legacy data is processed inline in your data transfer program.

    Syntax:

    CALL TRANSACTION

    USING

    MODE

    UPDATE

    A Display all

    E Display errors only

    N No display

    S Synchronous

    A Asynchronous

    L Local update

    The process flow of CALL TRANSACTION

    A program that uses CALL TRANSACTION USING to process legacy data should execute

    thefollowing steps:

    Prepare a BDCDATA structure for the transaction that you wish to run.

    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.

    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA

    structure. For example:

    CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.

    IF SY-SUBRC 0.

    .

    ENDIF.

    Overview of Batch Input Session

    The first batch input method is to create a batch input session. It is the processing of this batch input

    session that updates the database, not the execution of the batch input program.

    Reward if usefull

    Like (0)

    Re: BDC-ABAP

    Pls refer the following link:

    http://www.planetsap.com/bdc_main_page.htm

    http://www.sap-img.com/abap/question-about-bdc-program.htm

    http://abap-gallery.blogspot.com/2007/08/bdc-batch-data-communication-tutorial.html

    Dawood Ghasletwala Oct 11, 2007 8:28 AM (in response to Dipankar DebRoy)

  • Follow SCNSite Index Contact Us SAP Help Portal

    Privacy Terms of Use Legal Disclosure Copyright

    0 Tweet 0Share 0Like

    http://www.sap-img.com/bdc.htm - here you can get sample codes too

    http://aspalliance.com/1130_Batch_Data_Communication_BDC_in_SAP_R3

    Pls reward points if useful.

    Like (0)

    Re: BDC-ABAP

    Advantage of using BDC

    help in BDC

    Source Code for BDC using Call Transaction

    Please Reward points..

    Like (0)

    Murali Poli Oct 11, 2007 8:29 AM (in response to Dipankar DebRoy)

    Re: BDC-ABAP

    Hi Dipankar,

    Please go through this blog.

    http://allaboutsap.blogspot.com/search/label/BDC

    http://allaboutsap.blogspot.com/2007/03/bdc-explained-part-2-sample-program-for.html

    Reward if helpful.

    Regards,

    Harini.S

    Like (0)

    Harini Somaysula Oct 11, 2007 8:31 AM (in response to Dipankar DebRoy)