Regarding: call taransaction and sy-subrc

Hello all,
i am uploading data through call transaction  which is in subroutine.
after  that there is another subroutine in which i am doing error handling .
but my query is :
i have to check value of sy-subrc to check that tcode is executed successfully or not .
but value of sy-subrc is always coming 0 whether tcode is successfully executed or not.
how may i do this.
thanks.

hi ,
i am getting problem for call transaction in my case.
suppose my file does not have correct data.
i am getting  sy-subrc = 0 in mode 'A'.
But in mode 'N' sy-subrc = 1001.
its making me confuse.as every time whether data is correct or not
for mode 'A' sy-subrc is not changing
please help me if you have me any suggestion.
Thanks.

Similar Messages

  • Regarding call transaction and session method???

    HI All,
    Cud u pls let me know
    1. differences between call transaction and session???
    2. Is it possible to schedule call transaction in background?? ( all are saying MODE N = background scheduling  in call transaction.......but i dont think so)
    3. Is it posible to handle multiple transactions in call transaction ? if so,how?
    4. Is it posible to handle multiple transactions in session ? if so,how?
    5. How can we see the log in session method????

    Hi ,
    Check this documentation.
    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.
    CALL TRANSACTION
    About CALL TRANSACTION
    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 by
    Call transaction <tcode> using <BDCTAB>
    Mode <A/N/E>
    Update <S/A>
    Messages into <MSGTAB>.
    Parameter – 1 is transaction code.
    Parameter – 2 is name of BDCTAB table.
    Parameter – 3 here you are specifying mode in which you execute transaction
    A is all screen mode. All the screen of transaction are displayed.
    N is no screen mode. No screen is displayed when you execute the transaction.
    E is error screen. Only those screens are displayed wherein you have error record.
    Parameter – 4 here you are specifying update type by which database table is updated.
    S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.
    A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).
    Parameter – 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:
    1. Tcode: Transaction code
    2. Dyname: Batch point module name
    3. Dynumb: Batch input Dyn number
    4. Msgtyp: Batch input message type (A/E/W/I/S)
    5. Msgspra: Batch input Lang, id of message
    6. Msgid: Message id
    7. MsgvN: Message variables (N = 1 - 4)
    For each entry, which is updated in database, table message is available in BDCMSGCOLL. As BDCMSGCOLL is structure, you need to declare a internal table which can contain multiple records (unlike structure).
    Steps for CALL TRANSACTION method
    1. Internal table for the data (structure similar to your local file)
    2. BDCTAB like BDCDATA
    3. UPLOAD or WS_UPLOAD function to upload the data from local file to itab. (Considering file is local file)
    4. Loop at itab.
    Populate BDCTAB table.
    Call transaction <tcode> using <BDCTAB>
    Mode <A/N/E>
    Update <S/A>.
    Refresh BDCTAB.
    Endloop.
    (To populate BDCTAB, You need to transfer each and every field)
    The major differences between Session method and Call transaction are as follows:
    SESSION METHOD CALL TRANSACTION
    1. Data is not updated in database table unless Session is processed. Immediate updation in database table.
    2. No sy-subrc is returned. Sy-subrc is returned.
    3. Error log is created for error records. Errors need to be handled explicitly
    4. Updation in database table is always synchronous Updation in database table can be synchronous Or Asynchronous.
    Error Handling in CALL TRANSACTION
    When Session Method updates the records in database table, error records are stored in the log file. In Call transaction there is no such log file available and error record is lost unless handled. Usually you need to give report of all the error records i.e., records which are not inserted or updated in the database table. This can be done by the following method:
    Steps for the error handling in CALL TRANSACTION
    1. Internal table for the data (structure similar to your local file)
    2. BDCTAB like BDCDATA
    3. Internal table BDCMSG like BDCMSGCOLL
    4. Internal table similar to Ist internal table
    (Third and fourth steps are for error handling)
    5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)
    6. Loop at itab.
    Populate BDCTAB table.
    Call transaction <tr.code> using <Bdctab>
    Mode <A/N/E>
    Update <S/A>
    Messages <BDCMSG>.
    Perform check.
    Refresh BDCTAB.
    Endloop.
    7 Form check.
    IF sy-subrc <> 0. (Call transaction returns the sy-subrc if updating is not successful).
    Call function Format_message.
    (This function is called to store the message given by system and to display it along with record)
    Append itab2.
    Display the record and message.
    Check this program for session method using multiple transactions.
    Have one BDC_OPEN_GROUP, multiple BDC_INSERT s and one BDC_CLOSE_GROUP.
    You should have multiple BDC_INSERT s for multiple transactions.
    call function BDC_OPENGROUP.
    Build BDC data and cal lBDC_INSERT for transaction 1
    Build BDC data and cal lBDC_INSERT for transaction 2
    Build BDC data and cal lBDC_INSERT for transaction 3
    call function BDC_CLOSE_GROUP.
    Check out this sample program
    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
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Regarding Call Transaction and Session Method in BDC.

    Hi,
    If there are 50 records and 25th row data is having error.
    What will happen when we run it in Call Transaction and Session Method in both Foreground and Background methods ? Can anybody explain me in details ?

    Hi Naresh,
    If you are using call transaction,
    if executed in Foreground, 24 records will be posted and for 25th you will have option to correct data or skip.
    if executed in background,
    if mode is N,  24 records are processed 25th is skipped and 26th onwards is processed again.
    if mode is E, 24 records will be posted and for 25th you will have option to correct data or skip.
    For Session also it should be same the difference is that the error would be there in sessionlog and you can re-process it.
    Hope it helps.
    Regards,
    Komal.

  • Help regarding 'table controls' and 'internal table' updation

    Hi all.
    Basically this is what i have done..... I have created a table control in module pool program. I declared an Internal table and also have populated it from a database table. I have also used insert statement to insert an blank record in the table control view and delete statements to delete any record,  also in the table control view... .
    But I am not able to update any new record into an Internal table or  the  original table ..
    Any Ideas how to do it ,Gurus
    Thanks

    HEllo,
    Check thsi simple report.
    REPORT ZTFH_TABLECONTROL .
    TABLES : ZEMPTABLE.
    DATA : SELLINE .
    DATA : FLD(20).
    DATA : LINNO TYPE I , OFF TYPE I.
    DATA : ITAB LIKE ZEMPTABLE OCCURS 10 WITH HEADER LINE.
    CONTROLS  : CON_TAB TYPE TABLEVIEW USING SCREEN 100.
    SELECT * FROM ZEMPTABLE INTO TABLE ITAB.
    DESCRIBE TABLE ITAB LINES CON_TAB-LINES.
    CALL SCREEN 100.
    *&      Module  EXT_COMM  INPUT
    *       text
    MODULE EXT_COMM INPUT.
    LEAVE PROGRAM.
    ENDMODULE.                 " EXT_COMM  INPUT
    *&      Module  TAB_UPDATE  INPUT
    *       text
    MODULE TAB_UPDATE INPUT.
    CASE SY-UCOMM.
    WHEN 'DEL'.
          IF SELLINE = 'X'.
            DELETE ITAB WHERE EMPNO = ITAB-EMPNO.
            MESSAGE I000(ZYF_DEL).
          ENDIF.
    WHEN 'UPD'.
        IF SELLINE = 'X'.
             MODIFY ITAB INDEX CON_TAB-CURRENT_LINE.
             MESSAGE I001(ZYF_DEL).
        ENDIF.
    WHEN 'INS'.
         IF SELLINE = 'X'.
          GET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
          SET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
          IF FLD CP 'ITAB*' AND SY-SUBRC = 0.
            IF LINNO >= 1.
              LINNO = LINNO + CON_TAB-TOP_LINE - 1.
              CLEAR ITAB.
              INSERT ITAB INDEX LINNO.
              CON_TAB-LINES = CON_TAB-LINES + 1.
            ELSE.
              CLEAR ITAB.
              APPEND ITAB.
              CON_TAB-LINES = CON_TAB-LINES + 1.
            ENDIF.
          ENDIF.
        ENDIF.
    WHEN 'SAV'.
      MODIFY ITAB INDEX CON_TAB-CURRENT_LINE.
      MESSAGE I002(ZYF_DEL).
    ENDCASE.
    ENDMODULE.                 " TAB_UPDATE  INPUT
    “ FLOW LOGIC
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    LOOP AT ITAB WITH CONTROL CON_TAB.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    MODULE EXT_COMM AT EXIT-COMMAND.
    LOOP AT ITAB.
    MODULE TAB_UPDATE.
    ENDLOOP.     
    REgards,
    Vasanth

  • Basic query regarding work-area and select query

    hi
    dear sdn members,
    thanks too all for solving all my query's up till now
    i am stuck in a problem need help
    1)  why basically work-area has been used ? the sole purpose
    2)  different types of select query ? only coding examples
    note: no links pls
    regards,
    virus

    hi,
    Work Area
    Description for a data object that is particularly useful when working with internal tables or database tables as a source for changing operations or a target for reading operations.
    WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.
    Each row in a table is a record and each column is a field.
    While adding or retrieving records to / from internal table we have to keep the record temporarily.
    The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    .g.
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.
    With header line
    SELECT.
    Put the curson on that word and press F1 . You can see the whole documentation for select statements.
    select statements :
    SELECT result
    FROM source
    INTO|APPENDING target
    [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
    Effect
    SELECT is an Open-SQL-statement for reading data from one or several database tables into data objects.
    The select statement reads a result set (whose structure is determined in result ) from the database tables specified in source, and assigns the data from the result set to the data objects specified in target. You can restrict the result set using the WHERE addition. The addition GROUP BY compresses several database rows into a single row of the result set. The addition HAVING restricts the compressed rows. The addition ORDER BY sorts the result set.
    The data objects specified in target must match the result set result. This means that the result set is either assigned to the data objects in one step, or by row, or by packets of rows. In the second and third case, the SELECT statement opens a loop, which which must be closed using ENDSELECT. For every loop pass, the SELECT-statement assigns a row or a packet of rows to the data objects specified in target. If the last row was assigned or if the result set is empty, then SELECT branches to ENDSELECT . A database cursor is opened implicitly to process a SELECT-loop, and is closed again when the loop is ended. You can end the loop using the statements from section leave loops.
    Up to the INTO resp. APPENDING addition, the entries in the SELECTstatement define which data should be read by the database in which form. This requirement is translated in the database interface for the database system´s programming interface and is then passed to the database system. The data are read in packets by the database and are transported to the application server by the database server. On the application server, the data are transferred to the ABAP program´s data objects in accordance with the data specified in the INTO and APPENDING additions.
    System Fields
    The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.
    sy-subrc Relevance
    0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.
    4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.
    8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.
    After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.
    Notes
    Outside classes, you do not need to specify the target area with INTO or APPENDING if a single database table or a single view is specified statically after FROM, and a table work area dbtab was declared with the TABLES statement for the corresponding database table or view. In this case, the system supplements the SELECT-statement implicitly with the addition INTO dbtab.
    Although the WHERE-condition is optional, you should always specify it for performance reasons, and the result set should not be restricted on the application server.
    SELECT-loops can be nested. For performance reasons, you should check whether a join or a sub-query would be more effective.
    Within a SELECT-loop you cannot execute any statements that lead to a database commit and consequently cause the corresponding database cursor to close.
    SELECT - result
    Syntax
    ... lines columns ... .
    Effect
    The data in result defines whether the resulting set consists of multiple rows (table-like structure) or a single row ( flat structure). It specifies the columns to be read and defines their names in the resulting set. Note that column names from the database table can be changed. For single columns, aggregate expressions can be used to specify aggregates. Identical rows in the resulting set can be excluded, and individual rows can be protected from parallel changes by another program.
    The data in result consists of data for the rows lines and for the columns columns.
    SELECT - lines
    Syntax
    ... { SINGLE }
    | { { } } ... .
    Alternatives:
    1. ... SINGLE
    2. ... { }
    Effect
    The data in lines specifies that the resulting set has either multiple lines or a single line.
    Alternative 1
    ... SINGLE
    Effect
    If SINGLE is specified, the resulting set has a single line. If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set. The data objects specified after INTO may not be internal tables, and the APPENDING addition may not be used.
    An exclusive lock can be set for this line using the FOR UPDATE addition when a single line is being read with SINGLE. The SELECT command is used in this case only if all primary key fields in logical expressions linked by AND are checked to make sure they are the same in the WHERE condition. Otherwise, the resulting set is empty and sy-subrc is set to 8. If the lock causes a deadlock, an exception occurs. If the FOR UPDATE addition is used, the SELECT command circumvents SAP buffering.
    Note
    When SINGLE is being specified, the lines to be read should be clearly specified in the WHERE condition, for the sake of efficiency. When the data is read from a database table, the system does this by specifying comparison values for the primary key.
    Alternative 2
    Effect
    If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.
    If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:
    If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
    If the system tries to access pool or cluster tables and single columns are specified in columns.
    Note
    When specifying DISTINCT, note that you have to carry out sort operations in the database system for this.
    SELECT - columns
    Syntax
    | { {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ... }
    | (column_syntax) ... .
    Alternatives:
    1. ... *
    2. ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    3. ... (column_syntax)
    Effect
    The input in columns determines which columns are used to build the resulting set.
    Alternative 1
    Effect
    If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views. Only one data object can be specified after INTO.
    Note
    If multiple database tables are specified after FROM, you cannot prevent multiple columns from getting the same name when you specify *.
    Alternative 2
    ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    Effect
    A list of column labels col1 col2 ... is specified in order to build the resulting list from individual columns. An individual column can be specified directly or as an argument of an aggregate function aggregate. The order in which the column labels are specified is up to you and defines the order of the columns in the resulting list. Only if a column of the type LCHAR or LRAW is listed does the corresponding length field also have to be specified directly before it. An individual column can be specified multiple times.
    The addition AS can be used to define an alternative column name a1 a2 ... with a maximum of fourteen digits in the resulting set for every column label col1 col2 .... The system uses the alternative column name in the additions INTO|APPENDING CORRESPONDING FIELDS and ORDER BY. .
    Column labels
    The following column labels are possible:
    If only a single database table or a single view is specified after FROM, the column labels in the database table - that is, the names of the components comp1 comp2... - can be specified directly for col1 col2 ... in the structure of the ABAP Dictionary.
    If the name of the component occurs in multiple database tables of the FROM addition, but the desired database table or the view dbtab is only specified once after FROM, the names dbtab~comp1 dbtab~comp2 ... have to be specified for col1 col2 .... comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    If the desired database table or view occurs multiple times after FROM, the names tabalias~comp1 tabalias~comp2 ... have to be specified for col1 col2 .... tabalias is the alternative table name of the database table or view defined after FROM, and comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    The data type of a single column in the resulting list is the datatype of the corresponding component in the ABAP Dictionary. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note
    If multiple database tables are specified after FROM, you can use alternative names when specifying single columns to avoid having multiple columns with the same name.
    Example
    Read specific columns of a single row.
    DATA wa TYPE spfli.
    SELECT SINGLE carrid connid cityfrom cityto
    INTO CORRESPONDING FIELDS OF wa
    FROM spfli
    WHERE carrid EQ 'LH' AND connid EQ '0400'.
    IF sy-subrc EQ 0.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDIF.
    Alternative 3
    ... (column_syntax)
    Effect
    Instead of static data, a data object column_syntax in brackets can be specified, which, when the command is executed, either contains the syntax shown with the static data, or is initial. The data object column_syntax can be a character-type data object or an internal table with a character-type data type. The syntax in column_syntax, like in the ABAP editor, is not case-sensitive. When specifying an internal table, you can distribute the syntax over multiple rows.
    If column_syntax is initial when the command is executed, columns is implicitly set to * and all columns are read.
    If columns are specificied dynamically without the SINGLE addition, the resulting set is always regarded as having multiple rows.
    Notes
    Before Release 6.10, you could only specify an internal table with a flat character-type row type for column_syntax with a maximum of 72 characters. Also, before Release 6.10, if you used the DISTINCT addition for dynamic access to pool tables or cluster tables, this was ignored, but since release 6.10, this causes a known exception.
    If column_syntax is an internal table with header line, the table body and not the header line is evaluated.
    Example
    Read out how many flights go to and from a city. The SELECT command is implemented only once in a sub-program. The column data, including aggregate function and the data after GROUP BY, is dynamic. Instead of adding the column data to an internal l_columns table, you could just as easily concatenate it in a character-type l_columns field.
    PERFORM my_select USING `CITYFROM`.
    ULINE.
    PERFORM my_select USING `CITYTO`.
    FORM my_select USING l_group TYPE string.
    DATA: l_columns TYPE TABLE OF string,
    l_container TYPE string,
    l_count TYPE i.
    APPEND l_group TO l_columns.
    APPEND `count( * )` TO l_columns.
    SELECT (l_columns)
    FROM spfli
    INTO (l_container, l_count)
    GROUP BY (l_group).
    WRITE: / l_count, l_container.
    ENDSELECT.
    ENDFORM.
    SELECT - aggregate
    Syntax
    ... { MAX( col )
    | MIN( col )
    | AVG( col )
    | SUM( col )
    | COUNT( DISTINCT col )
    | COUNT( * )
    | count(*) } ... .
    Effect
    As many of the specified column labels as you like can be listed in the SELECT command as arguments of the above aggregate expression. In aggregate expressions, a single value is calculated from the values of multiple rows in a column as follows (note that the addition DISTINCT excludes double values from the calculation):
    MAX( col ) Determines the maximum value of the value in the column col in the resulting set or in the current group.
    MIN( col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
    AVG( col ) Determines the average value of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    SUM( col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    COUNT( DISTINCT col ) Determines the number of different values in the column col in the resulting set or in the current group.
    COUNT( * ) (or count(*)) Determines the number of rows in the resulting set or in the current group. No column label is specified in this case.
    If you are using aggregate expressions, all column labels that are not listed as an argument of an aggregate function are listed after the addition GROUP BY. The aggregate functions evaluate the content of the groups defined by GROUP BY in the database system and transfer the result to the combined rows of the resulting set.
    The data type of aggregate expressions with the function MAX, MIN or SUM is the data type of the corresponding column in the ABAP Dictionary. Aggregate expressions with the function AVG have the data type FLTP, and those with COUNT have the data type INT4. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note the following points when using aggregate expressions:
    If the addition FOR ALL ENTRIES is used in front of WHERE, or if cluster or pool tables are listed after FROM, no other aggregate expressions apart from COUNT( * ) can be used.
    Columns of the type STRING or RAWSTRING cannot be used with aggregate functions.
    When aggregate expressions are used, the SELECT command makes it unnecessary to use SAP buffering.
    Null values are not included in the calculation for the aggregate functions. The result is a null value only if all the rows in the column in question contain the null value.
    If only aggregate expressions are used after SELECT, the results set has one row and the addition GROUP BY is not necessary. If a non-table type target area is specified after INTO, the command ENDSELECT cannot be used together with the addition SINGLE. If the aggregate expression count( * ) is not being used, an internal table can be specified after INTO, and the first row of this table is filled.
    If aggregate functions are used without GROUP BY being specified at the same time, the resulting set also contains a row if no data is found in the database. If count( * ) is used, the column in question contains the value 0. The columns in the other aggregate functions contain initial values. This row is assigned to the data object specified after INTO, and unless count( * ) is being used exclusively, sy-subrc is set to 0 and sy-dbcnt is set to 1. If count( *) is used exclusively, the addition INTO can be omitted and if no data can be found in the database, sy-subrc is set to 4 and sy-dbcnt is set to 0.
    if helpful reward points

  • What is the diffreence between call transaction and session method

    hi gurus
    can any one suggest me
    what is the difference between call transaction and session methods
    in which cases we have to use teh call transaction and
    in which cases we have to use session method.
    thank you
    regards
    kals.

    CLASSICAL BATCH INPUT (Session Method)
    CALL TRANSACTION
    BATCH INPUT METHOD:
    This method is also called as &#8216;CLASSICAL METHOD&#8217;.
    Features:
    Asynchronous processing.
    Synchronous Processing in database update.
    Transfer data for more than one transaction.
    Batch input processing log will be generated.
    During processing, no transaction is started until the previous transaction has been written to the database.
    CALL TRANSACTION METHOD :
    This is another method to transfer data from the legacy system.
    Features:
    Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
    Updating the database can be either synchronous or asynchronous. The program specifies the update type.
    Transfer data for a single transaction.
    Transfers data for a sequence of dialog screens.
    No batch input processing log is generated.
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    Among the two methods call transaction is better compared to session bcoz data transfer is faster in it.
    Differences between call transaction and session.
    Session Method:
    1) Data is not updated in the database table until the session is processed.
    2) No sy-subrc is returned.
    3) Error log is created for error records.
    4) Updation is always synchronous.
    Call Transaction Method:
    1) Immediate updation in the database table.
    2) sy-subrc is returned.
    3)Error need to be handled explicitly.
    4) updation can be synchronous as well as asynchronous.
    2) ya u can use using the N mode no screen.
    3)u can't handle multiple transaction in call transaction.
    4) u can handle multiple transaction in session using the BDC_INSERT fm.
    5)When u go to SM35 u can able to see the error records.
    Which is best?
    That depends on your requirement. Both of them have there advantages.
    According to the situation u can choose any one of these.
    difference between batch input and call transaction in BDC Session method.
    1) synchronous processing.
    2) can tranfer large amount of data.
    3) processing is slower.
    4) error log is created
    5) data is not updated until session is processed.
    Call transaction.
    1) asynchronous processing
    2) can transfer small amount of data
    3) processing is faster.
    4) errors need to be handled explicitly
    5) data is updated automatically
    For session method,these are the function modules to b used.
    BDC_OPEN_GROUP
    BDC_INSERT
    BDC_CLOSE_GROUP
    For call transaction,this is the syntax.
    CALL TRANSACTION TCODE USING BDCDATA
    MODE A or E or N
    UPDATE A or S
    MESSAGES INTO MESSTAB.
    Take a scenario where we need to post documents in FB01 and the input file has say 2000 records (2000 documents, not line items in FB01 but 2000 records)
    In the BDC call transaction method
    We call the transaction FB01 2000 times (once for each record posting) and if the processing fails in record no 3 it can be captured and start with reocord 4.
    Eg: Loop at itab.
    call transaction FB01
    capture errors
    endloop.
    In the session method.
    We do not explicity call the transaction 2000 times, but all the records are appeneded into a session and this session is stored. The processinf of the session is done wwhenever the user wants it to be done. Hence the errors cannot be captured in the program itself
    Check these link:
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://www.sap-img.com/abap/question-about-bdc-program.htm
    http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
    http://www.planetsap.com/bdc_main_page.htm
    Batch Input Session method is asynchronous as told by others here. But the advantage of this is that you have all the error messages and the data for each transaction held persistantly. You don't have to code anything for processing them or writing the logs.
    But at the same time, the same feature can be disadvantageous if you need to react to an error or if there are too many errors to manually correct in a session. Since the session are created in the program and its execution is done seperately, you loose the trackability of such transactions.
    With a call transaction, what was a disadvantage above will become an advantage. Call transaction immediately gives you messages back and you can react to it in your program. But the disadvantage is that, if you have several hundreds of transactions to run, running them from within the program can be resource crunching affair. It will hamper the system performance and you cannot really distribute the load. Of course, you have some mechanisms with which you can overcome this, but you will have to code for it. Also, storing the messages and storing the errored transaction data etc will have to be handled by you in the program. Whereas, in batch input session, your program's job is to just create the session, after that everything is standard SAP system's responsibility.
    Ideally, you should do a call transaction if the resources are not a problem and if it fails, put the errored transaction into a session.
    You can decide based on the data volume that your BDC is processing. If data volume is high go for session else call transaction will do.The call transaction updates will be instantaneous where as session needs to be processed explictly after creation.
    Session Method
    1) Session method supports both small amount of data aswell as large amount of data
    2) data processing is asynchronus and data updation is synchronus.
    3) it process multiple apllication while perfomaning validations.
    4) in session method data will be updated in data base only after processing session only.
    5) system provide by default logfile for handling error records.
    6) it supports both foreground aswell as background process
    in bdc we use FM ...
    bdc_open_group " for creating Session
    bdc_insert " adding transaction and bdcdata table for updating database
    bdc_close_group " for closing Session
    Call Transaction
    1) Call transaction exclusively for small amout of data
    2) it supports only one apllication while perfoming validations
    3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.
    we can create logfile by using structure....BDCMSGCOLL
    4) it doesn't support background processing.
    5) data processing is synchronous and Data updation is Synchronous( default), in
    this method also supports daya updation in asynchronus process also.
    syntax:
    Call transaction <transaction-name> using BDCDATA
    mode <A/N/E>
    update <L/A/S>
    messages into BDCMSGCOLL.
    BDC:
    Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.
    Features :
    BDC is an automatic procedure.
    This method is used to transfer large amount of data that is available in electronic medium.
    BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).
    BDC uses normal transaction codes to transfer data.
    Types of BDC :
    CLASSICAL BATCH INPUT (Session Method)
    CALL TRANSACTION
    BATCH INPUT METHOD:
    This method is also called as &#8216;CLASSICAL METHOD&#8217;.
    Features:
    Asynchronous processing.
    Synchronous Processing in database update.
    Transfer data for more than one transaction.
    Batch input processing log will be generated.
    During processing, no transaction is started until the previous transaction has been written to the database.
    CALL TRANSACTION METHOD :
    This is another method to transfer data from the legacy system.
    Features:
    Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
    Updating the database can be either synchronous or asynchronous. The program specifies the update type.
    Transfer data for a single transaction.
    Transfers data for a sequence of dialog screens.
    No batch input processing log is generated.
    For BDC:
    http://myweb.dal.ca/hchinni/sap/bdc_home.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sapdevelopment.co.uk/bdc/bdchome.htm
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
    Check these link:
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://www.sap-img.com/abap/question-about-bdc-program.htm
    http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
    http://www.planetsap.com/bdc_main_page.htm
    call Transaction or session method ?
    Check the following links:
    http://www.sap-img.com/bdc.htm
    See below example code :
    Call three FM : BDC_OPEN_GROUP,BDC_INSERT and BDC_CLOSE_GROUP.
    Once you execute the program and it creates the session at SM35 Transaction.
    Report : ZMPPC011
    Type : Data upload
    Author : Chetan Shah
    Date : 05/05/2005
    Transport : DV3K919557
    Transaction: ??
    Description: This ABAP/4 Program creates new Production Versions
    (C223). It accepts tab-delimited spreadsheet input and
    creates BDC sessions.
    Modification Log
    Date Programmer Request # Description
    06/10/2005 Chetan Shah DV3K919557 Initial coding
    report zmppc011 no standard page heading line-size 120 line-count 55
    message-id zz.
    pool of form routines
    include zmppn001.
    Define BDC Table Structure
    data: begin of itab_bdc_tab occurs 0.
    include structure bdcdata.
    data: end of itab_bdc_tab.
    Input record layout of Leagcy File
    data: begin of itab_xcel occurs 0,
    matnr(18) type c,
    werks(4) type c,
    alnag(2) type c,
    verid(4) type c,
    text1(40) type c,
    bstmi like mkal-bstmi,
    bstma like mkal-bstma,
    adatu(10) type c,
    bdatu(10) type c,
    stlal(2) type c,
    stlan(1) type c,
    serkz(1) type c,
    mdv01(8) type c,
    elpro(4) type c,
    alort(4) type c,
    end of itab_xcel.
    data: begin of lt_pp04_cache occurs 0,
    matnr like itab_xcel-matnr,
    werks like itab_xcel-werks,
    alnag like itab_xcel-alnag,
    plnnr like mapl-plnnr,
    arbpl like crhd-arbpl,
    ktext like crtx-ktext,
    end of lt_pp04_cache.
    data: v_ssnnr(4) type n,
    v_lines_in_xcel like sy-tabix,
    v_ssnname like apqi-groupid,
    v_trans_in_ssn type i,
    wa_xcel LIKE itab_xcel,
    l_tabix like sy-tabix,
    v_matnr like rc27m-matnr,
    v_plnnr like mapl-plnnr,
    v_plnal like mapl-plnal,
    v_tcode like sy-tcode value 'C223',
    v_plnty like plas-plnty value 'R',
    v_objty like crhd-objty value 'A',
    v_plpo_steus like plpo-steus value 'PP04',
    v_verwe like crhd-verwe value '0007'.
    Parameters
    selection-screen: skip 3.
    selection-screen: begin of block 1 with frame.
    parameters: p_name like rlgrap-filename
    default 'C:\My Documents\InputFile.txt'
    obligatory,
    bdc session name prefix
    p_bdcpfx(6) default 'ZPVCRT'
    obligatory,
    number for transction per BDC session
    p_trnssn type i
    default 2000 obligatory,
    retain the BDC session after successfull execution
    p_keep like apqi-qerase
    default 'X',
    user who will be executing BDC session
    p_uname like apqi-userid
    default sy-uname
    obligatory.
    selection-screen: end of block 1.
    possible entry list (F4 dropdown) for input file name
    at selection-screen on value-request for p_name.
    *-SELECT FILE FROM USERS LOCAL PC
    call function 'WS_FILENAME_GET'
    exporting
    DEF_FILENAME = ' '
    def_path = 'C:\Temp\'
    mask = ',.,..'
    mode = 'O'
    title = 'Select File '(007)
    importing
    filename = p_name
    RC =
    exceptions
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    others = 5.
    if sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    begin the show
    start-of-selection.
    read data from input file
    perform transfer_xcel_to_itab.
    loop at itab_xcel.
    hang on to xcel line num
    l_tabix = sy-tabix.
    each line in the xcel file marks begining of new prod.version defn
    if num-of-trnas-in-session = 0, create new BDC session
    if v_trans_in_ssn is initial.
    perform bdc_session_open.
    endif.
    begin new bdc script for rtg create trans
    fill in bdc-data for prod.version maintenance screens
    perform bdc_build_script.
    insert the bdc script as a BDC transaction
    perform bdc_submit_transaction.
    keep track of how many BDC transactions were inserted in the BDC
    session
    add 1 to v_trans_in_ssn.
    if the user-specified num of trans in BDC session is reached OR
    if end of input file is reached, close the BDC session
    if v_trans_in_ssn = p_trnssn or
    l_tabix = v_lines_in_xcel.
    perform bdc_session_close.
    clear v_trans_in_ssn.
    endif.
    endloop.
    top-of-page.
    call function 'Z_HEADER'
    EXPORTING
    FLEX_TEXT1 =
    FLEX_TEXT2 =
    FLEX_TEXT3 =
    FORM TRANSFER_XCEL_TO_ITAB *
    Transfer Xcel Spreadsheet to SAP Internal Table *
    form transfer_xcel_to_itab.
    Read the tab-delimited file into itab
    call function 'WS_UPLOAD'
    exporting
    filename = p_name
    filetype = 'DAT'
    IMPORTING
    filelength = flength
    tables
    data_tab = itab_xcel
    exceptions
    conversion_error = 1
    file_open_error = 2
    file_read_error = 3
    invalid_table_width = 4
    invalid_type = 5
    no_batch = 6
    unknown_error = 7
    others = 8.
    if sy-subrc = 0.
    sort the data
    sort itab_xcel by matnr werks.
    clear v_lines_in_xcel.
    if no data in the file - error out
    describe table itab_xcel lines v_lines_in_xcel.
    if v_lines_in_xcel is initial.
    write: / 'No data in input file'.
    stop.
    endif.
    else.
    if file upload failed - error out
    write: / 'Error reading input file'.
    stop.
    endif.
    endform.
    FORM BDC_SESSION_OPEN *
    Open BDC Session *
    form bdc_session_open.
    create bdc session name = prefix-from-selectn-screen + nnnn
    add 1 to v_ssnnr.
    concatenate p_bdcpfx v_ssnnr into v_ssnname.
    open new bdc session
    call function 'BDC_OPEN_GROUP'
    exporting
    client = sy-mandt
    group = v_ssnname
    keep = p_keep
    user = p_uname
    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.
    endform.
    FORM BDC_BUILD_SCRIPT *
    Build BDC *
    form bdc_build_script.
    data: l_arbpl like crhd-arbpl,
    l_text1 like mkal-text1,
    l_mdv01 like mkal-mdv01,
    l_mapl like mapl.
    clear bdc-data itab - begin of new bdc transaction
    clear itab_bdc_tab.
    refresh itab_bdc_tab.
    read material cross reference tables to determine sap part#
    clear : v_matnr, v_plnnr, v_plnal.
    perform read_matnr_cross_ref using itab_xcel-matnr
    itab_xcel-werks
    changing v_matnr.
    determine the version description to use
    if itab_xcel-text1 is initial.
    l_text1 = itab_xcel-verid.
    else.
    l_text1 = itab_xcel-text1.
    endif.
    determine the routing group# and group ctr# to use
    perform read_routing .
    determine the production line to use
    if itab_xcel-mdv01 is initial.
    if not provided in the file then:
    prod line = work ctr on the last PP04 op of the rtg determined above
    perform read_wc_on_last_pp04 using v_plnnr v_plnal
    changing l_mdv01.
    NOTE: when executing the above form\routine, if v_plnnr is initial
    or v_plnal is initial, THEN l_mdv01 will automatically be
    returned blank (ie initial)
    else.
    l_mdv01 = itab_xcel-mdv01.
    endif.
    build bdc script
    perform bdc_build_script_record
    fill in initial screen
    using: 'X' 'SAPLCMFV' '1000',
    ' ' 'BDC_OKCODE' '=ENTE',
    ' ' 'MKAL-WERKS' itab_xcel-werks,
    ' ' 'MKAL-MATNR' v_matnr,
    ' ' 'MKAL_ADMIN-DISPO' space,
    ' ' 'MKAL-PLNNR' space,
    ' ' 'MKAL_ADMIN-STTAG' space,
    ' ' 'MKAL-PLNNG' space,
    ' ' 'MKAL-MDV01' space,
    ' ' 'MKAL-PLNNM' space,
    click create button on initial screen and go to detail screen
    'X' 'SAPLCMFV' '1000',
    ' ' 'BDC_OKCODE' '=CREA',
    fill in the detail screen and go back to initial screen
    'X' 'SAPLCMFV' '2000',
    ' ' 'BDC_OKCODE' '=CLOS',
    ' ' 'MKAL_EXPAND-MATNR' v_matnr,
    ' ' 'MKAL_EXPAND-VERID' itab_xcel-verid,
    ' ' 'MKAL_EXPAND-TEXT1' l_text1,
    ' ' 'MKAL_EXPAND-BSTMI' itab_xcel-bstmi,
    ' ' 'MKAL_EXPAND-BSTMA' itab_xcel-bstma,
    ' ' 'MKAL_EXPAND-ADATU' itab_xcel-adatu,
    ' ' 'MKAL_EXPAND-BDATU' itab_xcel-bdatu,
    ' ' 'MKAL_EXPAND-PLTYG' v_plnty,
    ' ' 'MKAL_EXPAND-PLNNG' v_plnnr,
    ' ' 'MKAL_EXPAND-ALNAG' v_plnal,
    ' ' 'MKAL_EXPAND-STLAL' itab_xcel-stlal,
    ' ' 'MKAL_EXPAND-STLAN' itab_xcel-stlan,
    ' ' 'MKAL_EXPAND-SERKZ' itab_xcel-serkz,
    ' ' 'MKAL_EXPAND-MDV01' l_mdv01,
    ' ' 'MKAL_EXPAND-ELPRO' itab_xcel-elpro,
    ' ' 'MKAL_EXPAND-ALORT' itab_xcel-alort,
    save the production version from initial screen
    'X' 'SAPLCMFV' '1000',
    ' ' 'BDC_OKCODE' '=SAVE'.
    endform.
    FORM BDC_SUBMIT_TRANSACTION *
    Submit BDC Session *
    form bdc_submit_transaction.
    Load BDC script as a trqansction in BDC session
    call function 'BDC_INSERT'
    exporting
    tcode = v_tcode
    tables
    dynprotab = itab_bdc_tab
    exceptions
    internal_error = 01
    not_open = 02
    queue_error = 03
    tcode_invalid = 04.
    endform.
    FORM BDC_BUILD_SCRIPT_RECORD *
    form bdc_build_script_record using dynbegin name value.
    clear itab_bdc_tab.
    if dynbegin = 'X'.
    move: name to itab_bdc_tab-program,
    value to itab_bdc_tab-dynpro,
    'X' to itab_bdc_tab-dynbegin.
    else.
    move: name to itab_bdc_tab-fnam,
    value to itab_bdc_tab-fval.
    shift itab_bdc_tab-fval left deleting leading space.
    endif.
    append itab_bdc_tab.
    endform.
    FORM BDC_SESSION_CLOSE *
    Close BDC Session *
    form bdc_session_close.
    close the session
    call function 'BDC_CLOSE_GROUP'
    exceptions
    not_open = 1
    queue_error = 2
    others = 3.
    skip 2.
    if sy-subrc ne 0.
    write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.
    else.
    write : / 'Session created:', v_ssnname,
    50 '# of transactions:', v_trans_in_ssn.
    endif.
    endform.
    *& Form read_routing_cache
    *FORM read_routing_cache USING pi_matnr
    pi_werks
    pi_alnag
    pi_verid
    pi_mdv01.
    DATA: BEGIN OF lt_plpo OCCURS 0,
    vornr LIKE plpo-vornr,
    objty LIKE crhd-objty,
    objid LIKE crhd-objid,
    arbpl LIKE crhd-arbpl,
    END OF lt_plpo,
    l_mapl_plnnr LIKE mapl-plnnr.
    determine the routing group#
    CLEAR lt_pp04_cache.
    chk if its in the cache first, if not then get it from MAPL table
    and put it in the cache
    READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
    werks = pi_werks
    alnag = pi_alnag.
    IF sy-subrc = 0.
    do nothing - lt_pp04_cache header line has rtg#
    ELSE.
    get the routing group # from MAPL
    SELECT plnnr INTO l_mapl_plnnr
    FROM mapl UP TO 1 ROWS
    WHERE matnr = pi_matnr AND
    werks = pi_werks AND
    plnty = 'R' AND
    plnal = pi_alnag AND
    loekz = space.
    ENDSELECT.
    put it in the cache internal table
    IF NOT l_mapl_plnnr IS INITIAL.
    lt_pp04_cache-matnr = pi_matnr.
    lt_pp04_cache-werks = pi_werks.
    lt_pp04_cache-alnag = pi_alnag.
    lt_pp04_cache-plnnr = l_mapl_plnnr.
    APPEND lt_pp04_cache.
    ENDIF.
    ENDIF.
    if the rtg# was determined AND
    the work center was not determined yet AND
    work center was really needed for this line in the input file
    then
    read the work center from last PP04 operation on the routing
    update the cache accordingly
    IF NOT lt_pp04_cache-plnnr IS INITIAL AND
    lt_pp04_cache-arbpl IS INITIAL AND
    ( pi_verid IS INITIAL OR
    pi_mdv01 IS INITIAL ).
    read the last PP04 operation
    CLEAR lt_plpo.
    REFRESH lt_plpo.
    SELECT vornr eobjty eobjid e~arbpl
    INTO CORRESPONDING FIELDS OF TABLE lt_plpo
    FROM plas AS b
    INNER JOIN plpo AS c
    ON bplnty = cplnty AND
    bplnnr = cplnnr AND
    bzaehl = czaehl
    INNER JOIN crhd AS e
    ON carbid = eobjid
    WHERE b~plnty = v_plnty AND
    b~plnnr = lt_pp04_cache-plnnr AND
    b~plnal = lt_pp04_cache-alnag AND
    c~loekz = space AND
    c~steus = v_plpo_steus AND
    e~objty = v_objty AND
    e~werks = lt_pp04_cache-werks AND
    e~verwe = v_verwe.
    SORT lt_plpo BY vornr DESCENDING.
    READ TABLE lt_plpo INDEX 1.
    IF NOT lt_plpo-arbpl IS INITIAL.
    lt_pp04_cache-arbpl = lt_plpo-arbpl.
    read work center description
    SELECT SINGLE ktext INTO lt_pp04_cache-ktext
    FROM crtx WHERE objty = lt_plpo-objty AND
    objid = lt_plpo-objid AND
    spras = sy-langu.
    the following read will get the index of the correct record to be
    updated in the cache
    READ TABLE lt_pp04_cache
    WITH KEY matnr = pi_matnr
    werks = pi_werks
    alnag = pi_alnag.
    MODIFY lt_pp04_cache
    INDEX sy-tabix
    TRANSPORTING arbpl ktext.
    ENDIF.
    ENDIF.
    *ENDFORM. " read_last_pp04_operation_cache
    *& Form read_routing
    form read_routing.
    data: begin of lt_mapl occurs 0,
    plnnr like mapl-plnnr,
    plnal like mapl-plnal,
    end of lt_mapl,
    l_arbpl like crhd-arbpl.
    get all the rtg# and grp ctr# from MAPL
    select plnnr plnal
    into corresponding fields of table lt_mapl
    from mapl
    where matnr = v_matnr and
    werks = itab_xcel-werks and
    plnty = v_plnty and "Rate Routing
    loekz = space. "with del flag = OFF
    sort lt_mapl by plnal.
    if not itab_xcel-verid is initial.
    if the verid=0001 then use the 1st good rtg-grp# and grp-ctr#
    if itab_xcel-verid = '0001'.
    read table lt_mapl index 1.
    v_plnnr = lt_mapl-plnnr.
    v_plnal = lt_mapl-plnal.
    else.
    if the verid0001 then use the rtg-grp# and grp-ctr# of the routing
    whose work center on the last PP04 operation matches the given verid
    loop at lt_mapl.
    clear l_arbpl.
    get the work center from the last PP04 operation
    perform read_wc_on_last_pp04 using lt_mapl-plnnr
    lt_mapl-plnal
    changing l_arbpl.
    if itab_xcel-verid = l_arbpl.
    v_plnnr = lt_mapl-plnnr.
    v_plnal = lt_mapl-plnal.
    exit.
    endif.
    endloop.
    endif.
    else.
    do nothing
    endif.
    For version IDs that are other then '0000' or 'ZWIP' :--
    if itab_xcel-verid NE '0000' and
    itab_xcel-verid NE 'ZWIP'.
    if routing group# or group counter was not determined, make the
    valid-to date 99/99/9999 so that the BDC, on execution, errors out.
    if v_plnnr is initial or
    v_plnal is initial.
    itab_xcel-bdatu = '99/99/9999'.
    endif.
    endif.
    determine the routing group#
    CLEAR lt_pp04_cache.
    chk if its in the cache first, if not then get it from MAPL table
    and put it in the cache
    READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
    werks = pi_werks
    alnag = pi_alnag.
    IF sy-subrc = 0.
    do nothing - lt_pp04_cache header line has rtg#
    ELSE.
    get the routing group # from MAPL
    put it in the cache internal table
    IF NOT l_mapl_plnnr IS INITIAL.
    lt_pp04_cache-matnr = pi_matnr.
    lt_pp04_cache-werks = pi_werks.
    lt_pp04_cache-alnag = pi_alnag.
    lt_pp04_cache-plnnr = l_mapl_plnnr.
    APPEND lt_pp04_cache.
    ENDIF.
    ENDIF.
    if the rtg# was determined AND
    the work center was not determined yet AND
    work center was really needed for this line in the input file
    then
    read the work center from last PP04 operation on the routing
    update the cache accordingly
    IF NOT lt_pp04_cache-plnnr IS INITIAL AND
    lt_pp04_cache-arbpl IS INITIAL AND
    ( pi_verid IS INITIAL OR
    pi_mdv01 IS INITIAL ).
    read the last PP04 operation
    CLEAR lt_plpo.
    REFRESH lt_plpo.
    SELECT vornr eobjty eobjid e~arbpl
    INTO CORRESPONDING FIELDS OF TABLE lt_plpo
    FROM plas AS b
    INNER JOIN plpo AS c
    ON bplnty = cplnty AND
    bplnnr = cplnnr AND
    bzaehl = czaehl
    INNER JOIN crhd AS e
    ON carbid = eobjid
    WHERE b~plnty = v_plnty AND
    b~plnnr = lt_pp04_cache-plnnr AND
    b~plnal = lt_pp04_cache-alnag AND
    c~loekz = space AND
    c~steus = v_plpo_steus AND
    e~objty = v_objty AND
    e~werks = lt_pp04_cache-werks AND
    e~verwe = v_verwe.
    SORT lt_plpo BY vornr DESCENDING.
    READ TABLE lt_plpo INDEX 1.
    IF NOT lt_plpo-arbpl IS INITIAL.
    lt_pp04_cache-arbpl = lt_plpo-arbpl.
    read work center description
    SELECT SINGLE ktext INTO lt_pp04_cache-ktext
    FROM crtx WHERE objty = lt_plpo-objty AND
    objid = lt_plpo-objid AND
    spras = sy-langu.
    the following read will get the index of the correct record to be
    updated in the cache
    READ TABLE lt_pp04_cache
    WITH KEY matnr = pi_matnr
    werks = pi_werks
    alnag = pi_alnag.
    MODIFY lt_pp04_cache
    INDEX sy-tabix
    TRANSPORTING arbpl ktext.
    ENDIF.
    ENDIF.
    endform. " read_last_pp04_operation_cache
    *& Form read_wc_on_last_pp04
    form read_wc_on_last_pp04 using pi_plnnr
    pi_plnal
    changing pe_arbpl.
    data: begin of lt_plpo occurs 0,
    vornr like plpo-vornr,
    objty like crhd-objty,
    objid like crhd-objid,
    arbpl like crhd-arbpl,
    end of lt_plpo.
    get all the PP04 operations for the given rtg# & grp-ctr#
    select vornr eobjty eobjid e~arbpl
    into corresponding fields of table lt_plpo
    from plas as b
    inner join plpo as c
    on bplnty = cplnty and
    bplnnr = cplnnr and
    bzaehl = czaehl
    inner join crhd as e
    on carbid = eobjid
    where b~plnty = v_plnty and "Rate Routing
    b~plnnr = pi_plnnr and
    b~plnal = pi_plnal and
    c~loekz = space and "Oper Del Flag = OFF
    c~steus = v_plpo_steus and "PP04
    e~objty = v_objty. "WC Obj Type = 'A'
    read the last operation
    sort lt_plpo by vornr descending.
    read table lt_plpo index 1.
    pe_arbpl = lt_plpo-arbpl.
    endform. " read_wc_on_last_pp04
    Goto LSMW-> Select Direct Input method in 1st step. These are the standard programs for data transfer.
    Otherwise goto SPRO->SAP Reference IMG-> Under this you'll find standard data transfer programs module wise.
    Regards,
    Sunil Kumar Mutyala

  • Can we hav call transaction and session method for an application

    can we hav call transaction and session method for an application ?if yes how?

    Hi ,
    You can.  If Call Transaction fails, a batch input session can be created.
    Check this example-
    Call the transaction. Messages from Call Transaction are stored in the
    internal table messtab 
      CALL TRANSACTION 'LT01' USING bdc_tab MODE 'N' UPDATE 'S'
          MESSAGES INTO messtab.
      IF sy-subrc = 0.                                                 
    Call transaction successfull,  get the number of the Transfer Order that
    was created                                                        
        LOOP AT messtab.                                               
          IF messtab-dynumb = '0104' AND messtab-msgnr = '016'.        
            w_transportorderno = messtab-msgv1.                        
          ENDIF.                                                       
        ENDLOOP.
      ELSE.
    Call transaction failed, create a batch input session instead.
        PERFORM open_group.                        
        PERFORM bdc_insert USING 'LT01'.           
        PERFORM close_group.                       
    ENDIF.
    Regards,
    Sookshma

  • Bdc(call transaction and session method)

    hi experts,
       i want to write for bdc program in which i have used call transaction and session method.please help me.
    thank you
    with regards,
    santosh

    Hi,
    See the Sample BDc Code for Vendor Master Upload:
    Look at the Include BDCRECX1 for Seesion and Call Transaction types:
    REPORT zmm_vendor_master_upload
           NO STANDARD PAGE HEADING
           LINE-SIZE 255.
    ABAP Name   :   ZMM_VENDOR_MASTER_UPLOAD
    Description :   This Program is used to Upload the Vendor Master.
      Modification Log:
      Date         Programmer          Correction    Description
    Standard Include for Selection Screen
    INCLUDE bdcrecx1.
    Internal Table for Upload Data
    DATA: BEGIN OF i_vendor OCCURS 0,
            bukrs(004),             " Company Code
            ekorg(004),             " Purchase Orgn
            ktokk(004),             " Account Group
    Address Screen
            anred(015),             " Title
            name1(035),                                         " Name1
            sortl(010),             " Sort Field
            name2(035),                                         " Name2
            name3(035),             " Contact Person1
            name4(035),             " Contact Person 2
            stras(035),             " Street
            pfach(010),             " PO Box
            ort01(035),             " City
            pstlz(010),             " Postal Code
            land1(003),             " Country
            spras(002),             " Language
            telf1(016),             " Telephone No
            telfx(031),             " Fax Number
            lfurl(132),             " URL-Mail Id
    Material Group Characteristics
           klart(003),             " Class Type '010'
           class(018),             " Class 'Vendor'
           mname_01(030),          " Characteristic
           mname_02(030),          " Characteristic
           mname_03(030),          " Characteristic
            mwert_01(030),          " Charct.Value
            mwert_02(030),          " Charct.Value
            mwert_03(030),          " Charct.Value
    Control Data
            emnfr(010),             " Manufact.Part No
    Bank Details
            banks_01(003),          " Country of Bank1
            banks_02(003),          " Country of Bank2
            bankl_01(015),          " Bank Key of 1
            bankl_02(015),          " Bank Key of 2
            bankn_01(018),          " Account No Bank1
            bankn_02(018),          " Account No Bank2
    Accounting Info
            akont(010),             " Reconcillation Account
            zuawa(003),             " Sort Key
            fdgrv(010),             " Cash Management Group
    Payment Transactions
            zterm(004),             " Payment terms
           reprf(001),             " Check Double Inv.
            zwels(010),             " Payment Method
            hbkid(005),             " House Bank
           xpore(001),             " Individ.Payment
    Correspondence
            mahns(001),             " Dunning Level
            xausz(001),             " Account Statement
    Withholding Tax Details
            qland(003),             " Withholding Tax Country
            witht_01(002),          " WH tax Type
           wt_withcd(002),        " WH Tax Code
           wt_subjct(001),        " Indicator:WH Tax
    Purchasing Data
            waers(005),             " Currency
            zterm1(004),            " Payment Terms
          END OF i_vendor.
    Data Variables & Constants
    CONSTANTS : c_x     VALUE 'X'.  " Flag
    Paramters
    PARAMETERS: p_file LIKE ibipparms-path.  " Filename
    At selection-screen on Value Request for file Name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Get the F4 Values for the File
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
    Start of Selection
    START-OF-SELECTION.
    Open the BDC Session
      PERFORM open_group.
    Upload the File into internal Table
      CALL FUNCTION 'UPLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'
        TABLES
          data_tab                = i_vendor
        EXCEPTIONS
          conversion_error        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          OTHERS                  = 7.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Upload the Data from Internal Table
      LOOP AT i_vendor.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RF02K-KTOKK'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RF02K-BUKRS'
                                      i_vendor-bukrs.
        PERFORM bdc_field       USING 'RF02K-EKORG'
                                      i_vendor-ekorg.
        PERFORM bdc_field       USING 'RF02K-KTOKK'
                                      i_vendor-ktokk.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0110'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFA1-SPRAS'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=KLAS'.
        PERFORM bdc_field       USING 'LFA1-ANRED'
                                      i_vendor-anred.
        PERFORM bdc_field       USING 'LFA1-NAME1'
                                      i_vendor-name1.
        PERFORM bdc_field       USING 'LFA1-SORTL'
                                      i_vendor-sortl.
        PERFORM bdc_field       USING 'LFA1-NAME2'
                                      i_vendor-name2.
        PERFORM bdc_field       USING 'LFA1-NAME3'
                                      i_vendor-name3.
        PERFORM bdc_field       USING 'LFA1-NAME4'
                                      i_vendor-name4.
        PERFORM bdc_field       USING 'LFA1-STRAS'
                                      i_vendor-stras.
        PERFORM bdc_field       USING 'LFA1-PFACH'
                                      i_vendor-pfach.
        PERFORM bdc_field       USING 'LFA1-ORT01'
                                      i_vendor-ort01.
        PERFORM bdc_field       USING 'LFA1-PSTLZ'
                                      i_vendor-pstlz.
        PERFORM bdc_field       USING 'LFA1-LAND1'
                                      i_vendor-land1.
        PERFORM bdc_field       USING 'LFA1-SPRAS'
                                      i_vendor-spras.
        PERFORM bdc_field       USING 'LFA1-TELF1'
                                      i_vendor-telf1.
        PERFORM bdc_field       USING 'LFA1-TELFX'
                                      i_vendor-telfx.
        PERFORM bdc_field       USING 'LFA1-LFURL'
                                      i_vendor-lfurl.
        PERFORM bdc_dynpro      USING 'SAPLCLCA' '0602'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RMCLF-KLART'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=ENTE'.
        PERFORM bdc_field       USING 'RMCLF-KLART'
                                      '010'. "i_vendor-klart.
        PERFORM bdc_dynpro      USING 'SAPLCLFM' '0500'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RMCLF-CLASS(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=AUSW'.
        PERFORM bdc_field       USING 'RMCLF-CLASS(01)'
                                      'Vendor'."i_vendor-class.
        PERFORM bdc_dynpro      USING 'SAPLCTMS' '0109'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RCTMS-MWERT(03)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=BACK'.
        PERFORM bdc_field       USING 'RCTMS-MNAME(01)'
                           'MATERIALGROUP'." i_vendor-mname_01.
        PERFORM bdc_field       USING 'RCTMS-MNAME(02)'
                           'MATERIALGROUP'." i_vendor-mname_02.
        PERFORM bdc_field       USING 'RCTMS-MNAME(03)'
                           'MATERIALGROUP'." i_vendor-mname_03.
        PERFORM bdc_field       USING 'RCTMS-MWERT(01)'
                                      i_vendor-mwert_01.
        PERFORM bdc_field       USING 'RCTMS-MWERT(02)'
                                      i_vendor-mwert_02.
        PERFORM bdc_field       USING 'RCTMS-MWERT(03)'
                                      i_vendor-mwert_03.
        PERFORM bdc_dynpro      USING 'SAPLCLFM' '0500'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RMCLF-CLASS(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=ENDE'.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0110'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFA1-ANRED'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0120'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFA1-EMNFR'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_field       USING 'LFA1-EMNFR'
                                      i_vendor-emnfr.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0130'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFBK-BANKN(02)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=VW'.
        PERFORM bdc_field       USING 'LFBK-BANKS(01)'
                                      i_vendor-banks_01.
        PERFORM bdc_field       USING 'LFBK-BANKS(02)'
                                      i_vendor-banks_02.
        PERFORM bdc_field       USING 'LFBK-BANKL(01)'
                                      i_vendor-bankl_01.
        PERFORM bdc_field       USING 'LFBK-BANKL(02)'
                                      i_vendor-bankl_02.
        PERFORM bdc_field       USING 'LFBK-BANKN(01)'
                                      i_vendor-bankn_01.
        PERFORM bdc_field       USING 'LFBK-BANKN(02)'
                                      i_vendor-bankn_02.
       PERFORM bdc_dynpro      USING 'SAPMF02K' '0130'.
       PERFORM bdc_field       USING 'BDC_CURSOR'
                                     'LFBK-BANKS(01)'.
       PERFORM bdc_field       USING 'BDC_OKCODE'
                                     '=VW'.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0210'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFB1-FDGRV'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_field       USING 'LFB1-AKONT'
                                      i_vendor-akont.
        PERFORM bdc_field       USING 'LFB1-ZUAWA'
                                      i_vendor-zuawa.
        PERFORM bdc_field       USING 'LFB1-FDGRV'
                                      i_vendor-fdgrv.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0215'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFB1-XPORE'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_field       USING 'LFB1-ZTERM'
                                      i_vendor-zterm.
        PERFORM bdc_field       USING 'LFB1-REPRF'
                                      c_x. "i_vendor-reprf.
        PERFORM bdc_field       USING 'LFB1-ZWELS'
                                      i_vendor-zwels.
        PERFORM bdc_field       USING 'LFB1-HBKID'
                                      i_vendor-hbkid.
        PERFORM bdc_field       USING 'LFB1-XPORE'
                                      c_x. "i_vendor-xpore.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0220'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFB5-MAHNS'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_field       USING 'LFB5-MAHNS'
                                      i_vendor-mahns.
        PERFORM bdc_field       USING 'LFB1-XAUSZ'
                                      i_vendor-xausz.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0610'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFBW-WT_SUBJCT(01)'.
        PERFORM bdc_field       USING 'LFB1-QLAND'
                                      i_vendor-qland.
        PERFORM bdc_field       USING 'LFBW-WITHT(01)'
                                      i_vendor-witht_01.
       PERFORM bdc_field       USING 'LFBW-WT_WITHCD(01)'
                                     i_vendor-wt_withcd.
        PERFORM bdc_field       USING 'LFBW-WT_SUBJCT(01)'
                                       c_x.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0310'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LFM1-ZTERM'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_field       USING 'LFM1-WAERS'
                                      i_vendor-waers.
        PERFORM bdc_field       USING 'LFM1-ZTERM'
                                      i_vendor-zterm1.
        PERFORM bdc_dynpro      USING 'SAPMF02K' '0320'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RF02K-LIFNR'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VW'.
        PERFORM bdc_dynpro      USING 'SAPLSPO1' '0300'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=YES'.
    Call the Transaction
        PERFORM bdc_transaction USING 'XK01'.
      ENDLOOP.
    Close the BDc Session
      PERFORM close_group.
    Regards,
    Anji

  • Call transaction and session method -urgent

    Hi,
       can anybody tell me the diffence between call transaction and session method .
    what are the advantage of each method and when we go for it.
    how to see log file in session method.
    i will really appricitate

    hi,
    check this code,
    REPORT ZTEST_ABCD NO STANDARD PAGE HEADING LINE-SIZE 255.
    *REPORT zabzon_bdc
          NO STANDARD PAGE HEADING LINE-SIZE 255.
    TYPES: BEGIN OF record,
          xbanl LIKE raifp3-xbanl,
           anln1 LIKE raifp2-anln1,
           anln2 LIKE raifp2-anln2,
           anbtr TYPE string,
           bldat TYPE string,
           budat TYPE string,
           bzdat TYPE string,
           sgtxt LIKE raifp2-sgtxt,
           monat LIKE raifp2-monat,
           blart LIKE raifp1-blart,
           gkont LIKE raifp2-gkont,
           bwasl LIKE raifp1-bwasl,
           xblnr LIKE raifp1-xblnr,
       END OF record.
    TYPES :BEGIN OF x_messages,
           index TYPE i,
           msgtyp(1),
           message(120),
           END OF x_messages.
    DATA: it_record TYPE STANDARD TABLE OF record,
          wa_record TYPE record.
    DATA : it_messages  TYPE STANDARD TABLE OF x_messages,
           wa_messages TYPE x_messages.
    DATA : it_bdcmsg TYPE STANDARD TABLE OF bdcmsgcoll,
           wa_bdcmsg TYPE bdcmsgcoll.
    DATA : bdcdata TYPE STANDARD TABLE OF bdcdata,
           wa_bdcdata TYPE bdcdata.
    DATA : it_excel TYPE STANDARD TABLE OF alsmex_tabline,
           wa_excel TYPE alsmex_tabline.
    DATA : fname TYPE string.
    DATA :l_index LIKE sy-tabix.
    data : str type string.
    *Selection screen.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_file1 TYPE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    *Selction-Screen F4 Help
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                field_name = 'p_file1'
           IMPORTING
                file_name  = p_file1.
    *START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM process_f1data.
      PERFORM execute_bdc.
           Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = program.
      wa_bdcdata-dynpro   = dynpro.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO bdcdata.
      CLEAR wa_bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval .
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = fnam.
      wa_bdcdata-fval = fval.
      APPEND wa_bdcdata TO bdcdata.
      CLEAR wa_bdcdata.
    ENDFORM.                    "BDC_FIELD
    *&      Form  process_f1data
          text
    -->  p1        text
    <--  p2        text
    FORM process_f1data.
      REFRESH it_excel.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename    = p_file1
                i_begin_col = 1
                i_begin_row = 1
                i_end_col   = 99
                i_end_row   = 1000
           TABLES
                intern      = it_excel.
      LOOP AT it_excel INTO wa_excel.
        CASE wa_excel-col .
         WHEN '1' .
           wa_record-xbanl = wa_excel-value.
          WHEN '1' .
            wa_record-anln1 = wa_excel-value.
          WHEN '2'.
            wa_record-anln2 = wa_excel-value.
          WHEN '3'.
            wa_record-anbtr = wa_excel-value.
          WHEN '4'.
            wa_record-bldat = wa_excel-value.
          WHEN '5'.
            wa_record-budat = wa_excel-value.
          WHEN '6'.
            wa_record-bzdat = wa_excel-value.
          WHEN '7'.
            wa_record-sgtxt = wa_excel-value.
          WHEN '8'.
            wa_record-monat = wa_excel-value.
          WHEN '9'.
            wa_record-blart = wa_excel-value.
          WHEN '10'.
            wa_record-gkont = wa_excel-value.
          WHEN '11'.
            wa_record-bwasl = wa_excel-value.
          WHEN '12'.
            wa_record-xblnr = wa_excel-value.
        ENDCASE.
        AT END OF row.
          CONDENSE : wa_record-anln1,wa_record-anln2,
                     wa_record-anbtr,wa_record-bldat,wa_record-budat,
                     wa_record-bzdat,wa_record-sgtxt,wa_record-monat,
                     wa_record-blart,wa_record-gkont,wa_record-bwasl,
                     wa_record-xblnr.
          APPEND  wa_record TO it_record.
          CLEAR  wa_record.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " process_f1data
    *&      Form  execute_bdc
          text
    -->  p1        text
    <--  p2        text
    FORM execute_bdc.
      LOOP AT it_record INTO wa_record.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=NEWA'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP3-XBANL'.
        PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                      'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '22.05.2008'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP2-ANLN1'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
        PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                      wa_record-anln1.    "'3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '22.05.2008'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP2-ANLN2'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
        PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                      wa_record-anln2.   "'0'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '22.05.2008'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP2-ANBTR'.
       str = wa_record-anbtr.
        PERFORM bdc_field       USING 'RAIFP2-ANBTR'
                                      wa_record-anbtr.       "'45000'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '22.05.2008'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-ANBTR'
                                     '45,000.00'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP1-BLDAT'.
        PERFORM bdc_field       USING 'RAIFP1-BLDAT'
                                      wa_record-bldat.        "'01.04.2008'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '22.05.2008'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-ANBTR'
                                     '45,000.00'.
       PERFORM bdc_field       USING 'RAIFP1-BLDAT'
                                     '01.04.2008'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP1-BUDAT'.
        PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                      wa_record-budat.    "'01.04.2008'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-ANBTR'
                                     '45,000.00'.
       PERFORM bdc_field       USING 'RAIFP1-BLDAT'
                                     '01.04.2008'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '01.04.2008'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP1-BZDAT'.
        PERFORM bdc_field       USING 'RAIFP1-BZDAT'
                                      wa_record-bzdat.   "'01.04.2008'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-ANBTR'
                                     '45,000.00'.
       PERFORM bdc_field       USING 'RAIFP1-BLDAT'
                                     '01.04.2008'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '01.04.2008'.
       PERFORM bdc_field       USING 'RAIFP1-BZDAT'
                                     '01.04.2008'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP2-SGTXT'.
        PERFORM bdc_field       USING 'RAIFP2-SGTXT'
                                      wa_record-sgtxt.      "'test01'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=TAB02'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP2-ANLN1'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-ANBTR'
                                     '45,000.00'.
       PERFORM bdc_field       USING 'RAIFP1-BLDAT'
                                     '01.04.2008'.
       PERFORM bdc_field       USING 'RAIFP1-BUDAT'
                                     '01.04.2008'.
       PERFORM bdc_field       USING 'RAIFP1-BZDAT'
                                     '01.04.2008'.
       PERFORM bdc_field       USING 'RAIFP2-SGTXT'
                                     'test01'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP2-MONAT'.
        PERFORM bdc_field       USING 'RAIFP2-MONAT'
                                      wa_record-monat.     "'01'.
       PERFORM bdc_field       USING 'RAIFP1-BLART'
                                     'AA'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-MONAT'
                                     '1'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP1-BLART'.
        PERFORM bdc_field       USING 'RAIFP1-BLART'
                                      wa_record-blart.    " 'AA'.
       PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
       PERFORM bdc_field       USING 'BDC_OKCODE'
                                     '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-MONAT'
                                     '1'.
       PERFORM bdc_field       USING 'RAIFP1-BLART'
                                     'AA'.
       PERFORM bdc_field       USING 'BDC_CURSOR'
                                     'RAIFP2-GKONT'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-MONAT'
                                     '1'.
       PERFORM bdc_field       USING 'RAIFP1-BLART'
                                     'AA'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP2-GKONT'.
        PERFORM bdc_field       USING 'RAIFP2-GKONT'
                                      wa_record-gkont.   "'1600'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-MONAT'
                                     '1'.
       PERFORM bdc_field       USING 'RAIFP1-BLART'
                                     'AA'.
       PERFORM bdc_field       USING 'RAIFP2-GKONT'
                                     '1600'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP1-BWASL'.
        PERFORM bdc_field       USING 'RAIFP1-BWASL'
                                      wa_record-bwasl.      "'100'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-MONAT'
                                     '1'.
       PERFORM bdc_field       USING 'RAIFP1-BLART'
                                     'AA'.
       PERFORM bdc_field       USING 'RAIFP2-GKONT'
                                     '1600'.
       PERFORM bdc_field       USING 'RAIFP1-BWASL'
                                     '100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RAIFP1-XBLNR'.
        PERFORM bdc_field       USING 'RAIFP1-XBLNR'
                                      wa_record-xblnr.   "'TEST01'.
        PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SAVE'.
       PERFORM bdc_field       USING 'BDC_CURSOR'
                                     'RAIFP2-ANLN1'.
       PERFORM bdc_field       USING 'RAIFP3-XBANL'
                                     'X'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN1'
                                     '3100309'.
       PERFORM bdc_field       USING 'RAIFP2-ANLN2'
                                     '0'.
       PERFORM bdc_field       USING 'RAIFP2-MONAT'
                                     '1'.
       PERFORM bdc_field       USING 'RAIFP1-BLART'
                                     'AA'.
       PERFORM bdc_field       USING 'RAIFP2-GKONT'
                                     '1600'.
       PERFORM bdc_field       USING 'RAIFP1-BWASL'
                                     '100'.
       PERFORM bdc_field       USING 'RAIFP1-XBLNR'
                                     'TEST01'.
       PERFORM bdc_dynpro      USING 'SAPLAMDP' '0100'.
       PERFORM bdc_field       USING 'BDC_OKCODE'
                                     '=SHWD'.
       PERFORM bdc_field       USING 'BDC_OKCODE'
                                     '=SAVE'.
        CALL TRANSACTION 'ABZON' USING bdcdata
                                            MODE 'A'
                                            MESSAGES INTO it_bdcmsg.
        PERFORM collect_bdc_messages.
      ENDLOOP.
    ENDFORM.                    " execute_bdc
    *&      Form  collect_bdc_messages
          text
    -->  p1        text
    <--  p2        text
    FORM collect_bdc_messages.
      DATA: l_msg(100).
      LOOP AT it_bdcmsg INTO wa_bdcmsg.
        CALL FUNCTION 'FORMAT_MESSAGE'
             EXPORTING
                  id        = wa_bdcmsg-msgid
                  lang      = wa_bdcmsg-msgspra
                  no        = wa_bdcmsg-msgnr
                  v1        = wa_bdcmsg-msgv1
                  v2        = wa_bdcmsg-msgv2
             IMPORTING
                  msg       = l_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.
        CONDENSE l_msg.
        CLEAR wa_bdcmsg.
        wa_messages-index = l_index.
        wa_messages-msgtyp = wa_bdcmsg-msgtyp.
        wa_messages-message = l_msg.
        APPEND wa_messages TO it_messages.
        WRITE:/  wa_messages-message.
      ENDLOOP.
      l_index = l_index + 1.
      REFRESH it_bdcmsg.
    ENDFORM.                    " collect_bdc_messages
    regards
    siva

  • Is there a major flaw with Iphoto in regards to organizing and backing up?

    Is there a major flaw with Iphoto in regards to organizing and backing up? And how should I proceed??
    Here is my story. I have moved roughly 15,000 photos from 7 computers (4 PCs and 3 Macs - basically everyone's computer in the family) onto one external hard drive. The photos were taken by many different digital cameras, are sparsely labeled, and have the most random names and folders. There are a LOT of duplicates. MY MISSION - label and back them up.
    The way I normally deal with photos/DATA is this: I plug my camera into my Mac and immediately think about organizing and backing them up. With "Preview" I look at photos (and decide which one I like), create a folder called "where-ever I took these photos" and drag them into that folder. The problem with Iphoto is that you have no ability to control folders, unlike many other applications.
    For example, in Itunes you can rename an artist, or even an album, and it will automatically appear in an updated folder. If you alter a photo in Photoshop, it makes you save it is a new file. In Iphoto you cannot make the same "root level" changes without making duplicates. From what I understand, you can place photos into an Album and then export that album (which makes duplicates). Iphoto will rename each duplicate file and then place it in the correct folder. The problem here is I have no idea where the original is to delete it.
    Basically I want to create folders called "Trip to Italy 2003" or "Rachel's Wedding" and place all the photos associated with that event in those folders. The problem I run into is that I have a bunch of duplicates. I have heard of a program called Duplicate Annihilator which has gotten favorable reviews. If I import them into Iphoto all the photos are placed in random named folders. I say random because some of the photos were taken on cameras that didn't have the date set correctly. Hence some of my photos will appear in a labyrinth of folders called "Modified / 2001 / Roll 17 / DCM482 / Image25874654.jpg"
    I am totally willing to wipe my Iphoto library clean and start again if there is a way to organize the photos as described above. Eventually I will take these folders and save them on a data DVD.
    Thanks to anyone who can help.
    Gary

    You do not need to delve into the folders within the iPhoto Library via the finder to access any photo. That is all done within iPhoto itself. If you need a photo for use outside of iPhoto read Terence Devlin's treatise on file access. iPhoto is a DAM application - Digital Asset Management, not a folder manager. There's a big difference. You can use keywords, album and smart albums to organize your photos.
    If you still have the original files you might consider what I do. I rename each file with the date it was taken using the international date format: YYYY-MM-DD-001.jpg. You can download the demo version ofMedia Expression and automatically rename each folder of photos with the EXIF date and a sequential number. This makes chronological searching and sorting much easier both in iPhoto and the Finder.
    If you want to not only manage the photos but the folders then Expression Media will let you do both. It will let you rename files after being imported into a catalog, move them between folders, add ITPC metadata to the files, create virtual albums called Supplemental categories, and much, much more. I use it as my primary DAM and iPhoto for special projects like books, slideshows, calendars, etc.

  • Difference between SY-SUBRC EQ 0 and SY-SUBRC EQ ' 0 '

    Dear All,
    I am not from abap background.
    I have a simple question.
    what is the difference between sy-subrc eq 0 and sy-subrc eq '0'
    How does it impact a statement like this for example
    SELECT /BIC/ZAGENT /BIC/ZBATCH_MO /BIC/ZDOC_NUM /BIC/ZCUSTOMER
               /BIC/ZSTORE /BIC/ZLINE_NUM /BIC/ZMATERIAL /BIC/ZBARCODE
          FROM /BIC/AZO_AMVN100
          INTO CORRESPONDING FIELDS OF TABLE it_aquisition
          WHERE /BIC/ZAGENT EQ SOURCE_FIELDS-/BIC/ZAGENT
          AND /BIC/ZDOC_NUM EQ SOURCE_FIELDS-/BIC/ZDOC_NUM
          AND /BIC/ZOCFLAG = '1'.
        if sy-subrc EQ '0'.
          SELECT SINGLE /BIC/ZDOC_NUM FROM /BIC/AZO_PMVN300
            INTO v_docnum
            WHERE /BIC/ZDOC_NUM EQ SOURCE_FIELDS-/BIC/ZDOC_NUM
            AND /BIC/ZAGENT EQ SOURCE_FIELDS-/BIC/ZAGENT
    kindly help me with this.
    Pleae do a little more research before posting questions here...even if you are new to ABAP.
    Edited by: kishan P on Aug 24, 2010 10:00 AM

    Hi,
    Please refer [Wiki post|http://wiki.sdn.sap.com/wiki/display/ABAP/Sy-Subrc].
    hope it help you,
    regards,

  • My iphone 4S has problem in making and receiving the calls. While making the call , call fails and netwrok disappears. Like wise no voice is heard for incoming calls. This happened after return from the overseas travel.

    My iphone 4S has problem in making and receiving the calls. While making the call , call fails and netwrok disappears. Like wise no voice is heard for incoming calls. This happened after return from the overseas travel.

    Hello SamSax
    Check out the assist page below for troubleshooting call connectivity.
    Calls and connection issues
    http://www.apple.com/support/iphone/assistant/calls/
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • Two subjects one is be aware of (855)999-9115 calling you and how can i secure my mac or my Netgear Box

    Two subjects here:
    1: I got a call from this phone number telling me this is so and so from Netgear , (855)999-9115 .The reason i am calling you is we detected that someone had hacked your Netgear Router and he told me to type in the Google search bar logmein123.com , So i did so and then he told me to type 5 or 6 numbers so he can go inn to my computer to repare it (All this over my cell phone) Not sure how he got it or he was the original to hack my system and get all my infor from my Two Iphones,Macbook Pro ,Ipad Air and my Imac .
    So he start doing not sure what put me on hold each time and then he pops up a page higlighting a name by Midnight Gracie a few times that she or he had hacked your system and he will remove it for free.I trusted him since Netgear is a respectful company , Aftey 32 minutes he tells me i spoke to my supervisor and you pay one time lifetime fee of $399.00 charged to your credit card ,I said no way cant ,Then put me on hold again , came back said ok my supervisor said $299.00 to make story short he siad ok you are over 65 years old special price $49.00 and i will fix your system.Then i said no so he started loging out of my system but in the 32 minutes or more what did he do to my computer ?
    The guy sunded as a Philipino . Two guys after this scam since when he called me first i was driving and asked me to be called back , But when i got home i called him and the other guy asnwerd the phone and said ok the Technician that called you is here and talk to him,It it was Netgear how would you knopw who called.
    This namber is a big scam , Many people got screwed paid money and wrote reviews on Yelp and other places that thye where great fixed there computer and so helpfull.
    I filed a complaint at the Internet FBI and other place that i called forgot there names they take complaints for internet fraud .
    BE AWARE NOT TO GET THROUGH THIS , REPORT THEM SO THEY GO TO JAIL ASAP.
    2:
    How can i protect my systems at home?
    I went changed my users name and passwrod on my router and all my computers. But if he got in to my system who can i be sure that he will not get inn to it again since he had all my info and ny IP#.
    Please tey to help .
    Best regards
    Sam

    1. I'd backup all of my personal data (only) and perform a clean install of OSX if I experienced your problem as no one here or elsewhere could guarantee your machine is free from compromise after that scenario. You should also change your Apple ID password if you haven't done this already.
    2. Ultimately trust no one other than yourself even though this is difficult if not impossible in the real world. There are measures you can take however which will lessen your chances of being compromised. Here's a link to one of the most concise write-ups I've ever read on basic computer security essentials by ASC contributer Linc Davis for the average person (scroll to Linc's reply at the bottom of this linked page):
    https://discussions.apple.com/message/21065409#21065409

  • How to create bdc for fbs1 using both call transaction and session

    Hi Friends,
    i have one problem with tcode FBS1, i need to create a bdc program for both call transaction and session method using subroutine.
    first call transaction needs to execute if there is an error sesion has to execute. if u have code please forward.
    thanks in advance.
    chandramouli pothugunta

    where as in call transaction we can do error handling explictly.those errors  are stored in one file .this file will send to the error log(session method),i.e session log.
    in the above case we use both call transaction n session method at time in one program.sample code is below ,go through it .
    data : begin of itxk01 occurs 0,
    end of itxk01.
    data : bdcdata like itbdcdata occurs 0 with header line.
    data : itbdcmsgcoll like itbdcmsgcoll occurs 0 with header line,
             itxk01 like itxk01-dup occurs 0 with header line.
    call gui-upload.
    loop at itxk01.
    refresh itxk01.
    perform bdc-dynpr0 using 'prg' 'scr'
    perform bdc-dynfld using fnam fval
    call transaction 'xk01' using bdcdata mode 'a' update 's' messages into itbdcmsgcoll.
    if sy-subrc ne 0.
    append itxk01 into  itxk01-dup.
    endif.
    endloop.
    if not itxk01-dup[] is initial.
    refresh itck01.
    call bdc_open_group
    itxk01 = itxk01-dup.
    loop at itxk01.
    refresh itxk01.
    perform bdc-dynpr0 using 'prg' 'scr'
    perform bdc-dynfld using fnam fval
    call bdc-insert.
    endloop.
    call bdc-close-group.
    form bdc-dynpr0 using pr sc
    endform .
    form bdc-field  using fnam faval
    endform.
    this will help u.
    reward points for me
    kiran

  • CALL TRANSACTION AND SKIP FIRST SCREEN to specified tab in TCODE 'IW32'

    Hi,
    I am using CALL TRANSACTION AND SKIP FIRST SCREEN in ALV Grid Report to call IW32 tcode and it goes to tcode skipping the first screen. But it goes to the default header tab in the tab control. Whereas I wish to go to the specified tab 'OPERATIONS'.
    Can any one help me, as to how to resolve this issue ?
    Thanks in advance.

    Sridher,
    I have the similar requirement. but in my case its COSTS tab. Could you please provide the code you have used for this to work?
    I used standard "call transaction with mode 'E' ". This seems to be working but I am not pleased by my effort. Is there any proper way that you might have followed ?
    Greatly appreciated your help.
    Regards,
    Reddy

Maybe you are looking for

  • How do you import photos into IPhoto from a RSS feeder?

    I want to create a Photocast so I can deliver pictures into my friend's photo management program of choice. I have IPhoto 6 but my friends that have IPhoto 5 are having trouble. When I send them a Photocast, they can put the URL in the Safari Address

  • Need advice/idea about Image gallery

    Hello to ALL!!! I'm trying to make an dynamic image gallery WITH!!! some active buttons above (for example: BUTTON1 with function "delete" and BUTTON2 with function "update") a picture and some "dataoutput" below (for example:Price). So, separate cel

  • How can I disable "tabs' completely?

    I'm currently using Firefox version 16.0.2, I want to be able to get rid of tabs altogether. I've read there was a "tabkiller" download but it says it doesn't work on FF versions later than 3.

  • Photoshop Elements 12 for Mac reinstall

    I have reinstalled my iMac (OS 10.10) and want to re-install Photoshop Elements 12 for Mac that I previously purchased. Right now I do not need Photoshop Elements 13 How do I? Can not find Photoshop Elements 12 at Adobe's website

  • Will removal of BONJOUR effect use of 4th gen Ipod Nano ?

    I read that Bonjour is un-essential and I removed it from my pc, the nano is for my daughter to download songs from itunes for xmas, will bonjour removal harm the ipod functionality in any way ? james Message was edited by: JamesKavanagh