Error in bdc recording

Hi guys,
I am doing a bdc recording for transaction co02. when i got to CO02 transaction and give the order no and press enter.Then in the next screen if u go to menu Function-->Read pp master data, then a small pop-up screen will come.In that screen for the field prod version i m giving the data programtically(what ever i gave programtically it is displaying in that field).For example i gave the production version 2 for the production order z1.If the order Z1 doesn't have a production version 2 it is throwing a popup error message and it is not continuing any further.The next order is not exectued.It is stopping at the order Z1.If the order z1 has prod version 2 then it will accept and will continue to the next production order.
I hope u understand my requirement.Everywhere i m passing the correct data to the required fields.I want to handle the popup error message programatically.
Thanks
dp.

Hi,
Here you have to know the message type, class, and number,  for the wrong production version.
With the help of these values write and if condition to skip the pop up screen.
Or do that production version checking manually for the given input before populating the values into the transaction.
Try this and reply me if there is any queries

Similar Messages

  • When does a error log is creaded during BDC recording

    hi,
    i am working on Reports, i need to know how the BDC recording works, and when the error log log be created

    Hi anitha,
    You have got a message generated from message class "RQ" with message number "XXX".
    Are you getting this error during recording. Which transaction you are using for recording.
    The error messages will be generated when you documented is not proceesed completly via BDC. You can collect the error messages in to an internal table and print at the end of the program as a report.
    If you are using Call Traansaction
    *------ Declaring Internal Table to Store BDC Errors *----
    DATA: BEGIN OF T_MESSTAB OCCURS 0.
            INCLUDE STRUCTURE BDCMSGCOLL.
    DATA: END OF T_MESSTAB.
    CALL TRANSACTION 'TCODE' USING BDC_TAB MODE 'A'
                           MESSAGES INTO T_MESSTAB.
    LOOP AT T_MESSTAB.
            WRITE / TEXT-001.
            WRITE:/10 T_MESSTAB-DYNAME, 30 T_MESSTAB-DYNUMB.
            WRITE:/10 T_MESSTAB-MSGV1.
    ENDLOOP.
    Lanka

  • Want to output Error message in BDC recording(PA30)

    Hi all,
    Currently iam working on upload program,whic is done by BDC recording with transaction PA30.while loading the data to different infotypes,iam checking one condition
    in particular infotype,after that i need to give the error message(Type E) and i data should not get uploaded for that infotype,and it has to go to next infotype.i want to log this error also,how can i do this?

    The ERROR message will stop the processing of the program,  the message will need to be either an I(information) or a W(warning) message into for the program to continue processing.
    Log the message by writing it to an internal table.
    IF SOME_CONDITION = 'X'.
    MESSAGE W001(00) with 'Hey, here is a message'.
    itab-pernr = p_pernr.
    itab-msgid = '00'.
    itab-msgno = '001'.
    append itab.
    ENDIF.
    CALL TRANSACTION 'PA30'........
    Regards,
    Rich HEilman

  • Error in bdc

    Error in bdc ... cannot insert in the transaction pa30 , infotype 0105 , adding userid
    Error :- usrid does not exists in given time span
    Plz let me knw if u have any sol

    When u r creating a new user then check Start date. If start date is not equals to current date then it will give a message other wise message will not come it seems. Suppose message is coming while creating time then no issue go to PA0105 table and check it's creating or not. If it's creating that means your BDC is delimiting the record and entring new record into data base.
    Rajneesh Gupta

  • Error in BDC session Insert.....

    Hi All,
    Guys iam running BDC pgm for MEK1 create condition records transaction and i get an error while executing through BDC_INSERT. Its an internal error with text "Error in BDC session Insert..".The text file iam using contains 26 line items for the first contract created earlier and 30 line items for the second record. My concern is it only happens for this text file with multiple or more line items.
    While debugging i have observed that after the session has been created the first bdc insert goes well for the first header record and then it fails for the second record with an internal error "Error in BDC session Insert..".
    Does anyone have enountered such issue before or is it related to limited number of line items in MEK1 transaction.
    Any help would be appreciated.
    Thanks,
    Avinash

    report ZSESSION1
           no standard page heading line-size 255.
    *include bdcrecx1.
    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE .
    TYPES: BEGIN OF TYP_STU,
                   Z_STUDID TYPE ZSTUD1-Z_STUDID,
                   Z_STUDNAME TYPE ZSTUD1-Z_STUDNAME,
                   Z_STUDAGE TYPE ZSTUD1-Z_STUDAGE,
              END OF TYP_STU.
    DATA: IT_STU TYPE STANDARD TABLE OF TYP_STU,
              GW_STU TYPE TYP_STU,
              V_PATH TYPE STRING.
      PARAMETERS  SUREN TYPE  IBIPPARMS-PATH OBLIGATORY.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR  SUREN .
         PERFORM  GETFILE USING SUREN.
    V_PATH = SUREN.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      =  V_PATH
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      =  IT_STU
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
       CLIENT                    = SY-MANDT
      DEST                      = FILLER8
       GROUP                     =  'SESSION1'
      HOLDDATE                  = FILLER8
       KEEP                      =  'X'
       USER                      = SY-UNAME
       RECORD                    = FILLER1
       PROG                      = SY-CPROG
      DCPFM                     = '%'
      DATFM                     = '%'
    IMPORTING
      QID                       =
    EXCEPTIONS
      CLIENT_INVALID            = 1
      DESTINATION_INVALID       = 2
      GROUP_INVALID             = 3
      GROUP_IS_LOCKED           = 4
      HOLDDATE_INVALID          = 5
      INTERNAL_ERROR            = 6
      QUEUE_ERROR               = 7
      RUNNING                   = 8
      SYSTEM_LOCK_ERROR         = 9
      USER_INVALID              = 10
      OTHERS                    = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    START-OF-SELECTION.
    LOOP AT IT_STU INTO GW_STU.
    REFRESH BDCDATA.
    *perform open_group.
    perform bdc_dynpro      using 'SAPMSRD0' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSRD1-TBMA_VAL'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=EDIT'.
    perform bdc_field       using 'RSRD1-TBMA'
                                  'X'.
    perform bdc_field       using 'RSRD1-TBMA_VAL'
                                  'ZSTUD1'.
    perform bdc_dynpro      using 'SAPLSD41' '2200'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'DD02D-DDTEXT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TDED'.
    perform bdc_field       using 'DD02D-DDTEXT'
                                  'Stud details'.
    perform bdc_dynpro      using '/1BCDWB/DBZSTUD1' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZSTUD1-Z_STUDAGE'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SAVE'.
    perform bdc_field       using 'ZSTUD1-Z_STUDID'
                                  GW_STU-Z_STUDID .
    perform bdc_field       using 'ZSTUD1-Z_STUDNAME'
                                  GW_STU-Z_STUDNAME .
    perform bdc_field       using 'ZSTUD1-Z_STUDAGE'
                                 GW_STU-Z_STUDAGE .
    perform bdc_dynpro      using '/1BCDWB/DBZSTUD1' '0101'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZSTUD1-Z_STUDID'.
    perform bdc_dynpro      using 'SAPLSD41' '2200'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'DD02D-DDTEXT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=WB_BACK'.
    perform bdc_field       using 'DD02D-DDTEXT'
                                  'Stud details'.
    perform bdc_dynpro      using 'SAPMSRD0' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSRD1-TBMA_VAL'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'RSRD1-TBMA'
                                  'X'.
    perform bdc_field       using 'RSRD1-TBMA_VAL'
                                  'ZSTUD1'.
    *perform bdc_transaction using 'SE11'.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
       TCODE                  = 'SE11'
      POST_LOCAL             = NOVBLOCAL
      PRINTING               = NOPRINT
      SIMUBATCH              = ' '
      CTUPARAMS              = ' '
      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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
    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.
    *ENDLOOP.
    *perform close_group.
    *&      Form  bdc_dynpro
          text
         -->P_0207   text
         -->P_0208   text
    *FORM bdc_dynpro  USING    VALUE(P_0207)
                             VALUE(P_0208).
    *ENDFORM.                    " bdc_dynpro
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    "BDC_DYNPRO
    *&      Form  bdc_field
          text
         -->P_0212   text
         -->P_0213   text
    *FORM bdc_field  USING    VALUE(P_0212)
                            VALUE(P_0213).
    *ENDFORM.                    " bdc_field
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR BDCDATA.
      BDCDATA-FNAM = FNAM.
      BDCDATA-FVAL = FVAL.
      APPEND BDCDATA.
    ENDFORM .
    FORM GETFILE USING SUREN.
         CALL FUNCTION 'F4_FILENAME'
          EXPORTING
            PROGRAM_NAME        = SYST-CPROG
            DYNPRO_NUMBER       = SYST-DYNNR
          IMPORTING
            FILE_NAME           = SUREN.
            ENDFORM.

  • Error in BDC for VK-11

    Hi All,
    I have created a BDC for T-Code VK11. When I am loading the data then my BDC is throwing an error becoz for some materials Unit of Measurement(UOM) sceen is coming which I have not captured in BDC. This UOM is coming only for few materials and this screen is not coming when I m entering these materials manually.
    Can anybody plz help me out in solving this.
    Warm Regards,
    Nishu

    Do a recording with a material which is throwing u the UOM screen .
    IF ur flat file is not having Uom pick the values for the materials from MARA/ MARM table into a variable and submit it to the screen of UOM.
    See a recording will be done considering the fact that all the possible scenarios are handled . So If the screen is popping up with a UOM screen then it has to be handled .
    You have to capture this in ur BDC recording .
    Cause even it throws the UOM screen for one material u need to handle that .
    There is one more screen for UOM jsut do a select and pass the UOM for the material in the code
    if u r not intending to maintain the same in ur flat file.
    Regards,
    vijay

  • Error in bdc uupload

    hi all
    during bdc recording when i upload files using pgm the values are uploaded using a # symbol why such error is occurin can anyone help me plz

    Check out the below code for the uploading of data from an excel sheet...
    *& Report  ZUPLOAD_CLASS                                               *
    REPORT  ZUPLOAD_CLASS                           .
    *added for Excel file upload
    selection-screen begin of block selscr with frame title text-001.
    parameters : p_file type rlgrap-filename obligatory .     "Input File
    parameters: begcol type i default 1 no-display,
                begrow type i default 1 no-display,
                endcol type i default 100 no-display,
                endrow type i default 32000 no-display.
    * Tick don't append header
    parameters: kzheader as checkbox.
    selection-screen end of block selscr.
    data: begin of intern occurs 0.
            include structure  alsmex_tabline.
    data: end of intern.
    data: begin of intern1 occurs 0.
            include structure  alsmex_tabline.
    data: end of intern1.
    data: begin of t_col occurs 0,
           col like alsmex_tabline-col,
           size type i.
    data: end of t_col.
    data: zwlen type i,
          zwlines type i.
    data: begin of fieldnames occurs 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          end of fieldnames.
    data: begin of data_tab occurs 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
            value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
            value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
            value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
            value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
            value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
          end of data_tab.
    types : begin of ttab ,
            type(3),
            class(18),
            desc(50),
            alloc(1),
            char1(30),
            char2(30),
            char3(30),
            char4(30),
            char5(30),
            char6(30),
            char7(30),
            char8(30),
            char9(30),
            char10(30),
            char11(30),
            char12(30),
            char13(30),
            char14(30),
            char15(30),
            char16(30),
            char17(30),
            char18(30),
            char19(30),
            char20(30),
            org(10),
            origin(10),
            end of ttab.
    data itab type ttab occurs 0 with header line.
    data: tind(4) type n.
    data: zwfeld(19).
    data : CLASSNUMNEW like BAPI_CLASS_KEY-CLASSNUM.
    data : CLASSTYPENEW like BAPI_CLASS_KEY-CLASSTYPE.
    data : CLASSBASICDATA like BAPI1003_BASIC.
    data : CLASSDESCRIPTIONS like BAPI1003_CATCH occurs 0 with header line.
    data : CLASSLONGTEXTS like BAPI1003_LONGTEXT occurs 0 with header line.
    data : BAPIRET2 like BAPIRET2 occurs 0 with header line.
    data : CLASSCHARACTERISTICS like BAPI1003_CHARACT occurs 0
           with header line.
    field-symbols: <fs1>.
    *include zbdcrecx1.
    data : n type i.
    *  AT SELECTION-SCREEN
    * F4 for Input file
    at selection-screen on value-request for p_file.
      perform get_local_file_name using p_file.
    start-of-selection.
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_file
          i_begin_col             = begcol
          i_begin_row             = begrow
          i_end_col               = endcol
          i_end_row               = endrow
        TABLES
          intern                  = intern
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          others                  = 3.
      if sy-subrc <> 0.
        write:/ 'Upload Error ', sy-subrc.
      endif.
    end-of-selection.
      loop at intern.
        intern1 = intern.
        clear intern1-row.
        append intern1.
      endloop.
      sort intern1 by col.
      loop at intern1.
        at new col.
          t_col-col = intern1-col.
          append t_col.
        endat.
        zwlen = strlen( intern1-value ).
        read table t_col with key col = intern1-col.
        if sy-subrc eq 0.
          if zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            modify t_col index sy-tabix.
          endif.
        endif.
      endloop.
      describe table t_col lines zwlines.
      sort intern by row col.
      if kzheader = 'X'.
        loop at intern.
          fieldnames-title = intern-value.
          append fieldnames.
          at end of row.
            exit.
          endat.
        endloop.
      else.
        do zwlines times.
          write sy-index to fieldnames-title.
          append fieldnames.
        enddo.
      endif.
      sort intern by row col.
      loop at intern.
        if kzheader = 'X'
        and intern-row = 1.
          continue.
        endif.
        tind = intern-col.
        concatenate 'DATA_TAB-VALUE_' tind into zwfeld.
        assign (zwfeld) to <fs1>.
        <fs1> = intern-value.
        at end of row.
          append data_tab.
          clear data_tab.
        endat.
      endloop.
      loop at data_tab.
        itab-type = data_tab-value_0001.
        itab-class = data_tab-value_0002.     
        itab-desc = data_tab-value_0003.
        itab-alloc = data_tab-value_0004.
        itab-char1 = data_tab-value_0005.
        itab-char2 = data_tab-value_0006.
        itab-char3 = data_tab-value_0007.     
        itab-char4 = data_tab-value_0008.
        itab-char5 = data_tab-value_0009.
        itab-char6 = data_tab-value_0010.
        itab-char7 = data_tab-value_0011.     
        itab-char8 = data_tab-value_0012.
        itab-char9 = data_tab-value_0013.
        itab-char10 = data_tab-value_0014.
        itab-char11 = data_tab-value_0015.     
        itab-char12 = data_tab-value_0016.
        itab-char13 = data_tab-value_0017.
        itab-char14 = data_tab-value_0018.
        itab-char15 = data_tab-value_0019.     
        itab-char16 = data_tab-value_0020.
        itab-char17 = data_tab-value_0021.
        itab-char18 = data_tab-value_0022.
        itab-char19 = data_tab-value_0023.     
        itab-char20 = data_tab-value_0024.
        itab-org = data_tab-value_0025.
        itab-origin = data_tab-value_0026.
        append itab.
        clear itab.
      endloop.
    n = 0.
      loop at itab.
        CLASSNUMNEW = itab-class.
        CLASSTYPENEW = itab-type.
    *    CLASSTYPENEW-CLASSNUM = itab-class.
        CLASSBASICDATA-STATUS = '1'.
        CLASSBASICDATA-CLASSGROUP = 'NFG_CLASS'.
        CLASSBASICDATA-DEPARTMENT_VIEW = itab-org.
        CLASSBASICDATA-VALID_FROM = '20050405'.
        CLASSDESCRIPTIONS-LANGU = 'E'.
        CLASSDESCRIPTIONS-LANGU_ISO = 'EN'.
        CLASSDESCRIPTIONS-CATCHWORD = itab-desc.
        append CLASSDESCRIPTIONS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char1.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char2.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char3.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char4.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char5.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char6.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char7.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char8.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char9.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char10.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char11.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char12.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char13.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char14.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char15.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char16.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char17.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char18.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char19.
        append CLASSCHARACTERISTICS.
        CLASSCHARACTERISTICS-NAME_CHAR = itab-char20.
        append CLASSCHARACTERISTICS.
        CALL FUNCTION 'BAPI_CLASS_CREATE'
          EXPORTING
            CLASSNUMNEW                 = CLASSNUMNEW
            CLASSTYPENEW                = CLASSTYPENEW
    *       CHANGENUMBER                =
            CLASSBASICDATA              = CLASSBASICDATA
    *       CLASSDOCUMENT               =
    *       CLASSADDITIONAL             =
    *       CLASSSTANDARD               =
          TABLES
            RETURN                      = BAPIRET2
            CLASSDESCRIPTIONS           = CLASSDESCRIPTIONS
            CLASSLONGTEXTS              = CLASSLONGTEXTS
            CLASSCHARACTERISTICS        = CLASSCHARACTERISTICS
    *       CHARACTOVERWRITE            =
    *       CHARACTVALUEOVERWRITE       =
    *       CHARACTVALUETEXTOVR         =
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    *     EXPORTING
    *       WAIT          =
    *     IMPORTING
    *       RETURN        =
      clear CLASSNUMNEW.
      clear CLASSTYPENEW.
      clear CLASSBASICDATA.
      clear CLASSDESCRIPTIONS .
      refresh CLASSDESCRIPTIONS .
      clear CLASSLONGTEXTS.
      refresh CLASSLONGTEXTS.
      clear CLASSCHARACTERISTICS.
      refresh CLASSCHARACTERISTICS.
    loop at bapiret2 where type = 'E'.
           write :/ bapiret2-message  , itab-class.
        endloop.
         loop at bapiret2 where type = 'S' or type = 'W' or type = 'I'.
          at last.
          n = n + 1.
          write : / 'Uploaded class' , itab-class.
          endat.
        endloop.
      endloop.
    write :/ 'Records Uploaded ', n.
    form get_local_file_name using file type rlgrap-filename.
      call function 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name     = file
        EXCEPTIONS
          mask_too_long = 1
          others        = 2.
      if sy-subrc <> 0.
        message i000(fb) with
          'Error in getting filename'(004).
      endif.
    endform.                    " GET_LOCAL_FILE_NAME

  • Error in BDC within user exit

    Hi All,
    I am trying to generate a BDC recording within a function exit. I have declared the BDCRECX1 include within the TOP include of the function group. But the include BDCRECX1 which actually contains all the FORMs also contains a selection-screen defined in it. I am not able to activate it because it gives me the following error "SELECTION-SCREEN statements can only be used between SELECTION-SCREEN BEGIN and END OF SCREEN (program type is not "1")" Is it because we are not allowed to define a selection screen between Function-Endfunction which defines a function exit?
    Please let me know why this error is generated and the step to rectify it.

    Hi Nagaraj,
    What Smitha is trying to accomplish here is reuse the subroutines that are available within the INCLUDE bdcrecx1.
    Smitha - You cannot re-use the INCLUDE bdcrecx1 as it is, you will have to create a copy of it and take out all the code that relates to selection screen and reference to these selection parameters within the subroutines, as selection screen can be in programs type "1" - that is executable/report programs.
    I guess you will need only the subroutines FORM BDC_DYNPRO USING PROGRAM DYNPRO. and FORM BDC_FIELD USING FNAM FVAL. just copy these routines into a new include. And you can use declare BDCDATA in the global data of the Function group.
    If you ask me, i guess you could just write these 10-15 lines of code within the same include of the function exit and proceed rather than taking all this trouble.
    Regards,
    Chen

  • I was strucked in BDC recording scenario help me?

    Hi expertsu2026u2026u2026
    I am working on the scenario BDC Recording for fk01 and I am getting an error?
    Error is : Different number of parameters in FORM and PERFORM(routine:BDC_FIELD,number of normal parameters:2,number of actual parameters:3).
    Following is as follows source code.
    report ZROHIT_BDC_FK01 no standard page heading line-size 255.
    include bdcrecx1.
    DATA:BEGIN OF ITAB OCCURS 0,
         LIFNR(16),
         BUKRS(4),
         KTOKK(4),
         ANRED(15),
         NAME1(35),
         SORTL(35),
         STRAS(3),
         ORT01(35),
         ORT02(35),
         LAND1(10),
         AKONT(10),
         END OF ITAB.
    start-of-selection.
    CALL FUNCTION 'UPLOAD'
    * EXPORTING
    *   FILENAME                      = 'D:\'
    *   ACT_FILETYPE                  =
      TABLES
        DATA_TAB                      = ITAB
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    perform open_group.
    LOOP AT ITAB.
    perform bdc_dynpro      using 'SAPMF02K' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  ITAB-LIFNR                  'ROHIT100'.
    perform bdc_field       using 'RF02K-BUKRS'
                                  ITAB-BUKRS                  '1000'.
    perform bdc_field       using 'RF02K-KTOKK'
                                  ITAB-KTOKK                  '0002'.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_transaction using 'FK01'.
    END LOOP.
    perform close_group.
    thanks in advance
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code and please use code tags.
    Edited by: Rob Burbank on Oct 7, 2009 10:34 AM

    Hi,
    The performs should be like this:
    FORM bdc_dynpro USING program TYPE bdc_prog
                          dynpro TYPE bdc_dynr.
      CLEAR wa_bdcdata.
      wa_bdcdata-program = program.
      wa_bdcdata-dynpro = dynpro.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO gi_bdcdata.
    ENDFORM .                    " bdc_dynpro
    *&      FORM  BDC_FIELD
    FORM to get the field name and field value
    FORM bdc_field  USING fnam TYPE any
                          fval TYPE any.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = fnam.
      wa_bdcdata-fval = fval.
      APPEND wa_bdcdata TO gi_bdcdata.
    ENDFORM .                    " bdc_field
    and make the changes as stated in your code:
    LOOP AT ITAB.
    perform bdc_dynpro      using 'SAPMF02K' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    >>perform bdc_field       using 'RF02K-LIFNR'
            >>                      ITAB-LIFNR                  " 'ROHIT100'.
    >>perform bdc_field       using 'RF02K-BUKRS'
        >>                          ITAB-BUKRS                "  '1000'.
    >>perform bdc_field       using 'RF02K-KTOKK'
        >>                          ITAB-KTOKK                  " '0002'.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_transaction using 'FK01'.
    END LOOP.
    Regards,
    Rajesh Kumar

  • No Acct Document with BAPI_GOODSMVT_CREATE & BDC Recording for MB1A 221Q

    Please see my posting @ Re: BAPI_GOODSMVT_CREATE or BDC for MB1A not creating Accounting Doc
    It seems that I can do a 221Q direct via MB1A successfully and generate a Material Doc & an Accounting Doc.  I'm not using reference to Reservation / PO, but obviously I have to provide my Cost Center & Order#.
    If I create a BDC Recording from this same successful dataset and process the BDC "in the foreground", I get the Material Doc but the Accounting Doc is not created.  The same problem occurs in the Background.
    I also get this very same issue if I use the data in a call to BAPI_GOODSMVT_CREATE directly, followed by a BAPI_TRANSACTION_COMMIT.
    I can't quite figure out what the issue is, since if I'm using the same data as in the successful MB1A direct posting and creating a BDC recording from the very same data/screen sequence, shouldn't the Accounting Document be created?
    Many thanks..

    what error you are getting..? and are you able to post them separately .

  • BDC Recording for uploading data into Fi01

    HI,
    I need to upload date from a file into SAP Fi01 transaction
    i used a sample program and added my bdc recording to it as per instrucrion
    there is a error while uploading.
    i believe it is at the place i am pointing in bold. it is at read dataset. could you advice me how to solve it.
    CODE:
    REPORT Z_BANK_DIRECTORY
    NO STANDARD PAGE HEADING
    LINE-SIZE 200
    LINE-COUNT 300.
    *-- DATA DECLARATION--
    *---Types
    DATA : BEGIN OF t_upload,
    data element: BANKS
            BANKS_001(003),
    data element: BANKK
            BANKL_002(015),
    data element: BANKA
            BANKA_003(060),
    data element: REGIO
            PROVZ_004(003),
    data element: STRAS_GP
            STRAS_005(035),
    data element: ORT01_GP
            ORT01_006(035),
    data element: BRNCH
            BRNCH_007(040),
    data element: SWIFT
            SWIFT_008(011),
    data element: BGRUP
            BGRUP_009(002),
    data element: AD_TITLETX
            TITLE_MEDI_010(030),
    data element: AD_NAME1
            NAME1_011(040),
    data element: AD_STRSPP1
            STR_SUPPL1_012(040),
    data element: AD_STRSPP2
            STR_SUPPL2_013(040),
    data element: AD_STREET
            STREET_014(060),
    data element: AD_CITY2
            CITY2_015(040),
    data element: AD_CITY3
            HOME_CITY_016(040),
    data element: AD_PSTCD1
            POST_CODE1_017(010),
    data element: LAND1
            COUNTRY_018(003),
    data element: AD_POBX
            PO_BOX_019(010),
    data element: AD_PSTCD2
            POST_CODE2_020(010),
    data element: SPRAS
            LANGU_021(002),
    data element: AD_TLNMBR1
            TEL_NUMBER_022(030),
    data element: AD_MBNMBR1
            MOB_NUMBER_023(030),
    data element: AD_FXNMBR1
            FAX_NUMBER_024(030),
    data element: AD_SMTPADR
            SMTP_ADDR_025(132),
    data element: BANKA
            BANKA_026(060),
    data element: REGIO
            PROVZ_027(003),
    data element: STRAS_GP
            STRAS_028(035),
    data element: ORT01_GP
            ORT01_029(035),
    data element: BRNCH
            BRNCH_030(040),
    data element: SWIFT
            SWIFT_031(011),
    data element: BGRUP
            BGRUP_032(002),
    END OF t_upload.
    *--- Tables
    DATA : BEGIN OF i_bdcdata OCCURS 0."to hold the transaction t_upload
    INCLUDE STRUCTURE bdcdata.
    DATA: END OF i_bdcdata.
    DATA: i_upload LIKE STANDARD TABLE OF t_upload," to hold file data.
    i_upload1 LIKE STANDARD TABLE OF t_upload." to hold file data.
    *--- Work Areas
    DATA: wa_upload2 LIKE t_upload,
    wa_upload LIKE t_upload,
    wa_upload1 LIKE t_upload.
    *--- Variables
    DATA: v_count1(4) TYPE n,
    v_error TYPE c,
    v_session(12),
    v_field(21) TYPE c,
    v_message(60) type C.
    *--Constants
    DATA: c_open TYPE c VALUE '(',
    c_close TYPE c VALUE ')',
    c_x TYPE c VALUE 'X'.
    *---Initialisation
    initialization.
    refresh : i_upload , i_upload1 ,i_bdcdata.
    -------Selection Screen Design -
    *Selection screen for input of upload file address
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    ---AT SELECTION SCREEN -
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    *--For popup to select file.
    PERFORM give_help.
    -----START OF SELECTION -
    START-OF-SELECTION.
    *--Data upload using WS_Upload.
    PERFORM get_data.
    *-- OPEN SESSION
    PERFORM open_group.
    *--Insert transactions using BDCDATA table in the session.
    PERFORM do_transaction .
    *-- Close the session.
    PERFORM close_group.
    END-OF-SELECTION.
    *& Form f_get_data
    For data upload from external file.
    FORM get_data.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = p_file
    filetype = 'DAT'
    TABLES
    data_tab = i_upload
    EXCEPTIONS
    conversion_error = 1
    file_open_error = 2
    file_read_error = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    DELETE I_UPLOAD INDEX 1.
    ENDIF.
    ENDFORM. " f_get_data
    *& Form F_open_group
    To open session in session management.
    FORM open_group.
    v_session = 'FI01'.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    client = sy-mandt
    group = v_session
    user = sy-uname
    keep = 'X'.
    ENDFORM. " F_open_group
    *& Form f_do_transaction
    Insert transactions in session after passing values to BDCDATA
    FORM do_transaction.
    LOOP AT i_upload INTO wa_upload .
    *---- insert your generated codes from recording at SHDB here
    read dataset <b>wa_upload</b> into t_upload.
    if sy-subrc <> 0. exit. endif.
    perform bdc_dynpro      using 'SAPMF02B' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BNKA-BANKL'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BNKA-BANKS'
                                  t_upload-BANKS_001.
    perform bdc_field       using 'BNKA-BANKL'
                                  t_upload-BANKL_002.
    perform bdc_dynpro      using 'SAPMF02B' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BNKA-BGRUP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ADDR'.
    perform bdc_field       using 'BNKA-BANKA'
                                  t_upload-BANKA_003.
    perform bdc_field       using 'BNKA-PROVZ'
                                  t_upload-PROVZ_004.
    perform bdc_field       using 'BNKA-STRAS'
                                  t_upload-STRAS_005.
    perform bdc_field       using 'BNKA-ORT01'
                                  t_upload-ORT01_006.
    perform bdc_field       using 'BNKA-BRNCH'
                                  t_upload-BRNCH_007.
    perform bdc_field       using 'BNKA-SWIFT'
                                  t_upload-SWIFT_008.
    perform bdc_field       using 'BNKA-BGRUP'
                                  t_upload-BGRUP_009.
    perform bdc_dynpro      using 'SAPLSZA1' '0201'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'SZA1_D0100-SMTP_ADDR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=CONT'.
    perform bdc_field       using 'SZA1_D0100-TITLE_MEDI'
                                  t_upload-TITLE_MEDI_010.
    perform bdc_field       using 'ADDR1_DATA-NAME1'
                                  t_upload-NAME1_011.
    perform bdc_field       using 'ADDR1_DATA-STR_SUPPL1'
                                  t_upload-STR_SUPPL1_012.
    perform bdc_field       using 'ADDR1_DATA-STR_SUPPL2'
                                  t_upload-STR_SUPPL2_013.
    perform bdc_field       using 'ADDR1_DATA-STREET'
                                  t_upload-STREET_014.
    perform bdc_field       using 'ADDR1_DATA-CITY2'
                                  t_upload-CITY2_015.
    perform bdc_field       using 'ADDR1_DATA-HOME_CITY'
                                  t_upload-HOME_CITY_016.
    perform bdc_field       using 'ADDR1_DATA-POST_CODE1'
                                  t_upload-POST_CODE1_017.
    perform bdc_field       using 'ADDR1_DATA-COUNTRY'
                                  t_upload-COUNTRY_018.
    perform bdc_field       using 'ADDR1_DATA-PO_BOX'
                                  t_upload-PO_BOX_019.
    perform bdc_field       using 'ADDR1_DATA-POST_CODE2'
                                  t_upload-POST_CODE2_020.
    perform bdc_field       using 'ADDR1_DATA-LANGU'
                                  t_upload-LANGU_021.
    perform bdc_field       using 'SZA1_D0100-TEL_NUMBER'
                                  t_upload-TEL_NUMBER_022.
    perform bdc_field       using 'SZA1_D0100-MOB_NUMBER'
                                  t_upload-MOB_NUMBER_023.
    perform bdc_field       using 'SZA1_D0100-FAX_NUMBER'
                                  t_upload-FAX_NUMBER_024.
    perform bdc_field       using 'SZA1_D0100-SMTP_ADDR'
                                  t_upload-SMTP_ADDR_025.
    perform bdc_dynpro      using 'SAPMF02B' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'BNKA-BANKA'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    perform bdc_field       using 'BNKA-BANKA'
                                  t_upload-BANKA_026.
    perform bdc_field       using 'BNKA-PROVZ'
                                  t_upload-PROVZ_027.
    perform bdc_field       using 'BNKA-STRAS'
                                  t_upload-STRAS_028.
    perform bdc_field       using 'BNKA-ORT01'
                                  t_upload-ORT01_029.
    perform bdc_field       using 'BNKA-BRNCH'
                                  t_upload-BRNCH_030.
    perform bdc_field       using 'BNKA-SWIFT'
                                  t_upload-SWIFT_031.
    perform bdc_field       using 'BNKA-BGRUP'
                                  t_upload-BGRUP_032.
    *----- insertion ends
    perform bdc_transaction using 'FI01'.
    REFRESH : I_BDCDATA.
    CLEAR : WA_UPLOAD.
    ENDIF.
    ENDLOOP.
    ENDFORM. " f_do_transaction
    *& Form bdc_dynpro
    For appending screen details to BDCDATA
    FORM bdc_dynpro USING program dynpro.
    CLEAR i_bdcdata.
    i_bdcdata-program = program.
    i_bdcdata-dynpro = dynpro.
    i_bdcdata-dynbegin = 'X'.
    APPEND i_bdcdata.
    CLEAR i_bdcdata.
    ENDFORM. "bdc_dynpro
    *& Form bdc_field
    For appending field details to bdcdata table
    FORM bdc_field USING fnam fval.
    CLEAR i_bdcdata.
    i_bdcdata-fnam = fnam.
    i_bdcdata-fval = fval.
    APPEND i_bdcdata.
    CLEAR i_bdcdata.
    ENDFORM. " bdc_field
    *& Form bdc_transaction
    For inserting Transaction in the session
    FORM bdc_transaction USING tcode.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    tcode = 'FI01'
    TABLES
    dynprotab = i_bdcdata.
    ENDFORM. " bdc_transaction
    *& Form F_close_group
    For closing the session created in Session manager SM35
    FORM close_group.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    concatenate 'Session ' v_session 'successfully created' into v_field.
    MESSAGE v_field type 'I'..
    CALL TRANSACTION 'SM35'.
    ENDFORM. "f_close_group
    *& Form f_give_help
    For user help to select file
    FORM give_help.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    mask = ',.,..'
    mode = 'O'
    IMPORTING
    filename = p_file
    EXCEPTIONS
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    OTHERS = 5.
    IF sy-subrc <> 0 AND NOT sy-msgty IS INITIAL.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " f_give_help
    ---- End of Template -

    Actually, there is no need for the dataset statemant at all.  Comment that out, and add a line that moves the data from wa_upload to t_upload,  or you could change the rest of the references to point to wa_upload and forget about t_upload.  Your choice.
    LOOP AT i_upload INTO wa_upload .
    *---- insert your generated codes from recording at SHDB here
    *read dataset wa_upload into t_upload.
    *f sy-subrc <> 0. exit. endif.
    t_upload = wa_upload.
    Regards,
    RIch Heilman

  • BDC Recording for creating a new Transport request

    Hi folks,
            I have done BDC to update a view. It has to update the values in view and create a new request at run time. Its working fine in foreground. But when it comes to back ground, it shows error, saying no batch input data for that screen. Here i am cliking 'create new request' icon to create new request and system will generate a request at runtime. So it might be showign that error. Could any body suggest me how to handle this error. How to create a new request in BDC recording at ruen time....Thanks in advance..
              Shyam.

    Hi Shyam,
    Please check the recording. I think you have missed some thing  while recording.
    Best regards,
    raam

  • BDC Recording for Sorting a coloum

    Hi All,
    I have to do BDC Recording for  a transaction.During recording i have to select a coloum and sort it ascending and then do further processing.
    BDC recording happens for sorting but not for selecting coloum.
    and hence it gives error when we process the recording  that "Select a coloum".
    can u plz tell me how to add seelcting coloum in BDC recorording.
    Thanks

    Hi,
    You should try to incorporate your functionality using FIND or POSITION button instead of going for sort option.
    Find or position button work very good in this scenerio. With find button you can find the desired entry easily.
    Hope this will solve your problem.
    Regards,
    Brajvir

  • Handling errors in bdc

    Hi,
    How to handle errors in bdc call transaction method.
    what is the steps to download errors from bdcmsgcoll into flat file  in call transaction method
    uday

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

  • Bdc record

    Dear all,
       i created the sales order with that reference i created delivery also.
       when i am doing bdc record with vl01n error is occuring.
      error: No delivery-relevant items in order 0000012359,order type OR.
    plz solve the problem and give me the procedure. 
                                            Regards,
                                          mallikharjuna rao.

    Hi,
    i created the sales order with that reference i created delivery also.
    As u said u already created the delivery for that order. So when u do BDC recording it wont allow to do.
    Do one thing. Go to VL02N open the delivery. Menu=>Outbound delivery=>Delete.
    Now go to SHDB and record by creating new delivery. It will now now.
    But i sugest u to go with BAPI BAPI_GOODSMVT_CREATE
    rather than BDC for VL01N since it is enzoy transaction it is not advisable to use BDC even though it works.
    Check the FM documentation for BAPI. It is clearly explained on how to use.
    Thanks,
    Vinod.

