Session method

hi all,
       i wrote the session method for f-02 transaction,
if voucher number(bkpf-xblnr) found in bkpf i need to skip that voucher number.i need to display error report like (xblnr belnr bldat). and any errors experienced during batch input creation like format errors etc.these errors also i need to disply in error report.
if voucher number(bkpf-xblnr) not found in bkpf i need to insert that voucher number.
if in the flat file 2 records found in bkpf and 2 records not found in bkpf. in sm35 log file it must show 2 records processed and
2 reocrds with errors.
*& Report  ZFGLDIOO20                                                    *
PROGRAM NAME   : ZFGLDI0020
REQUEST NO     : CD1K900572
APLICATION AREA: FI
AUTHOR         : SRINIVAS M
DATE           : 13-07-2006
DESCRIPTION    :This interface will Developement of a Program to read
and Upload the electronic file containig billing refunds information.
*This upload file will generate transactions in the Accounts payble module.
*After the payments have been done an out put file is created containing the cheque
*information to be uploaded on the revenue billing databases.
REPORT HEADER                                                        *
REPORT zfgldi0020  NO STANDARD PAGE HEADING
                   LINE-SIZE 255
                   LINE-COUNT 65.
====[TABLES]======================================================
TABLES: bkpf,   "Accounting Document Header"
        bseg,   "Accounting Document Segment"
        bsec.   "One-Time Account Data Document Segment"
====[TYPE-POOLS]======================================================
TYPE-POOLS: slis.
===[INTERNAL TABLES]==================================================
DATA : BEGIN OF it_file_up OCCURS 0,
         sgtxt(11),
         ls_c2(5),
         zuonr(21),
         name1(51),
         ls_c5(7),
         ls_c6(2),
         ls_c7(5),
         ls_c8(4),
         bldat(9),
         ls_c10(9),
         ls_c11(21),
         ls_c12(2),
         ls_c13(31),
         ls_c14(31),
         ls_c15(31),
         ls_c16(31),
         ls_c17(31),
         ls_c18(5),
         wrbtr(16),
         ls_c20(51),
         ls_c21(51),
         ls_c22(51),
         ls_c23(51),
         ls_c24(51),
         ls_c25(7),
         ls_c26(21),
         ls_c27(3),
         ls_c28(21),
         ls_c29(9),
         ls_c30(21),
         ls_c31(16),
       END OF it_file_up.
DATA : BEGIN OF it_file OCCURS 0,
         bldat(10),                                   "Document Date"
         blart(2) TYPE c VALUE 'ZD',                  "Document Type"
         bukrs(4) TYPE n VALUE '0100',                "Company Code"
         budat(10),                                    "Posting Date"
         monat(2) TYPE n VALUE '1',                    " Period"
         waers(3) TYPE c VALUE 'ZAR',                  "Currency"
         xblnr(16) TYPE c,  " VALUE 'VOUCHER NUMBER',    " Reference"
         bktxt(25) TYPE c VALUE 'BILLING REFUNDS',    "Doc headertext"
         bschl(2) TYPE c VALUE '31',                  "Posting Key"
         hkont(7) TYPE n VALUE '490905',               "Account"
         name1(35) TYPE c,                            "Name"
         stras(35) TYPE c VALUE '66 Jorissen street', "Street"
         ort01(35) TYPE c VALUE 'JOHANNESBERG',       "City"
         pstlz(4) TYPE n VALUE '2001',                "Postal Code"
         wrbtr(16) ,                                  "Amount"
         mwskz(2) TYPE c VALUE 'V0',                  "Tax Code"
         zuonr(18) TYPE c,                            "Assignment"
         sgtxt(50) TYPE c,                            "Text"
         bschl1(2) TYPE c VALUE '40',                 "Posting Key"
         hkont1(7) TYPE n VALUE '8701120',            "Account"
         wrbtr1(16),                                  "Amount"
         zuonr1(18) TYPE c,                           "Assignment"
         sgtxt1(50) TYPE c,                            "Text"
       END OF it_file.
DATA : BEGIN OF it_process OCCURS 0,
         bldat(10),                                   "Document Date"
         blart(2) TYPE c VALUE 'ZD',                  "Document Type"
         bukrs(4) TYPE n VALUE '0100',                "Company Code"
         budat(10),                                    "Posting Date"
         monat(2) TYPE n VALUE '1',                    " Period"
         waers(3) TYPE c VALUE 'ZAR',                  "Currency"
         xblnr(16) TYPE c,  " VALUE 'VOUCHER NUMBER',    " Reference"
         bktxt(25) TYPE c VALUE 'BILLING REFUNDS',    "Doc headertext"
         bschl(2) TYPE c VALUE '31',                  "Posting Key"
         hkont(7) TYPE n VALUE '490905',               "Account"
         name1(35) TYPE c,                            "Name"
         stras(35) TYPE c VALUE '66 Jorissen street', "Street"
         ort01(35) TYPE c VALUE 'JOHANNESBERG',       "City"
         pstlz(4) TYPE n VALUE '2001',                "Postal Code"
         wrbtr(16) ,                                  "Amount"
         mwskz(2) TYPE c VALUE 'V0',                  "Tax Code"
         zuonr(18) TYPE c,                            "Assignment"
         sgtxt(50) TYPE c,                            "Text"
         bschl1(2) TYPE c VALUE '40',                 "Posting Key"
         hkont1(7) TYPE n VALUE '8701120',            "Account"
         wrbtr1(16),                                  "Amount"
         zuonr1(18) TYPE c,                           "Assignment"
         sgtxt1(50) TYPE c,                            "Text"
       END OF it_process.
