BDC Batch input session method

Hi ,
           I am new to SAP progamming. Pls let me know the basics of BDC Batch Input session method and Call transaction method. I want to know the pros and cons of both methods with justification. Please help me in this regarding.

Hi,
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
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
Session method:
1. Data migration is done in two steps .. Generate session and Process session.
So resouces can be used efficiently. good for bulkdata migration.
2. Session method generates error log when u process a session.
3. No SY-SUBRC can be returned after each transaction is called.
4. Provides synchronous Updation only...
Call transaction method:
1. Data migration is done in single steps ..bcoz Transactions are called immediately after filling BDCDATA table. So good for small amount of data.
2. We have to collect error messages using BDCMSGCOLL Table
3. Returns SY-SUBRC and Messages ..after each Call Transaction..very useful feature for further processing based on the Status and Messages..
4. Supports Asynch or Synch Updation.
Example code for session method
Here is the porgram for Purchase order
REPORT zmm0069 NO STANDARD PAGE HEADING
                                  MESSAGE-ID z0
                                  LINE-SIZE  132
                                  LINE-COUNT 65(2).
                     Internal Tables                                 *
*Internal table for the purchasing info records fields.
  DATA: BEGIN OF i_inforecord OCCURS 0,
        matnr(18),
        lifnr(10),
        uom(3),
        ekgrp(3),
        planned_time(3),
        under_tol(3),
        over_tol(3),
        qty(10),
        price_cat(5),
        inco(3),
        designation(28),
        netpr(13),
        scale_qty1(10),
        scale_pr1(13),
        scale_qty2(10),
        scale_pr2(13),
        scale_qty3(13),
        scale_pr3(10),
        scale_qty4(13),
        scale_pr4(10),
        scale_qty5(13),
        scale_pr5(10),
        scale_qty6(13),
        scale_pr6(10),
        scale_qty7(13),
        scale_pr7(10),
        scale_qty8(13),
        scale_pr8(10),
        scale_qty9(13),
        scale_pr9(10),
        scale_qty10(13),
        scale_pr10(10),
        END OF i_inforecord.
Internal table for Old and New Vendor number
  DATA : BEGIN OF i_lfb1 OCCURS 1,
         lifnr(10),
         altkn(10),
         END   OF i_lfb1.
Declare internal table for Call Transaction and BDC Session
  DATA: i_bdc_table LIKE bdcdata OCCURS 0 WITH HEADER LINE.
                     Global Variables                                *
  DATA: g_counter(2) TYPE n,
        g_field_name(18) TYPE c,
        zc_yes  TYPE syftype VALUE 'X'.
                     Selection Screen                                *
  SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
  PARAMETERS: p_fname1 TYPE localfile .
  SELECTION-SCREEN SKIP 1.
  SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-002.
  PARAMETERS: p_rloc1 AS CHECKBOX  DEFAULT 'X'.
  SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-003.
  PARAMETERS p_group(12) OBLIGATORY DEFAULT 'ZPURCHINFO'.
  SELECTION-SCREEN END OF BLOCK c.
  SELECTION-SCREEN END OF BLOCK b.
  SELECTION-SCREEN END OF BLOCK a.
**WRITE the report header
  TOP-OF-PAGE.
    INCLUDE zheading.
                     Start of selection                              *
  START-OF-SELECTION.
Load Input file
    PERFORM f_load_input_file.
Create BDC records.
    PERFORM create_bdc_records .
*&      Form  Create_BDC_records
      Perform the BDC for the records in the internal table
  FORM create_bdc_records .
    IF NOT i_inforecord[] IS INITIAL.
Open BDC session
      PERFORM open_bdc_session.
      SELECT lifnr altkn FROM lfb1 INTO TABLE i_lfb1
                          FOR ALL ENTRIES IN i_inforecord
                          WHERE altkn = i_inforecord-lifnr.
Sorting the Internal table for better performance
      SORT i_lfb1 BY altkn.
      LOOP AT i_inforecord.
***Mapping Old Vendor number to the new Vendor number
        READ TABLE i_lfb1 WITH KEY altkn = i_inforecord-lifnr BINARY
                                                              SEARCH.
        IF sy-subrc EQ 0.
          i_inforecord-lifnr = i_lfb1-lifnr.
        ENDIF.
        CLEAR i_bdc_table[].
        PERFORM insert_screen_header.
     call transaction 'ME11' using i_bdc_table
                   mode 'A'.
     CLEAR i_bdc_table.
      ENDLOOP.
      CLEAR i_inforecord[].
      PERFORM close_bdc_session.
Release the BDC sessions created
      PERFORM release_bdc.
    ENDIF.
  ENDFORM.                    " open_group
