Errors in Flat files while using BDC

*Hey Experts,*
*I have made a BDC program which uploads an excel file into the system.Check the coding below*
*I tried to run the same data but i received the following error at the system  status.*
*Excel file://c:\cannot be processed .on checking in details i received this*
*Message no. UX893*
*Diagnosis*
*An error occurred while attempting to process Excel file FILE://C:\Users\Administrator\Desktop\jack abaper\.*
*Check whether:*
*the file exists*
*you have authorization to process the file*
*Excel is installed and can be run*
*System Response*
*Excel file FILE://C:\Users\Administrator\Desktop\jack abaper\ is not processed. The activity is terminated.*
*Procedure*
*When the error has been corrected, restart the program.*
*is there a way for the program to check the exact cause of error,like for my case the same data i was uploading.*
*if it could tell me which row of data in the file is bringing this error.Apart from that I am to run this program in background not foreground ,please note of that while forgering a solution.*
*Does anyone have a solution for this,or a better way gladly accept?*
*Thank you my fellow abapers*
*all help is appreciated.*
*regds*
*Ja*
*Below see program>>>*
REPORT  z_uploadbdc NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPE-POOLS: truxs.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_file TYPE  rlgrap-filename OBLIGATORY DEFAULT 'C:\'.
SELECTION-SCREEN : END OF BLOCK blk1.
*&     Global Declarations
TYPES: BEGIN OF t_datatab,
      col1(30)    TYPE c,
      col2(30)    TYPE c,
      col3(30)    TYPE c,
      END OF t_datatab.
DATA: it_datatab TYPE STANDARD TABLE OF t_datatab,
      wa_datatab TYPE t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
TYPES: BEGIN OF ty_material,
       matnr TYPE matnr,
       anzahl TYPE anzahl,
       eqtyp TYPE eqtyp,
       servon TYPE servon,
       serbis TYPE serbis,
       sernr TYPE serbis,
       END OF ty_material.
DATA: it_material TYPE TABLE OF ty_material,
      wa_material TYPE ty_material,
      it_bdcdata TYPE TABLE OF bdcdata,
      wa_bdcdata TYPE bdcdata.
Table for messages from call transaction.
The table is automatically filled with messages from call transaction.
DATA BEGIN OF messtab OCCURS 10.
        INCLUDE STRUCTURE bdcmsgcoll.
DATA END OF messtab.
DATA : WF_MESSAGE(100).
REFRESH MESSTAB.
*&   AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      field_name = 'P_FILE'
    IMPORTING
      file_name  = p_file.
*include bdcrecx1.
*&   START-OF-SELECTION
START-OF-SELECTION.
  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
  I_FIELD_SEPERATOR          =
      i_line_header              = 'X'
      i_tab_raw_data             = it_raw
      i_filename                 = p_file
    TABLES
      i_tab_converted_data       = it_material
    EXCEPTIONS
      conversion_failed = 1
      OTHERS            = 2.
  IF sy-subrc NE  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 it_material INTO wa_material.
    PERFORM bdc_dynpro      USING 'SAPMIEQ0' '2000'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RISA0-SERNR(01)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  'BU'.
    PERFORM bdc_field       USING 'RISA0-MATNR'
                                  wa_material-matnr.
    PERFORM bdc_field       USING 'RISA0-ANZAHL'
                                  wa_material-anzahl.
    PERFORM bdc_field       USING 'EQUI-EQTYP'
                                  wa_material-eqtyp.
    PERFORM bdc_field       USING 'RISA0-SERVON'
                                  wa_material-servon.
    PERFORM bdc_field       USING 'RISA0-SERBIS'
                                  wa_material-serbis.
    PERFORM bdc_field       USING 'RISA0-SERNR(01)'
                                   wa_material-sernr.
perform bdc_transaction using 'IQ04'.
    CALL TRANSACTION 'IQ04' USING it_bdcdata
                      MODE 'A' UPDATE 'S'
                      MESSAGES into messtab.
    REFRESH it_bdcdata.
ENDLOOP.
*&      Form  bdc_dynpro
      text
     -->PROGRAM    text
     -->DYNPRO     text
FORM bdc_dynpro USING program dynpro.
  CLEAR wa_bdcdata.
  wa_bdcdata-program = program.
  wa_bdcdata-dynpro = dynpro.
  wa_bdcdata-dynbegin = 'X'.
  APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.                    "bdc_dynpro
*&      Form  bdc_field
      text
     -->FNAM       text
     -->FVAL       text
FORM bdc_field USING fnam fval.
  CLEAR wa_bdcdata.
  wa_bdcdata-fnam = fnam.
  wa_bdcdata-fval = fval.
  APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.                    "bdc_field
perform close_group.
Edited by: JackAbaper on Feb 8, 2012 3:11 PM
Edited by: JackAbaper on Feb 8, 2012 3:14 PM
Edited by: JackAbaper on Feb 8, 2012 3:15 PM

Hi ,
This is what you can do.
Upload the file from presentation server to the application server through CG3Z.
Then you can fetch the file from Application server to your BDC  program (Which you want to run in background).
Regards,
Chandan.