*& BDC/Call transaction data.
DATA: BEGIN OF bdcdata OCCURS 0.
        INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA: BEGIN OF it_error OCCURS 0,
      xblnr LIKE bkpf-xblnr,
      belnr LIKE bkpf-belnr,
      bldat LIKE bkpf-bldat,
      END OF it_error.
*DATA: it_check LIKE bkpf OCCURS 0 WITH HEADER LINE.
DATA: messtab LIKE bdcmsgcoll OCCURS 100 WITH HEADER LINE.
DATA: lt_fldcat TYPE slis_t_fieldcat_alv,
      lt_errorcat TYPE slis_t_fieldcat_alv.
DATA: BEGIN OF err_fld OCCURS 0,
      icon(8),
      rec_no(6) TYPE n,
      messg(100),
END   OF err_fld.
===[DATA]=============================================================
DATA: lv_subrc LIKE sy-subrc,
      f_session,
      f_session_created,
      lv_xblnr  LIKE bkpf-xblnr,
      lv_doc    LIKE bkpf-belnr,
      lt_files TYPE filetable,
      ls_files TYPE file_table,
      lv_return TYPE i,
      lv_filen TYPE string,
      lv_error,
      lv_repid LIKE sy-repid.
DATA: lv_bldat(10),
      lv_budat(10).
===[STRUCTURES]=======================================================
DATA: ls_fldcat TYPE slis_fieldcat_alv.
*DATA: ls_fldcat1 TYPE slis_t_fieldcat_alv.
DATA: ls_errorcat TYPE slis_fieldcat_alv.
===[SELECTION SCREEN]=================================================
PARAMETERS:
  p_file  LIKE rlgrap-filename LOWER CASE OBLIGATORY.
SELECTION-SCREEN SKIP.
PARAMETERS:
  p_sess  LIKE d0100-mapn DEFAULT 'BILLING' OBLIGATORY.
===[AT SELECTION-SCREEN]==============================================
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  PERFORM get_file_name.
===[START-OF-SELECTION]===============================================
START-OF-SELECTION.
*& Upload file into internal table
  PERFORM fm_upload_file.
*& Process file
  PERFORM fm_process_file.
===[END-OF-SELECTION]=================================================
END-OF-SELECTION.
IF lv_error <> space.
   PERFORM output_error_tab.
ENDIF.
SKIP.
*& No data in file
  IF it_file_up[] IS INITIAL.
    MESSAGE s016(rp) WITH 'No data found in file'.
  ENDIF.
*& Build catalog for column headings
  PERFORM fm_build_catalog.
*& Displaying output in alv grid
  PERFORM fm_alv_grid_display.
*& Build catalog for column headings
  PERFORM fm_error_catalog.
*& Displaying output in alv grid
  PERFORM fm_error_grid_display.
===[FORMS]============================================================
*&      Form  fm_process_file
      text