Maybe you are looking for

  • IPhone 5 Calendar Issue: January 1, 1995

    I flew from the Eastern Time Zone into Central Time Zone, which is my home time zone, this afternoon, and tonight my iPhone 5 is telling me the date is January 1, 1995. Can anyone help explain why this is happening, and/or how to fix it? It sometimes

  • Nano 6th generation - flashing and flickering white screen loop

    I have an issue that does not seem to be exactly answered anywhere.  1.  The screen was bad and was not responsive when unplugged from the computer.   Black screen, no nothing. 2.  When connected to the computer it would show up in iTunes, however th

  • Lost Album in Album View

    I have an album that I first synched with the iTouch that was titled Greatest Hits by Queen. I could see the album artwork no problem in album view. Then this last weekend I downloaded a couple of songs from the album Greatest Hits by Fleetwood Mac.

  • Oracle 11.2.0.2 NLS_* parameters dynamically set

    Hello guys, I just did a systemcopy for an ERP system (r3load) and imported the export into the newest Oracle database (11.2.0.2) on Windows. Everything went fine apart from one strange parameter "error". After the installation when executing the aut

  • Concatenating the stings

    Hi friends , This is a scenerio from idoc to file . I need to concatnate 3 fields from the same segment . I concatenate the fields and map to the target . What I found is in source payload the field combination mapping does not exist . If I look at t