Similar Messages

  • Bdc - errors in flat file

    hi,
    in BDC,
    after uploading data from flat file,
    how to find if there are any errors in flat file,
    before starting the session.

    Hi,
    You have to create internal tables for all the mandatory fields. see the following code :
    I am giving an example for XK01 Transaction.
    TYPES:BEGIN OF TY_XK01,
          LIFNR(10)      TYPE  C ,          "VENDOR'S ACCOUNT NUMBER
          BUKRS(4)       TYPE  C ,          "COMPANY CODE
          EKORG(4)       TYPE  C ,          "PURCHASING ORGANISATION
          KTOKK(4)       TYPE  C ,          "VENDOR ACCOUNT GROUP
          NAME1(35)      TYPE  C ,                              "NAME1
          SORTL(10)      TYPE  C ,          "SORT FIELD
          STRAS(35)      TYPE  C ,          "STREET
          PSTLZ(10)      TYPE  C ,          "POSTAL CODE
          ORT01(35)      TYPE  C ,          "CITY
          LAND1(3)       TYPE  C ,          "COUNTRY KEY
          REGIO(3)       TYPE  C ,          "REGION
          TIME_ZONE(6)   TYPE  C ,          "ADDRESS TIME ZONE
          LANGU(1)       TYPE  C ,          "LANGUAGE KEY
          TELF1(16)      TYPE  C ,          "TELEPHONE NUMBER
          TELFX(31)      TYPE  C ,          "FAX NUMBER
          SMTP_ADDR(241) TYPE  C ,          "E-MAIL ADDRESS
          URI_SCREEN(132) TYPE  C ,     "UNIFORM RESOURCE LOCATOR
          AKONT(10)      TYPE  C ,          "RECONCILITATION ACCOUNT
          ZUAWA(3)       TYPE  C ,          "KEY FOR SORTING ACCORDING TO ASSIGNMENT NUMBERS
          MINDK(3)       TYPE  C ,          "MINORITY INDICATORS
          ALTKN(10)      TYPE  C ,          "PREVIOUS MASTER RECORD NUMBER
          ZTERM(4)       TYPE  C ,          "TERMS OF PAYMENT KEY
          ZWELS(10)      TYPE  C ,          "LIST OF THE PAYMENT METHODS
          WAERS(5)       TYPE  C ,          "PURCHASE ORDER CURRENCY
          END OF TY_XK01,
    BEGIN OF TY_LIFNR,
         LIFNR(10)  TYPE  C ,
         END OF TY_LIFNR,
         BEGIN OF TY_BUKRS,
         BUKRS(4)  TYPE  C ,
         END OF TY_BUKRS,
         BEGIN OF TY_EKORG,
         EKORG(4)  TYPE  C ,
         END OF TY_EKORG,
         BEGIN OF TY_KTOKK,
         KTOKK(4)  TYPE  C ,
         END OF TY_KTOKK,
         BEGIN OF TY_LAND1,
         LAND1(3)  TYPE  C ,
         END OF TY_LAND1,
         BEGIN OF TY_LANGU,
         LANGU(1)  TYPE  C ,
         END OF TY_LANGU,
         BEGIN OF TY_AKONT,
         AKONT(10) TYPE  C ,
         END OF TY_AKONT,
         BEGIN OF TY_ZUAWA,
         ZUAWA(3)  TYPE  C ,
         END OF TY_ZUAWA,
         BEGIN OF TY_MINDK,
         MINDK(3) TYPE  C ,
         END OF TY_MINDK,
         BEGIN OF TY_WAERS,
         WAERS(5)  TYPE  C ,
         END OF TY_WAERS.
    DATA : I_XK01     TYPE TABLE OF  TY_XK01,     "FOR HOLDING DATA FROM FLAT FILE
           I_SUCCMESG TYPE TABLE OF  TY_MESG,     "FOR SUCCESS RECORDS DETAILS
           I_ERRMESG  TYPE TABLE OF  TY_MESG,     "FOR ERROR RECORDS DETAILS
           I_ERROR TYPE TABLE OF TY_ERROR,
    I_LIFNR TYPE TABLE OF TY_LIFNR,
    I_BUKRS TYPE TABLE OF TY_BUKRS,
    I_EKORG TYPE TABLE OF TY_EKORG,
    I_KTOKK TYPE TABLE OF TY_KTOKK,
    I_LAND1 TYPE TABLE OF TY_LAND1,
    I_LANGU TYPE TABLE OF TY_LANGU,
    I_AKONT TYPE TABLE OF TY_AKONT,
    I_ZUAWA TYPE TABLE OF TY_ZUAWA,
    I_MINDK TYPE TABLE OF TY_MINDK,
    I_WAERS TYPE TABLE OF TY_WAERS,
    I_FINALMESG TYPE TABLE OF TY_ERROR,
    I_MESG TYPE TABLE OF TY_MESG.
    *& WORK AREA DECLARATION
    DATA:  WA_XK01     TYPE TY_XK01,               "FOR HOLDING DATA FROM FLAT FILE
           WA_SUCCMESG TYPE TY_MESG,               "FOR SUCCESS RECORDS DETAILS
           WA_ERRMESG  TYPE TY_MESG,               "FOR ERROR RECORDS DETAILS
           WA_ERROR TYPE TY_ERROR,
    WA_LIFNR TYPE TY_LIFNR,
    WA_BUKRS TYPE TY_BUKRS,
    WA_EKORG TYPE TY_EKORG,
    WA_KTOKK TYPE TY_KTOKK,
    WA_LAND1 TYPE TY_LAND1,
    WA_LANGU TYPE TY_LANGU,
    WA_AKONT TYPE TY_AKONT,
    WA_ZUAWA TYPE TY_ZUAWA,
    WA_MINDK TYPE TY_MINDK,
    WA_WAERS TYPE TY_WAERS,
    WA_MESG TYPE TY_MESG,
    WA_FINALMESG TYPE TY_ERROR.
    INITIALIZATION.
    SELECT LIFNR FROM LFA1 INTO TABLE I_LIFNR.
      SELECT BUKRS FROM T001 INTO TABLE I_BUKRS .
      SELECT EKORG FROM T024E INTO TABLE I_EKORG .
      SELECT KTOKK FROM T077K INTO TABLE I_KTOKK .
      SELECT LAND1 FROM T005 INTO TABLE I_LAND1.
      SELECT SPRAS FROM T002 INTO TABLE I_LANGU.
      SELECT SAKNR FROM SKA1 INTO TABLE I_AKONT .
      SELECT ZUAWA FROM TZUN INTO TABLE I_ZUAWA .
      SELECT MINDK FROM T059M INTO TABLE I_MINDK .
      SELECT WAERS FROM TCURC INTO TABLE I_WAERS.
    LOOP AT I_XK01 INTO WA_XK01.
          TRANSLATE WA_XK01-LIFNR TO UPPER CASE.
          READ TABLE I_LIFNR INTO WA_LIFNR WITH KEY LIFNR = WA_XK01-LIFNR.
          IF SY-SUBRC = 0 .
            CONCATENATE WA_MESG-MESG TEXT-100 WA_XK01-LIFNR TEXT-101  ' , ' INTO WA_MESG-MESG.
          ENDIF.
          TRANSLATE WA_XK01-BUKRS TO UPPER CASE.
          READ TABLE I_BUKRS INTO WA_BUKRS WITH KEY BUKRS = WA_XK01-BUKRS.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG  TEXT-102 WA_XK01-BUKRS TEXT-103  ' , ' INTO WA_MESG-MESG.
          ENDIF.
          TRANSLATE WA_XK01-EKORG TO UPPER CASE.
          READ TABLE I_EKORG INTO WA_EKORG WITH KEY EKORG = WA_XK01-EKORG.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-104    WA_XK01-EKORG  TEXT-103  ',' INTO WA_MESG-MESG.
          ENDIF.
          TRANSLATE WA_XK01-KTOKK TO UPPER CASE.
          READ TABLE I_KTOKK INTO WA_KTOKK WITH KEY KTOKK = WA_XK01-KTOKK.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-105   WA_XK01-KTOKK  TEXT-103   ',' INTO WA_MESG-MESG.
          ENDIF.
          TRANSLATE WA_XK01-LAND1 TO UPPER CASE.
          READ TABLE I_LAND1 INTO WA_LAND1 WITH KEY LAND1 = WA_XK01-LAND1.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-106   WA_XK01-LAND1  TEXT-103   ',' INTO WA_MESG-MESG.
          ENDIF.
          TRANSLATE WA_XK01-LANGU TO UPPER CASE.
          READ TABLE I_LANGU INTO WA_LANGU WITH KEY LANGU = WA_XK01-LANGU.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-107  WA_XK01-LANGU  TEXT-103   ',' INTO WA_MESG-MESG.
          ENDIF.
          READ TABLE I_AKONT INTO WA_AKONT WITH KEY AKONT = WA_XK01-AKONT.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-108   WA_XK01-AKONT  TEXT-103  ',' INTO WA_MESG-MESG.
          ENDIF.
          READ TABLE I_ZUAWA INTO WA_ZUAWA WITH KEY ZUAWA = WA_XK01-ZUAWA.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-109    WA_XK01-ZUAWA  TEXT-103   ',' INTO WA_MESG-MESG.
          ENDIF.
          READ TABLE I_MINDK INTO WA_MINDK WITH KEY MINDK = WA_XK01-MINDK.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-110    WA_XK01-MINDK  TEXT-103   ',' INTO WA_MESG-MESG.
          ENDIF.
          TRANSLATE WA_XK01-WAERS TO UPPER CASE.
          READ TABLE I_WAERS INTO WA_WAERS WITH KEY WAERS = WA_XK01-WAERS.
          IF SY-SUBRC <> 0 .
            CONCATENATE WA_MESG-MESG TEXT-111   WA_XK01-WAERS  TEXT-103   ',' INTO WA_MESG-MESG.
          ENDIF.
    append wa_mesg to err_mesg. 
    endloop.
    I am populating the error messages into workarea using concatenate statement.
    Hope this  solves the problem.
    Reward points if helpful.
    Thanks and Regards,
    Narayana.

  • Type of error in the log file while using using call transaction mode u2018Eu2019

    Hi Gurus,
    Please Answer for this qusetion urgently
    what type of error exactly  you will be seeing in the log file while using call transaction mode u2018Eu2019?
    Thanks/
    Radha.

    Hi,
    Can you be clear.
    In call transaction , no error logs  are created, you have to handle the errors explicitly using the structure BDCMSGCOLL.
    Whenever you use E mode then if the transaction encounters any of the errors i.e. data type mismatching or invalid values etc, it will stop at that screen.
    You can handle the errors in call transaction in the following method.
    create a table using the structure BDCMSGCOLL.
    then
    loop at ......
          CALL TRANSACTION 'XK01' USING I_BDCDATA MODE 'N' UPDATE 'S' MESSAGES INTO I_MESGTAB.
    endloop.
      SORT I_MESGTAB BY MSGID MSGV1 ASCENDING.
      DELETE ADJACENT DUPLICATES FROM I_MESGTAB.
      LOOP AT I_MESGTAB.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID   = I_MESGTAB-MSGID
            LANG = I_MESGTAB-MSGSPRA
            NO   = I_MESGTAB-MSGNR
            V1   = I_MESGTAB-MSGV1
            V2   = I_MESGTAB-MSGV2
            V3   = I_MESGTAB-MSGV3
            V4   = I_MESGTAB-MSGV4
          IMPORTING
            MSG  = MESG1.
        IF I_MESGTAB-MSGTYP = 'S' .
          WA_SUCCMESG-MESG = MESG1.
          APPEND WA_SUCCMESG TO I_SUCCMESG.
    else     IF I_MESGTAB-MSGTYP = 'E' .
          WA_ERRMESG-MESG = MESG1.
          APPEND WA_ERRMESG TO I_ERRMESG.
        ENDIF.
      ENDLOOP.
    Hope this is clear.
    Thanks and Regards.

  • Export table data in a flat file without using FL

    Hi,
    I am looking for options where I can export table data into a flat file without using FL(File Layout) i.e., by using App Engine only.
    Please share your experience if you did anything as this
    Thanks

    A simple way to export any record (table/view) to an csv fiel, is to create a rowset and loop through all record fields, like below example code
    Local Rowset &RS;
    Local Record &Rec;
    Local File &MYFILE;
    Local string &FileName, &strRecName, &Line, &Seperator, &Value;
    Local number &numRow, &numField;
    &FileName = "c:\temp\test.csv";
    &strRecName = "PSOPRDEFN";
    &Seperator = ";";
    &RS = CreateRowset(@("Record." | &strRecName));
    &RS.Fill();
    &MYFILE = GetFile(&FileName, "W", %FilePath_Absolute);
    If &MYFILE.IsOpen Then
       For &numRow = 1 To &RS.ActiveRowCount
          &Rec = &RS(&numRow).GetRecord(@("RECORD." | &strRecName));
          For &numField = 1 To &Rec.FieldCount
             &Value = String(&Rec.GetField(&numField).Value);
             If &numField = 1 Then
                &Line = &Value;
             Else
                &Line = &Line | &Seperator | &Value;
             End-If;
          End-For;
          &MYFILE.WriteLine(&Line);
       End-For;
    End-If;
    &MYFILE.Close(); You can of course create an application class for generic calling this piece of code.
    Hope it helps.
    Note:
    Do not come complaining to me on performance issues ;)

  • After the most recent iPhoto update, I keep getting the following error: "iPhoto quit unexpectedly while using the Sonix SN9c201 webcam plugin."  This seems to happen after *every* iPhoto update.  Is there a fix on the way?

    After the most recent iPhoto update, I keep getting the following error: "iPhoto quit unexpectedly while using the Sonix SN9c201 webcam plugin."  This seems to happen after *every* iPhoto update.  Is there a fix on the way?

    As you can see below, when I right click, I have no such option.  In the User Account Settings, I'm operating as the "System Administrator".
    Any other suggestions?

  • Process chains from the flat file by using filezilla client version in  BI

    Hi experts,
    please let me know how to create the process chains from  flat file by using filezilla client version.
    so far, I didn't work with file zilla FTP. can anybody give detailed step by step procedure to find the flat files and download them and creating process chains from that flat file.
    Thanks & Regards,
    Babu..

    Hi,
    Check these:----
    Process chain configuration for Flat file loading
    http://wiki.sdn.sap.com/wiki/display/BI/Howtowriteroutinetofetchcurrentday%27sfilename
    Regards,
    Suman

  • Reg : Error in flat file in BDC

    hi friends...
    let consider 10 records in my flat file...
    suppose 5th record is error means
    In BDC Session method, what happen records before and after the error record, its get update or not ? like
    In BDC Call Transaction method, what happen records before and after the error record, its get update or not ?
    please give me some detail...
    Regards
    Selva

    Hi,
    In call transaction method you will have an option of Displaying No screens, all screens and Error screens,
    If you select No screens all other records except error records will be process and messages will be collected by an internal table of type bdcmsgcoll.
    In all screens you need to process each screen manually yourself by selecting the OK code. It is kinda like debugging. So when you encounter the error screen you can change the error data and proceed.
    When you select error screens it will stop when the error occurs. So you need to correct the error and continue with the further processing.
    Regards,
    Pramod

  • Error file generation using BDC

    Hi .. friends . This is Sudhir . I have  a scenario of loading 50 materials using BDC concept (generate session method) with tcode mm01. During loading if we have any faulty materials then they have to be written in a separate flat file (in the location which we specify in our pc). How can it be done?  Hope your answers will be helpful for me to proceed further. Expecting for your reply...
    With Regards
    Sudhir S

    Hi  Sudhir,
                I had also similar requirement through Call Transaction method, Solution is
               We can store all messages occuring during exection of transaction (e.g MM01) in an internal table of type BDCMSGCOLL, so it contains message id, message no and not message description for that u have to  pass internal table to a function module  MESSAGE_TEXT_BUILD now u can get message description now store this in an internal table.
              Pass this internal table to a function module GUI_DOWNLOAD this will create flat file on ur PC based on the location u have given to this function module.
              For session method, session log contains the information u can check   INCLUDE program BDCRECX1 which will be created during recording, run this program in the debugger mode u will get idea.
    Hope this will help u..............

  • Error while using BDC

    Hi Experts,
         I have used the alv list report
    for eg: the output is
    vendor.no  plant  quantity
    i had displayed quantity's sum at the end of the field(quantity),using do_sum = 'x'.
    that total amount(wrbtr) should display in FB60(in amount field)
    i had used bdc for this,but im getting the error as
    FIELD INVFO-WRBTR. input value is longer than screen field
    Can anyone suggest me on this issue.
    Regards,
    Sharmila.S

    data:value type c.
    loop at it_mseg1.
        move it_mseg1-lifnr to bdc-lifnr.
        move it_mseg1-werks to bdc-werks.
        move it_mseg1-diff to bdc-diff1.
        collect bdc.
        clear it_mseg1.
        endloop.
        value = bdc-diff1.*this is the value*
        CONDENSE value no-gaps.
    loop at bdc.
    perform bdc_dynpro      using 'SAPMF05A' '1100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *perform bdc_field       using 'INVFO-WRBTR'
                                  value.*
    *perform bdc_field       using 'INVFO-WRBTR'
                                  value.*
    *perform bdc_field       using 'INVFO-WRBTR'
                                  value.*
    *perform bdc_field       using 'INVFO-WRBTR'
                                  value.*
    *perform bdc_field       using 'INVFO-WRBTR'
                                  value.*
    *perform bdc_field       using 'INVFO-WRBTR'
                                  value.*
      CALL TRANSACTION 'FB60' USING BDCDATA MODE 'A' .
    ENDLOOP.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Edited by: Sharmila Somasundaram on Dec 30, 2009 6:31 PM
    Edited by: Sharmila Somasundaram on Dec 30, 2009 6:52 PM

  • Error in uploading the data using BDC

    Hi All,
    I developed a BDC to upload the data for Infotype-0195.When I am trying to upload the flatfile using Functional Module option I am getting the error Invalid Date Format.
    Can anyone please help me out giving the solution..........
    Thanks in advance,
    Deepika

    Hi Avinash,
    I am passing the date field in the format MM/DD/YYYY but in the program i am converting to the format YYYYMMDD using concatenate and then passing the value to the FM but still I am getting the error.
    For ur convenience I am sending the code
    *-- Includes Declaration                                               *
    INCLUDE zixx_data_upload.
    INCLUDE zixx_conversion_log.
    INCLUDE bdcrecx1.
    *-- SELECTION SCREEN                                                   *
    SELECTION-SCREEN BEGIN OF BLOCK funcmod WITH FRAME TITLE text-t01.
    PARAMETERS : p_fm   TYPE c AS CHECKBOX.
    PARAMETERS : p_ctumod TYPE ctu_mode DEFAULT '0',
                 p_date TYPE c AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK funcmod.
    TYPES Declaration.
    Types decalration for flat file structure
    *Declaration for internal table/wa for flat file structure
    TYPES: BEGIN OF gt_data,
              pernr TYPE rp50g-pernr,
              begda(10) TYPE c,
              endda(10) TYPE c,
              gcase     TYPE pb10_gcase,
              objps TYPE p0195-objps,
              ordcd TYPE p0195-ordcd,
              rulid TYPE p0195-rulid,
              ibaln(13) TYPE c,
              deduc(13) TYPE c,
              dedut TYPE p0195-dedut,
              li1no TYPE q0195-li1no,
              li1ex TYPE q0195-li1ex,
              nval1(13) TYPE c,
              nuni1 TYPE p0195-nuni1,
              li2no TYPE q0195-li1no,
              li2ex TYPE q0195-li2ex,
              nval2(13) TYPE c,
              nuni2 TYPE p0195-nuni2,
              addno TYPE q0195-addno,
              addex TYPE q0195-addex,
              addvl(13) TYPE c,
              addun TYPE p0195-addun,
              fstat TYPE p0195-fstat,
              exemp TYPE p0195-exemp,
              addde TYPE p0195-addde,
              levda(10) TYPE c,
              fild1 TYPE p0195-fild1,
              fild2 TYPE p0195-fild2,
              fild3 TYPE p0195-fild3,
              fild4 TYPE p0195-fild4,
            END OF gt_data,
            BEGIN OF gt_0194,
               pernr TYPE p0194-pernr,
               begda TYPE p0194-begda,
               endda TYPE p0194-endda,
               subty TYPE p0194-subty,
               lifnr TYPE p0194-lifnr,
               schid TYPE p0194-schid,
               rulnr TYPE p0194-rulnr,
               plain TYPE p0194-plain,
               orign TYPE p0194-orign,
               orcod TYPE p0194-orcod,
               ornam TYPE p0194-ornam,
               orstr TYPE p0194-orstr,
               orort TYPE p0194-orort,
               orreg TYPE p0194-orreg,
               orcnt TYPE p0194-orcnt,
               orplz TYPE p0194-orplz,
               lapdy TYPE p0194-lapdy,
               lapdt TYPE p0194-lapdt,
               gcase TYPE p0194-gcase,
               gprio TYPE p0194-gprio,
               gcate TYPE p0194-gcate,
               gstat TYPE p0194-gstat,
               rcvdd TYPE p0194-rcvdd,
               rlsdd TYPE p0194-rlsdd,
               scrul TYPE p0194-scrul,
            END OF gt_0194.
    TYPES: BEGIN OF gt_data_d,
              pernr TYPE rp50g-pernr,
              begda(10) TYPE c,
              endda(10) TYPE c,
              gcase     TYPE pb10_gcase,
              objps TYPE p0195-objps,
              ordcd TYPE p0195-ordcd,
              rulid TYPE p0195-rulid,
              ibaln(13) TYPE c,
              deduc(13) TYPE c,
              dedut TYPE p0195-dedut,
              li1no TYPE q0195-li1no,
              li1ex TYPE q0195-li1ex,
              nval1(13) TYPE c,
              nuni1 TYPE p0195-nuni1,
              li2no TYPE q0195-li1no,
              li2ex TYPE q0195-li2ex,
              nval2(13) TYPE c,
              nuni2 TYPE p0195-nuni2,
              addno TYPE q0195-addno,
              addex TYPE q0195-addex,
              addvl(13) TYPE c,
              addun TYPE p0195-addun,
              fstat TYPE p0195-fstat,
              exemp TYPE p0195-exemp,
              addde TYPE p0195-addde,
              fild1 TYPE p0195-fild1,
              fild2 TYPE p0195-fild2,
              fild3 TYPE p0195-fild3,
              fild4 TYPE p0195-fild4,
            END OF gt_data_d.
    INTERNAL TABLE/WORK AREA Declaration.
    *Declaration for internal table/wa for flat file structure
    DATA:    gi_data       TYPE TABLE OF gt_data,
             gw_data       TYPE gt_data,
             gi_0194       TYPE TABLE OF gt_0194,
             gw_0194       TYPE gt_0194,
    *Declaration for BDCDATA
            gi_bdcdata     TYPE STANDARD TABLE OF bdcdata,
            gw_bdcdata     TYPE bdcdata,
    *Declaration for BDCMSGCOLL
            gi_bdcmsgcoll  TYPE TABLE OF bdcmsgcoll,
            gw_bdcmsgcoll  TYPE bdcmsgcoll,
             gi_data_d     TYPE TABLE OF gt_data_d,
             gw_data_d     TYPE gt_data_d,
             gw_p0195      TYPE p0195,
             gw_p0194      TYPE pa0194.
    DATA: gw_return TYPE bapireturn1,
    *Declaration for Global Variables
            gv_count(5)    TYPE c VALUE 0.
    *Declaration for constants
    CONSTANTS: gc_update               VALUE 'L',
               gc_msgid(2)             VALUE 'PG',
               gc_s_msgid(3)           VALUE '102',
               gc_pa30 TYPE tstc-tcode VALUE 'PA30',
               gc_200(3)               VALUE '200'.
    *-- AT SELECTION SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      nodata = ' '.
      group = sy-uname.
    *To change the screen attributes dynamically.
      PERFORM upload_screen_output.
    *-- START-OF-SELECTION                                                 *
    START-OF-SELECTION.
      IF p_date = 'X'.
    *-- Routine to upload the file data
        PERFORM upload USING 'X'       "HAS_SEPARATOR
                             'ASC'     "File Type
                             space     "ALT_SEPARATOR Alternate separator
                             'X'       "DISPLAY_ERROR
                             'X'       "ERROR_OCCURRED
                             gi_data. "TABLE Table to upload into
        IF NOT gi_data IS INITIAL.
          SELECT pernr begda endda subty
                 lifnr schid rulnr
                 plain orign orcod
                 ornam orstr orort
                 orreg orcnt orplz
                 lapdy lapdt gcase
                 gprio gcate gstat
                 rcvdd rlsdd scrul
            FROM pa0194
            INTO TABLE gi_0194
             FOR ALL ENTRIES IN gi_data
           WHERE pernr = gi_data-pernr
             AND gcase = gi_data-gcase.
    *-- Routine to perform bdc
          IF sy-subrc IS INITIAL.
            IF p_fm NE 'X'.
              PERFORM bdc.
            ELSE.
              PERFORM function_module.
            ENDIF.
          ENDIF.
        ENDIF.
      ELSE.
    *-- Routine to upload the file data
        PERFORM upload USING 'X'       "HAS_SEPARATOR
                             'ASC'     "File Type
                             space     "ALT_SEPARATOR Alternate separator
                             'X'       "DISPLAY_ERROR
                             'X'       "ERROR_OCCURRED
                             gi_data_d. "TABLE Table to upload into
        IF NOT gi_data_d IS INITIAL.
          IF p_fm EQ 'X'.
            PERFORM function_module.
          ENDIF.
        ENDIF.
      ENDIF.
    *Perform to insert the filename in Z-Table and move the file from New
    *to Processed in APP Server.
      SORT gi_log BY msg_typ.
      READ TABLE gi_log INTO gw_log WITH KEY msg_typ = 'E' BINARY SEARCH.
      IF sy-subrc <> '0'.
        PERFORM file_moving USING gi_data.
      ENDIF.
    *-- END-OF-SELECTION                                                   *
    END-OF-SELECTION.
    *-- Routine to display conversion log
      PERFORM log_display.
      Subroutine Pool
    *&      Form  BDC
          Routine to perform bdc
    FORM bdc .
    *Data declaration for collecting success and error records
      DATA: lv_success(5)     TYPE c VALUE 0,
            lv_begda  TYPE string,
            lv_rlsdd  TYPE string,
            lv_lapdt  TYPE string,
            lv_endda  TYPE string,
            lv_rcvdd  TYPE string.
      gv_count = 0.
      PERFORM open_group.
      SORT gi_0194 BY pernr gcase.
      LOOP AT gi_data INTO gw_data.
        gv_count = gv_count + 1.
        READ TABLE gi_0194 INTO gw_0194 WITH KEY pernr = gw_data-pernr
                                                 gcase = gw_data-gcase.
        IF sy-subrc = 0.
       LOOP AT gi_0194 INTO gw_0194 WHERE gcase = gw_data-grnum.
          MOVE gw_0194-begda TO lv_begda.
          MOVE gw_0194-endda TO lv_endda.
    *FUNCTION MODULE TO CONVERT DATE FORMAT
          CALL FUNCTION '/SAPDII/SPP05_CONVERT_DATE'
            EXPORTING
              if_date = lv_begda
            IMPORTING
              ef_date = lv_begda.
          CALL FUNCTION '/SAPDII/SPP05_CONVERT_DATE'
            EXPORTING
              if_date = lv_endda
            IMPORTING
              ef_date = lv_endda.
          PERFORM bdc_dynpro      USING 'SAPMP50A' '1000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=MOD'.
          PERFORM bdc_field       USING 'RP50G-PERNR'
                                        gw_data-pernr.
          PERFORM bdc_field       USING 'RP50G-TIMR6'
                                        'X'.
          PERFORM bdc_field       USING 'RP50G-CHOIC'
                                        '0194'.
          PERFORM bdc_field       USING 'RP50G-SUBTY'
                                        gw_0194-subty.
          PERFORM bdc_dynpro      USING 'MP019400' '2000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=GROR'.
          PERFORM bdc_field       USING 'P0194-BEGDA'
                                        lv_begda.
          PERFORM bdc_field       USING 'P0194-ENDDA'
                                        lv_endda.
          PERFORM bdc_field       USING 'P0194-LIFNR'
                                        gw_0194-lifnr.
          PERFORM bdc_field       USING 'P0194-SCHID'
                                        gw_0194-schid.
          PERFORM bdc_field       USING 'P0194-RULNR'
                                        gw_0194-rulnr.
          PERFORM bdc_field       USING 'P0194-pLAIN'
                                        gw_0194-plain.
          PERFORM bdc_field       USING 'P0194-ORIGN'
                                        gw_0194-orign.
          PERFORM bdc_field       USING 'P0194-ORCOD'
                                        gw_0194-orcod.
          PERFORM bdc_field       USING 'P0194-ORNAM'
                                        gw_0194-ornam.
          PERFORM bdc_field       USING 'P0194-ORSTR'
                                        gw_0194-orstr.
          PERFORM bdc_field       USING 'P0194-ORORT'
                                        gw_0194-orort.
          PERFORM bdc_field       USING 'P0194-ORREG'
                                        gw_0194-orreg.
          PERFORM bdc_field       USING 'P0194-ORCNT'
                                        gw_0194-orcnt.
          PERFORM bdc_field       USING 'P0194-ORPLZ'
                                        gw_0194-orplz.
          PERFORM bdc_field       USING 'P0194-LAPDY'
                                        gw_0194-lapdy.
          IF gw_0194-lapdt IS NOT INITIAL.
            MOVE gw_0194-lapdt TO lv_lapdt.
            CALL FUNCTION '/SAPDII/SPP05_CONVERT_DATE'
              EXPORTING
                if_date = lv_lapdt
              IMPORTING
                ef_date = lv_lapdt.
            PERFORM bdc_field       USING 'P0194-LAPDT'
                                          lv_lapdt.
          ENDIF.
          PERFORM bdc_field       USING 'P0194-GCASE'
                                        gw_0194-gcase.
          PERFORM bdc_field       USING 'P0194-GPRIO'
                                        gw_0194-gprio.
          PERFORM bdc_field       USING 'P0194-GCATE'
                                        gw_0194-gcate.
          PERFORM bdc_field       USING 'P0194-GSTAT'
                                        gw_0194-gstat.
          IF gw_0194-rcvdd IS NOT INITIAL.
            MOVE gw_0194-rcvdd TO lv_rcvdd.
            CALL FUNCTION '/SAPDII/SPP05_CONVERT_DATE'
              EXPORTING
                if_date = lv_rcvdd
              IMPORTING
                ef_date = lv_rcvdd.
            PERFORM bdc_field       USING 'P0194-RCVDD'
                                          lv_rcvdd.
          ENDIF.
          IF gw_0194-rlsdd IS NOT INITIAL.
            MOVE gw_0194-rlsdd TO lv_rlsdd.
            CALL FUNCTION '/SAPDII/SPP05_CONVERT_DATE'
              EXPORTING
                if_date = lv_rlsdd
              IMPORTING
                ef_date = lv_rlsdd.
            PERFORM bdc_field       USING 'P0194-RLSDD'
                                          lv_rlsdd.
          ENDIF.
          PERFORM bdc_field       USING 'P0194-SCRUL'
                                        gw_0194-scrul.
         PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.
         PERFORM bdc_field       USING 'BDC_CURSOR'
                                       'SPOP-TEXTLINE1'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '=YES'.
          PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'SPOP-TEXTLINE1'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=YES'.
          PERFORM bdc_dynpro      USING 'MP019500' '2000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=UPD'.
          PERFORM bdc_field       USING 'P0195-BEGDA'
                                        gw_data-begda.
          PERFORM bdc_field       USING 'P0195-ENDDA'
                                        gw_data-endda.
          PERFORM bdc_field       USING 'P0195-ORDCD'
                                        gw_data-ordcd.
          PERFORM bdc_field       USING 'P0195-RULID'
                                        gw_data-rulid.
          PERFORM bdc_field       USING 'P0195-IBALN'
                                        gw_data-ibaln.
          PERFORM bdc_field       USING 'P0195-DEDUC'
                                        gw_data-deduc.
          PERFORM bdc_field       USING 'P0195-DEDUT'
                                        gw_data-dedut.
    Begin of Insertion V2.0 by S.NATARAJAN
         IF ( ( gw_data-li1no = '1' AND gw_data-li1ex = ''  ) OR
              ( gw_data-li1no = ''  AND gw_data-li1ex = ''  ) ).
          IF ( ( gw_data-li1no = '1' AND gw_data-li1ex = ''  ) OR
               ( gw_data-li1no = ''  AND gw_data-li1ex = ''  ) OR
               ( gw_data-li1no = ''  AND gw_data-li1ex = '2' ) ).
    End of Insertion V2.0 by S.NATARAJAN
            PERFORM bdc_field       USING 'Q0195-LI1NO'
                                          'X'.
            PERFORM bdc_field       USING 'P0195-NVAL1'
                                          gw_data-nval1.
            PERFORM bdc_field       USING 'P0195-NUNI1'
                                          gw_data-nuni1.
    Begin of Insertion V2.0 by S.NATARAJAN
         ELSEIF  gw_data-li1no = '' AND gw_data-li1ex = '2'  .
          ELSEIF ( gw_data-li1no = '' AND gw_data-li1ex = '1' ) .
    End of Insertion V2.0 by S.NATARAJAN
            PERFORM bdc_field       USING 'Q0195-LI1EX'
                                          'X'.
            PERFORM bdc_field       USING 'P0195-NVAL1'
                                          gw_data-nval1.
            PERFORM bdc_field       USING 'P0195-NUNI1'
                                          gw_data-nuni1.
          ENDIF.
    Begin of Insertion V2.0 by S.NATARAJAN
         IF ( ( gw_data-li2no = '1' AND gw_data-li2ex = ''  ) OR
              ( gw_data-li2no = ''  AND gw_data-li2ex = ''  ) ).
          IF ( ( gw_data-li2no = '1' AND gw_data-li2ex = ''  ) OR
               ( gw_data-li2no = ''  AND gw_data-li2ex = ''  ) OR
               ( gw_data-li2no = ''  AND gw_data-li2ex = '2' ) ).
            PERFORM bdc_field       USING 'Q0195-LI2NO'
                                          'X'.
            PERFORM bdc_field       USING 'P0195-NVAL2'
                                          gw_data-nval2.
            PERFORM bdc_field       USING 'P0195-NUNI2'
                                          gw_data-nuni2.
    Begin of Insertion V2.0 by S.NATARAJAN
         ELSEIF  ( gw_data-li2no = '' AND gw_data-li2ex = '2' ).
          ELSEIF  ( gw_data-li2no = '' AND gw_data-li2ex = '1' ).
    End of Insertion V2.0 by S.NATARAJAN
            PERFORM bdc_field       USING 'Q0195-LI2EX'
                                          'X'.
            PERFORM bdc_field       USING 'P0195-NVAL2'
                                          gw_data-nval2.
            PERFORM bdc_field       USING 'P0195-NUNI2'
                                          gw_data-nuni2.
          ENDIF.
    Begin of Insertion V2.0 by S.NATARAJAN
         IF ( ( gw_data-addno = '1' AND gw_data-addex = ''  ) OR
              ( gw_data-addno = ''  AND gw_data-addex = ''  ) ).
    End of Insertion V2.0 by S.NATARAJAN
          IF ( ( gw_data-addno = '1' AND gw_data-addex = ''  ) OR
               ( gw_data-addno = ''  AND gw_data-addex = ''  ) OR
               ( gw_data-addno = ''  AND gw_data-addex = '2' ) ) .
            PERFORM bdc_field       USING 'Q0195-ADDNO'
                                          'X'.
            PERFORM bdc_field       USING 'P0195-ADDVL'
                                          gw_data-addvl.
            PERFORM bdc_field       USING 'P0195-ADDUN'
                                          gw_data-addun.
    Begin of Insertion V2.0 by S.NATARAJAN
    *ELSEIF  gw_data-addno = '' AND gw_data-addex = '2' .
          ELSEIF ( gw_data-addno = '' AND gw_data-addex = '1' ).
    End of Insertion V2.0 by S.NATARAJAN
            PERFORM bdc_field       USING 'Q0195-ADDEX'
                                          'X'.
            PERFORM bdc_field       USING 'P0195-ADDVL'
                                          gw_data-addvl.
            PERFORM bdc_field       USING 'P0195-ADDUN'
                                          gw_data-addun.
          ENDIF.
          PERFORM bdc_dynpro      USING 'MP019500' '2000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=UPD'.
          PERFORM bdc_dynpro      USING 'MP019400' '2000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/EBCK'.
          PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'SPOP-TEXTLINE1'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=YES'.
          PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'SPOP-TEXTLINE1'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=YES'.
          PERFORM bdc_dynpro      USING 'MP019500' '2000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=UPD'.
         CALL TRANSACTION gc_pa30 USING gi_bdcdata
                                   MODE p_ctumod
                                 UPDATE gc_update
                               MESSAGES INTO gi_bdcmsgcoll.
          PERFORM bdc_transaction USING gc_pa30.
          gi_bdcmsgcoll[] = messtab[].
          LOOP AT gi_bdcmsgcoll INTO gw_bdcmsgcoll.
            IF gw_bdcmsgcoll-msgnr NE gc_200.
              IF gw_bdcmsgcoll-msgid = gc_msgid.
                IF gw_bdcmsgcoll-msgnr EQ gc_s_msgid.
                  ADD 1 TO lv_success.
                ENDIF.
              ENDIF.
              gw_log-msg_id   = gw_bdcmsgcoll-msgid.
              gw_log-msg_num  = gw_bdcmsgcoll-msgnr.
              gw_log-msg_key  = gw_bdcmsgcoll-msgv1.
              gw_log-msg_typ  = gw_bdcmsgcoll-msgtyp.
              gw_log-rec_no   = gv_count.
              CALL FUNCTION 'FORMAT_MESSAGE'
                EXPORTING
                  id        = gw_log-msg_id
                  no        = gw_log-msg_num
                  v1        = gw_bdcmsgcoll-msgv1
                  v2        = gw_bdcmsgcoll-msgv2
                  v3        = gw_bdcmsgcoll-msgv3
                  v4        = gw_bdcmsgcoll-msgv4
                IMPORTING
                  msg       = gw_log-msg_txt
                EXCEPTIONS
                  not_found = 1
                  OTHERS    = 2.
              IF sy-subrc <> 0.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ENDIF.
              CONCATENATE gw_log-msg_txt 'for Personnel No -' ''''
                          gw_data-pernr '''' 'Case -' '''' gw_data-gcase
                          '''' INTO gw_log-msg_txt SEPARATED BY space.
              APPEND gw_log TO gi_log.
              REFRESH gi_bdcmsgcoll.
            ENDIF.
          ENDLOOP.
          CLEAR : lv_begda,lv_endda,
                  lv_lapdt,lv_rlsdd.
        ELSE.
          gw_log-msg_id = 'CUST'.
          gw_log-msg_num = 'XXX'.
          gw_log-msg_key  = 'USK'.
          gw_log-msg_typ  = 'E'.
          gw_log-rec_no   = gv_count.
          CONCATENATE 'Case -' '''' gw_data-gcase ''''
                      'does not exists for Personnel No -'
                      '''' gw_data-pernr ''''
                       INTO gw_log-msg_txt SEPARATED BY space.
          APPEND gw_log TO gi_log.
        ENDIF.
       ENDLOOP.
        CLEAR : gw_0194, gw_data.
        REFRESH gi_bdcdata.
      ENDLOOP.
      FREE gi_data.
      gv_tot_rec = gv_count.
      gv_suc_rec = lv_success.
      gv_err_rec = gv_count - lv_success.
      gv_ifnam   = p_upfile.
      PERFORM close_group.
    ENDFORM.                    " BDC
    *&      Form  FUNCTION_MODULE
          text
    FORM function_module .
      IF p_date = 'X'.
        LOOP AT gi_data INTO gw_data.
          gv_count = gv_count + 1.
          SELECT SINGLE pernr begda endda subty grnum
            FROM pa0194
            INTO CORRESPONDING FIELDS OF gw_p0194
           WHERE pernr = gw_data-pernr
             AND gcase = gw_data-gcase.
          IF sy-subrc = 0.
            MOVE-CORRESPONDING gw_data TO gw_p0195.
            CONCATENATE gw_data-begda6(4) gw_data-begda3(2)
                        gw_data-begda+0(2)
                       INTO gw_p0195-begda.
            CONCATENATE gw_data-endda6(4) gw_data-endda3(2)
                        gw_data-endda+0(2)
                       INTO gw_p0195-endda.
            CONCATENATE gw_data-levda6(4) gw_data-levda3(2)
                        gw_data-levda+0(2)
                       INTO gw_p0195-levda.
            gw_p0195-grnum = gw_p0194-grnum.
            gw_p0195-nein1 = ' '.
            gw_p0195-nein2 = ' '.
            gw_p0195-addin = ' '.
            IF ( gw_data-li1no = '' AND gw_data-li1ex = '1' ) .
              gw_p0195-nein1 = '1'.
            ELSEIF ( gw_data-li1ex = '2' OR gw_data-li1ex = '' ).
              gw_p0195-nein1 = '2'.
            ENDIF.
            IF ( gw_data-li2no = '' AND gw_data-li2ex = '1' ) .
              gw_p0195-nein2 = '1'.
            ELSEIF ( gw_data-li2ex = '2' OR gw_data-li2ex = '' ).
              gw_p0195-nein2 = '2'.
            ENDIF.
            IF ( gw_data-addno = '' AND gw_data-addex = '1' ) .
              gw_p0195-addin = '1'.
            ELSEIF ( gw_data-addex = '2' OR gw_data-addex = '' ).
              gw_p0195-addin = '2'.
            ENDIF.
            CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
              EXPORTING
                number = gw_p0195-pernr
              IMPORTING
                return = gw_return.
            IF gw_return-type NE 'E'.
              CALL FUNCTION 'HR_INFOTYPE_OPERATION'
                EXPORTING
                  infty         = '0195'
                  number        = gw_p0195-pernr
                  validityend   = gw_p0195-endda
                  validitybegin = gw_p0195-begda
                  record        = gw_p0195
                  operation     = 'INS'
                  dialog_mode   = p_ctumod                      "Mod-01
                  tclas         = 'A'
                  nocommit      = ' '
                IMPORTING
                  return        = gw_return.
              CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
                EXPORTING
                  number = gw_p0195-pernr.
            ENDIF.
            IF gw_return IS NOT INITIAL.
              gw_log-msg_id = gw_return-id.
              gw_log-msg_num = gw_return-number.
              CONCATENATE gw_data-pernr gw_data-gcase INTO
              gw_log-msg_key SEPARATED BY '|'.
              gw_log-msg_typ  = gw_return-type.
              gw_log-rec_no   = gv_count.
              gw_log-msg_txt  = gw_return-message.
            ELSE.
              gw_log-msg_id = 'CUST'.
              gw_log-msg_num =  '000'.
              CONCATENATE gw_data-pernr gw_data-gcase INTO
              gw_log-msg_key SEPARATED BY '|'.
              gw_log-msg_typ  = 'S'.
              gw_log-rec_no   = gv_count.
              gw_log-msg_txt  = 'Record Created'(t02).
            ENDIF.
          ELSE.
            gw_log-msg_id = 'CUST'.
            gw_log-msg_num = 'XXX'.
            CONCATENATE gw_data-pernr gw_data-gcase INTO
            gw_log-msg_key SEPARATED BY '|'.
            gw_log-msg_typ  = 'E'.
            gw_log-rec_no   = gv_count.
            gw_log-msg_txt  =  'Case does not exists for Personnel No'(t03).
          ENDIF.
          APPEND gw_log TO gi_log.
          CLEAR : gw_log,gw_return,gw_data,gw_p0194,gw_p0195.
        ENDLOOP.
      ELSE.
        LOOP AT gi_data_d INTO gw_data_d.
          gv_count = gv_count + 1.
          SELECT SINGLE pernr begda endda subty grnum
            FROM pa0194
            INTO CORRESPONDING FIELDS OF gw_p0194
           WHERE pernr = gw_data_d-pernr
             AND gcase = gw_data_d-gcase.
          IF sy-subrc = 0.
            MOVE-CORRESPONDING gw_data_d TO gw_p0195.
            CONCATENATE gw_data_d-begda6(4) gw_data_d-begda3(2)
         gw_data_d-begda+0(2)
                       INTO gw_p0195-begda.
            CONCATENATE gw_data_d-endda6(4) gw_data_d-endda3(2)
         gw_data_d-endda+0(2)
                       INTO gw_p0195-endda.
            gw_p0195-grnum = gw_p0194-grnum.
            gw_p0195-nein1 = ' '.
            gw_p0195-nein2 = ' '.
            gw_p0195-addin = ' '.
            IF ( gw_data_d-li1no = '' AND gw_data_d-li1ex = '1' ) .
              gw_p0195-nein1 = '1'.
            ELSEIF ( gw_data_d-li1ex = '2' OR gw_data_d-li1ex = '' ).
              gw_p0195-nein1 = '2'.
            ENDIF.
            IF ( gw_data_d-li2no = '' AND gw_data_d-li2ex = '1' ) .
              gw_p0195-nein2 = '1'.
            ELSEIF ( gw_data_d-li2ex = '2' OR gw_data_d-li2ex = '' ).
              gw_p0195-nein2 = '2'.
            ENDIF.
            IF ( gw_data_d-addno = '' AND gw_data_d-addex = '1' ) .
              gw_p0195-addin = '1'.
            ELSEIF ( gw_data_d-addex = '2' OR gw_data_d-addex = '' ).
              gw_p0195-addin = '2'.
            ENDIF.
            CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
              EXPORTING
                number = gw_p0195-pernr
              IMPORTING
                return = gw_return.
            IF gw_return-type NE 'E'.
              CALL FUNCTION 'HR_INFOTYPE_OPERATION'
                EXPORTING
                  infty         = '0195'
                  number        = gw_p0195-pernr
                  validityend   = gw_p0195-endda
                  validitybegin = gw_p0195-begda
                  record        = gw_p0195
                  operation     = 'INS'
                  dialog_mode   = p_ctumod                      "Mod-01
                  tclas         = 'A'
                  nocommit      = ' '
                IMPORTING
                  return        = gw_return.
              CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
                EXPORTING
                  number = gw_p0195-pernr.
            ENDIF.
            IF gw_return IS NOT INITIAL.
              gw_log-msg_id = gw_return-id.
              gw_log-msg_num = gw_return-number.
              CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO
              gw_log-msg_key SEPARATED BY '|'.
              gw_log-msg_typ  = gw_return-type.
              gw_log-rec_no   = gv_count.
              gw_log-msg_txt  = gw_return-message.
            ELSE.
              gw_log-msg_id = 'CUST'.
              gw_log-msg_num =  '000'.
              CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO
              gw_log-msg_key SEPARATED BY '|'.
              gw_log-msg_typ  = 'S'.
              gw_log-rec_no   = gv_count.
              gw_log-msg_txt  = 'Record Created'(t02).
            ENDIF.
          ELSE.
            gw_log-msg_id = 'CUST'.
            gw_log-msg_num = 'XXX'.
            CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO
            gw_log-msg_key SEPARATED BY '|'.
            gw_log-msg_typ  = 'E'.
            gw_log-rec_no   = gv_count.
           gw_log-msg_txt  =  'Case does not exists for Personnel No '(t03).
          ENDIF.
          APPEND gw_log TO gi_log.
          CLEAR : gw_log,gw_return,gw_data_d,gw_p0194,gw_p0195.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    Thanks.

  • Errors in flat file records? how can i handle them?

    Hi All,
    I am new for BDC. I am uploading customer(XD01) records using BDC caltransaction method.my problem is when i am running the program, some times my program is not updating the records because of my flat file errors. after i correcting the error records and if i run the same program already updated records not processing. my program not running. what i need to do? how can i handle the flat file for reprocessing the error records?
    i have around 50,000 records in my flat file.

    your program accepts a flat file say the structure of it is structure_load and you create another structure similar to structure_load and name it structure_error.
    loop at itab_load.
    call transactions...
    if success..
    commit work and wait X sec.
    else.
    move-corresponding field to structure_error
    append structure_error.
    endif.
    endloop.
    write the file stru_error to PC or app server and make the changes  to the data and use the str_error as input to your code again..

  • Error in flat file data loading

    Hi All,
    I have a flat file which has 20000 records, when I tried to do Read Preivew data in Data source creation Iam getting the following error.
    I have the field name GROSSMARGIN in flat file I have given the properties of Grossmargin as a keyfigure and
    Data Type :FLTP-Floating point number,
    Unit/Currency: 0CURRENCY.
    I am not getting any error while loading the value like '22134'.But when ever the records which are having the value of 5 digits, and starts with 3 like above one.After words I have replaces the value with some 5 digit number like(24432),It has worked fine.I do not understand the error cause.
    Please help me.
    Regards,
    G S Ramanjaneyulu.

    Hi Raman,
    You are using data type INT2 for this and there is a restriction for this data type.
    INT2: 2-byte integer between -32767 and 32767. Fields of this type should only be used for length fields. These long fields are positioned immediately in front of a long field (type LCHR, LRAW). With INSERT or UPDATE on the long field, the database interface enters the length which was actually used in the length field. The length is set to 5 places for this data type.
    So this accepts the max no. till 32767 and if you put any no. more than that it will give you error of Overflow.
    Please let me know if there are any questions.
    Thanks
    Amit

  • Error in flat file

    hai...........
    If there is a error in 5  th record of flat file.
    what happens if we upload that data through session method,  whether it stops at 4 th record or except 4 th record all r updated........
    and what happens with call transaction .
    plz any body give me clear explanation.....?

    Dear Satheesh,
    If there is error in 4th record,....in (1) Session method:- it skips that records, and all remaining records get uploaded into the system...and u have to go the log thr' SM35, then either u can see error to what screen and to what field by Analyze ro Statistics or Log options from Application Tool bar buttons...and do correction and process them again.......While as in (2) Call Transaction method:- screen gets stucks immediately at the point of error. In this situation, u have to do corrections manually to process that screen ( means u have to filled data for those fields,where error occurs)....I think that this info. will sufficient for you.
    Sanjay Bhalerao

  • Error in flat file mapping

    I am using flat file as source ,and when i am trying to validate the mapping i am getting the following error:
    No data file specified
    I tried to configure the mapping,I did not find any option asking source file name.
    Can you please help me...
    Kiran

    Hi Kiran
    As far as I remember...when you configure the map, the map configuration property inspector has a tree in the lhs if you navigate to the flat file operator, and right click on that node you should be able to add a data file. The properties for the data file are shown on the rhs when selected in tree.
    Cheers
    David

  • Error in Flat File to XML conversion

    Hi all,
    I am trying to convert a flat file to XML using the Sender File Adapter and I am getting the following error message.
    2006-01-23 17:23:00 EST: Error: Conversion of complete file content to XML format failed around position 0: Exception: ERROR converting document line no. 2 according to structure 'GL_FileUpload_SAPECC_Header_DT1':java.lang.Exception: ERROR in configuration: more elements in file csv structure than field names specified!
    My flat file looks like this,
    --Start
    GL,GLI,1,RefTest,4011,Test,1234567890,12032005,12032005,GL,RK
    GL,GLI,4011,3011,,,,,,AU,600,7000,8000,9000,5000,RK,,,,,,,,,,,,,,,,,,,,
    ---End
    The adapter configuration is like this:
    Document Name: GL_FileUpload_SAPECC_Item_MT1
    Document Namespace: urn:corptech.qld.gov.au:sss_std_offering:gl
    RecordSet Name: GL_FileUpload_SAPECC_Record_DT1
    RecordSet Namespace: urn:corptech.qld.gov.au:sss_std_offering:gl
    RecordSet Structure: GL_FileUpload_SAPECC_Header_DT1,1,GL_FileUpload_SAPECC_Item_DT1,*
    RecordSet Sequence: Ascending
    Key FieldName: TransType
    On the Adapter Properties, I have got:
    --Start
    GL_FileUpload_SAPECC_Header_DT1.fieldNames: TransType,RowType,SequenceNo,ReferenceKey,SenderSystem,HeaderText,CompanyCode,DocumentDate,PostingDate,DocumentType,ReferenceNo
    GL_FileUpload_SAPECC_Header_DT1.fieldSeparator: ,
    GL_FileUpload_SAPECC_Item_DT1.fieldNames: TransType,RowType,SequenceNo,GLAccount,CostCentre,ProfitCentre,InternalOrder,WBSElement,TaxCode,Currency,GLAmount,VendorAmount,CustomerAmount,AssetAmount,DRCR,ItemText,VendorNo,CustomerNo,Name,Street,City,PostCode,PoBox,State,Country,BankKey,BankAccount,BankCountry,CalcTax,PaymentTerms,BaseDate,PaymentBlock,PaymentMethod,Assignment,AssetNo,AssetSubNo,AssetTransaction
    GL_FileUpload_SAPECC_Item_DT1.fieldSeparator: ,
    ignoreRecordsetName: true
    GL_FileUpload_SAPECC_Header_DT1.keyFieldValue: GL
    GL_FileUpload_SAPECC_Item_DT1.keyFieldValue: GL
    ---End
    The structure defined on the data type looks like this,
    --Start
    GL_FileUpload_SAPECC_Record_DT1   Complex Type
       GL_FileUpload_SAPECC_Header_DT1  Element
          TransType                     Element
          RowType                       Element
          Sequence Number               Element
        GL_FileUpload_SAPECC_Item_DT1   Element
          TransType                     Element
          RowType                       Element
          Sequence Number               Element
          GLAccount                     Element
    ---End
    Any help or suggestion please.
    Thank you.
    Warm Regards,
    Ranjan

    Hi, Ranjan.
      First of all, let's look at the meaning of the error.
    > ...Exception: ERROR converting document line no. 2 according to
    > structure 'GL_FileUpload_SAPECC_Header_DT1':java.lang.Exception:
    > ERROR in configuration: more elements in file csv structure than
    > field names specified!
      It seems that XI interpreted 2nd line as
    Header_DT1 not as Item_DT1 that you meant.
    >  GL,GLI,4011,3011,,,,,,AU,600,7000,8000,9000,5000,RK,,,,,,,,,,,,,,,,,,,,
      That's why it says this line has more elements than the structure
    defined(Header_DT1)
      And the reason why XI misinterpreted the above as Header is that
    you used keyFieldValue with the same value.
    > ...Header_DT1.keyFieldValue: GL
    > ...Item_DT1.keyFieldValue: GL
      According to the following help,
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    it says like the following.
    Key Field Name
    If you specified a variable number of substructures for Recordset
    Structure, in other words, at least one substructure has the value
    ‘*’, then the substructures must be identified by the parser from
    their content. This means that a key field must be set with different
    constants for the substructures. In this case, you must specify a key
    field and the field name must occur in all substructures.
    How about using different constants for header and item if possible?
    Good luck.

