23343274-BDC-7

download 23343274-BDC-7

of 15

Transcript of 23343274-BDC-7

  • 8/7/2019 23343274-BDC-7

    1/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    1.What is BDC and Explain the real time scenarios where we need to write the BDC

    Programs ?

    Batch Data Communication (BDC ) is a batch data interfacing technique used for

    uploading Bulk of data into the SAP R/3 system.

    BDC Programming is an Inbound Data Transfer Technique to transfer the Data from

    SAP/Non-SAP into SAP .

    Inbound: Data transfer from External System into SAP.

    Note: Target System is always SAP.

    Note : BDC works by simulating the user input from transactional screen via anABAP program.

    Note : Any Transaction in SAP Can Create Only One Record at a time, but theProcedure to Create any number of Records through the same transaction is

    always SAME.

    So Simply BDC Program is Automating the Procedure of Creating a record.

    BDC REAL TIME SCENARIOS:

    SCENARIO: 1

    When migrating from NON-SAP to SAP all the master data should be transferred into

    SAP.

    SCENARIO:2

    When working with third party systems like customers,vendors,banks etc.

    SCENARIO:3

    When transferring the data from non-SAP departments into SAP within the organisation.

    Page 1 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

    SAP

    SAP

    Non-SAP

  • 8/7/2019 23343274-BDC-7

    2/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    2.List out the SAP supplied programs(Direct Input Methods) to load master data?

    RM06BBI0 (Purchase Requisitions)

    RMDATIND (Material Master)

    RFBIKR00 (Vendor Masters)

    RFBIDE00 (Customer Master)

    RVINVB00 (Sales Order)

    3.What are the techniques involved in using SAP supplied programs?

    Identify relevant fields

    Maintain transfer structure ( Predefined first one is always session record)

    Session record structure, Header Data, Item ( STYPE record type )

    Fields in session structure STYPE, GROUP , MANDT, USERNAME , NO

    DATA.

    Fields in header structure consists of transaction code also

    STYPE, BMM00, TCODE, MATNR and Fields in Item - ITEMS

    Maintain transfer file sample data set creation

    4.How do you handle errors in Call Transaction?

    Error Handling in CALL TRANSACTION

    When the records are uploaded in database table by Session Method error record is stored

    in the log file. In Call transaction there is no such log file available. Usually we need togive report of all the error records i.e records, which are not inserted or updated in the

    database table and this can be done by following Method.

    Page 2 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    3/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    CALL TRANSACTION TCODE USING MODE . A All Screens

    N - No screens

    E Error screensUPDATE

    MESSAGE INTO IT_BDCMSGCOLL.

    A Asynchronous

    S - Synchronous

    Note : The Status of the Call Transaction is collected into IT_BDCMSGCOLL.

    But the messgae Text is Not available Only the Message No, Message Class and theVariable text is available. But the Actual Message for the Above Information is

    Maintained in Table T100.(T100-TEXT) but the TEXT also not Complete as it Contains

    the Placeholders so that we need to replace the same.

    Steps for the error handling in CALL TRANSACTION

    Requirement :

    Uploading the Cost Center Master Data into SAP.

    Recording the transaction Code KS01(Create Cost Center).Execute SHDB

    Provide the Recording name and transaction code .

    5) What is difference between session method and Call Transaction?

    Page 3 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

    1. LOOP AT IT_DATA.( i.e For each data record )

    Populate IT_BDCTAB tableCALL TRANSACTION USING IT_BDCDATA

    MODE

    UPDATE

    MESSAGES INTO IT_BDCMSGCOLL.

    If sy-subrc 0. ( Call transaction returns the sy-subrc if not successful

    In updation).

    Call function FORMAT_MESSAGE.

    OR

    Call Function BAPI_MESSAGE_GETDETAILOR

    Querry the Message TEXT from the table T100 for the Messages Collected into

    IT_BDCMSGCOLL.

    The Text in T100-TEXT would be maintained with Place Holders(&1,&2,&3,&4) or

    (&,&,&,&).Replace the Place Holders with Variable Texts from IT_BDCMSGCOLL(MSGV1,

    MSGV2, MSGV3, MSGV4).

  • 8/7/2019 23343274-BDC-7

    4/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    5. Difference Between Call Transaction and Session Method ?

    Call Transaction Session Method

    Single transaction Can be ProcessedAlways.

    Multiple Transaction Can be ProcessedThrough the Same Session.

    Synchronous processing.Which means Transfers data for a singletransaction.

    Asynchronous processing.Which Means Transfers data for multipletransactions

    Asynchronous and Synchronous update.Synchronous and asynchronous databaseupdating both possible.

    Synchronous update.Means no transaction is started until theprevious transaction has been written to thedatabase.

    No session log is created Session log is created

    Faster as it Asynchronous Update also Slower as it is Synchronous Update

    Return the SY-SUBRC Doesnt Return the SY-SUBRC

    Update :

    Asynchronous Update : it will update transaction level and lt goes next record.

    later it updates database level.

    synchronous Update - It will update transaction level and it goes database level.Then it it goes

    to the Next Record.

    Processing :

    Synchronous - Only after a particular transaction is completed you can do the next Transaction

    Asynchronous - Any no of transactions can be done simultaneously without depending on thefirst job to get completed

    6.What is the Importance Of BDCDATA and BDCMSGCOLL Structures in Call

    Transaction and also list out the Fields From each Structure ?

    Page 4 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    5/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    BDCDATA is to Declare IT_BDCDATA is an Internal Table to Maintain the Screen,

    field, OK Code Details i.e. Simply the Procedure to run the transaction so that the same

    procedure can be used to Create any no of records in BDC Programming.

    BDCMSGCOLL is to Declare IT_BDCMSGCOLL is an Internal table to Collect

    The Status Of Call Transaction and Process the Errors if any after the Call Transaction.

    BDCDATA:

    FIELD NAME SHORT TEXT

    PROGRAM BDC module pool

    DYNPRO BDC Screen number

    DYNBEGIN BDC screen start

    FNAM Field name

    FVAL BDC field value

    BDCMSGCOLL:

    FIELD NAME SHORT TEXT

    TCODE BDC Transaction code

    DYNAME Batch input module name

    DYNUMB Batch input screen number

    MSGTYP Batch input message typeMSGSPRA Language ID of a message

    MSGID Batch input message ID

    MSGNR Batch input message number

    MSGV1 Variable part of a message

    MSGV2 Variable part of a message

    MSGV3 Variable part of a message

    MSGV4 Variable part of a message

    ENV Batch input monitoring activity

    FLDNAME Field name

    7.Steps to Work with BDC Program in Detail ?

    STEP1: Analyze the SAP Transaction i.e. to Be automated , to find out the

    procedure to run the transaction i.e. find out list of screens, Screen numbers ,Order ofscreens and screen field name for the fields for which data is to be transferred.

    Page 5 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    6/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    NOTE :Along with input field names we should also find out the screen field names for

    ENTER ,SAVE,ACTIVATE,CREATE etc.

    STEP2:Declaring internal tables.

    a) IT_DATA according to the source file structure.

    b) IT_BDCDATA like table of BDCDATA. ( to collect the procedure to run thetransaction ).

    STEP3:Transferring data from flat file to internal table (IT_DATA).

    STEP4:For each record that is to be created

    LOOP AT IT_DATA INTO WA_DATA.

    * APPEND one record to IT_BDCDATA for first screen.( ie )WA_BDCDATA-PROGRAM = < program>.

    WA_BDCDATA-DYNPRO = < SCREEN NUMBER>.

    WA_BDCDATA-DYNBEGIN = 'X'.APPEND WA_BDCDATA to IT_BDCDATA.

    * APPEND one record for each field in the above screen.

    WA_BDCDATA-FNAM = WA_BDCDATA-Fval =

    APPEND WA_BDCDATA TO IT_BDCDATA.

    NOTE:Repeat the append procedure for all the screens in the order of

    the screens and also for all the fields for which the data has to be transferred .

    NOTE:After completion of the append procedure we get all theinformation required to run the transaction in ITAB i.e. (IT_BDCDATA).

    STEP5:

    IF Session Method,

    Insert the IT_BDCDATA into the session by calling the Function

    module BDC_INSERT.

    ELSEIF CALL TRANSACTION METHOD.

    CALL TRANSACTION USING IT_BDCDATA

    MESSAGES INTO IT_BDCMSGCOLL.

    ENDIF.

    ENDLOOP.(FOR IT_DATA).

    8.What is the importance of Recording (SHDB) in BDC Programs ?

    Page 6 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    7/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    SHDB is a transaction to record all the steps while executing the session method.

    Instead of collecting all the Screen no and Screen Field Names by Pressing F1 on the

    required field -> Technical Information, we can simply record all the details throughrecording.

    Through recording, we can generate the Source code for BDC Programs and we changethe same according to our requirements.

    9.How to Process More than ONE Transaction through Session Method ?

    Open the Session Once.

    Call FM : BDC_OPEN_GROUP.

    *FOR IST TRANSACTION.

    *For Each Record to be Created .

    LOOP AT IT_XD01. CustomersInsert the Transaction and its Corresponding Screen and Field Details

    Internal Table into the Session

    Call FM : BDC_INSERT.

    ENDLOOP.

    *FOR SECOND TRANSACTION.

    *For Each Record to be Created .

    LOOP AT IT_MK01. Vendors

    Insert the Transaction and its Corresponding Screen and Field DetailsInternal Table into the Session

    Call FM : BDC_INSERT.

    ENDLOOOP.

    Note : Repeat the above LOOP-ENDLOOP Procedure for each transaction to be

    processed through the same Session.

    Close the Session.

    Call FM : BDC_CLOSE_GROUP.

    10.What are different Display modes of Call Transaction method and explain them?

    There are three modes of Call Transaction method:

    A Display All Screens

    E - Display Errors

    Page 7 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    8/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    N Background Processing (No Screens)

    11.How to Run the Session in Background ?

    Schedule RSBDCSUB to run periodically in one or more background jobs throughtransaction SM36.

    (OR)

    We Can also SUBMIT the Program RSBDCSUB within the BDC Session

    Program itself.

    Result Of Submitting the Program :

    Batch input sessions are started automatically rather than by hand. The RSBDCSUBprogram can be set up to start all sessions that arrive in an R/3 System, or it can be fine-

    tuned to start only batch input sessions that you expect.

    12.What do you do with errors in BDC batch sessions?

    We look into the list of incorrect session and process it again to correct incorrect session,

    we analyze the session to determine which screen and value produced the error. For small

    errors in data we correct them interactively otherwise modify batch input program thathas generated the session(If Required) or many times even the data file.

    13.Explain the Steps to Work with Session Method ?

    STEPS TO WORK WITH SESSION METHOD:

    NOTE:Since both Call Transaction & session method works based on

    screen sequences, all the steps are common except the Call Transaction statement.

    Page 8 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

    Input For the Program RSBDCSUB:

    session name

    date and time of generation

    status: ready to run or held in the queue becauseof errors

  • 8/7/2019 23343274-BDC-7

    9/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    Step 1:Create session , Call F.M:BDC_OPEN_GROUP

    Step 2:Insert the Transaction code and the corresponding screen &field details

    (IT_BDCDATA) to process the transportation into the Session.

    Call FM: BDC_INSERT

    Note:Repeat BDC_INSERT for each new transaction code to be processedwith the and its corresponding .

    Step 3:Close the Session BDC_CLOSE_GROUP.

    Close the session since we can't process the already open session.

    Step 4:Process or run the session through SM35 to process the session Manually or

    Schedule the Program RSBDCSUB to Schedule it in Background.

    14.Complete Syntax For Call Transaction ?

    CALL TRANSACTION transaction code

    USING "internal table of structure BDCDATA

    MODE "display mode

    UPDATE "update mode

    MESSAGES INTO .

    15.Explain the Role Of CTU_PARAMS Structure in Call Transaction ?

    It is to Consider the Default Screen Resolution (standard screen size) . Because WhileWorking with Table Control in BDC , the Source Code depends on the No of lines

    visible and which depends on the Screen resolution and to make sure the source code

    works in the same way in all the systems, we set the Default Size option to X.

    CTU_PARAMS:

    FIELD NAME SHORT TEXT

    DISMODE Display Mode (A/E/N)

    UPDMODE Update mode for CALL TRANSACTION

    USING(A/S)

    CATTMODE CATT mode for CALL TRANSACTION

    Page 9 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    10/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    USING...

    DEFSIZE Default screen size

    * Structure for Screen Resolution option in BDC

    DATA WA_OPT TYPE CTU_PARAMS.

    WA_OPT-UPDMODE = S. Synchronous

    WA_OPT-DEFSIZE = X.

    WA_OPT-DISMODE = N. No Screens

    CALL TRANSACTION " Transaction Name

    USING "Screen & Field Internal Table

    OPTION FROM WA_OPT. " screen resolution option.

    16.Explain how to Handle the Table Control in BDC ?

    Table Control is used to Input multiple records.

    Observe the Screen from Customer Master Creation without Table Control.

    Note : The Screen Field Names are Fixed i.e. KNA1-NAME1,KNA1-SORTL etc.

    Page 10 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

    Screen Field Description

    KNA1-NAME1 NameKNA1-SORTL Search key

    KNA1-STRAS Street

    KNA1-ORT01 CityKNA1-LAND1 Country

    KNA1-SPRAS Language

  • 8/7/2019 23343274-BDC-7

    11/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    Screen with Table Ctrl For Customer Bank Details:

    Note : Here in the table control, field names depends on the no of Bank details for eachcustomer , i.e. the row no in each field name is Dynamic.

    Processing Logic to build the field names in the table Control.

    Ex : IT_KNB1 is the table for list of Customer bank details.

    Page 11 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

    KNBK-BANKS(01) - Bank Country KeyKNBK-BANKL(01) - Bank KeyKNBK-BANKN(01) - Bank Account

    Observe (01) for each filed , This is to Identify the Row from the Table

    Control and for the 2nd row it is (02) etc.

    i.e the row index is added at the end of each of field.

    DATA : V_INDEX(2) TYPE N.

    DATA V_FNAM LIKE BDCDATA-FNAM.

    LOOP AT IT_BANKS INTO WA_BANKS.

    *IS INCEMENTED BY 1 EACH TIME FOR ALL RECORDS

    V_INDEX = SY-TABIX. LOOP COUNTER

    *FOR BANKS

    CONCATENATE KNBK-BANKS( V_INDEX ) INTO

    V_FNAM.

    WA_BDCDATA-FNAM = V_FNAM.

    WA_BDCDATA-FVAL = WA_BANKS-BANKS.

    APPEND WA_BDCDATA TO IT_BDCDATA.

    *NOTE : REPEAT THE SAME PROCEDURE FOR ALL FIELDS

    IN THE ROW OF THE TABLE CONTROL.ENDLOOP.

    Result of

    CONCATENATE

    Is KNNK-BANKS(01)for 1st recordKNNK-BANKS(02) for

    2nd record

    Etc..

  • 8/7/2019 23343274-BDC-7

    12/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    DGFFSDFFD

    Note : While incrementing the V_INDEX, we need to Check for the Max no of recordsfor the Current Page, Once reached, We need to Click On Next Page so that the

    OK_CODE , =P+ should be APPENDed to IT_BDCDATA and Initialize the Counter

    V_INDEX.

    17.While uploading a flat file through BDC Call Transaction, the system

    suddenly get CRASHED. How do I know many records have been updated?

    Even though it is bulk data processing, but updating the database is always record by

    record only . So After Calling the Transaction , Maintain the Status of the Calling

    transaction into one Custom Table including the record details.

    So that We can check the Custom table for the latest details.

    18.List Of Useful OK CODEs while Processing the records through

    BDC programming ?

    OK Codes and their Functionalities :.

    Page 12 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    13/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    19 .What is BDCRECX1 ?

    Is a standard Program, Generated from recording which contains all the re-usable

    delcerations and also the re-usable Subroutine Definitions for all the BDC Programs.

    20.How can you PRINT a session log file?

    Execute RSBDCLOG.

    21.How to Export the Session ?

    From SM35 -> Utilities->Export Session.

    Page 13 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    14/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    EXERCISES:-

    Theory :

    1) Explain the types Of BDC Programming Techniques ?

    2) Explain the Different Ways to Process/Run the Session ?

    3) What is Direct Input method and List out the Standard programs Available ?

    Practical :

    1. Write a BDC Program to Upload Cost Centers through Call

    Transaction ? (Tcode : KS01 )

    2. Write a BDC Program to Upload Purchasing Info Records throughSession Method ? ((Tcode : ME11 )

    3. Write a BDC Program to upload General Ledger Accounts through

    Call Transaction and Push the Un Successful Records into Session Method ?

    Page 14 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.

  • 8/7/2019 23343274-BDC-7

    15/15

    BDC We Never Compromise in Quality. Would You ?

    _______________________________________________________________________

    _

    4. Write a BDC Program to Upload the Employee Previous-Expiernce

    Details ? (Infotype 0023, Tocde PA30)

    5. Write a BDC Program to Upload the Bill Of Materials through Both

    Call Transaction and Session Method ? (Tcode : CS01)

    6. Upload Customer Credit Master Records (FD32)?

    7. Upload the Purchase Orders (ME21N) ?

    8. Upload the Sales Orders (VA01N) ?

    9. Upload Bank Master Data(FI01) ?

    10. Upload the Customer Master with Bank Details (XD01) ?

    Page 15 of 15 Prepared By : Ganapati Adimulam

    eMAX Technologies,AmeerPet,Hyderabad

    Ph : +91 40 65976727.