Skip to Content
author's profile photo Former Member
Former Member

BDC

Hi,

How can i display all the BDC's in my system.

Is there any table which contains all the BDC's, any tcode.

i need it urgently,

thanks in advance for your help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 09:08 AM

    Go through the below links.

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

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

    http://help.sap.com/saphelp_46c/helpdata/en/fa/097140543b11d1898e0000e8322d00/frameset.htm

    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

    =================================================

    BATCH DATA COMMUNICATION

    About Data Transfer In R/3 System

    When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.

    In the process of replacing current applications and transferring application data, two situations might occur:

    • The first is when application data to be replaced is transferred at once, and only once.

    • The second situation is to transfer data periodically from external systems to SAP and vice versa.

    • There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.

    The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called “batch input” or “batch data communication”.

    1. SESSION METHOD

    2. CALL TRANSACTION

    3. DIRECT INPUT

    Advantages offered by BATCH INPUT method:

    1. Can process large data volumes in batch.

    2. Can be planned and submitted in the background.

    3. No manual interaction is required when data is transferred.

    4. Data integrity is maintained as whatever data is transferred to the table is through transaction. Hence batch input data is submitted to all the checks and validations.

    To implement one of the supported data transfers, you must often write the program that exports the data from your non-SAP system. This program, known as a “data transfer” program must map the data from the external system into the data structure required by the SAP batch input program.

    The batch input program must build all of the input to execute the SAP transaction.

    Two main steps are required:

    • To build an internal table containing every screen and every field to be filled in during the execution of an SAP transaction.

    • To pass the table to SAP for processing.

    Prerequisite for Data Transfer Program

    Writing a Data Transfer Program involves following prerequisites:

    Analyzing data from local file

    Analyzing transaction

    Analyzing transaction involves following steps:

    • The transaction code, if you do not already know it.

    • Which fields require input i.e., mandatory.

    • Which fields can you allow to default to standard values.

    • The names, types, and lengths of the fields that are used by a transaction.

    • Screen number and Name of module pool program behind a particular transaction.

    To analyze a transaction::

    • Start the transaction by menu or by entering the transaction code in the command box.

    (You can determine the transaction name by choosing System – Status.)

    • Step through the transaction, entering the data will be required for processing your batch input data.

    • On each screen, note the program name and screen (dynpro) number.

    (dynpro = dyn + pro. Dyn = screen, pro = number)

    • Display these by choosing System – Status. The relevant fields are Program (dynpro) and Dynpro number. If pop-up windows occur during execution, you can get the program name and screen number by pressing F1 on any field or button on the screen.

    The technical info pop-up shows not only the field information but also the program and screen.

    • For each field, check box, and radio button on each screen, press F1 (help) and then choose Technical Info.

    Note the following information:

    - The field name for batch input, which you’ll find in its own box.

    - The length and data type of the field. You can display this information by double clicking on the Data Element field.

    • Find out the identification code for each function (button or menu) that you must execute to process the batch-input data (or to go to new screen).

    Place the cursor on the button or menu entry while holding down the left mouse button. Then press F1.

    In the pop-up window that follows, choose Technical info and note the code that is shown in the Function field.

    You can also run any function that is assigned to a function key by way of the function key number. To display the list of available function keys, click on the right mouse button. Note the key number that is assigned to the functions you want to run.

    Once you have program name, screen number, field name (screen field name), you can start writing.

    DATA TRANSFER program.

    Declaring internal table

    First Integral Table similar to structure like local file.

    Declaring internal table like BDCDATA

    The data from internal table is not transferred directly to database table, it has to go through transaction. You need to pass data to particular screen and to particular screen-field. Data is passed to transaction in particular format, hence there is a need for batch input structure.

    The batch input structure stores the data that is to be entered into SAP system and the actions that are necessary to process the data. The batch input structure is used by all of the batch input methods. You can use the same structure for all types of batch input, regardless of whether you are creating a session in the batch input queue or using CALL TRANSACTION.

    This structure is BDCDATA, which can contain the batch input data for only a single run of a transaction. The typical processing loop in a program is as follows:

    • Create a BDCDATA structure

    • Write the structure out to a session or process it with CALL TRANSACTION USING; and then

    • Create a BDCDATA structure for the next transaction that is to be processed.

    Within a BDCDATA structure, organize the data of screens in a transaction. Each screen that is processed in the course of a transaction must be identified with a BDCDATA record. This record uses the Program, Dynpro, and Dynbegin fields of the structure.

    The screen identifier record is followed by a separate BDCDATA record for each value, to be entered into a field. These records use the FNAM and FVAL fields of the BDCDATA structure. Values to be entered in a field can be any of the following:

    • Data that is entered into screen fields.

    • Function codes that are entered into the command field. Such function codes execute functions in a transaction, such as Save or Enter.

    The BDCDATA structure contains the following fields:

    • PROGRAM: Name of module pool program associated with the screen. Set this field only for the first record for the screen.

    • DYNPRO: Screen Number. Set this field only in the first record for the screen.

    • DYNBEGIN: Indicates the first record for the screen. Set this field to X, only for the first record for the screen. (Reset to ‘ ‘ (blank) for all other records.)

    • FNAM: Field Name. The FNAM field is not case-sensitive.

    • FVAL: Value for the field named in FNAM. The FVAL field is case-sensitive. Values assigned to this field are always padded on the right, if they are less than 132 characters. Values must be in character format.

    Transferring data from local file to internal table

    Data is uploaded to internal table by UPLOAD of WS_UPLOAD function.

    Population of BDCDATA

    For each record of internal table, you need to populate Internal table, which is similar to BDCDATA structure.

    All these five initial steps are necessary for any type of BDC interface.

    DATA TRANSFER program can call SESSION METHOD or CALL TRANSACTION. The initial steps for both the methods are same.

    First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.

    SESSION METHOD

    About Session method

    In this method you transfer data from internal table to database table through sessions.

    In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.

    Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.

    When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.

    Unless session is processed, the data is not transferred to database table.

    BDC_OPEN_GROUP

    You create the session through program by BDC_OPEN_GROUP function.

    Parameters to this function are:

    • User Name: User name

    • Group: Name of the session

    • Lock Date: The date on which you want to process the session.

    • Keep: This parameter is passed as ‘X’ when you want to retain session after

    processing it or ‘ ‘ to delete it after processing.

    BDC_INSERT

    This function creates the session & data is transferred to Session.

    Parameters to this function are:

    • Tcode: Transaction Name

    • Dynprotab: BDC Data

    BDC_CLOSE_GROUP

    This function closes the BDC Group. No Parameters.

    Some additional information for session processing

    When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.

    However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.

    If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 09:03 AM

    Go to transaction SHDB and record what you want and later write the logic

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 09:05 AM

    Hi,

    In SHDB you will find all the BDC recording programs.

    You can select what you want but your question in not specific..

    Regards,

    Bohra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 09:09 AM

    Here are examples

    report ZKIRAN_UPLOAD

    no standard page heading line-size 255.

    include bdcrecx1.

    --


    Tables declaration--

    tables : zkiran_tab2.

    --


    data declaration--

    data : itab like zkiran_tab2 occurs 15 with header line.

    --


    selection screen--

    selection-screen: begin of block a1.

    parameters : i_file like rlgrap-filename default 'D:\Documents and Settings\tzj13g\Desktop\sample.txt'.

    selection-screen : end of block a1.

    *at selection-screen on value-request for i_file.

    *CALL FUNCTION 'F4_FILENAME'

    *EXPORTING

    *PROGRAM_NAME = sy-repid

    • DYNPRO_NUMBER = SYST-DYNNR

    • FIELD_NAME = ' '

    • IMPORTING

    *FILE_NAME = i_file.

    start-of-selection.

    parameters: dataset(132) lower case.

    • DO NOT CHANGE - the generated data section - DO NOT CHANGE ***

    *

    • If it is nessesary to change the data section use the rules:

    • 1.) Each definition of a field exists of two lines

    • 2.) The first line shows exactly the comment

    • '* data element: ' followed with the data element

    • which describes the field.

    • If you don't have a data element use the

    • comment without a data element name

    • 3.) The second line shows the fieldname of the

    • structure, the fieldname must consist of

    • a fieldname and optional the character '_' and

    • three numbers and the field length in brackets

    • 4.) Each field must be type C.

    *

    • Generated data section with specific formatting - DO NOT CHANGE ***

    data: begin of record,

    • data element: CLASSTAB

    TBMA_001(001),

    • data element: TABNAME16

    TBMA_VAL_002(016),

    • data element: ZEMPNO

    EMPNO_003(010),

    • data element: ZNAME

    NAME_004(020),

    • data element: ZDEPTID

    DEPTID_005(002),

    • data element: ZDESIG

    DESIG_006(010),

    • data element: ZPLACE

    PLACE_007(010),

    • data element: CLASSTAB

    TBMA_008(001),

    • data element: TABNAME16

    TBMA_VAL_009(016),

    end of record.

    • End generated data section ***

    start-of-selection.

    perform u_itab.

    perform upload_ztable.

    end-of-selection.

    &----


    *& Form upload_ztable

    &----


    FORM upload_ztable .

    • perform open_dataset using dataset.

    • perform open_group.

    loop at itab.

    • read dataset dataset into record.

    • if sy-subrc <> 0. exit. endif.

    perform bdc_dynpro using 'SAPMSRD0' '0102'.

    perform bdc_field using 'BDC_CURSOR'

    'RSRD1-TBMA_VAL'.

    perform bdc_field using 'BDC_OKCODE'

    '=SHOW'.

    perform bdc_field using 'RSRD1-TBMA'

    record-TBMA_001.

    perform bdc_field using 'RSRD1-TBMA_VAL'

    'ZKIRAN_TAB2'.

    perform bdc_dynpro using 'SAPLSD41' '2200'.

    perform bdc_field using 'BDC_CURSOR'

    'DD02D-TABCLTEXT'.

    perform bdc_field using 'BDC_OKCODE'

    '=TDED'.

    perform bdc_dynpro using '/1BCDWB/DBZKIRAN_TAB2' '0101'.

    perform bdc_field using 'BDC_CURSOR'

    'ZKIRAN_TAB2-PLACE'.

    perform bdc_field using 'BDC_OKCODE'

    '=SAVE'.

    perform bdc_field using 'ZKIRAN_TAB2-EMPNO'

    ITAB-EMPNO.

    perform bdc_field using 'ZKIRAN_TAB2-NAME'

    ITAB-NAME.

    perform bdc_field using 'ZKIRAN_TAB2-DEPTID'

    ITAB-DEPTID.

    perform bdc_field using 'ZKIRAN_TAB2-DESIG'

    ITAB-DESIG.

    perform bdc_field using 'ZKIRAN_TAB2-PLACE'

    ITAB-PLACE.

    perform bdc_dynpro using '/1BCDWB/DBZKIRAN_TAB2' '0101'.

    perform bdc_field using 'BDC_OKCODE'

    '/EBACK'.

    perform bdc_field using 'BDC_CURSOR'

    'ZKIRAN_TAB2-EMPNO'.

    perform bdc_dynpro using 'SAPLSD41' '2200'.

    perform bdc_field using 'BDC_CURSOR'

    'DD02D-TABCLTEXT'.

    perform bdc_field using 'BDC_OKCODE'

    '=WB_BACK'.

    perform bdc_dynpro using 'SAPMSRD0' '0102'.

    perform bdc_field using 'BDC_CURSOR'

    'RSRD1-TBMA_VAL'.

    perform bdc_field using 'BDC_OKCODE'

    '=BACK'.

    perform bdc_field using 'RSRD1-TBMA'

    record-TBMA_008.

    perform bdc_field using 'RSRD1-TBMA_VAL'

    record-TBMA_VAL_009.

    perform bdc_transaction using 'SE11'.

    endloop.

    • perform close_group.

    • perform close_dataset using dataset.

    ENDFORM. " upload_ztable

    &----


    *& Form upload_itab

    &----


    FORM u_itab .

    break-point.

    CALL FUNCTION 'WS_UPLOAD'

    EXPORTING

    • CODEPAGE = ' '

    FILENAME = i_file

    FILETYPE = 'DAT'

    • HEADLEN = ' '

    • LINE_EXIT = ' '

    • TRUNCLEN = ' '

    • USER_FORM = ' '

    • USER_PROG = ' '

    • DAT_D_FORMAT = ' '

    • IMPORTING

    • FILELENGTH =

    TABLES

    DATA_TAB = itab

    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

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

    Program2- Updating data into table from text file

    &----


    *& Report YTEST

    *&

    &----


    *&

    *&

    &----


    REPORT YTEST.

    --


    Table declaration--

    TABLES : ZKIRAN_T1.

    --


    variable declaration--

    --


    interna table s declaration--

    DATA : ITAB LIKE ZKIRAN_T1 OCCURS 10 WITH HEADER LINE.

    --


    selectio-screen--

    selection-screen: begin of block b1.

    parameters : p_file like rlgrap-filename default 'D:\Documents and Settings\tzj13g\Desktop\sample.txt'.

    selection-screen : end of block b1.

    start-of-selection.

    perform upload_itab.

    perform display.

    -at selection-screen --


    &----


    *& Form upload_itab

    &----


    FORM upload_itab .

    CALL FUNCTION 'WS_UPLOAD'

    EXPORTING

    • CODEPAGE = ' '

    FILENAME = p_file

    FILETYPE = 'ASC'

    • HEADLEN = ' '

    • LINE_EXIT = ' '

    • TRUNCLEN = ' '

    • USER_FORM = ' '

    • USER_PROG = ' '

    • DAT_D_FORMAT = ' '

    • IMPORTING

    • FILELENGTH =

    TABLES

    DATA_TAB = itab

    • 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

    • NO_AUTHORITY = 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. " upload_itab

    &----


    *& Form display

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM display .

    modify zkiran_t1 from table itab.

    ENDFORM. " display

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.