*&      Form  bdc_dynpro_start
      Start the screen for the transfer of fields
  FORM bdc_dynpro_start  USING    p_g_program_1
                                  p_g_screen.
    CLEAR i_bdc_table.
    i_bdc_table-program  = p_g_program_1.
    i_bdc_table-dynpro   = p_g_screen.
    i_bdc_table-dynbegin = 'X'.
    APPEND i_bdc_table.
  ENDFORM.                    " bdc_dynpro_start_start
*&      Form  bdc_insert_field
       Insert field                                                  *
  FORM bdc_insert_field USING f_name f_value.
    IF f_value <> space.
      CLEAR i_bdc_table.
      i_bdc_table-fnam = f_name.
      i_bdc_table-fval = f_value.
      APPEND i_bdc_table.
    ENDIF.
  ENDFORM.                    "bdc_insert_field
*&      Form  open_bdc_session
      Open a BDC session
  FORM open_bdc_session .
Open BDC session and create and update records
    CALL FUNCTION 'BDC_OPEN_GROUP'
      EXPORTING
        client                    = sy-mandt
      DEST                      = FILLER8
        group                     = p_group
      HOLDDATE                  = FILLER8
        keep                      = 'X'
        user                      = sy-uname
      RECORD                    = FILLER1
      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.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDFORM.                    " create_bdc_session
*&      Form  insert_screen_header
      Screen flow for the transfer of fields
  FORM insert_screen_header .
First Screen 100
    PERFORM bdc_dynpro_start USING 'SAPMM06I' '0100'.
    PERFORM bdc_insert_field USING:'BDC_CURSOR' 'EINA-LIFNR',
                                   'BDC_OKCODE' '/00',
                                   'EINA-LIFNR' i_inforecord-lifnr,
                                   'EINA-MATNR' i_inforecord-matnr,
                                   'EINE-EKORG' '1000',
                                   'RM06I-NORMB' zc_yes.
Next Screen 101
    PERFORM bdc_dynpro_start USING 'SAPMM06I' '0101'.
    PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'EINA-MAHN1',
                                     'BDC_OKCODE' '/00',
                                     'EINA-MEINS' i_inforecord-uom.
*Next Screen 102
    PERFORM bdc_dynpro_start USING 'SAPMM06I' '0102'.
    PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'EINE-INCO2',
                                 'EINE-APLFZ' i_inforecord-planned_time,
                                 'EINE-EKGRP' i_inforecord-ekgrp,
                                 'EINE-NORBM' i_inforecord-qty.
    PERFORM bdc_insert USING  'EINE-UEBTK' ' '.
    PERFORM bdc_insert_field USING:'EINE-PEINH' i_inforecord-scale_qty1,
                                   'EINE-BPRME' i_inforecord-uom,
                                   'EINE-UNTTO' '5',
                                   'EINE-UEBTO' '25',
                                   'EINE-MEPRF' i_inforecord-price_cat,
                                   'EINE-NETPR' i_inforecord-netpr,
                                   'EINE-INCO1' i_inforecord-inco,
                                  'EINE-INCO2' i_inforecord-designation.
Checking for Scale quantities
    IF i_inforecord-scale_qty2 = space.
      PERFORM bdc_insert_field  USING 'BDC_OKCODE' '=BU'.
      PERFORM insert_bdc_new.
    ELSE.
      PERFORM bdc_insert_field  USING 'BDC_OKCODE' '=KO'.
Next Screen 201
      PERFORM bdc_dynpro_start USING 'SAPMV13A' '0201'.
      PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'RV13A-DATAB',
                                        'BDC_OKCODE' '=PSTF'.
Next Screen 201
      PERFORM bdc_dynpro_start USING 'SAPMV13A' '0201'.
      PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'KONP-KSCHL(01)',
                                       'BDC_OKCODE' '=PSTF',
                                       'RV130-SELKZ(01)' zc_yes.
LAST SCREEN 303
      PERFORM bdc_dynpro_start USING 'SAPMV13A' '0303'.
      PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'KONM-KBETR(03)',
                                       'BDC_OKCODE' '=SICH'.
Counter to Loop the Item level entry
      g_counter = 0.
      PERFORM scale_entry USING i_inforecord-scale_qty2
                                i_inforecord-scale_pr2.
      PERFORM scale_entry USING i_inforecord-scale_qty3
                                i_inforecord-scale_pr3.
      PERFORM scale_entry USING i_inforecord-scale_qty4
                                i_inforecord-scale_pr4.
      PERFORM scale_entry USING i_inforecord-scale_qty5
                                i_inforecord-scale_pr5.
      PERFORM scale_entry USING i_inforecord-scale_qty6
                                i_inforecord-scale_pr6.
      PERFORM scale_entry USING i_inforecord-scale_qty7
                                i_inforecord-scale_pr7.
      PERFORM scale_entry USING i_inforecord-scale_qty8
                                i_inforecord-scale_pr8.
      PERFORM scale_entry USING i_inforecord-scale_qty9
                                i_inforecord-scale_pr9.
      PERFORM scale_entry USING  i_inforecord-scale_qty10
                                 i_inforecord-scale_pr10.
      PERFORM insert_bdc_new.
    ENDIF.
  ENDFORM.                    " insert_screen_header