Maybe you are looking for

  • How to modify a namespace

    hi to all! We have a namespace in our system, and my manager wants me to research on how to update a namespace, as what I've researched, I need to go to se03 then change namespace, I did that and I transported it last friday,,, however up to now, It

  • Anyone Solved the N96 Update Issue?

    Wondering if anyone has come up with a solution to the problem of being asked to remove battery, charger and retry etc when using Nokia PC Suite to upgrade the firmware? I have a branded T-Mobile N96 and the firmware update is available now to 11.###

  • Applescript : how to create a new numbers document

    I know you have to use +make new+ command. But how to specify the path and name. I tried +at, properties+ nothing helps. My code: *tell application "Numbers"* * make new sheet at "Macintosh HD:Users:Nimmy" with properties {name:"test"}* *end tell* I

  • How to transfer apps from old ID

    Hi, I was wondering if there is a way to get my apps from my old apple ID to my new one. Redownloaded all the free apps that were linked to the old address onto my new one. However there are some purchased apps on my old Address. The only reason I as

  • Apps installed on a previous os-x installation wont run

    Hello. I have a bunch of applications that I installed to /Users/homedir/Applications and one day the computer gave errors and couldn't boot. I reinstalled the system and restored my home dir from backup but the applications in /Users/homedir/Applica