Doubt in HR-ABAP BDC Program

hi all,
    My BDC program is going to dump while execution. Below I'm pasting the report.
    TYPES : BEGIN OF IT_INPUT,
        PERNR TYPE PERNR_D,
        CHOIC TYPE CHOIC,
        BEGDA TYPE CHAR10,
        ENDDA TYPE CHAR10,
        ANREX TYPE ANREX,
        NACHN TYPE NACHN,
        VORNA TYPE VORNA,
        GBPAS TYPE GBPAS,
        SPRSL TYPE SPRSL,
        END OF IT_INPUT.
TYPES : BEGIN OF IT_RAW,
        LINE TYPE CHAR120,
        END OF IT_RAW.
INTERNAL TABLES
DATA : IT_FINAL TYPE STANDARD TABLE OF IT_INPUT.
DATA : IT_RAW TYPE STANDARD TABLE OF IT_RAW.
DATA : IT_ERROR TYPE STANDARD TABLE OF BDCMSGCOLL.
WORK AREA
DATA : WA_FINAL TYPE IT_INPUT.
DATA : WA_RAW TYPE IT_RAW.
DATA : WA_ERROR TYPE BDCMSGCOLL.
CONSTANTS : C_TAB TYPE C value '/'.
INCLUDE : BDCRECXY.
START-OF-SELECTION.
SUBROUTINE TO READ DATA FROM FLAT FILE
PERFORM READ_DATA_FROM_FF.
SUBROUTINE TO MAP DATA TO SCREEN FIELDS
PERFORM DATA_MAPPING.
*&      Form  READ_DATA_FROM_FF
      text
-->  p1        text
<--  p2        text
FORM READ_DATA_FROM_FF .
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = 'E:\RAG\BDC1.txt'
  TABLES
    DATA_TAB                      = IT_RAW
IF sy-subrc eq 0.
LOOP AT IT_RAW INTO WA_RAW.
SPLIT WA_RAW
AT C_TAB
INTO WA_FINAL-PERNR
     WA_FINAL-CHOIC
     WA_FINAL-BEGDA
     WA_FINAL-ENDDA
     WA_FINAL-ANREX
     WA_FINAL-NACHN
     WA_FINAL-VORNA
     WA_FINAL-GBPAS
     WA_FINAL-SPRSL.
APPEND WA_FINAL TO IT_FINAL.
WRITE : WA_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
ENDIF.
ENDFORM.                    " READ_DATA_FROM_FF
*&      Form  DATA_MAPPING
      text
-->  p1        text
<--  p2        text
FORM DATA_MAPPING .
LOOP AT IT_FINAL INTO WA_FINAL.
FIRST SCREEN INFORMATION FOR PA30
perform bdc_dynpro      using 'SAPMP50A' '1000'.
perform bdc_field       using 'RP50G-PERNR'
                              WA_FINAL-PERNR.
*perform bdc_field       using 'BDC_CURSOR'
                             'T582S-ITEXT(03)'.
perform bdc_field       using 'RP50G-SELEC(03)'
                               'X'.
perform bdc_field       using 'RP50G-TIMR6'
                               'X'.
perform bdc_field       using 'RP50G-CHOIC'
                               '0002'.
perform bdc_field       using 'BDC_OKCODE'
                              '=INS'.
SECOND SCREEN INFORMATION 0002
perform bdc_dynpro      using 'MP000200' '2001'.
*perform bdc_field       using 'BDC_CURSOR'
                             'Q0002-GBPAS'.
perform bdc_field       using 'BDC_OKCODE'
                              'UPD'.
perform bdc_field       using 'P0002-BEGDA'
                               WA_FINAL-BEGDA.
perform bdc_field       using 'P0002-ENDDA'
                              WA_FINAL-ENDDA.
perform bdc_field       using 'Q0002-ANREX'
                              WA_FINAL-ANREX.
perform bdc_field       using 'P0002-NACHN'
                              WA_FINAL-NACHN.
perform bdc_field       using 'P0002-VORNA'
                              WA_FINAL-VORNA.
perform bdc_field       using 'Q0002-GBPAS'
                              WA_FINAL-GBPAS.
perform bdc_field       using 'P0002-SPRSL'
                              WA_FINAL-SPRSL.
perform bdc_transaction tables it_error using 'PA30' 'x' 'a' 'a'.
         IF it_ERROR[] IS NOT INITIAL.
            LOOP AT it_ERROR INTO wa_ERROR.
            WRITE : wa_ERROR.
           ENDLOOP.
          REFRESH it_ERROR.
         ENDIF.
ENDLOOP.
Error which I was getting is 'UNABLE TO INTERPRET '/ ' AS  A NUMBER'.

Hi
Look out for the error in the flat file which you are uploading. I have seen this error and I found it in Flat file. its a conversion error.
Just copy few lines from the original file, make a new file and upload it. In this way, you will be able to say whether there is an error in file or in code.
Regards
Waz