*&      Form  insert_bdc
      Insert BDC
  FORM insert_bdc_new .
    CALL FUNCTION 'BDC_INSERT'
       EXPORTING
         tcode                  = 'ME11'
      POST_LOCAL             = NOVBLOCAL
      PRINTING               = NOPRINT
      SIMUBATCH              = ' '
      CTUPARAMS              = ' '
       TABLES
         dynprotab              = i_bdc_table
    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.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CLEAR i_bdc_table[].
  ENDFORM.                    " insert_bdc
*&      Form  close_bdc_session
     Close the BDC session
  FORM close_bdc_session .
    CALL FUNCTION 'BDC_CLOSE_GROUP'
         EXCEPTIONS
              not_open    = 1
              queue_error = 2
              OTHERS      = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDFORM.                    " close_bdc_session
*&      Form  f_load_input_file
      Upload the file
  FORM f_load_input_file.
Check always Local file for upload
    IF p_rloc1 = zc_yes.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                filename                = p_fname1
                filetype                = 'DAT'
           TABLES
                data_tab                = i_inforecord
           EXCEPTIONS
                conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_type            = 4
                no_batch                = 5
                unknown_error           = 6
                invalid_table_width     = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                OTHERS                  = 10.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        STOP.
      ENDIF.
    ENDIF.
  ENDFORM.                    " f_load_input_file
*&      Form  release_bdc
     Release the session
  FORM release_bdc.
    SUBMIT rsbdcsub WITH mappe EQ p_group
                    WITH von EQ sy-datum
                    WITH bis EQ sy-datum
                    WITH fehler EQ '.'
                    EXPORTING LIST TO MEMORY
                    AND RETURN.
  ENDFORM.                    " release_bdc
*&      Form  scale_entry
      Populate the Scale quantities
     -->P_SCALE_QTY
     -->P_SCALE_PRICE
  FORM scale_entry USING    p_scale_qty
                            p_scale_price.
Increment the Counter
    g_counter = g_counter + 1.
    IF p_scale_qty <> space.
      CONCATENATE 'KONM-KSTBM('  g_counter  ')' INTO g_field_name.
      PERFORM bdc_insert_field USING g_field_name p_scale_qty.
      CONCATENATE 'KONM-KBETR('  g_counter  ')' INTO g_field_name.
      PERFORM bdc_insert_field USING g_field_name p_scale_price.
    ENDIF.
  ENDFORM.
*&      Form  bdc_insert
      To uncheck the Unlimited (UEBTK)
  FORM bdc_insert USING  f_name f_value.
    CLEAR i_bdc_table.
    i_bdc_table-fnam = f_name.
    i_bdc_table-fval = f_value.
    APPEND i_bdc_table.
  ENDFORM.                    " bdc_insert
Reward points if it is usefull ....
Cheers,
Chandra Sekhar.

