How to create a session using call transaction method.

hi , this is nagaraju,
How to create a session using call transaction method.

Hi,
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
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 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. Unless session is processed, the data is not transferred to database table.
A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program.
SESSION METHOD
Data is not updated in database table unless Session is processed.
No sy-subrc is returned.
Error log is created for error records.
Updation in database table is always synchronous
CALL TRANSACTION
Immediate updation in database table.
Sy-subrc is returned.
Errors need to be handled explicitly
Updation in database table can be synchronous Or Asynchronous.
Regards,
Sruthi.

Similar Messages

  • Passing select-options values using call transaction method

    Hi Experts,
    I have a scenario in which i have three fields BUKRS,WERKS and MATKL in an internal table i_tab and I have MATNR as a selection-option.
    After this I have to use call transaction <tcode> for all the line items in the internal table and the MATNR select-option values I have to pass directly for each line of i_tab using call transaction method.
    TYPES:  BEGIN OF t_tab,
              bukrs TYPE bukrs,
              werks TYPE werks_d,
              matkl TYPE matkl,
            END OF t_tab.
    DATA:  w_tab TYPE t_tab,
                i_tab      TYPE STANDARD TABLE OF t_tab.
    SELECT-OPTIONS: s_matnr FOR marc-matnr.
    Now I am putting a loop at i_tab and have to use CALL TRANSACTION <TCODE> for each line with the SELECT-OPTIONS for MATNR.
    Please tell me whether we can pass multiple ranges for MATNR using call transcation method.
    for example there can be multiple single values/multiple ranges/excluded ranges for MATNR. so please suggest me how tho achieve this sceanrio using CALL transaction method of BDC.
    Thanks a lot.
    Regards,
    Krishan

    Hi Krishan,
    For the Call transaction TCODE there is extension ....OPTIONS from OPT. Just Check it out. I think it is possible like this.
    ... OPTIONS FROM opt
    *Effect*
    This addition gives you control using the values of the components of the structure opt, which must be of the Dictionary type CTU_PARAMS. The components have the following meaning:
    DISMODE
    Processing mode (comparable with the MODE addition)
    UPDMODE
    Update mode (comparable with the UPDATE addition)
    CATTMODE
    CATT mode (controlling a CATT procedure)
    The CATT mode can have the following values:
    ' ' No CATT procedure active
    'N' CATT procedure without single screen control
    'A' CATT procedure with single screen control
    DEFSIZE
    Use standard window size
    RACOMMIT
    COMMIT WORK does not end CATT procedure
    NOBINPT
    No batch input mode, that s SY-BINPT = SPACE.
    NOBIEND
    No batch input mode after BDC data has been read
    The components DEFSIZE , RACOMMIT, NOBINPT, NOBIEND always take the following values:
    'X' Yes
    ' ' No
    If the OPTIONS addition is omitted, the following settings are valid for the control parameters:
    DISMODE from the MODE addition
    UPDMODE
    from the UPDATE addition
    CATTMODE
    No CATT procedure active
    DEFSIZE
    Do not use standard window size
    RACOMMIT
    COMMIT WORK ends procedure successfully
    NOBINPT
    Batch input mode, that is SY-BINPT =X.
    NOBIEND
    Batch input mode also active after BDC data has been read
    Regards,
    Swapna.

  • How bapi different from session and call transaction?

    how bapi different from session and call transaction?
    thanks in advance.

    For one, Batch Data Communication (BDC) is older. Business Application Programming Interface (BAPI) came later, about 10 years ago (you can see this already from the name, which contains marketese like "business" ).
    More important though, they are different technologies. With BDC you build the "batch input transaction" yourself, with an ABAP program which creates the "batch input session" ("Batch-Input-Mappe" in german). You then take that session, like an object, and "run" it on a system (most of the time, this is done on a local system by the administrators, after it has been tested for correctness).
    With BAPI, a system (local or remote) exposes its interface to you through some kind of Remote Function Call (RFC). Practically, it tells you: "What do you want to do? Insert that data into Materials Management? Here is the function and the the parameters you have to use for each record". You only work with the Interface - the exposed function. How this function works does not have to interest you. You don't have sessions to "run", you fire your function calls filled with data, one after another and you're done.
    BAPI can be run remotely. With BDC, you probably have to call the administrators of the remote system and send them the session you created for them to run. With BDC you go through the whole transaction in one BDC session, with BAPI you may need more than one "BAPI calls" to do this.
    With BAPI you don't fill obcure field names with values, you just fill the parameters. You can use a BAPI from inside your ABAP program to let a "business object" do some clearly defined work for you, then you can continue with your code doing other things. You don't do this with BDC. With BDC you write a dedicated program that creates the "session", which is then executed separately.
    Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a
    typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.
    BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The transaction is then started using this internal table as the input and executed in the background.
    In Call Transaction, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
    It can also be used for real-time interfaces and custom error handling & logging features. Whereas in Batch Input Sessions, the ABAP
    program creates a session with all the transactional data, and this session can be viewed, scheduled and processed (using Transaction SM35) at a later time. The latter technique has a built-in error processing mechanism too.
    Batch Input (BI) programs still use the classical BDC approach but doesnt require an ABAP program to be written to format the
    BDCDATA. The user has to format the data using predefined structures and store it in a flat file. The BI program then reads this and
    invokes the transaction mentioned in the header record of the file.
    Direct Input (DI) programs work exactly similar to BI programs. But the only difference is, instead of processing screens they validate
    fields and directly load the data into tables using standard function modules. For this reason, DI programs are much faster (RMDATIND - Material Master DI program works at least 5 times faster) than the BDC counterpart and so ideally suited for loading large volume data. DI programs are
    not available for all application areas.
    Business Add-In (BADI) are a new SAP enhancement technique based on ABAP Objects.
    They can be inserted into the SAP System to accommodate user requirements too specific to be included in the standard delivery. Since specific industries often require special functions, SAP allows you to predefine these points in your software.
    As with customer exits two different views are available:
    In the definition view, an application programmer predefines exit points in a source that allow specific industry sectors, partners, and customers to attach additional software to standard SAP source code without having to modify the original object.
    In the implementation view, the users of Business Add-Ins can customize the logic they need or use a standard logic if one is available.
    In contrast to customer exits, Business Add-Ins no longer assume a two-level infrastructure (SAP and customer solutions), but instead allow for a multi-level system landscape (SAP, partner, and customer solutions, as well as country versions, industry solutions, and the like). Definitions and implementations of Business Add-Ins can be created at each level within such a system infrastructure.

  • Log file in session and call transaction methods

    Hi Experts,
    How to see log file in session and call transaction methods?

    hi
    If its a session then goto SM35, select ur session and then u can see log button over there at the top... that will give the log
    If its a call transaction then in ur program u need to declare internal table IT_MSGS like this
    DATA:  IT_MSGS LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
      LOOP AT IT_SALES.
        PERFORM POPULATE_BDC.
        CALL TRANSACTION 'VA01' USING IT_BDCDATA
                                      MODE MODE
                                      UPDATE UPDATE
                                      MESSAGES INTO IT_MSGS.
        IF NOT IT_MSGS[] IS INITIAL.
          LOOP AT IT_MSGS.
            CALL FUNCTION 'FORMAT_MESSAGE'
              EXPORTING
                ID        = IT_MSGS-MSGID
                LANG      = 'EN'
                NO        = IT_MSGS-MSGNR
                V1        = IT_MSGS-MSGV1
                V2        = IT_MSGS-MSGV2
                V3        = IT_MSGS-MSGV3
                V4        = IT_MSGS-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.
            WRITE:/ V_MSG.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    This will create a log for you, dont forget to award points if found helpful

  • Where can i find the theory for session and call transaction method

    hi
    where can i find the theory for session and call transaction method
    bye

    check this link
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.planetsap.com/bdc_main_page.htm
    lsmw, bapi, bdc- session, bdc-calltransaction
    u can get it in help.sap.com also

  • Error while updating data using session and call transaction method

    Hi all,
        i have to update data using MM01 transaction from flat file to database.i have used both session method and call transaction method to do that.in both the methods data has been transferred from internal tables to screens but while updating the data that is by clicking the ok-code at the end of the transaction iam getting a dialogue box stating
       SAP EXPRESS DOCUMENT "UPDATE WAS TERMINATED" RECEIVED FROM AUTHOR "SAP".
      please tell whether the problem lies and solution for that.
                                       thanks and regards.

    hi,
    check your recording.check whether u saved your material no in recording or not.
    once again record the transacton mm01.
           MATNR LIKE RMMG1-MATNR,
           MBRSH LIKE RMMG1-MBRSH,
           MTART LIKE RMMG1-MTART,
           MAKTX LIKE MAKT-MAKTX,
           MEINS LIKE MARA-MEINS,
           MATKL LIKE MARA-MATKL,
           BISMT LIKE MARA-BISMT,
           EXTWG LIKE MARA-EXTWG,
    these are the fields which u have to take in internal table.
    this is the record which i took in my flatfile.use filetype as asc and hasfieldseperator as 'X'.
    SUDHU-6     R     ROH     MATSUDHU     "     001     7890     AA
    i did the same.but i didn't get any error.

  • How to send error record to session in call transaction method

    Hi experts,
    I want to send only the error record to session while executing the program in call transaction method. please give me example on this
    regards,
    siva kumar

    One logiv that I can suggest is that after you have got the details of the record in error, you write another perform build_Session and put the below logic in that.
    Logic:
    1. Build a internal table for the error records similar to the internal table you used for looping for the call transaction. In short this internal table will have only the records that have an error in call transaction.
    2. Copy the recordign that you have done before and put it in the perform inside the loop and build the BDC table.
    3. Then .using this BDC table you can build the BDC session.
    - Guru
    Reward points for helpful answers
    3.

  • Clarification on session and call transaction method.

    in session method updation is synchronous and processing is asynchrounous. Session Method can handle Multiple Applications at a time. Where as Call Transaction Method can handle only one Application.
    can anyone explain the above lines with a simple example.what is updation and what is meant by processing.how a session handles multiple transactions as we know that sessions cannot be run in parallel?At a time multiple screens are updated in session?how?
    in the below thread it has been mentioned "2. If u want to execute the program in future u can create a session and keep it ready so that u can execute it at any point of time. That is not possible in call transaction method."
    Session Method & Call Transaction
    if we write the bdc program with call transaction , then it can also be used in future ,then what makes the difference.
    what is meant by local update?when we need to use local update in call transaction?.

    We're not your free code factory. Try yourself, search for existing solutions, and come back here with specific problems.

  • Doubt in uploading using call transaction method

    hi all
    i am uploading f-29 in call transaction method .. i have a problem in currency field, the currency field is not picking up it shows a error that input field is longer than screen field .. i have declared currency field as type BSEG-WRBTR(same as screen field ...how to go about
    thanks
    lokesh

    Hi,
    When you use the database value directly in your BDC, you will have this issue. It is always advisable to use character fields when doing BDC. so change it to charecter field and try it..
    Regards
    Sudheer

  • How to upload error records in call transaction method

    Hi all,
    While uploading data by using call transaction. If any errors occured, how can we process that  error records to database.
    If all records are processed. How can we display the recent records which where uploaded.
    AdvanceThanks for all.

    Hi Bharath
    You can handle this in many ways. But the easiest option to do is as below,
    once the call transaction ends in error, move that particular upload data to a separate internal table. Then finally download all these data to an error file.
    Besides this after processing all the records diplay the log for error. So that users can modify the error in the file and can use the same for uploading again. For the data that has been processed successfully you can display the log similarly.
    The error as well as sucess messages can be obtained from the messages table.
        CALL TRANSACTION TCODE USING BDCDATA
                         MODE   CTUMODE
                         UPDATE CUPDATE
                         MESSAGES INTO MESSTAB.
    Regards
    Kathirvel

  • Mappimg and updation in bdc 'session ' and 'call transaction' methods

    What will happen if error record comes while updating in session method and call transaction method.

    Hi,
    If any error comes in Session method U can find that error in SM35->Log
    and updste again database for those enteries
    In cll transaction Method U have to handel error manually . for this u have to use structure BDCMSGCOL and Table T100.
    Regards
    Gaurav

  • How to create MRP view using BO BUS1001006 & Method CreateViews.

    Guys,
    I need to create MRP view using BO BUS1001006 & Method CreateViews.
    i am not able to unterstand, what i need to specify to create MRP view, other than material number.
    what field i need to send for MRP view.
    Regards.
    santosh.
    Edited by: santosh koraddi on Jun 23, 2010 6:14 PM

    Hi,
    I have a similar question, have done a search and I see this sort of thing has come up a few times but with no definitive answer.... this thread seems close but don't really understand the solution (I'm not an ABAPER)
    I have a material master creation workflow under construction, it uses BUS1001006 and method createviews.
    The issues is that I want to restrict creation of certain views to certain agents, I have a fork in my workflow and its meant to split up the various views for various agents.
    The problem is that if an agent in one of the forks completes their views the workflow tries to get them to completes teh other views which they do not have authoisation to do... anyway the end result is that the workflow thinks all teh views have been created and the workflow items dissappear from the others inboxes.
    How do I setup my workflow such that each agent in each fork only has to complete the views they have authorisation to maintain and leaves work items in the inboxes of other agents for them to complete?

  • How to create Material Document using MI10 transaction

    Hi,
    I am posting a differnce of Quantity using the transaction MI10. My requirement is to make the inventory 0 for all the materials whose inventory is negative. This should create a physical inventory document and a Material document with movement type 702.
    However when I am trying to do so I am able to get the Physical Inventory document but not the Material document.
    Please let me know how can I create the Material document simultaneously.
    Also please let me know if there is a BAPI which does the work of MI10 transaction.
    Thanks,
    Abhishek

    hi,
    You shd check the PI posting document for the reference to see the qty diff. which is posted....
    Internally system will auto call the 702 and make the settlements and will update book inventory..
    Regards
    Priyanka.P

  • How can we correct and process errorrecords in session and call transaction

    hai all
    how ca we correct and process error records  in session and call transaction method . tell me with coding.
    Edited by: swamy katta on May 14, 2008 10:25 AM
    Edited by: swamy katta on May 14, 2008 10:26 AM
    Edited by: swamy katta on May 14, 2008 10:27 AM

    hi,
    Check out the below sample code ...Here are the records are getting posting with call transaction method and a session is getting created with erroreneous records....
    REPORT  ztest_report
    NO STANDARD PAGE HEADING
                            LINE-SIZE 255
                            MESSAGE-ID ZRASH.
    *                 Internal Table Declarations                          *
    *--Internal Table for Data Uploading.
    DATA : BEGIN OF IT_FFCUST OCCURS 0,
             KUNNR(10),
             BUKRS(4),
             KTOKD(4),
             ANRED(15),
             NAME1(35),
             SORTL(10),
             STRAS(35),
             ORT01(35),
             PSTLZ(10),
             LAND1(3),
             SPRAS(2),
             AKONT(10),
           END OF IT_FFCUST.
    *--Internal Table to Store Error Records.
    DATA : BEGIN OF IT_ERRCUST OCCURS 0,
             KUNNR(10),
             EMSG(255),
           END OF IT_ERRCUST.
    *--Internal Table to Store Successful Records.
    DATA : BEGIN OF IT_SUCCUST OCCURS 0,
             KUNNR(10),
             SMSG(255),
           END OF IT_SUCCUST.
    *--Internal Table for Storing the BDC data.
    DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    *--Internal Table for storing the messages.
    DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : V_FLAG1(1) VALUE ' ',
    "Flag used for opening session.
           V_TLINES LIKE SY-TABIX,
           "For storing total records processed.
           V_ELINES LIKE SY-TABIX,
           "For storing the no of error records.
           V_SLINES LIKE SY-TABIX.
           "For storing the no of success records.
    *          Selection screen                                            *
    SELECTION-SCREEN BEGIN OF BLOCK B1.
    PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
                 V_SESNAM  LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN END OF BLOCK B1.
    *          Start-of-selection                                          *
    START-OF-SELECTION.
    *-- Form to upload flatfile data into the internal table.
      PERFORM FORM_UPLOADFF.
    *        TOP-OF-PAGE                                                   *
    TOP-OF-PAGE.
      WRITE:/ 'Details of the error and success records for the transaction'
      ULINE.
      SKIP.
    *          End of Selection                                            *
    END-OF-SELECTION.
    *-- Form to Generate a BDC from the Uploaded Internal table
      PERFORM FORM_BDCGENERATE.
    *--To write the totals and the session name.
      PERFORM FORM_WRITEOP.
    *&      Form  form_uploadff
    *     Form to upload flatfile data into the internal table.
    FORM FORM_UPLOADFF .
    *--Variable to change the type of the parameter file name.
      DATA : LV_FILE TYPE STRING.
      LV_FILE = V_FNAME.
    *--Function to upload the flat file to the internal table.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      =  LV_FILE
    *     FILETYPE                      = 'ASC'
          HAS_FIELD_SEPARATOR           = 'X'
    *     HEADER_LENGTH                 = 0
    *     READ_BY_LINE                  = 'X'
    *     DAT_MODE                      = ' '
    *   IMPORTING
    *     FILELENGTH                    =
    *     HEADER                        =
        TABLES
          DATA_TAB                      = IT_FFCUST
        EXCEPTIONS
          FILE_OPEN_ERROR               = 1
          FILE_READ_ERROR               = 2
          NO_BATCH                      = 3
          GUI_REFUSE_FILETRANSFER       = 4
          INVALID_TYPE                  = 5
          NO_AUTHORITY                  = 6
          UNKNOWN_ERROR                 = 7
          BAD_DATA_FORMAT               = 8
          HEADER_NOT_ALLOWED            = 9
          SEPARATOR_NOT_ALLOWED         = 10
          HEADER_TOO_LONG               = 11
          UNKNOWN_DP_ERROR              = 12
          ACCESS_DENIED                 = 13
          DP_OUT_OF_MEMORY              = 14
          DISK_FULL                     = 15
          DP_TIMEOUT                    = 16
          OTHERS                        = 17
      IF SY-SUBRC = 0.
    *--Deleting the headings from the internal table.
        DELETE IT_FFCUST INDEX 1.
    *--Getting the total number of records uploaded.
        DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
      ENDIF.
    ENDFORM.                    " form_uploadff
    *&      Form  Form_bdcgenerate
    *     Form to Generate a BDC from the Uploaded Internal table
    FORM FORM_BDCGENERATE .
    *--Generating the BDC table for the fields of the internal table.
      LOOP AT IT_FFCUST.
        PERFORM POPULATEBDC USING :
                                    'X' 'SAPMF02D' '0105',
                                    ' ' 'BDC_OKCODE'  '/00' ,
                                    ' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
                                    ' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
                                    ' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
                                    'X' 'SAPMF02D' '0110' ,
                                    ' ' 'BDC_OKCODE'  '/00',
                                    ' ' 'KNA1-ANRED'  IT_FFCUST-ANRED,
                                    ' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
                                    ' ' 'KNA1-SORTL'  IT_FFCUST-SORTL,
                                    ' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
                                    ' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
                                    ' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
                                    ' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
                                    ' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
                                    'X' 'SAPMFO2D' '0120',     
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0125',     
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0130',     
                                    ' ' 'BDC_OKCODE'  '=ENTR',
                                    'X' 'SAPMF02D' '0340',     
                                    ' ' 'BDC_OKCODE'  '=ENTR',
                                    'X' 'SAPMF02D' '0360',
                                    ' ' 'BDC_OKCODE'  '=ENTR',
                                    'X' 'SAPMF02D' '0210',     
                                    ' ' 'KNB1-AKONT'  IT_FFCUST-AKONT,
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0215',
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0220',     
                                    ' ' 'BDC_OKCODE'  '/00',
                                    'X' 'SAPMF02D' '0230',     
                                    ' ' 'BDC_OKCODE'  '=UPDA'.
    *--Calling the transaction 'fd01'.
        CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
        MESSAGES INTO IT_CUSTMSG.
        IF SY-SUBRC <> 0.
    *--Populating the error records internal table.
          IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
          APPEND IT_ERRCUST.
          CLEAR IT_ERRCUST.
    *--Opening a session if there is an error record.
          IF V_FLAG1 = ' '.
            PERFORM FORM_OPENSESSION.
            V_FLAG1 = 'X'.
          ENDIF.
    *--Inserting the error records into already open session.
          IF V_FLAG1 = 'X'.
            PERFORM FORM_INSERT.
          ENDIF.
    *--Populating the Success records internal table.
        ELSE.
          IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
          APPEND IT_SUCCUST.
          CLEAR IT_SUCCUST.
        ENDIF.
    *--Displaying the messages.
        IF NOT IT_CUSTMSG[] IS INITIAL.
          PERFORM FORM_FORMATMSG.
        ENDIF.
    *--Clearing the message and bdc tables.
        CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
      ENDLOOP.
    *--Getting the total no of error records.
      DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
    *--Getting the total no of successful records.
      DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
    *--Closing the session only if it is open.
      IF V_FLAG1 = 'X'.
        PERFORM FORM_CLOSESESS.
      ENDIF.
    ENDFORM.                    " Form_bdcgenerate
    *&      Form  populatebdc
    *       FOrm to Populate the BDC table.
    FORM POPULATEBDC  USING    VALUE(P_0178)
                               VALUE(P_0179)
                               VALUE(P_0180).
      IF P_0178 = 'X'.
        IT_CUSTBDC-PROGRAM = P_0179.
        IT_CUSTBDC-DYNPRO = P_0180.
        IT_CUSTBDC-DYNBEGIN = 'X'.
      ELSE.
        IT_CUSTBDC-FNAM = P_0179.
        IT_CUSTBDC-FVAL = P_0180.
      ENDIF.
      APPEND IT_CUSTBDC.
      CLEAR IT_CUSTBDC.
    ENDFORM.                    " populatebdc
    *&      Form  FORM_OPENSESSION
    *       Form to Open a session.
    FORM FORM_OPENSESSION .
    *--Variable to convert the given session name into reqd type.
      DATA : LV_SESNAM(12).
      LV_SESNAM = V_SESNAM.
    *--Opening a session.
      CALL FUNCTION 'BDC_OPEN_GROUP'
       EXPORTING
         CLIENT                    = SY-MANDT
         GROUP                     = LV_SESNAM
         HOLDDATE                  = '20040805'
         KEEP                      = 'X'
         USER                      = SY-UNAME
         PROG                      = SY-CPROG
    *  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.
        WRITE :/ 'Session not open'.
      ENDIF.
    ENDFORM.                    " FORM_OPENSESSION
    *&      Form  FORM_INSERT
    *       fORM TO INSERT ERROR RECOED INTO A SESSION.
    FORM FORM_INSERT .
    *--Inserting the record into session.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE                  = 'FD01'
    *     POST_LOCAL             = NOVBLOCAL
    *     PRINTING               = NOPRINT
    *     SIMUBATCH              = ' '
    *     CTUPARAMS              = ' '
        TABLES
          DYNPROTAB              = IT_CUSTBDC
        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.
        WRITE :/ 'Unable to insert the record'.
      ENDIF.
    ENDFORM.                    " FORM_INSERT
    *&      Form  FORM_CLOSESESS
    *       Form to Close the Open Session.
    FORM FORM_CLOSESESS .
      CALL FUNCTION 'BDC_CLOSE_GROUP'
        EXCEPTIONS
          NOT_OPEN    = 1
          QUEUE_ERROR = 2
          OTHERS      = 3.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    " FORM_CLOSESESS
    *&      Form  FORM_FORMATMSG
    *       Form to format messages.
    FORM FORM_FORMATMSG .
    *--Var to store the formatted msg.
      DATA : LV_MSG(255).
      CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          ID        = SY-MSGID
          LANG      = SY-LANGU
          NO        = SY-MSGNO
          V1        = SY-MSGV1
          V2        = SY-MSGV2
          V3        = SY-MSGV3
          V4        = SY-MSGV4
        IMPORTING
          MSG       = LV_MSG
        EXCEPTIONS
          NOT_FOUND = 1
          OTHERS    = 2.
      IF SY-SUBRC = 0.
        WRITE :/ LV_MSG.
      ENDIF.
      ULINE.
    ENDFORM.                    " FORM_FORMATMSG
    *&      Form  form_writeop
    *       To write the totals and the session name.
    FORM FORM_WRITEOP .
      WRITE :/ 'Total Records Uploaded :',V_TLINES,
               / 'No of Error Records :',V_ELINES,
               / 'No of Success Records :',V_SLINES,
               / 'Name of the Session :',V_SESNAM.
      ULINE.
    ENDFORM.                    " form_writeop
    *  if routeindicator is initial.
    *   LOOP AT IT_YMMEE00090.
    *      LV_LENGTH = STRLEN( IT_YMMEE00090-CHANGETYPE ).
    *      IF SY-TABIX = '1'.
    *        IF  IT_YMMEE00090-CHANGETYPE = 'B' AND LV_LENGTH = 1.
    *          ROUTEINDICATOR = 'S'.
    *        ELSEIF IT_YMMEE00090-CHANGETYPE = 'R' AND LV_LENGTH = 1.
    *          ROUTEINDICATOR = 'S'.
    *        ELSEIF IT_YMMEE00090-CHANGETYPE = 'S' AND LV_LENGTH = 1.
    *          ROUTEINDICATOR = 'S'.
    *        ELSEIF IT_YMMEE00090-CHANGETYPE CA 'BRSCD' AND LV_LENGTH GT 1
    *                                          AND LV_LENGTH LE 5.
    *          ROUTEINDICATOR = 'S'.
    *        ENDIF.
    *      ELSE.
    *        IF  IT_YMMEE00090-CHANGETYPE = 'B' AND LV_LENGTH = 1 AND
    *                                         ROUTEINDICATOR = 'S'.
    *          ROUTEINDICATOR = 'S'.
    *        ELSEIF IT_YMMEE00090-CHANGETYPE = 'R' AND LV_LENGTH = 1 AND
    *                                         ROUTEINDICATOR = 'S'.
    *          ROUTEINDICATOR = 'S'.
    *        ELSEIF IT_YMMEE00090-CHANGETYPE = 'S' AND LV_LENGTH = 1 AND
    *                                         ROUTEINDICATOR = 'S'.
    *          ROUTEINDICATOR = 'S'.
    *        ELSEIF IT_YMMEE00090-CHANGETYPE CA 'BRSCD' AND LV_LENGTH GT 1
    *                  AND LV_LENGTH LE 5 AND ROUTEINDICATOR = 'S'.
    *          ROUTEINDICATOR = 'S'.
    *        ENDIF.
    *      ENDIF.
    *  ENDLOOP.
    * endif.

  • Bi session vs call transaction

    hi,
    what i need to clarify is that i only can use either 1 of the asterisk line below, right? if want to create BI session i use bdc_insert else if update directly use call transaction. correct?
    as i make use of bdcdata, i still need to have the steps like below .
      bdc_open_group
      loop
          append bdcdata
        bdc_insert using t-code
        call transaction 'tcode' using bdcdata ......
      endloop
      bdc_close_group
    thanks

    Hi
    Yes, it's right. The ABAP code to create a BDC program is the same for the both cases: bi session and call transaction methods.
    So it depends on only which method you need or want to use.
    If you need to do many transactions perhaps it's better to create a bi session and run the session in the quite moment (so the night).
    If you want to use CALL TRANSACTION method it's good thing to create a BI session if the CALL TRANSACTION fails.
    Anywway you can insert a parameter to choose the method to be used.
    Max

Maybe you are looking for

  • How do I use a xml file in iDVD

    Hello All, Hopefully someone can help.  I'm new to Mac, Final Cut Pro (Trial), and iDVD 09.  I a making a project with several chapters in FCPX and would like to use iDVD for the menus.  The only export option I have in FCPX I have is Export XML.  I

  • External H D was NTFS now it is 'RAW' WHAT TO DO?

    I have a Western Digital 2T External HD. It "pooped-out" some time ago but being always hopeful I keep it connected to my computer. It continually says the drive must be formatted . . . it took me a long time to reconcile myself to the fact that I wo

  • Photo Stream not syncing on my PC

    We just bought a new PC with Windows 8. Photos from my iPhone 5 are not syncing to my Photo Stream folder. I have changed the path..I have restarted my computer, etc. I'm pretty sure I've tried everything. I must be missing something.....

  • Questions for FI workshop

    Hello folks, I want to know if you guys have a question bank to start conducting workshop and create Blueprint for GL,AP, AR process. Any help would be appreciated. Best Regards Shine

  • Installing a printer on my mac

    I'm a college student and I brought my printer from home which is an HP Deskjet 5400 and was going to install it on my Mac but it is saying something about PowerPC applications and i have no idea what that is. Am i going to have to buy a new printer?