Similar Messages

  • BDC program using HR ABAP

    Hi,
    I am new to HR ABAP . Can anybody send me an end to end sample BDC program using HR ABAP. I have a requirement  to develop a program.
    Please give the sample file which  has the sample data to upload to SAP.
    Rgds,
    Sofia

    hi....
    to create a program of your own....
    goto tcode 'SHDB' and there go for a new recording of the TCODE as required by you...
    after recording is complete there is a button to GENERATE a program for that
    i am looking for a complete data tranfer example which i have done.... i ll send that to you
    regards
    this is a sample code for it
    THIS IS WRITTEN BY ME,YOU CAN GENERATE PROGRAM DIRECTLY
    *" Type declarations...................................................
    Type declaration of the structure to hold material information      *
    TYPES:
      BEGIN OF type_s_mat,
        name(10)  TYPE c,                  " Material Number
        industry  TYPE c,                  " Industry Sector
        mtype(10) TYPE c,                  " Material Type
        descr(20) TYPE c,                  " Material Description
        unit(10)  TYPE c,                  " Base Unit of Measure
      END OF type_s_mat,
      type_s_f2(4096) TYPE c.
    *" Data declarations...................................................
    Work variables                                                      *
    DATA:
      fs_f1 TYPE type_s_mat,               " Field string of TYPE_S_MAT
      fs_workarea TYPE bdcdata,            " Field string of type BDCDATA
      fs_bdc TYPE bdcmsgcoll,              " Field string of type bdcmsgcoll
      w_msg(72) TYPE c,                    " Holds message for writing
      w_i TYPE i,                          " Holds value of rc
      w_file TYPE filetable,               " Holds name of the file
      w_var  TYPE file_table,              " Field string of file_table
      w_file1 TYPE string.                 " Holds the path of the file
    Internal table to hold data for the input                           *
    DATA:
      t_itab LIKE
    STANDARD TABLE
          OF fs_workarea,
    Internal table to hold data for the messages                        *
       t_mess LIKE
    STANDARD TABLE
           OF fs_bdc,
       t_mat LIKE
    STANDARD TABLE
          OF fs_f1,
    Internal table to hold data for the input                           *
      t_temp TYPE
    STANDARD TABLE
          OF type_s_f2.
    *"Selection screen elements............................................
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_file(128) TYPE c.
    SELECTION-SCREEN END OF BLOCK b1.
               AT SELECTION-SCREEN ON VALUE-REQUEST EVENT               *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'FILE_OPEN'
          default_extension       = 'XLS'
        CHANGING
          file_table              = w_file
          rc                      = w_i
        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.
      ENDIF.                               " IF SY-SUBRC <> 0.
      LOOP AT w_file INTO w_var.
        p_file = w_var-filename.
      ENDLOOP.                             " LOOP AT W_FILE INTO W_VAR.
      ULINE.
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_tab_raw_data       = t_temp
          i_filename           = p_file
        TABLES
          i_tab_converted_data = t_mat
        EXCEPTIONS
          conversion_failed    = 1
          OTHERS               = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.                               " IF SY-SUBRC EQ 0.
                          END-OF-SELECTION EVENT                        *
    END-OF-SELECTION.
      PERFORM sub_display.
    *& Form  sub_screen
    This subroutine appends the value of screen name and number        *
         -->PV_screenam  This holds screen name                         *
         -->PV_scrnum    This holds screen number                       *
    FORM sub_screen  USING    value(pv_screenam)
                                  value(pv_scrnum).
      CLEAR fs_workarea.
      fs_workarea-program = pv_screenam.
      fs_workarea-dynpro = pv_scrnum.
      fs_workarea-dynbegin = 'X'.
      APPEND fs_workarea TO  t_itab.
    ENDFORM.                               " FORM SUB_SCREEN
    *& Form  SUB_FIELD_DATA                                               *
    This subroutine apppends  field name and value of the screen.      *
    -->PV_FLDNAM   This holds field name                               *
    -->PV_FLDVAL   This holds Field value                              *
    FORM sub_field_data  USING    value(pv_fldnam)
                               value(pv_fldval).
      CLEAR fs_workarea.
      fs_workarea-fnam = pv_fldnam.
      fs_workarea-fval = pv_fldval.
      APPEND fs_workarea TO  t_itab.
    ENDFORM.                               " FORM SUB_FIELD_DATA
    *& Form  sub_display                                             *
    This subroutine fills the value on screen fields when BDC executes *
    There are no interface parameters to be passed to this subroutine. *
    FORM sub_display .
      LOOP AT t_mat INTO fs_f1.
        CLEAR fs_workarea.
        CLEAR fs_bdc.
        PERFORM sub_screen     USING 'SAPLMGMM' '0060'.
        PERFORM sub_field_data USING 'RMMG1-MATNR' fs_f1-name.
        PERFORM sub_field_data USING 'RMMG1-MBRSH' fs_f1-industry.
        PERFORM sub_field_data USING 'RMMG1-MTART' fs_f1-mtype.
        PERFORM sub_field_data USING 'BDC_OKCODE' '/00'.
        PERFORM sub_screen     USING 'SAPLMGMM' '0070'.
        PERFORM sub_field_data USING 'MSICHTAUSW-KZSEL(01)' 'X'.
        PERFORM sub_field_data USING 'MSICHTAUSW-KZSEL(02)' 'X'.
        PERFORM sub_field_data USING 'BDC_OKCODE' '=ENTR'.
        PERFORM sub_screen     USING 'SAPLMGMM' '4004'.
        PERFORM sub_field_data USING 'MAKT-MAKTX' fs_f1-descr.
        PERFORM sub_field_data USING 'MARA-MEINS' fs_f1-unit.
        PERFORM sub_field_data USING 'BDC_OKCODE' '/00'.
        PERFORM sub_screen     USING 'SAPLMGMM' '4004'.
        PERFORM sub_field_data USING 'BDC_OKCODE' '=BU'.
        CALL TRANSACTION 'MM01' USING t_itab MODE 'A' MESSAGES INTO t_mess.
      ENDLOOP.
    ENDFORM.                    " SUB_DISPLAY
    Edited by: Mohit Kumar on Feb 18, 2009 12:40 PM

  • 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.

  • Can we make a BDC program as a webservice

    Hi All,
    Can we write a BDC program in RFC Function Module and access it through web service.
    We have a requirement to create a Return Order, for that we have recorded the Va01 transaction for return order and included the same recorded code in RFC Function module and also created web service for it. But when we tried to access through webservice, it is showing the following error
    "Call to returned http code 500 (Internal Server Error) with unacceptable content type (text/html; charset=utf-8).
    ><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode> soap:Server </faultcode><faultstring xml:lang="en"> RABAX occurred on server side </faultstring><detail><sap:Rabax xmlns:sap="http://www.sap.com/webas/710/soap/runtime/abap/fault/generic"><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><SYMSGID>VX</SYMSGID><SYMSGTY>S</SYMSGTY><SYMSGNO>206</SYMSGNO><SYMSGV1>TextEditControl</SYMSGV1><SYMSGV2></SYMSGV2><SYMSGV3></SYMSGV3><SYMSGV4></SYMSGV4><SYREPID>SAPLV70T</SYREPID><SYTCODE>VA01</SYTCODE><SYDYNNR>2000</SYDYNNR><SYUNAME>DIK</SYUNAME><SYMANDT>100</SYMANDT><SYLANGU>E</SYLANGU><SYECODE>558</SYECODE><SYHOST>sapdvp</SYHOST><SYSYSID>SD1</SYSYSID><SYOPSYS>Windows NT</SYOPSYS><SYDBSYS>MSSQL</SYDBSYS><SYSAPRL>700</SYSAPRL><SYXPROG>SAPCNVE</SYXPROG><SYXFORM>CONVERSION_EXIT</SYXFORM><SYDATUM>20111104</SYDATUM><SYUZEIT>153001</SYUZEIT><SYETEXT>RABAX_STATE</SYETEXT><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE><PATHTRANS>/sap/bc/srt/rfc/sap/zcom_create_return_bdc/100/zcom_create_return_bdc/zcom_create_return_bdc</PATHTRANS><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE></sap:Rabax></detail></soap:Fault></soap:Body></soap:Envelope>"
    When we execute the same RFC from SAP SE37 T-Code , it is working fine but same not working from web service .
    One more thing If anybody knows the standard BAPI or Function Module to create the Sales Return Order please do post .
    Thanks in advance ,
    Chaitanya

    Hi Pranav,
    Okay. Kindly let me know how to run rfc function module in background  because we have call transaction perform in RFC function module and I am posting BDC code that is using inside RFC function module.
    TYPES:BEGIN OF t_bdcdata,
            program TYPE bdc_prog,
            dynpro  TYPE bdc_dynr,
            dynbegin TYPE bdc_start,
            fnam TYPE fnam_____4,
            fval  TYPE bdc_fval,
        END OF t_bdcdata.
      DATA:wa_bdcdata TYPE t_bdcdata,
           it_bdcdata TYPE TABLE OF t_bdcdata.
      DATA:auart_001 TYPE bdc_fval,
         vkorg_002 TYPE bdc_fval,
         vtweg_003 TYPE bdc_fval,
         spart_004 TYPE bdc_fval,
         vbeln_005 TYPE bdc_fval,
         kunwe_006 TYPE bdc_fval,
         bstkd_007 TYPE bdc_fval,
         augru_010 TYPE bdc_fval,
         bsark_011 TYPE bdc_fval,
         augru_019 TYPE bdc_fval,
         bsark_020 TYPE bdc_fval.
      DATA:v_subrc TYPE sy-subrc.
      MOVE auart TO auart_001.
      MOVE vkorg TO vkorg_002.
      MOVE vtweg TO vtweg_003.
      MOVE spart TO spart_004.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = vbeln
        IMPORTING
          output = vbeln.
      MOVE vbeln TO vbeln_005.
      MOVE kunwe TO kunwe_006.
      MOVE bstkd TO bstkd_007.
      MOVE augru TO augru_010.
      MOVE bsark TO bsark_011.
      MOVE augru TO augru_019.
      MOVE bsark TO bsark_020.
      wa_bdcdata-program  = 'SAPMV45A'.
      wa_bdcdata-dynpro   = '0101'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'VBAK-AUART'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=COPY'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-AUART'.
      wa_bdcdata-fval = auart_001.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-VKORG'.
      wa_bdcdata-fval = vkorg_002.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-VTWEG'.
      wa_bdcdata-fval = vtweg_003.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-SPART'.
      wa_bdcdata-fval = spart_004.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = 'SAPLV45C'.
      wa_bdcdata-dynpro   = '0100'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=UEBR'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'LV45C-VBELN'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'LV45C-VBELN'.
      wa_bdcdata-fval = vbeln_005.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = 'SAPLJ3AD'.
      wa_bdcdata-dynpro   = '2010'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=ENT1'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-KUNWE'.
      wa_bdcdata-fval = kunwe_006.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-BSTKD'.
      wa_bdcdata-fval = bstkd_007.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.
      wa_bdcdata-fval = augru_010.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.
      wa_bdcdata-fval = bsark_011.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = 'SAPLJ3AD'.
      wa_bdcdata-dynpro   = '2010'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=SICH'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.
      wa_bdcdata-fval = augru_019.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.
      wa_bdcdata-fval =  bsark_020.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
        EXPORTING
          tcode                         = 'VA01'
         skip_screen                   = ''
         mode_val                      = 'N'
         update_val                    = 'A'
       IMPORTING
         subrc                         = subrc
       TABLES
         using_tab                     = it_bdcdata
        SPAGPA_TAB                    =
         mess_tab                      = messtab
       EXCEPTIONS
         call_transaction_denied       = 1
         tcode_invalid                 = 2
         OTHERS                        = 3
      IF sy-subrc <> 0.
        subrc = sy-subrc.
        EXIT.
      ENDIF.
    so i am using BDC code to create order instead of function module and converted bdccode into rfc function module,
    just help how to do with above code.
    With Regards,
    Krishna Chaitanya

  • Please  Help me How write the BDC program for the MIGO inbound Delivery

    Please help me how to write bdc program for the MIGO Inbound Delivery in 4.7EE Version. Please help me.
    Not in LSMW.  Required call transaction or Session Method. Please help me.
    Mohan

    Run transaction BAPI . Select Logistics Execution/Shipping/InboundDelivery/SaveReplica.. You can use function module BAPI_INB_DELIVERY_SAVEREPLICA in your ABAP program.

  • ABAP MAPPING PROGRAM TRANSPORTATION ISSUE

    Hi Experts,
    Our issue is as following:
    Already one ABAP mapping program is there in our DEV and in QA also.
    Now we have changes the code according to some requirement.
    Now we need to reflect the same in QA also.
    For that I have certain doubts.
    1) after releasing the request number in R/3, will it effect there in integration builder of the QA?
    2) Is there any need to do in ADMINISTRATION to reflect the same?
    Please revert urgenly.
    Regards
    sreeni

    hi barry,
    thanks a lot . we have released it into integration it is working fine.
    thanks once again and i wll reward points also.
    I think you can tell my one more doubt is as:
    I have one new ABAP mapping program which is not used till now in any interface mapping in ID of XI.
    now want use this my integration builder ID in as mapping program.
    in this case is any requirement to enable the same in Integration ADMINISTRATION tab.
    plz clarify me.
    regards
    sreeni

  • Can someone give me ABAP Dialog program /ALV Step by Step hands on examples

    Can someone give me a document for ABAP Dialog programming(module pool) and ALV - but i need Step by Step example ,with sreenshots and explanations.
    In general any ABAP, STEP BY STEP hands on examples - Smartform, Sapscrips, Report, BDC will be highly appreciated.
    I only need hands on examples please - regular Abap courses does not work because they dont have examples.
    Please help ASAP.
    Bob
    Welcome to SCN - but please read the rules of engagement before posting
    Edited by: Rob Burbank on Jun 14, 2009 4:28 PM

    What temporary files are you talking about?

  • Query on bdc program

    hi friends,
                   I really have doubt on bdc program. I wantedto complete this task.
    1.  Create a BDC program for the following
      - Read a flat file containing Vendor Master details (keep the record structure as simple as possible).  The file should contain a list of Vendors to be created in the SAP system.
      - Using BDC technique, create the Vendor master using FK01 transaction
      - Repeat the steps for creating all Vendors listed in the file.  For each transaction, print out if the BDC was successful or not, and if successful print out the Vendor Number that was created.
    but nothing is woking out.
    I jus wnated to know what was my mistake.
    I would provide my screen shots with expalnations for each and ery step.
    Kindly please anyone of help me to know my mistake and to get the program done. i need to finish this by today since theres a lot of pressure in my work place.
    Pls provide me ur mail id to send my documents as attachmnents..
    I would be very thankful for your timely help.
    Thanks in advance
    rinky123

    I have tested your program up to the BDC part, looks like you program is uploading the data and putting it in to the RECORD internal table correctly.  This leads me to believe that the problem is in the BDC code itself.  As Srinivas has suggested, run the program with mode "A".  You can set this in the selection screen.  Currently it is mode "N".  Mode "A" will allow you to see all of the steps that the BDC is doing and you can find out what the error is at that time.
    Regards,
    Rich Heilman

  • Doubt in Basic ABAP.

    Hi Gurus,
    I have a small doubt in basic ABAP.
    What is the exact difference between the below statements.
    Types: Begin of ty_data,
                 matnr type mara-matnr,
              end of ty_data.
    Types: Begin of ty_data,
                 matnr type matnr,
              end of ty_data.
    Types: Begin of ty_data,
                 matnr like mara-matnr,
              end of ty_data.
    Types: Begin of ty_data,
                 matnr like matnr,
              end of ty_data.
    data: matnr type mara-matnr.
    data: matnr type matnr
    data: matnr like mara-matnr
    data: matnr like matnr.
    In those above statement which are correct. And the difference between those statements.
    Thanks,
    Srihari.

    hi,
    LIKE means the datatype of the variable is similar to the referenced variable.
    TYPE means it is a predefined data type.
    Eg:
    DATA int TYPE i.
    Here int is of integer data type.
    DATA var LIKE int.
    var IS a variable having same data type of int. which in turn is integer.
    You can find these helpful when you reference database table variables... You need not know what is the datatype defined.
    Also it adds to FLEXIBILITY.
    Whenever you make changes to your database tables and fields,
    that change is REFLECTED back to your program that is,
    You need not change all your program code when you change your table fields...
    Hope you understand and appreciate the flexibility that SAP provides to the programmers...
    Thanks
    Arun

  • What is the use of CTU_PRAMS in bdc programming?

    what is the use of CTU_PRAMS in bdc programming?
    can any explain wit a sample code.

    Hi,
    Hi,
    If u write table control bdc program in 14'' monitor screen, then if the same program u run at different monitor size, then the screen resolution problem comes in to the picture,
    like, u get 5 records in table control in one screen, and some other records in other screen, to avoid this screen resolution problem we use CTU-PARAMS Structure.
    In ur program u have to set
    defsize type ctu_params-defsize value 'X',
    Then u will be free of screen resolution problem.
    Fill the str CTU_PARAMS-defsize = 'X' and pass in CTU stmnt as
    call transaction 'XXX' options using t_bdcdata ctu_params.
    Analysing :
    1. If nothing works, then we have to
    some ifs & buts.
    2. There shall be normally
    2-4 different kinds of resolution
    on various users comptuers.
    3. Based on this,
    we have to know beforehand,
    what will be the number of rows
    in the table control.
    4. The user can be given
    a selection/paraemter
    for resolution
    eg. 800x600
    1024x100
    axb
    etc.
    5. Based on this, we will hardcode
    in the program (based upon our knowledge/recording
    which we have seen and done)
    we will hardcode
    the number of lines
    in the VARIBLE.
    6. Then we can simply use this variable
    for our LOOP and logic purpose.
    7. It will be the responsibiltiy of the
    use to CHOOSE THE CORRECT resolution,
    on the selection-screen.
    For screen resolution use ctu_params, with default size
    Data : f_option type ctu_params,
    f_option-updmode = 'S'.
    f_option-defsize = 'X'.
    f_option-dismode = 'N'.
    call transaction 'VA01' using bdcdata options from f_option messages into bdcerror.
    CALL TRANSACTION tcode... OPTIONS FROM opt
    ... OPTIONS FROM opt
    Effect
    Allows you to control processing using the values of the componetns of the structure opt, which must have the ABAP Dictionary type CTU_PARAMS. The components have the following meanings:
    DISMODE
    Display mode (like the MODE addition)
    UPDMODE
    Update mode (like the UPDATE addition)
    CATTMODE
    CATT mode (controls a CATT)
    CATT mode can have the following values:
    ' ' No CATT active
    'N' CATT without single-screen control
    'A' CATT with single-screen control
    DEFSIZE
    Use default window size
    RACOMMIT
    Do not end transaction at COMMIT WORK
    NOBINPT
    No batch input mode (that is, SY-BINPT = SPACE)
    NOBIEND
    No batch input mode after the end of BDC data.
    The components DEFSIZE , RACOMMIT, NOBINPT, and NOBIEND always take the following values:
    'X' Yes
    ' ' No
    If you do not use the OPTIONS FROM addition, the following control parameter settings apply:
    DISMODE
    From addition MODE
    UPDMODE
    From addition UPDATE
    CATTMODE
    No CATT active
    DEFSIZE
    Do not use default window size
    RACOMMIT
    Successful end on COMMIT WORK
    NOBINPT
    Batch input mode active ( SY-BINPT = X
    NOBIEND
    Batch input mode remains active after the BDC data

  • ABAP HR PROGRAMMING MATERIAL

    Hi All,
    I want <b>ABAP HR Programming Material</b>.......
    Plz. suggest me, from where i can select this material, it's URGENT for me.....
    Thanks & Regards,
    <b>Anil Kumar</b>

    Hi
    HR:
    HR deals with the INFOTYPES which are similar to Tables in General ABAP.
    There are different ways of fetching data from these infotypes.
    There are different areas in HR LIKE Personal Admn, Orgn Management, Benefits, Time amangement, Event Management, Payroll etc
    Infotypes for these areas are different from one another area.
    storing of records data in each type of area is different
    LDBS like PNP are used in HR programing.
    Instead of Select.. we use some ROUTINES and PROVIDE..ENDPROVIDE.. etc
    and in the case of Pay roll we use Clusters and we Import and Export them for data fetching.
    On the whole Normal ABAP is different from HR abap.
    For Personal Admn the Infotypes start with PA0000 to PA1999
    Time Related Infotypes start with PA2000 to PA2999.
    Orgn related Infotypes start with HRP1000 to HRP1999.
    All custom developed infotypes stsrat with PA9000 onwards.
    In payroll processing we use Clusters like PCL1,2,3 and 4.
    Instead of Select query we use PROVIDE and ENDPROVIDE..
    You have to assign a Logical Database in the attributes PNP.
    Go through the SAp doc for HR programming and start doing.
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    See:
    http://help.sap.com/saphelp_46c/helpdata/en/4f/d5268a575e11d189270000e8322f96/content.htm
    sites regarding hr-abap:
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
    http://www.atomhr.com/training/Technical_Topics_in_HR.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    You can see some Standard Program examples in this one ...
    http://www.sapdevelopment.co.uk/programs/programshr.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification
    http://www.erpgenie.com/faq/hr.htm.
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html
    These are the FAQ's that might helps you as well.
    http://www.sap-img.com/human/hr-faq.htm
    http://www.sapgenie.com/faq/hr.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.atomhr.com/library_full.htm
    HR Long texts Upload
    Look at the below link
    BDC - hr maintain text
    Regards
    Anji

  • Match code help and coding for save menu for PF STATUS and BDC programming

    hi,
    pl guide me step by step i'm new to abap.
    1)   i need search help for field V_TVAG-BEZEI..this is field is there in my table control to select the values from the line of list for reason to reject.
    2) i need code for SAVE button which i've created in PF STATUS.
    3) do i need to to BDC programming for save and update the table control in return order as well as in sales order?...if yes how can i do that?

    hi,
    pl guide me step by step i'm new to abap.
    1)   i need search help for field V_TVAG-BEZEI..this is field is there in my table control to select the values from the line of list for reason to reject.
    2) i need code for SAVE button which i've created in PF STATUS.
    3) do i need to to BDC programming for save and update the table control in return order as well as in sales order?...if yes how can i do that?

  • Bdc program with out coding

    Hi All,
    I want to know how to write a bdc program with out coding...
    Thank you,
    Gopi....

    Hai.
    check this.
    BATCH DATA COMMUNICATION
    About Data Transfer In R/3 System
    When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.
    In the process of replacing current applications and transferring application data, two situations might occur:
    • The first is when application data to be replaced is transferred at once, and only once.
    • The second situation is to transfer data periodically from external systems to SAP and vice versa.
    • There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.
    The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called “batch input” or “batch data communication”.
    1. SESSION METHOD
    2. CALL TRANSACTION
    3. DIRECT INPUT
    Advantages offered by BATCH INPUT method:
    1. Can process large data volumes in batch.
    2. Can be planned and submitted in the background.
    3. No manual interaction is required when data is transferred.
    4. Data integrity is maintained as whatever data is transferred to the table is through transaction. Hence batch input data is submitted to all the checks and validations.
    To implement one of the supported data transfers, you must often write the program that exports the data from your non-SAP system. This program, known as a “data transfer” program must map the data from the external system into the data structure required by the SAP batch input program.
    The batch input program must build all of the input to execute the SAP transaction.
    Two main steps are required:
    • To build an internal table containing every screen and every field to be filled in during the execution of an SAP transaction.
    • To pass the table to SAP for processing.
    Prerequisite for Data Transfer Program
    Writing a Data Transfer Program involves following prerequisites:
    Analyzing data from local file
    Analyzing transaction
    Analyzing transaction involves following steps:
    • The transaction code, if you do not already know it.
    • Which fields require input i.e., mandatory.
    • Which fields can you allow to default to standard values.
    • The names, types, and lengths of the fields that are used by a transaction.
    • Screen number and Name of module pool program behind a particular transaction.
    To analyze a transaction::
    • Start the transaction by menu or by entering the transaction code in the command box.
    (You can determine the transaction name by choosing System – Status.)
    • Step through the transaction, entering the data will be required for processing your batch input data.
    • On each screen, note the program name and screen (dynpro) number.
    (dynpro = dyn + pro. Dyn = screen, pro = number)
    • Display these by choosing System – Status. The relevant fields are Program (dynpro) and Dynpro number. If pop-up windows occur during execution, you can get the program name and screen number by pressing F1 on any field or button on the screen.
    The technical info pop-up shows not only the field information but also the program and screen.
    • For each field, check box, and radio button on each screen, press F1 (help) and then choose Technical Info.
    Note the following information:
    - The field name for batch input, which you’ll find in its own box.
    - The length and data type of the field. You can display this information by double clicking on the Data Element field.
    • Find out the identification code for each function (button or menu) that you must execute to process the batch-input data (or to go to new screen).
    Place the cursor on the button or menu entry while holding down the left mouse button. Then press F1.
    In the pop-up window that follows, choose Technical info and note the code that is shown in the Function field.
    You can also run any function that is assigned to a function key by way of the function key number. To display the list of available function keys, click on the right mouse button. Note the key number that is assigned to the functions you want to run.
    Once you have program name, screen number, field name (screen field name), you can start writing.
    DATA TRANSFER program.
    Declaring internal table
    First Integral Table similar to structure like local file.
    Declaring internal table like BDCDATA
    The data from internal table is not transferred directly to database table, it has to go through transaction. You need to pass data to particular screen and to particular screen-field. Data is passed to transaction in particular format, hence there is a need for batch input structure.
    The batch input structure stores the data that is to be entered into SAP system and the actions that are necessary to process the data. The batch input structure is used by all of the batch input methods. You can use the same structure for all types of batch input, regardless of whether you are creating a session in the batch input queue or using CALL TRANSACTION.
    This structure is BDCDATA, which can contain the batch input data for only a single run of a transaction. The typical processing loop in a program is as follows:
    • Create a BDCDATA structure
    • Write the structure out to a session or process it with CALL TRANSACTION USING; and then
    • Create a BDCDATA structure for the next transaction that is to be processed.
    Within a BDCDATA structure, organize the data of screens in a transaction. Each screen that is processed in the course of a transaction must be identified with a BDCDATA record. This record uses the Program, Dynpro, and Dynbegin fields of the structure.
    The screen identifier record is followed by a separate BDCDATA record for each value, to be entered into a field. These records use the FNAM and FVAL fields of the BDCDATA structure. Values to be entered in a field can be any of the following:
    • Data that is entered into screen fields.
    • Function codes that are entered into the command field. Such function codes execute functions in a transaction, such as Save or Enter.
    The BDCDATA structure contains the following fields:
    • PROGRAM: Name of module pool program associated with the screen. Set this field only for the first record for the screen.
    • DYNPRO: Screen Number. 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 for the first record for the screen. (Reset to ‘ ‘ (blank) for all other records.)
    • FNAM: Field Name. The FNAM field is not case-sensitive.
    • FVAL: Value for the field named in FNAM. The FVAL field is case-sensitive. Values assigned to this field are always padded on the right, if they are less than 132 characters. Values must be in character format.
    Transferring data from local file to internal table
    Data is uploaded to internal table by UPLOAD of WS_UPLOAD function.
    Population of BDCDATA
    For each record of internal table, you need to populate Internal table, which is similar to BDCDATA structure.
    All these five initial steps are necessary for any type of BDC interface.
    DATA TRANSFER program can call SESSION METHOD or CALL TRANSACTION. The initial steps for both the methods are same.
    First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.
    SESSION METHOD
    About Session method
    In this method you transfer data from internal table to database table through sessions.
    In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.
    Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.
    When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.
    Unless session is processed, the data is not transferred to database table.
    BDC_OPEN_GROUP
    You create the session through program by BDC_OPEN_GROUP function.
    Parameters to this function are:
    • User Name: User name
    • Group: Name of the session
    • Lock Date: The date on which you want to process the session.
    • Keep: This parameter is passed as ‘X’ when you want to retain session after
    processing it or ‘ ‘ to delete it after processing.
    BDC_INSERT
    This function creates the session & data is transferred to Session.
    Parameters to this function are:
    • Tcode: Transaction Name
    • Dynprotab: BDC Data
    BDC_CLOSE_GROUP
    This function closes the BDC Group. No Parameters.
    Some additional information for session processing
    When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.
    However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.
    If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.
    CALL TRANSACTION
    About CALL TRANSACTION
    A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program by
    Call transaction <tcode> using <BDCTAB>
    Mode <A/N/E>
    Update <S/A>
    Messages into <MSGTAB>.
    Parameter – 1 is transaction code.
    Parameter – 2 is name of BDCTAB table.
    Parameter – 3 here you are specifying mode in which you execute transaction
    A is all screen mode. All the screen of transaction are displayed.
    N is no screen mode. No screen is displayed when you execute the transaction.
    E is error screen. Only those screens are displayed wherein you have error record.
    Parameter – 4 here you are specifying update type by which database table is updated.
    S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.
    A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).
    Parameter – 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:
    1. Tcode: Transaction code
    2. Dyname: Batch point module name
    3. Dynumb: Batch input Dyn number
    4. Msgtyp: Batch input message type (A/E/W/I/S)
    5. Msgspra: Batch input Lang, id of message
    6. Msgid: Message id
    7. MsgvN: Message variables (N = 1 - 4)
    For each entry, which is updated in database, table message is available in BDCMSGCOLL. As BDCMSGCOLL is structure, you need to declare a internal table which can contain multiple records (unlike structure).
    Steps for CALL TRANSACTION method
    1. Internal table for the data (structure similar to your local file)
    2. BDCTAB like BDCDATA
    3. UPLOAD or WS_UPLOAD function to upload the data from local file to itab. (Considering file is local file)
    4. Loop at itab.
    Populate BDCTAB table.
    Call transaction <tcode> using <BDCTAB>
    Mode <A/N/E>
    Update <S/A>.
    Refresh BDCTAB.
    Endloop.
    (To populate BDCTAB, You need to transfer each and every field)
    The major differences between Session method and Call transaction are as follows:
    SESSION METHOD CALL TRANSACTION
    1. Data is not updated in database table unless Session is processed. Immediate updation in database table.
    2. No sy-subrc is returned. Sy-subrc is returned.
    3. Error log is created for error records. Errors need to be handled explicitly
    4. Updation in database table is always synchronous Updation in database table can be synchronous Or Asynchronous.
    Error Handling in CALL TRANSACTION
    When Session Method updates the records in database table, error records are stored in the log file. In Call transaction there is no such log file available and error record is lost unless handled. Usually you need to give report of all the error records i.e., records which are not inserted or updated in the database table. This can be done by the following method:
    Steps for the error handling in CALL TRANSACTION
    1. Internal table for the data (structure similar to your local file)
    2. BDCTAB like BDCDATA
    3. Internal table BDCMSG like BDCMSGCOLL
    4. Internal table similar to Ist internal table
    (Third and fourth steps are for error handling)
    5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)
    6. Loop at itab.
    Populate BDCTAB table.
    Call transaction <tr.code> using <Bdctab>
    Mode <A/N/E>
    Update <S/A>
    Messages <BDCMSG>.
    Perform check.
    Refresh BDCTAB.
    Endloop.
    7 Form check.
    IF sy-subrc <> 0. (Call transaction returns the sy-subrc if updating is not successful).
    Call function Format_message.
    (This function is called to store the message given by system and to display it along with record)
    Append itab2.
    Display the record and message.
    DIRECT INPUT
    About Direct Input
    In contrast to batch input, this technique does not create sessions, but stores the data directly. It does not simulate the online transaction. To enter the data into the corresponding database tables directly, the system calls a number of function modules that execute any necessary checks. In case of errors, the direct input technique provides a restart mechanism. However, to be able to activate the restart mechanism, direct input programs must be executed in the background only. Direct input checks the data thoroughly and then updates the database directly.
    You can start a Direct Input program in two ways;
    Start the program directly
    This is the quickest way to see if the program works with your flat file. This option is possible with all direct input programs. If the program ends abnormally, you will not have any logs telling you what has or has not been posted. To minimize the chance of this happening, always use the check file option for the first run with your flat file. This allows you to detect format errors before transfer.
    Starting the program via the DI administration transaction
    This transaction restarts the processing, if the data transfer program aborts. Since DI document are immediately posted into the SAP D/B, the restart option prevents the duplicate document posting that occurs during a program restart (i.e., without adjusting your flat file).
    Direct input is usually done for standard data like material master, FI accounting document, SD sales order and Classification for which SAP has provided standard programs.
    First time you work with the Direct Input administration program, you will need to do some preparation before you can transfer data:
    - Create variant
    - Define job
    - Start job
    - Restart job
    Common batch input errors
    - The batch input BDCDATA structure tries to assign values to fields which do not exist in the current transaction screen.
    - The screen in the BDCDATA structure does not match the right sequence, or an intermediate screen is missing.
    - On exceptional occasions, the logic flow of batch input session does not exactly match that of manual online processing. Testing the sessions online can discover by this.
    - The BDCDATA structure contains fields, which are longer than the actual definition.
    - Authorization problems.
    RECORDING A BATCH INPUT
    A B recording allows you to record a R/3 transaction and generate a program that contains all screens and field information in the required BDC-DATA format.
    You can either use SHDB transaction for recording or
    SYSTEM ? SERVICES ? BATCH INPUT ? EDIT
    And from here click recording.
    Enter name for the recording.
    (Dates are optional)
    Click recording.
    Enter transaction code.
    Enter.
    Click Save button.
    You finally come to a screen where, you have all the information for each screen including BDC_OKCODE.
    • Click Get Transaction.
    • Return to BI.
    • Click overview.
    • Position the cursor on the just recorded entry and click generate program.
    • Enter program name.
    • Click enter
    The program is generated for the particular transaction.
    BACKGROUND PROCESSING
    Need for Background processing
    When a large volume of data is involved, usually all batch inputs are done in background.
    The R/3 system includes functions that allow users to work non-interactively or offline. The background processing systems handle these functions.
    Non-interactively means that instead of executing the ABAP/4 programs and waiting for an answer, user can submit those programs for execution at a more convenient planned time.
    There are several reasons to submit programs for background execution.
    • The maximum time allowed for online execution should not exceed 300 seconds. User gets TIMEOUT error and an aborted transaction, if time for execution exceeds 300 seconds. To avoid these types of error, you can submit jobs for background processing.
    • You can use the system while your program is executing.
    This does not mean that interactive or online work is not useful. Both type of processing have their own purposes. Online work is the most common one entering business data, displaying information, printing small reports, managing the system and so on. Background jobs are mainly used for the following tasks; to process large amount of data, to execute periodic jobs without human intervention, to run program at a more convenient, planned time other than during normal working hours i.e., Nights or weekends.
    The transaction for background processing is SM36.
    Or
    Tools ? Administration ? Jobs ? Define jobs
    Or
    System ? services ? Jobs
    Components of the background jobs
    A job in Background processing is a series of steps that can be scheduled and step is a program for background processing.
    • Job name. Define the name of assigned to the job. It identifies the job. You can specify up to 32 characters for the name.
    • Job class. Indicates the type of background processing priority assigned to the job.
    The job class determines the priority of a job. The background system admits three types of job classes: A B & C, which correspond to job priority.
    • Job steps. Parameters to be passed for this screen are as follows:
    Program name.
    Variant if it is report program
    Start criteria for the job: Option available for this are as follows:
    Immediate - allows you to start a job immediately.
    Date/Time - allows you to start a job at a specific name.
    After job - you can start a job after a particular job.
    After event - allows you to start a job after a particular event.
    At operation mode - allows you to start a job when the system switches to a particular operation mode.
    Defining Background jobs
    It is two step process: Firstly, you define the job and then release it.
    When users define a job and save it, they are actually scheduling the report i.e., specifying the job components, the steps, the start time.
    When users schedule program for background processing, they are instructing the system to execute an ABAP/4 report or an external program in the background. Scheduled jobs are not executed until they are released. When jobs are released, they are sent for execution to the background processing system at the specified start time. Both scheduling and releasing of jobs require authorizations.
    HANDLING OF POP UP SCREEN IN BDC
    Many times in transaction pop up screen appears and for this screen you don’t pass any record but some indication to system telling it to proceed further. For example: The following screen
    To handle such screen, system has provided a variable called BDC_CURSOR. You pass this variable to BDCDATA and process the screen.
    Usually such screen appears in many transactions, in this case you are just passing information, that YES you want to save the information, that means YES should be clicked. So you are transferring this information to BDCDATA i.e., field name of YES which is usually SPOT_OPTION. Instead of BDC_OKCODE, you are passing BDC_CURSOR.
    BDC_CURSOR is also used to place cursor on particular field.
    AN EXAMPLE WITH SESSION METHOD
    Following program demonstrates how data is passed from flat file to SAP transaction and further to database table by using SESSION method.
    The transaction is TFBA (to change customer).
    A simple transaction where you are entering customer number on first screen and on next screen data is displayed for the particular customer number. Field, which we are changing here, are name and city. When you click on save, the changed record gets saved.
    Prerequisite to write this BDC interface as indicated earlier is:
    1. To find screen number
    2. To find screen field names, type of the field and length of the field.
    3. To find BDC_OKCODE for each screen
    4. Create flat file.
    Flat file can be created in your hard disk as follows:
    1 Vinod   Hyderabad
    2 Kavitha Secunderabad
    3 Kishore Hyderabad
    (Where 1st character field is Customer number, 2nd field is Customer name and 3rd field is City.)
    To transfer this data to database table SCUSTOM following interface can be used.
    REPORT DEMO1.
    Following internal table is to upload flat file.
    DATA: BEGIN OF ITAB OCCURS 0,
    ID(10),
    NAME(25),
    CITY(25),
    END OF ITAB.
    *Following internal table BDCDATA is to pass date from internal table to session.
    DATA: BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    Variables
    DATA: DATE1 LIKE SY-DATUM. DATE1 = SY-DATUM - 1. “ This is for Hold Date
    To upload flat file to internal table.
    CALL FUNCTION UPLOAD
    EXPORTING
    FILE NAME = ‘C:\FF.TXT’
    FILE TYPE = ‘ASC”
    TABLES
    DATA_TAB = ITAB
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    OTHERS = 6.
    If sy-subrc = 0.
    Calling Function to Create a Session
    CALL FUNCTION ‘BDC_OPEN_GROUP’
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = ‘POTHURI’
    HOLDDATE = DATE1
    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.
    *-- MAIN Logic--
    LOOP AT ITAB
    PERFORM GENERATE_DATA. “ Populating BDCDATA Table
    CALL FUNCTION ‘BDC_INSERT’
    EXPORTING
    TCODE = ‘TFBA’
    TABLES
    DYNPROTAB = BDCTAB
    EXCEPTIONS
    INTERNAL_ERROR = 1
    NOT_OPEN = 2
    QUEUE_ERROR = 3
    TCODE_INVALID = 4
    PRINTING_INVALID = 5
    POSTING_INVALID = 6
    OTHERS = 7.
    REFRESH BDCTAB
    ENDLOOP.
    Calling function to close the session
    CALL FUNCTION ‘BDC_CLOSE_GROUP’
    EXCEPTIONS
    NOT_OPEN = 1
    QUEUE_ERROR = 2
    OTHERS = 3.
    Endif.
    Endif.
    *& Form GENERATE_DATA
    Create BDC Data
    FORM GENERATE_DATA
    Passing information for 1st screen on BDCDATA
    BDCTAB-PROGRAM = ‘SAPMTFBA’.
    BDCTAX-DYNPRO = 100.
    BDCTAP-DYNBEGIN = ‘X’.
    APPEND BCDTAB.CLEAR BDCTAB.
    Passing field information to BDCDATA
    BDCTAB-FNAM = ‘SCUSTOM-ID’
    BDCTAB-FVAL = ITAB-ID.
    APPEND BDCTAB.CLEAR BDCTAB.
    Passing BDC_OKCODE to BDCDATA
    BDCTAB-FNAM = ‘BDC_OKCODE’.
    BDCTAB-FVAL = ‘/5’.
    APPEND BDCTAB.CLEAR BDCTAB.
    Passing screen information for next screen to BDCDATA
    BDCTAB-PROGRAM = ‘SAPMTFBA’.
    BDCTAB-DYNPRO = 200.
    BDCTAB-DYNBEGIN = ‘X’.
    APPEND BDCTAB.CLEAR BDCTAB.
    Passing screen information to BDCDATA
    BDCTAB-FNAM = ‘SCUSTOM-NAME’.
    BDCTAB-FVAL = ITAB-NAME.
    APPEND BDCTAB.CLEAR BDCTAB.
    Passing screen information to BDCDATA
    BDCTAB-FNAM = ‘SCUSTOM-CITY’.
    BDCTAB-FVAL = ITAB-CITY.
    APPEND BDCTAB.CLEAR BDCTAB.
    Passing BDC_OKCODE to BDCDATA
    BDCTAB-FNAM = ‘BDC_OKCODE’.
    BDCTAB-FVAL = ‘SAVE’.
    APPEND BDCTAB.CLEAR BDCTAB.
    ENDFORM. “GENERATE_DATA
    AN EXAMPLE WITH CALL TRANSACTION
    Same steps to be repeated for CALL TRANSACTION
    The only difference between the two types of interface is in Session method, you create session and store information about screen and data into session. When session is processed the data is transferred to database. While in CALL TRANSACTION, data is transferred directly to database table.
    REPORT DEMO1.
    Follow above Code till MAIN Logic. Even the Subroutine should be copied
    LOOP AT ITAB
    PERFORM GENERATE_DATA, “Populating BDCDATA Table
    Call transaction ‘TFBA’ using BCDDATA Mode ‘A’ Update ‘S’.
    REFRESH BDCTAB
    ENDLOOP.
    regards.
    sowjanya.b.

  • ABAP-BDC & ALV

    HI
    I WANTED TO KNOW ABOUT A GOOD BOOK ON ABAP-BDC & ALV WHICH IS AVAILABLE IN INDIA.ALSO WOULD LIKE TO KNOW WHERE IN INDIA WILL I GET THE BOOK PLEASE.

    Hi Vipul,
           Some of the books that gives a well explanation from the basic concepts are the following :
      1) Sams Teach Yourself ABAP/4 in 21 Days  by Ken Greenwood
      2) The ABAP Quick Reference  by H. Keller
    You can also catch on the Code samples and Forum threads on SDN which will cater you a more advanced programming knowledge.
    Thanks and Regards,
    Siva

  • About BDC Programming.

    Hi to all...
           I have a doubt in BDC Programming, I have a sample program of a BDC and i have executed it by uploading a .txt File.. But i
    can't able to know that whether the values are uploaded into the transaction or not. I also Like to Know about the Further
    Process  after executing the BDC report.. I don't Know how to View it in my transaction.. Can anyone Explain and Clear my
    Doubt.
    Moderator message: sorry, these forums cannot replace proper training, please search for available documentation or attend classes.
    locked by: Thomas Zloch on Sep 29, 2010 3:36 PM

    Hi..
    Basically I trying to Learn the BDC Programming now... I got an idea about BDC, But i can't able to know what is happening in it..
    Can You Have any sample Program With any comments Means Pls can you post it...

Maybe you are looking for

  • Total Target Costs not updated in Process Order

    Hi All, I  have a scenario in a Process Order, The Process order is Released, Goods Issued and GR done. But the when i go and check the Cost Analysis i did not see anything in the Total Target Costs  and Total Target Qty coloumns agianst all the cost

  • Which portable HD for backing up?

    I admit that we're a bit late about this, but we're now getting serious about backing up our two identical 14" G4 iBooks. They're both still in good shape, based on how they're performing for us and how they test out in Disk Utility, and we have yet

  • Install XE on VM ORACLE Virtualbox W7x32

    hi! Try to install subj. all time have "ok" instalation. but when try to connect from sql comand line have the same errors like do not have an oracle database. try to chek "ORAHOME" - its ok. chec rights - made an user owner of folder with oracle wit

  • I lost my i phone and I'm trying to find it on my computer

    I lost my I phone and am trying to find it using my computer......how do I do it?

  • Lenovo G450 battery stucks at 0% and it sshows plugged in,charging

    three months back I bought a new battery for my lenovo G450 laptop.Initially it was working well and now it's not get charged Stucks @0%,,,,,plz suggest me a solution for this