FORM fm_process_file.
  PERFORM bdc_open_group.
  LOOP AT it_process.
    SELECT SINGLE *  FROM bkpf
     WHERE bukrs = '0100'
       AND blart = 'ZD'
       AND xblnr = it_process-xblnr.
    IF sy-subrc = 0.
      it_error-xblnr = bkpf-xblnr.
      it_error-belnr = bkpf-belnr.
      it_error-bldat = bkpf-bldat.
      APPEND it_error.
      CONTINUE.
    ENDIF.
    REFRESH bdcdata.
    CLEAR   bdcdata.
    CONCATENATE : it_process-bldat6(2)  '.' it_process-bldat4(2)  '.'
  it_process-bldat+0(4) INTO lv_bldat.
    CONCATENATE : it_process-budat6(2)  '.' it_process-budat4(2)  '.'
  it_process-budat+0(4) INTO lv_budat.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BKPF-BLDAT'
                                  lv_bldat.
    PERFORM bdc_field       USING 'BKPF-BLART'
                                  'ZD'.
    PERFORM bdc_field       USING 'BKPF-BUKRS'
                                  '0100'.
    PERFORM bdc_field       USING 'BKPF-BUDAT'
                                  lv_budat.
    PERFORM bdc_field       USING 'BKPF-MONAT'
                                 '1'.
    PERFORM bdc_field       USING 'BKPF-WAERS'
                                  'ZAR'.
    PERFORM bdc_field       USING 'BKPF-XBLNR'
                                 it_process-xblnr.
    PERFORM bdc_field       USING 'BKPF-BKTXT'
                                  'BILLING REFUNDS'.
    PERFORM bdc_field       USING 'RF05A-NEWBS'
                                  '31'.
    PERFORM bdc_field       USING 'RF05A-NEWKO'
                                  '490900'.
    PERFORM bdc_dynpro      USING 'SAPLFCPD' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'BSEC-PSTLZ'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BSEC-NAME1'
                                  it_process-name1.
    PERFORM bdc_field       USING 'BSEC-STRAS'
                                  '66 JORISSEN STREET'.
    PERFORM bdc_field       USING 'BSEC-ORT01'
                                  'JOHANNESBURG'.
    PERFORM bdc_field       USING 'BSEC-PSTLZ'
                                  '2001'.
    PERFORM bdc_field       USING 'BSEC-LAND1'
                                  'ZA'.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0302'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BSEG-WRBTR'
                                  it_process-wrbtr.
    PERFORM bdc_field       USING 'BSEG-MWSKZ'
                                  'V0'.
    PERFORM bdc_field       USING 'BSEG-ZUONR'
                                  it_process-zuonr.
    PERFORM bdc_field       USING 'BSEG-SGTXT'
                                  it_process-sgtxt.
    PERFORM bdc_field       USING 'RF05A-NEWBS'
                                  '40'.
    PERFORM bdc_field       USING 'RF05A-NEWKO'
                                  '8701120'.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'BSEG-SGTXT'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BSEG-WRBTR'
                                  it_process-wrbtr.
    PERFORM bdc_field       USING 'BSEG-ZUONR'
                                  it_process-zuonr.
    PERFORM bdc_field       USING 'BSEG-SGTXT'
                                  it_process-sgtxt.
    PERFORM bdc_field       USING 'DKACB-FMORE'
                                  'X'.
    PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'COBL-KOSTL'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTE'.
    PERFORM bdc_field       USING 'COBL-KOSTL'
                                  '444615'.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'BSEG-WRBTR'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=BU'.
    PERFORM bdc_field       USING 'BSEG-WRBTR'
                                  it_process-wrbtr.
    PERFORM bdc_field       USING 'BSEG-ZUONR'
                                  it_process-zuonr.
    PERFORM bdc_field       USING 'BSEG-SGTXT'
                                  it_process-sgtxt.
    PERFORM bdc_field       USING 'DKACB-FMORE'
                                  'X'.
    PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'COBL-KOSTL'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  'ENTE'.
    PERFORM bdc_field       USING 'COBL-KOSTL'
                                  '21815'.
    PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/EESC'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'COBL-KOSTL'.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0700'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RF05A-NEWBS'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  'RW'.
    PERFORM bdc_field       USING 'BKPF-XBLNR'
                                  it_process-xblnr.
    PERFORM bdc_field       USING 'BKPF-BKTXT'
                                  'BILLING REFUNDS'.
    PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=NO'.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0700'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RF05A-NEWBS'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  'RW'.
    PERFORM bdc_field       USING 'BKPF-XBLNR'
                                  it_process-xblnr.
    PERFORM bdc_field       USING 'BKPF-BKTXT'
                                  'BILLING REFUNDS'.
    PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=YES'.
    PERFORM bdc_create_session.
  ENDLOOP.
  PERFORM bdc_close_session.
ENDFORM.                    "fm_process_file
*&      Form  bdc_dynpro
       Start new screen                                              *
     -->PROGRAM    text
     -->DYNPRO     text
FORM bdc_dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
  CLEAR bdcdata.
ENDFORM.                    "bdc_dynpro
*&      Form  bdc_field
       Insert field                                                  *
     -->FNAM       text
     -->FVAL       text
FORM bdc_field USING fnam fval.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
  CLEAR bdcdata.
ENDFORM.                    "bdc_field
*&      Form  bdc_create_session
      Create session
FORM bdc_create_session.
  CALL FUNCTION 'BDC_INSERT'
    EXPORTING
      tcode            = 'F-02'
    TABLES
      dynprotab        = bdcdata
    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.
    lv_subrc = sy-subrc.
    MESSAGE i398(00) WITH 'Cannot insert BDC into session' p_sess
                          'Return code='                   lv_subrc.
  ENDIF.
ENDFORM.                    " bdc_create_session
*&      Form  bdc_close_session
      Close session
FORM bdc_close_session.
  CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
      not_open    = 1
      queue_error = 2
      OTHERS      = 3.
  IF sy-subrc <> 0.
    lv_subrc = sy-subrc.
    MESSAGE i398(00) WITH 'Cannot close session' p_sess
                          'Return code='         lv_subrc.
  ENDIF.
ENDFORM.                    " bdc_close_session
*&      Form  fm_build_catalog
      text
FORM fm_build_catalog.
  ls_fldcat-fieldname = 'BLDAT'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'BLDAT'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'BLART'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'BLART'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'BUKRS'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'BUKRS'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'BUDAT'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'BUDAT'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'MONAT'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'MONAT'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'WAERS'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'WAERS'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'XBLNR'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'XBLNR'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'BKTXT'.
  ls_fldcat-ref_tabname = 'BKPF'.
  ls_fldcat-ref_fieldname = 'BKTXT'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'BSCHL'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'BSCHL'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'HKONT'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'HKONT'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'NAME1'.
  ls_fldcat-ref_tabname = 'BSEC'.
  ls_fldcat-ref_fieldname = 'NAME1'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'STRAS'.
  ls_fldcat-ref_tabname = 'BSEC'.
  ls_fldcat-ref_fieldname = 'STRAS'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'ORT01'.
  ls_fldcat-ref_tabname = 'BSEC'.
  ls_fldcat-ref_fieldname = 'ORT01'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'PSTLZ'.
  ls_fldcat-ref_tabname = 'BSEC'.
  ls_fldcat-ref_fieldname = 'PSTLZ'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'WRBTR'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'WRBTR'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'MWSKZ'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'MWSKZ'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'ZUONR'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'ZUONR'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'SGTXT'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'SGTXT'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'BSCHL1'.
  ls_fldcat-ref_tabname = 'ZBSEG'.
  ls_fldcat-ref_fieldname = 'BSCHL1'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'HKONT1'.
  ls_fldcat-ref_tabname = 'ZBSEG'.
  ls_fldcat-ref_fieldname = 'HKONT1'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'WRBTR'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'WRBTR'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'ZUONR'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'ZUONR'.
  APPEND ls_fldcat TO lt_fldcat.
  ls_fldcat-fieldname = 'SGTXT'.
  ls_fldcat-ref_tabname = 'BSEG'.
  ls_fldcat-ref_fieldname = 'SGTXT'.
  APPEND ls_fldcat TO lt_fldcat.