Similar Messages

  • How to handile errors in batch input(session)method

    Hi Friends..
    How to <b>Re upload the error records</b> in batch input(session)method in BDC Programming?
    Regards
    D Babu

    Hi
    U can do it manually by SM35: the wrong trxs can be run again.
    If you want to do automatically I don't think you can do it easyly, because to know if a record was loaded successfully depends on how you have loaded it and your data source .
    For example:
    if the records have to be loaded are from a file and every record is a trx, you could re-read the file and match it with session log:
    Log--Result--
    Record file
    Trx 1           OK                     1
    Trx 2           OK                     2
    Trx 3           KO                     3 (Re-load it)
    Trx 4           OK                     4
    Trx 5           KO                     5 (Re-load it)
    Trx 6           OK                     6
    How to read session log see trx sm35
    Max

  • Batch input data method

    can i know about batch input method in BDCs?

    Hi..,
    <b>DONT POST THE SAME THREADS AGAIN AND AGAIN !! CLOSE UR THREADS, WHEN UR PROBLEM IS SOLVED !! REWARD ALL HELPFUL ANSWERS !!</b>
    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.
    Types of BDC :
    CLASSICAL BATCH INPUT (Session Method)
    CALL TRANSACTION
    BATCH INPUT METHOD:
    Features:
    Asynchronous processing.
    Synchronous updating 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 :
    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 ?
    regards,
    sai ramesh

  • Test run in Batch input session

    Hi All,
    I am Working on BDC Batch input session i am able to create the Session 'SM35'  through my program.I have two radio two buttons in my program one is test and real.Is it possible to test run for the BDC(Batch input session).
    Thanks,

    Hi All,
    After Running the Batch Input Session in SM35.Is it possible  to get the order number which is created in the Batch Session.
    Can any body please help me out.
    Thanks,
    Swapna.

  • BDC programming using Batch input Session.

    Hello Experts.
    I'm an ABAP beginner. I've benn practicing BDC programming using Batch input Session
    at the moment.
    This is the program that upload Local file which has plural records, and put the records into a Session.
    These are the records.
    413459,KIM EI HWAN121                ,19810607,MIADONG1234
    423459,KIM EI HWAN122                ,19810607,MIADONG1235
    433459,KIM EI HWAN123                ,19810607,MIADONG1236
    443459,KIM EI HWAN124                ,19810607,MIADONG1237
    453459,KIM EI HWAN125                ,19810607,MIADONG1238
    463459,KIM EI HWAN126                ,19810607,MIADONG1239
    I succeeded making Session.
    However, for some reaseon, every record in the Session has got the same, value which is the first record.
    Why is this happening? And How can I correct the code below?
    REPORT ZBCUSER002_BATCH NO STANDARD PAGE HEADING
                            LINE-SIZE 255
                            MESSAGE-ID ZBATCH.
    = Types definition ===================================================
    TYPES: BEGIN OF TYP_LOCAL,               "For Local file upload
             RECORD(200) TYPE C,
           END   OF TYP_LOCAL.
    = Internal table definition ==============================================
    DATA: BEGIN OF BDC_TAB OCCURS 0.        "BDCDATA itab
            INCLUDE STRUCTURE BDCDATA.
    DATA: END   OF BDC_TAB.
    DATA: BEGIN OF MESSAGE_BDC OCCURS 0.    "Message itab
            INCLUDE STRUCTURE BDCMSGCOLL.
    DATA: END   OF MESSAGE_BDC.
    DATA: TBL_LOCAL TYPE STANDARD TABLE OF TYP_LOCAL,  "Local file itab
          F_TBL     TYPE FILETABLE.                    "FILETABLE fot local
    = Structure table definition =========================================
    DATA: STR_F_TBL LIKE LINE OF F_TBL,                "FILETABLE structure
          STR_LOCAL TYPE TYP_LOCAL.                    "Local file structure
    = Variable definition ================================================
    DATA: LV_RC     TYPE I,                            "Method parameter
          ENUMBER   TYPE ZT601-ENUMBER,                "Employee number
          NAME      TYPE ZT601-NAME,                   "Employee name
          BIRTH     TYPE ZT601-BIRTH,                           "Birthday
          HOMETOWN  TYPE ZT601-HOMETOWN,                        "Hometown
          SYSVAL    TYPE SY-SUBRC.                     "System valuible
    = Constants definition ===============================================
    CONSTANTS: TBL_NAME(10) TYPE C VALUE 'ZT601'.      "Table name ZT601
    = Parameters definition ==============================================
    PARAMETERS: F_NAME      TYPE RLGRAP-FILENAME OBLIGATORY,    "File path
                EXECMODE(1) TYPE C.                    "Execute mode
    INITIALIZATION
    *----- Initialize all valuables, structures and internal tables
    CLEAR: LV_RC,
           STR_F_TBL,
           STR_LOCAL,
           ENUMBER,
           NAME,
           BIRTH,
           HOMETOWN.
    REFRESH: F_TBL,
             TBL_LOCAL.
    AT SELECTION-SCREEN
    *----- When the button next to Parameter 'F_NAME',
    *----- File dialog open.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR F_NAME.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
        EXPORTING
          WINDOW_TITLE            = 'SELECT FILE'
          DEFAULT_FILENAME        = '*.TXT'
       CHANGING
         FILE_TABLE               = F_TBL
         RC                       = LV_RC
        EXCEPTIONS
          FILE_OPEN_DIALOG_FAILED = 1
          CNTL_ERROR              = 2
          OTHERS                  = 3
    *----- system valiable check.
    *----- If done properly,
    *----- Put the path into the File path parameter
      IF SY-SUBRC = 0.
        READ TABLE F_TBL INTO STR_F_TBL INDEX 1.
        F_NAME = STR_F_TBL.
    *----- If not done properly, show message
    *----- An error occured while getting file path then end program
      ELSE.
        MESSAGE E000.
      ENDIF.
    *----- Execute code can only be A or N.
    AT SELECTION-SCREEN ON EXECMODE.
      IF EXECMODE <> 'A' AND EXECMODE <> 'N'.
        MESSAGE E001.
      ENDIF.
    START-OF-SELECTION
    START-OF-SELECTION.
    *----- Upload Local file of file path parameter.
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                FILENAME                = F_NAME
                FILETYPE                = 'ASC'
           TABLES
                DATA_TAB                = TBL_LOCAL
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_READ_ERROR         = 2
                NO_BATCH                = 3
                GUI_REFUSE_FILETRANSFER = 4
                INVALID_TYPE            = 5
                OTHERS                  = 6.
    *----- System valiable check.
    *----- If not done properly, show an error message
    *----- An error occured while uploading local file then end program
      IF SY-SUBRC <> 0.
        MESSAGE E002.
      ENDIF.
      PERFORM BDC_OPEN.
    *----- Loop Internal table
      LOOP AT TBL_LOCAL INTO STR_LOCAL.
    *----- Spilt the file record and put them into each valiable.
        SPLIT STR_LOCAL AT ',' INTO  ENUMBER
                                     NAME
                                     BIRTH
                                     HOMETOWN.
    *----- Data check Function module
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
             EXPORTING
                  DATE                      = BIRTH
             EXCEPTIONS
                  PLAUSIBILITY_CHECK_FAILED = 1
                  OTHERS                    = 2.
    *----- When error occurs while checking date, show an error message.
    *----- (&1) is not date
        IF SY-SUBRC <> 0.
          MESSAGE E003 WITH BIRTH.
        ENDIF.
    *-- The first screen of SE11
    *----- Screen number 0102 of program id SAPMSRD0
        PERFORM BDC_DYNPRO      USING 'SAPMSRD0' '0102'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RSRD1-TBMA_VAL'. "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=SHOW'.          "Display button
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA'
                                      'X'.
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA_VAL'
                                       TBL_NAME.                "ZT601
    *-- Table definition screen
    *----- Screen number 2000 of program id SAPLSD02
        PERFORM BDC_DYNPRO      USING 'SAPLSD02' '2000'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'DD02D-TABCLTEXT'.  "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=TDED'.            "Create entry
        PERFORM BDC_FIELD       USING 'BDC_SUBSCR'
                                      'SAPLSD02'.
        PERFORM BDC_FIELD       USING 'BDC_SUBSCR'
                                      'SAPLSED5'.
    *-- Data input screen
    *----- Screen number 0101 of program /1BCDWB/DBZT601
        PERFORM BDC_DYNPRO      USING '/1BCDWB/DBZT601' '0101'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'ZT601-CRUSER'.    "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=SAVE'.                  "Save
        PERFORM BDC_FIELD       USING 'ZT601-MANDT'
                                      SY-MANDT.                 "Client
        PERFORM BDC_FIELD       USING 'ZT601-ENUMBER'
                                      ENUMBER.           "Employee number
        PERFORM BDC_FIELD       USING 'ZT601-NAME'
                                      NAME.              "Employee name
        PERFORM BDC_FIELD       USING 'ZT601-BIRTH'
                                      BIRTH.                    "Birthday
        PERFORM BDC_FIELD       USING 'ZT601-HOMETOWN'
                                      HOMETOWN.                 "Hometown
        PERFORM BDC_FIELD       USING 'ZT601-CRDATE'
                                      SY-DATUM.          "System date
        PERFORM BDC_FIELD       USING 'ZT601-CRTIME'
                                      SY-UZEIT.          "System time
        PERFORM BDC_FIELD       USING 'ZT601-CRUSER'
                                      SY-UNAME.          "System user
    *-- Data input screen (After input)
    *----- Screen number 0101 of program /1BCDWB/DBZT601
        PERFORM BDC_DYNPRO      USING '/1BCDWB/DBZT601' '0101'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '/EBACK'.                 "Back
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'ZT601-CRUSER'.    "Field on Cursor
    *-- Table definition screen]
    *----- Screen number 2000 of program SAPLSD02
        PERFORM BDC_DYNPRO      USING 'SAPLSD02' '2000'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'DD02D-TABCLTEXT'.  "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=WB_BACK'.               "Back
    *-- The first screen of SE11
    *----- Screen number 0102 of program SAPMSRD0
        PERFORM BDC_DYNPRO      USING 'SAPMSRD0' '0102'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RSRD1-TBMA_VAL'.   "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=BACK'.
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA'
                                      'X'.
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA_VAL'
                                      TBL_NAME.
        PERFORM BDC_INSERT.
      ENDLOOP.
      PERFORM BDC_CLOSE.
          FORM BDC_DYNPRO                                               *
          Put Program-Id, Dynpro screen number, Start point
          into DBCDATA
    -->  PROGRAM                                                       *
    -->  DYNPRO                                                        *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDC_TAB.
      BDC_TAB-PROGRAM  = PROGRAM.
      BDC_TAB-DYNPRO   = DYNPRO.
      BDC_TAB-DYNBEGIN = 'X'.
      APPEND BDC_TAB.
    ENDFORM.
          FORM BDC_FIELD                                                *
          Put Field Name and Value into BDCDATA
    -->  FNAM                                                          *
    -->  FVAL                                                          *
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR BDC_TAB.
      BDC_TAB-FNAM = FNAM.
      BDC_TAB-FVAL = FVAL.
      APPEND BDC_TAB.
    ENDFORM.
          FORM bdc_process                                              *
    FORM BDC_OPEN.
      CALL FUNCTION 'BDC_OPEN_GROUP'
           EXPORTING
                CLIENT = SY-MANDT
                GROUP  = 'Testsession'
                KEEP   = 'X'
                USER   = SY-UNAME.
      IF SY-SUBRC <> 0.
        MESSAGE E006 WITH SY-SUBRC.
      ENDIF.
    ENDFORM.
          FORM bdc_insert                                               *
    FORM BDC_INSERT.
      CALL FUNCTION 'BDC_INSERT'
           EXPORTING
                TCODE            = 'SE11'
           TABLES
                DYNPROTAB        = BDC_TAB
           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.
        MESSAGE E007 WITH SY-SUBRC.
      ENDIF.
      CLEAR: BDC_TAB.
    ENDFORM.
          FORM bdc_close                                                *
    FORM BDC_CLOSE.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
           EXCEPTIONS
                NOT_OPEN    = 1
                QUEUE_ERROR = 2
                OTHERS      = 3.
      IF SY-SUBRC <> 0.
        MESSAGE E008 WITH SY-SUBRC.
      ENDIF.
    ENDFORM.

    God I forgot to refresh Internal table after putting record into Session.
    Now I'm done.
    You guys be careful too.

  • 'S' message in BDC and message of type 'A' in batch input session

    We have to upload data for ABZON transaction of assets. When we use LSMW with recording method and try to upload say 3 records. All teh records are updated successfully but the batch input session log says last two records with a message of type 'A' "leave transaction is not possible in batch input"
    But when we upload the same data with BDC program with call transaction then teh log shows same message with type 'S'.
    what could be the reason for this?
    Though data gets uploaded successfully the 'A' message is being displayed in LSMW batch input log.
    if anyone has encountered a similar problem pls let us know how to resolve this asap.
    Thanks,
    Simmi

    Did your batch input end with save ( /11 ) or what ok_code are you using ?

  • Batch input session in background BDC

    Hi to all,
    Please clarify me about below BDC point.
    Call to the transaction should be in background through batch input session. does It mean that we have to use session method and call this in back ground through RSBDCSUB, is this approach is correct or some thing else i  nend to do.Please tell me briefley.
    I want to track all the errors, how to track the errrors with out using call tranaction.
    could any one help me on this issue please.
    Regards
    Raadha

    Hi,
    as per your approach is correct in BDC session method ,in session method generally you want run the bdc in backgroung using in RSBDCSUB is used for scheduling .
    in program after writing bdc_close_group ,just use submit statement and schedule the background.
    and generally in session method  execute the program and going to the sm35 selcting particular session name manually processing that session,when schedule rsbdcsub it is directly going to the background screen ,then give the session name and run the program.
    Regards,
    Madhu

  • BDC Data transfer - Session method...?

    Dear All,
    How to Transfer data using BDC Session method? - Step-by-step Process.
    Regards,
    Dharmesh

    hi,
    this will be usefull to u
    2.1.     Steps for submitting data for Batch Processing
    1.     Analyze the transactions for which a BDC program.
    The user has to determine the sequence of screens in the transactions and the information   about all the fields in every screen. To do this the user must run the transaction .
    Then select System &#61664; Status. This will give the screen number and the module pool associated with this screen of the transaction. These two are the most important fields that     the user would need in order to write the BDC program.
    2.     Use transaction SE38 to write the BDC program. This ABAP/4 program should reads the  external data that is to be entered in the SAP System and stores the data in a "batch-input session." A session stores the actions that are required to enter data using normal SAP transactions.  This is done by basically using three functions:
       BDC_OPEN_GROUP
       BDC_INSERT
       BDC_CLOSE_GROUP.
    3.     To create a batch input session, use the function BDC_OPEN_GROUP. This function has the following 5 parameters :
    a.     CLIENT which is by default set to SY_MANDT. It is the client in which the session is to be processed.
    b.     GROUP which is the name of the BDC session. This parameter is important because it is with this name that the user will recognize the BDC session in the batch input queue. Using this name process the BDC session.
    c.     USER which is usually set to SY-UNAME. It is the user name for starting the session in background.
    d.     KEEP indicates whether the session should be kept or deleted after processing. If ‘ ‘ then the session is deleted. If ‘X’ then the session is retained even after it is successfully processed without any errors.          
    e.     HOLDDATE Lock date.  The session is locked and may not be processed until after the date that is specified. Default:  No lock date, session can be processed immediately.  A lock date is optional.
    4.     Populate the bdcdata table .
          The user may define the table as  follows:
          DATA: BEGIN OF BDCDATA OCCURS 0.
                      INCLUDE STRUCTURE BDCDATA.
          DATA: END OF BDCDATA.
          This bdcdata structure has the following fields:
    •      PROGRAM
    Name of the program.
    •      DYNPRO
    Number of the screen.  Set this field only in the first record for the screen.
    •      DYNBEGIN
    Indicates the first record for the screen.  Set this field to X only in the first record for the screen. (Reset to ' ' (blank) for all other records.)
    •      FNAM
    Name of a field in the screen.  The FNAM field is not case-sensitive.
    •      FVAL
    Value for the field named in FNAM. 
    5.     The next step is to submit the BDC session. Use the BDC_INSERT function module to add a transaction to a batch input session.  Specify the transaction that is to be started in the call to BDC_INSERT.
          BDC_INSERT takes the following parameters:
    •      TCODE
    The code of the transaction that is to be run. TCODE is an EXPORTING parameter in the function module.
    •      DYNPROTAB
    The BDCDATA structure that contains the data that is to be processed       by the transaction. DYNPROTAB is a tables parameter in the function       module.
    6.     The final step is to close the BDC session. Use the BDC_CLOSE_GROUP function module to close a session. Once a session is closed, it can be processed.
    7.     Running this program will create a batch input session by the name that is specified in the GROUP parameter in the BDC_CREATE_GROUP function call.
    8.     Transaction SM35 can be used to process the submitted session. This transaction can be used to check the status of all BDC sessions.
    2.2.     Summary: Creating Batch Input Session:
    •     Open Batch Input group
        CALL FUNCTION 'BDC_OPEN_GROUP'   
        EXPORTING
              CLIENT = SY-MANDT
              GROUP  = GROUP
              USER   = USER
              KEEP   = KEEP.
    •     Fill in the Data for Transaction in an internal table 'BDCDATA'
            FORM INSERT_SCREEN USING PROGRAM DYNPRO.
               CLEAR BDCDATA.
               BDCDATA-PROGRAM = PROGRAM.
               BDCDATA-DYNPRO  = DYNPRO.
               BDCDATA-DYNBEGIN = 'X'.
               APPEND BDCDATA.
            ENDFORM.
            FORM INSERT_FIELD USING FNAM FVAL.
               CLEAR BDCDATA.
               BDCDATA-FNAM = FNAM.
               BDCDATA-FVAL = FVAL.
               APPEND BDCDATA.
            ENDFORM.
    •     Insert Transacton
            CALL FUNCTION 'BDC_INSERT'   
            EXPORTING
                TCODE     = 'ME21'
            TABLES
              DYNPROTAB = BDCDATA.
    •     Close Batch Input group
            CALL FUNCTION 'BDC_CLOSE_GROUP'.
    Finally to process Batch Input Session, first execute the BDC ABAP. This will create
    a BDC session. Run transaction 'SM35' & processes the BDC session.
    regards,
    padma.

  • LSMW Routing Standard Batch Input Create Batch Input Session

    Hello All,
    I am using LSMW for routing upload, using standard batch input method. Program RCPTRA01.
    I am facing this quite peculiar problem.
    I have tried first with separate text file for every source structure. Everything works fine till convert data step.
    But when I go for 'Create Batch Input Session' it creates session for tables MAPL, PLKO, PLPO, PLMZ, PLMK. Other tables remain balnk (EAPL, PLFL, PLAB, PLFH, PLPH, PLFT, PLFV, PLWP). Because of this while running the session only the header and material assignment to task list get uploaded. Rest data, operation, MIC, component allocation do not get uploaded.
    I have also tried for one text file for multiple structure. In that I face porblem for BDC creation. While debugging I faced th same thing in this also.
    Could anyone please explain me the soution for this? Do I need to amend any progrm fior this?
    Expecting lightning fast replies from Gurus....
    Mimiri

    Hello All,
    I am awaiting your reply on this.......
    Mimiri

  • Why we use more of Batch Input Session instead of Call Transaction?

    Hi,
    Please tell me why we use more of Batch Input Session instead of Call Transaction??
    Gagan

    Hi Gagan,
    See the Topic: Factors in choosing suitable method of bdc
    in ABAP Programming Forum Section.
    Or Follow the link below
    Re: Factors in choosing suitable method of bdc
    Regards,
    Vijay

  • How to check whether a batch input session is completed in ABAP program

    I have created a ABAP program to create a batch input session (reference to RSBDCSUB). After the creation of the batch input session, I kick it to start and read the execution log. However, sometimes I cannot read anything from the execution log as the execution of the batch input is a synchronized process to the execution of my program, i.e. at the time being that I try to read the log of a particular transaction, that transaction is being processing / haven't start processing.
    How can I check whether a batch input session is completed in the program?
    The code that corresponding to the triggering of batch input session:
    SUBMIT (SUBREPORT)
       USER MTAB-USERID
       VIA JOB MTAB-GROUPID
       NUMBER JNUMB
       WITH QUEUE_ID  EQ MTAB-QID
       WITH MAPPE     EQ MTAB-GROUPID
       WITH MODUS     EQ 'N'
       WITH LOGALL    EQ LMODUS
    Or is there any method to wait here until the process is completed before further processing?

    Hi gundam,
    1. Or is there any method to wait here until the process is completed before further processing?
    There is no such direct method to wait.
    2. Immediately after submitting in background,
       we cannot wait
      neither can we LOOP and go on detecting
      whether the b/g process has completed or not !
    3. To over come such problems,
      we have to use another technique.
    4. we have to submit another
       job which will get triggered
       on event SAP_END_OF_JOB
       ie. when the original job will finish,
      our new job will AUTOMATICALLY get triggered,
    5. This new job / program
       will do the FURTHER actions !
    regards,
    amit m.

  • How do I create a data set ready for a batch input session

    Hi:
    I don't know how to create a data set ready for an BATCH-INPUT SESSION.I know that with the function BDC_INSERT make de input online, but my requirement is that generate the data set and left to the user get in de SM35 transaccion and decide to him if it's execute or not. I have all the information in a BDCDATA table.
    Any clue would be great!!

    You just have to do:
    BDC_OPEN_GROUP (Open new batch)
    BUILD BDC DATA (Your own code)
    BDC_INSERT (Insert BDC data you have built in step 2)
    BDC_CLOSE_GROUP (Close batch)
    This will just create a new batch and it can be processed in SM35.
    To build BDC data:
    LOOP AT your_input_table.
    <<here you have to use the code generated from recording in  trasaction SHDB>> (i.e. bdc_dynpro and bdc_field performs)
    ENDLOOP.

  • Update error after all screens in Batch Input session is processed.

    Hi,
    I have a problem in processing the batch input session.  The batch input session is calling F-02 to post less than 999 line items (around 700) to a single financial document. The batch session is expected to have an error because tax code is missing for some line items but even after the tax code is added manually onto the batch screen, the update error message still happened at the end of the process. In the log, it said "System error: Error when inserting table BSET". Same account has been used to post 10+ line items manually with F-02, no error occurred.
    Does anyone have any idea what possible reason could cause the update error in updating the tax table?

    Hi Rob,
    That is exactly what happened to us. We already had note 521481 in our system but we also have OSS 558288 in which causes our scenario not generating an error message but an update termination instead.
    The other thing I found out is once tax code is entering in one of the line items, it will be copied to all the succeeding line items even for the accounts that does not require a tax code (i.e. posting without tax code allowed checked) which will significantly increase the amounts of data posted into BSET.
    We fixed the issue by changing the BDC program so it will take out the auto-copied tax code from other line items. Issue is solved. Thank you. I also rewarded the points.
    Minami

  • Batch input session for 'MB1C' is different from TC 'MB1C'

    hi all,
           I processed my bdc in sm35 in 'process/foreground' mode , and I find the screen is different from front-end screen. what's wrong? In 'SHDB', I already click the 'not a batch input session' checkbox.

    Hi Liang,
    Please check whether you are processing the bdc session for the same transaction 'MB1C' or is it session created for some other transaction. I don't think there can be separate screens for the same.
    Regards,
    Chetan.
    PS:Reward points if this is helpful.

  • Batch input session to FB01 using standard program RFBIBL00

    Hi all,
    I am creating a batch input session using the standard program RFBIBL00 to simulate transaction FB01.
    My problem is when I process the "batch input session" (using transaction SM35), this finish ok, but in the log I am retrieving the following message:
      "Field BSEG-DMBTR. does not exist in the screen SAPMF05A 0300"
    This is a success message and the document is created ok,and the field DMBTR is informed ok.
    Has somebody some idea?.
    Thanks so much in advance for any answer.

    Hi gundam,
    1. Or is there any method to wait here until the process is completed before further processing?
    There is no such direct method to wait.
    2. Immediately after submitting in background,
       we cannot wait
      neither can we LOOP and go on detecting
      whether the b/g process has completed or not !
    3. To over come such problems,
      we have to use another technique.
    4. we have to submit another
       job which will get triggered
       on event SAP_END_OF_JOB
       ie. when the original job will finish,
      our new job will AUTOMATICALLY get triggered,
    5. This new job / program
       will do the FURTHER actions !
    regards,
    amit m.

Maybe you are looking for

  • Is there a way to make the #'s and symbols come before the letter A?

    So say I wanted the 13th Floor Elevators to come before AC/DC, not after ZZ Top on itunes and my ipod and stuff. Is there a way to make that happen? On the old version of itunes it was automatically like that, but they changed it. Also, would this wo

  • Error while applying patch

    Hii.. Im upgrading from 11.5.10.2 to 12.1.1, I have successfully applied the Apply AD 12.1.1 upgrade driver (required) -7461070 patch but when i try to apply Run the American English upgrade patch driver (required) 6678700 its giving the following er

  • My iPhone 4s restarts when charging?

    My iPhone 4s restarts when charging ? Can anyone help before I give Apple a call. This happend a week already. Thanks

  • HDD RPM using powershell

    Hey guys, Do we have script with which i can pull HDD RPM of my remote server by using PowerShell script? i tried to check via WMI object, but couldn't get any clue related to HDD RPM.  Thank you.

  • Novell Linux Client Auto launch

    Hello I had a question about having the Novell Linux Client launch immediately after the user logs into their SLED system user their local user name and password. On NLD 9 desktops I was able to go into small launcher program (I cannot remember what