ENDFORM.                    "fm_build_catalog
*&      Form  fm_error_catalog
      text
FORM fm_error_catalog.
  ls_errorcat-fieldname = 'XBLNR'.
  ls_errorcat-ref_tabname = 'BKPF'.
  ls_errorcat-ref_fieldname = 'XBLNR'.
  APPEND ls_errorcat TO lt_errorcat.
  ls_errorcat-fieldname = 'BELNR'.
  ls_errorcat-ref_tabname = 'BKPF'.
  ls_errorcat-ref_fieldname = 'BELNR'.
  APPEND ls_errorcat TO lt_errorcat.
  ls_errorcat-fieldname = 'BLDAT'.
  ls_errorcat-ref_tabname = 'BKPF'.
  ls_errorcat-ref_fieldname = 'BLDAT'.
  APPEND ls_errorcat TO lt_errorcat.
ENDFORM.                    "fm_error_catalog
*&      Form  fm_alv_grid_display
      text
FORM fm_alv_grid_display.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = lv_repid
      it_fieldcat        = lt_fldcat
    TABLES
      t_outtab           = it_process.
ENDFORM.                    "fm_alv_grid_display
*&      Form  fm_error_grid_display.
      text
FORM fm_error_grid_display.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = lv_repid
      it_fieldcat        = lt_errorcat
    TABLES
      t_outtab           = it_error.
ENDFORM.                    "fm_error_grid_display
*&      Form  get_file_name
      Get file name
FORM get_file_name.
Select file
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = 'Select File'
      default_extension       = 'Text Files (*.TXT)'
      file_filter             = cl_gui_frontend_services=>filetype_text
      initial_directory       = 'C:\'
    CHANGING
      file_table              = lt_files
      rc                      = lv_return
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 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.
  ELSE.
    READ TABLE lt_files INTO ls_files INDEX 1.
    p_file = ls_files-filename.
    CLEAR lt_files[].
  ENDIF.
ENDFORM.                    " get_file_name
*&      Form  fm_upload_file
      text
FORM fm_upload_file.
  lv_filen = p_file.
Upload file
  CALL METHOD cl_gui_frontend_services=>gui_upload
     EXPORTING
       filename                = lv_filen
     has_field_separator     = 'X'
     CHANGING
       data_tab                = it_file_up[]
     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
       not_supported_by_gui    = 17
       error_no_gui            = 18
       OTHERS                  = 19.
  IF sy-subrc <> 0.
    lv_subrc = sy-subrc.
    MESSAGE e398(00) WITH 'Cannot upload file:' p_file
                          'Return code='        lv_subrc.
  ENDIF.
File did not upload or no data in file
  IF it_file_up[] IS INITIAL.
    STOP.
  ENDIF.
  LOOP AT it_file_up.
    CHECK it_file_up-ls_c2(4) = '9999'.
    it_file-bldat = it_file_up-bldat+0(8).  "Document Date"
    it_file-budat = it_file-bldat.          "Posting Date"
    it_file-xblnr = it_file_up-sgtxt+0(10).
    it_file-name1 = it_file_up-name1+0(35).  "Name"
    it_file-wrbtr = it_file_up-wrbtr+0(15).  "Amount"
    it_file-zuonr = it_file_up-zuonr+0(18).  "Assignment"
    it_file-sgtxt = it_file_up-sgtxt+0(10).  "Text"
    it_file-xblnr = it_file-xblnr.
    it_file-wrbtr1 = it_file-wrbtr.
    it_file-zuonr1 = it_file-zuonr.
    it_file-sgtxt1 = it_file-sgtxt.
    APPEND it_file.
  ENDLOOP.
  LOOP AT it_file.
    CHECK NOT it_file-bldat IS INITIAL.
    MOVE-CORRESPONDING it_file TO it_process.
    APPEND it_process.
  ENDLOOP.
ENDFORM.                    " fm_upload_file
*&      Form  bdc_open_group
      text
-->  p1        text
<--  p2        text
FORM bdc_open_group .
  CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
      group               = p_sess
      keep                = 'X'
      user                = sy-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.
  IF sy-subrc <> 0.
    lv_subrc = sy-subrc.
    MESSAGE i398(00) WITH 'Cannot open session' p_sess
                          'Return code='        lv_subrc.
    STOP.
  ENDIF.
ENDFORM.                    " bdc_open_group
anybody suggest me any other way to display error report.
and sm35 logfile logic.

Hi,
1) if you want to create documents pls use abap rfbibl00 (here's a documentation) or fm BAPI_ACC_DOCUMENT_POST
2) if you want to change header , use bdc to FB02;
   to item use FB09
A.

Similar Messages

  • Error message log in session method of ALV report,

    In ALV report please let me know:
    1) In session method:
    where all error messages are stored,I know that error messages are stored in a log file, so please tell me where is it stored.
    2)transaction method:
    How to handle error messages in transaction methos(for eg if a weight field text box value is negative)

    Ans for 2nd point.
    CALL TRANSACTION c_mb USING i_bdcdata
                              MODE g_ctumode
                              UPDATE g_cupdate
                              MESSAGES INTO i_messtab.
       COMMIT WORK.
       IF sy-subrc EQ 0. " BDC Executed Successfully
         CLEAR wa_messtab.
         LOOP AT i_messtab INTO wa_messtab .
           IF wa_messtab-msgtyp  = 'S' AND
              wa_messtab-msgid   = 'M7' AND
              wa_messtab-msgnr   = '060'.
             CALL FUNCTION 'MESSAGE_TEXT_BUILD'
               EXPORTING
                 msgid               = wa_messtab-msgid
                 msgnr               = wa_messtab-msgnr
                 msgv1               = wa_messtab-msgv1
                 msgv2               = wa_messtab-msgv2
                 msgv3               = wa_messtab-msgv3
                 msgv4               = wa_messtab-msgv4
               IMPORTING
                 message_text_output = l_msg.
             APPEND l_msg TO i_sucsess.
             CLEAR l_msg.
             g_docsuc = 1.
           ELSE.
             IF wa_messtab-msgtyp  = 'E'.
               CALL FUNCTION 'MESSAGE_TEXT_BUILD'
                 EXPORTING
                   msgid               = wa_messtab-msgid
                   msgnr               = wa_messtab-msgnr
                   msgv1               = wa_messtab-msgv1
                   msgv2               = wa_messtab-msgv2
                   msgv3               = wa_messtab-msgv3
                   msgv4               = wa_messtab-msgv4
                 IMPORTING
                   message_text_output = l_msg.
               g_errflg = 1.
               APPEND l_msg TO i_error.
               CLEAR: l_msg.
             ENDIF.

  • Session method and call transaction methos which one is the sap recomonded

    hi
    PLease give me the answer to these questions.
    session method and call transaction methos which one is the sap recomonded why .
    2) if we want to maintain BDC program in all the systems.wt to d0

    Hi Revethi,
    Here is the difference between the Session and Call Transaction method.
         Session
    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
    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.

  • Purpose of lock in session method?

    wat is the purpose of lock objects in session method ? when we use lock objects ?

    The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules. These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.
    The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields. When tables are selected, one table (the primary table) is first selected. Further tables (secondary tables) can also be added using foreign key relationships.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Regards,
    Santosh

  • Error in my BDC SESSION METHOD

    Hi,
    I was trying work on BDC SESSION METHOD AND MY TCODE IS XK01.
    Here is my code can some one tell me where i am doing wrong becoz its not giving the output as I expected. And I am uploading a tab delimeter file.
    report ZAN_BDCVENDOR
           no standard page heading line-size 255.
    include bdcrecx1.
    DATA: I_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF RECORD OCCURS 0,
    LIFNR(016),
    BURKS(004),
    EKORG(004),
    KTOKK(004),
    AKONT(010),
    FDGRV(010),
    WAERS(005),
    END OF RECORD.
    start-of-selection.
    perform open_group.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'C:\VENDOR.TXT'
    FILETYPE                      = 'ASC'
      tables
        data_tab                      = RECORD
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT RECORD.
    perform bdc_dynpro      using 'SAPMF02K' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'USE_ZAV'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  '8765'.
    perform bdc_field       using 'RF02K-BUKRS'
                                  '1000'.
    perform bdc_field       using 'RF02K-EKORG'
                                  '1000'.
    perform bdc_field       using 'RF02K-KTOKK'
                                  '0001'.
    perform bdc_field       using 'USE_ZAV'
                                  'X'.
    perform bdc_dynpro      using 'SAPMF02K' '0210'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFB1-FDGRV'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    perform bdc_field       using 'LFB1-AKONT'
                                  '160000'.
    perform bdc_field       using 'LFB1-FDGRV'
                                  'A1'.
    perform bdc_dynpro      using 'SAPMF02K' '0310'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFM1-WAERS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    perform bdc_field       using 'LFM1-WAERS'
                                  'usd'.
    perform bdc_transaction using 'XK01'.
    ENDLOOP.
    perform close_group.
                  CALL FUNCTION 'BDC_OPEN_GROUP'
                   EXPORTING
                    CLIENT                    = SY-MANDT
                    DEST                      = FILLER8
                     GROUP                     = 'SESSION1'
                    HOLDDATE                  = FILLER8
                    KEEP                      = FILLER1
                     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.
                  WRITE 'ERROR IN OPEN_GROUP'.
                  ENDIF.
                   CALL FUNCTION 'BDC_INSERT'
                   EXPORTING
                     TCODE                  = TCODE
                     POST_LOCAL             = NOVBLOCAL
                     PRINTING               = NOPRINT
                     SIMUBATCH              = ' '
                     CTUPARAMS              = ' '
                     TABLES
                       dynprotab              = I_BDCDATA
                   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.
                   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.
    I appreciate

    Hi,
    i guess, the error is due to, u didnt pass the TCODE parameter in BDC_INSERT FM.
    Try by passing it...
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = TCODE*
    POST_LOCAL = NOVBLOCAL
    PRINTING = NOPRINT
    SIMUBATCH = ' '
    CTUPARAMS = ' '
    TABLES
    dynprotab = I_BDCDATA
    EXCEPTIONS
    INTERNAL_ERROR = 1
    NOT_OPEN = 2
    QUEUE_ERROR = 3
    TCODE_INVALID = 4
    PRINTING_INVALID = 5
    POSTING_INVALID = 6
    OTHERS = 7
    Hope it works!!
    Regards,
    Pavan

  • Regarding PO creating with condition record Using Session method

    Hi All,
    I am facing the following problem during po creation using BDC session method.
       If there is error in any of the record in the PO upload file and if we jump to next record during batch input session, system changes data of previous correct record.
    Example u2013 Consider following data
    Matl code     Matl Description     Qty     UoM     Price
    98652565     Floater08 EPS Insert -with sta     15000     EA     171
    60890125     INSERT (PACKAGING) Wellpappe T     14000     EA     52.3
    65646353     INSERT CASE PACKAGING, univers     10000     EA     56.9
    98725563     Shipper-2nd-NA-Bubble TS.1850     9000     EA     213.4
    Consider that record 2 (60890125) contain wrong data. If we skip this record and move to next record 65646353, system executes previous correct record (98652565) and changes net price of that record (here its 171) to 56.9. If record 3 is also wrong, it will capture price from record 4 and will put it for record 1.
    If anyone know the solution, Please let me know.
    Thanks in Advance.

    Hi Prasad,
    You may not be clearing some workarea in the program while looping or while sending data to screens, clear workareas when required.
    If you still face the same issue, try posting the code here, lets see, whats the problem is.
    Rgds,
    Sripal

  • Creation of Material using BDC Session method & global class

    Hi
    Creation of Material using BDC Session method & global class by using oops.
    can anyone plz help me out

    Hi,
    it looks like it's not possible to call this BAPI wihtout material number. Here is a quote from BAPI documentation.
    When creating material master data, you must transfer the material
    number, the material type, and the industry sector to the method. You
    must also enter a material description and its language.
    Cheers

  • Creating Sales order texts while using BDC session method is not working

    Hi All,
    I have an existing program which creates sales order using BDC session method.( Actual program uses BAPI to create sales order and in case if any error occurs during creation of sales order BDC session is generated so that user can process it later and i am facing issues in this part of code where it uses BDC)
    I wanted to modify this BDC sesion  to update the sales order text also. I tried recording VA01 for creationg sales order text unfortunatly it is not capturing the data i am entering in the text fields.
    Please suggest if there is any way to create sales order using BDC.
    Regards
    Sheeba

    Hi Madhu,
    '=TP_CREATE' is the OK code i am getting for creating TEXTS. But the text entered are not captured in BDC.
    Part of BDC program generated for cretaing sales order texts.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=%_GC 128 22'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=%_GC 128 22'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    Regards,
    Sheeba

  • Problem in bdc session method for tcode FS00

    Hi Experts,
    problem in bdc session method, when i run this program no output is shown.
    Even it is not calling the transaction.
    code as follows.
    *& Report  Z_GL_MASTER
    *& CATEGORY         =  BDC.
    *& DESCRIPTION      =  UPLOADING G/L MASTER RECORDS.
    *& TECHNICAL CONST  =  FRANCIS REDDY.
    *& FUNTIONAL CONST  =  FICO.
    REPORT  Z_GL_MASTER.
    *& Internal  Table
    DATA : BEGIN OF IT_UPLOAD OCCURS 0,
           SAKNR LIKE  GLACCOUNT_SCREEN_KEY-SAKNR,          " ACCOUNT NUMBER.
           BUKRS LIKE  GLACCOUNT_SCREEN_KEY-BUKRS,          " COMPANY CODE.
           KTOKS LIKE GLACCOUNT_SCREEN_COA-KTOKS,           " ACCOUNT GROUP.
           XPLACCT LIKE GLACCOUNT_SCREEN_COA-XPLACCT,       " P&L STATEMEMENT.
           GVTYP LIKE  GLACCOUNT_SCREEN_COA-GVTYP,          " P&L STATEMENT TYPE.
           XBILK LIKE GLACCOUNT_SCREEN_COA-XBILK,           " BALANCE SHEET STATEMENT
           SHORT LIKE GLACCOUNT_SCREEN_COA-TXT20_ML,        " SHORT TEXT.
           LONG LIKE GLACCOUNT_SCREEN_COA-TXT50_ML,         " LONG TEXT.
           WAERS LIKE GLACCOUNT_SCREEN_CCODE-WAERS,         " ACCOUNT CURRENCY.
           XSALH LIKE GLACCOUNT_SCREEN_CCODE-XSALH,         " ONLY BALANCES IN LOCAL CURRENCY.
           MITKZ LIKE GLACCOUNT_SCREEN_CCODE-MITKZ,         " RECONCILATION ACCOUNT FOR ACCOUNT TYPEGLACCOUNT_SCREEN_CCODE-MITKZ
           XOPVW LIKE GLACCOUNT_SCREEN_CCODE-XOPVW,         " OPEN ITEM MANAGEMENT.
           XKRES LIKE GLACCOUNT_SCREEN_CCODE-XKRES,         " LINE ITEM DISPLAY.
           ZUAWA LIKE GLACCOUNT_SCREEN_CCODE-ZUAWA,         " SORT KEY.
           FSTAG LIKE GLACCOUNT_SCREEN_CCODE-FSTAG,         " FIELD STATUS GROUP.
           XGKON LIKE GLACCOUNT_SCREEN_CCODE-XGKON,         " RELAVENT CASH FLOW.
           END OF IT_UPLOAD.
    *& Internal  Table FOR BDC DATA.
    DATA : IT_BDCDATA TYPE  BDCDATA OCCURS 0  WITH HEADER LINE.
    *& DATA DECLARATIONS.
    DATA : V_FILE LIKE RLGRAP-FILENAME.
    *&  SELECTION SCREEN.
    PARAMETER : P_FILE LIKE V_FILE.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
         PERFORM GET_FILENAME.
    START-OF-SELECTION.
          PERFORM UPLOAD_DATA.
          PERFORM BDCDATA_OPEN.
          PERFORM BDC_POPULATE.
          PERFORM BDC_CLOSE.
    *&      Form  GET_FILENAME
    form GET_FILENAME .
      CALL FUNCTION 'F4_FILENAME'
       EXPORTING
         PROGRAM_NAME        = SYST-CPROG
         DYNPRO_NUMBER       = SYST-DYNNR
         FIELD_NAME          = 'P_FILE'
       IMPORTING
         FILE_NAME           = P_FILE.
    endform.                    " GET_FILENAME
    *&      Form  UPLOAD_DATA
    form UPLOAD_DATA .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      =  P_FILE
       FILETYPE                      = 'DAT'
      TABLES
        data_tab                     = IT_UPLOAD.
    endform.                    " UPLOAD_DATA
    *&      Form  BDCDATA_OPEN
       FORM FOR BDC_OPEN_GROUP.
    form BDCDATA_OPEN .
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
       CLIENT                    = SY-MANDT
       GROUP                     = 'GLMASTER'
       HOLDDATE                  = SY-DATUM
       KEEP                      = 'X'
       USER                      = SY-UNAME.
    endform.                    " BDCDATA_OPEN
    *&      Form  BDC_POPULATE
      POPULATING BDC DATA .
    form BDC_POPULATE .
    loop at it_upload.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=ACC_CRE'.
    PERFORM BDC_SUB2 USING 'BDC_CURSOR' 'GLACCOUNT_SCREEN_KEY-SAKNR'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_KEY-SAKNR'    IT_UPLOAD-SAKNR.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_KEY-BUKRS'    IT_UPLOAD-BUKRS.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=2102_GROUP'.
    PERFORM BDC_SUB2 USING 'BDC_CURSOR' 'GLACCOUNT_SCREEN_COA-KTOKS'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-KTOKS'    IT_UPLOAD-KTOKS.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-XPLACCT'  IT_UPLOAD-XPLACCT.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=2102_BS_PL'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-GVTYP'    IT_UPLOAD-GVTYP.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-XBILK'    IT_UPLOAD-XBILK.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_CURSOR' 'GLACCOUNT_SCREEN_COA-TXT20_ML'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-TXT20_ML' IT_UPLOAD-SHORT.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-TXT50_ML' IT_UPLOAD-LONG.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING  'BDC_OKCODE' '=TAB02'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-WAERS'  IT_UPLOAD-WAERS.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XSALH'  IT_UPLOAD-XSALH.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-MITKZ'  IT_UPLOAD-MITKZ.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XOPVW'  IT_UPLOAD-XOPVW.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XKRES'  IT_UPLOAD-XKRES.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-ZUAWA'  IT_UPLOAD-ZUAWA.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=TAB03'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-FSTAG' IT_UPLOAD-FSTAG.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XGKON' IT_UPLOAD-XGKON.
    CALL FUNCTION 'BDC_INSERT'
      EXPORTING
        TCODE                  = 'FS00'
       TABLES
         dynprotab              = IT_BDCDATA.
    endloop.
    endform.                    " BDC_POPULATE
    *&      Form  BDC_CLOSE
    FORM FOR CLOSING BDC_GROUP
    form BDC_CLOSE .
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    endform.                    " BDC_CLOSE
    *&      Form  BDC_SUB1
       FORM FOR BDCDATA.
    form BDC_SUB1   USING  A  B  C.
    CLEAR  IT_BDCDATA.
    IT_BDCDATA-DYNBEGIN = A.
    IT_BDCDATA-PROGRAM =  B.
    IT_BDCDATA-DYNPRO =   C.
    APPEND IT_BDCDATA.
    endform.                    " BDC_SUB1
    *&      Form  BDC_SUB2
          text
    form BDC_SUB2   USING  A  B.
    CLEAR  IT_BDCDATA.
      IT_BDCDATA-FNAM = A.
      IT_BDCDATA-FVAL = B.
      APPEND IT_BDCDATA.
    endform.                    " BDC_SUB2
    Points will be  rewarded.
    Thanks in advance.
    Francis.

    Hi,
    Once the program is executed..It will a BDC session..
    THen you have to use the transaction SM35..To process the BDC session..
    Thanks,
    Naren

  • Issue in session method --- urgent

    Hi,
    I developed one bdc which is working fine in call transaction mode when i am trying to run in session method it is giving information message like '    Processing of batch input session completed'.
    i am sending my code below.
    report ZAAATEST
           no standard page heading line-size 255.
    DATA: wa_opt TYPE ctu_params.
    PARAMETERS : P_GROUP LIKE APQI-GROUPID DEFAULT 'AVANTIMRG10'.
    wa_opt-nobinpt = 'X'.
    wa_opt-DISMODE = 'A'.
    wa_opt-UPDMODE = 'L'.
    WA_OPT-RACOMMIT = 'X'.
    include bdcrecx1.

    Hi,
    Go to SM35 transaction code.
    Click on your session name.
    And click on process.
    Regards,
    Bhanu

  • File type in Session Method

    Hi All,
    This is in the session method in the upload function....
    I am getting error"""""Unable to interpret "FILE NAME".  Possible causes of error: incorrect spelling or comma error.""""" and the code is as follows..
    TO UPLOAD FLAT FILE TO INTERNAL TABLE.
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    *CODEPAGE                      =''
       FILENAME                      = 'E:\RAJASAP\SELECTIONSCREEN.TXT'
       FILETYPE                      ='ASC'
      ITEM                          = ' '
    could any one help me in this issue.
    Message was edited by:
            Rajashekhar Reddy

    Hi Rajasekhar..
    See the Changes in BOLD
    CALL FUNCTION 'UPLOAD'
    <b>EXPORTING</b>    "you have to uncomment this..
    *CODEPAGE =''
    FILENAME = 'E:\RAJASAP\SELECTIONSCREEN.TXT'
    FILETYPE ='ASC'
    ITEM = ' '
    And one more thing
    Call the FM   GUI_UPLOAD instead of UPLOAD which is Obsolete .
    <b>Reward if Helpful</b>

  • Difference between call transaction and session method

    Hello Experts.
    i have one doubt.
    suppose if we have 100 records to upload, and we got an error in 55 record. In this case what will call trans will do and what will session will do.
    i mean the call trans will process 56th record or not . will it stop at 55 itself. What will session will do in this case.
    thank you so much for all the replies.

    Hi shiva,
    In the Call transaction Method,
    It will process all the records if the Update Mode is 'N', it will store all the error messages in BDCMSGCOLL structure. The errored records would be stored in that structure.
    In Session Method,
    It stops in the 55th error record, it wont move further.
    Edited by: Raj on May 21, 2008 9:23 PM

  • How to handle multiple transaction in session method.

    hi experts.
    please tell me how to<b> write code for multiple transaction</b> in session methods.
    Quest.  -de<b>another question is exactly which method we have to follow , how to</b>decide.
    what r the conditions for selecting which method is suitable for which type of
    transaction.

    hi,
    if you have run time validation while updating the data into SAP R/3 Transaction,then use BDC Call Transaction.
    example : when you load the data into Sales order then you need to load the into Header text of sales order.
    for this ,you have to use Update Mode 'S'.
    it is online update and if you small amount of data ,then prefer this one
    2. If you have huge amount of data and then prefer Session Method.
    we have one more advantage in session method...
    suppose file has 1,00,000 records and the if you use all the records at time,then you will get short dump like system time exceed .
    then you can split the each 10,000 records into one session and will process.
    3. Direct Input method : we prefer this method only few Transaction ,
    this will not applicable to when system has customer fields .
    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
    paas the tcodes to bdc_insert.
    call function BDC_CLOSE_GROUP.

  • How to handle the errors in BDC Session method

    Hi All,
    I am uploading Material Master (MM01) records using BDC Session Method.my problem is when i am running the program, all the error records are going to flat file.how can i correcting the error records and after correction how can i re-process the error records.tell me with example.
    i have around 70,000 records in my flat file.

    Hi,
    I am attaching few threads.Hope these will help you.
    If there are any error records in session, all those error records will get poulated in log .SM35 and after the session is completed , u can see error records which can be corrected and reprocessed again
    We have the structures BDCLD and BDCLM, which will capture the log details inthe session. Firstly, sesssion should be processed. After that log will be created. Then caputure the information into an internal table using BDCLM and BDCLD.
    and refer the link.
    error correction in bdc session
    regards
    Madhu

  • Error in CALL TRANSACTION and SESSION Method

    I have 8 records (1,2,3,4,5,6,7,8) to update into SAP database using CALL TRANSACTION and SESSION Method. If there is a error in 6th record. What happens in both call transaction and session method.
    Please let me know which records will process and what about the error record. How to process only the error record if all other records have updated into database.

    Hi Patil_sumeet,
    if your code for this is not protected secret of some federal agency, you may read [How to post code in SCN, and some things NOT to do...|How to post code in SCN, and some things NOT to do...; and then post relevant lines here.
    According to the facts presented until know it may have been better to ask Radio Eriwan
    Regards
    Clemens

Maybe you are looking for