Uploading INT4 data using ws_upload??

Hi friends,
I am trying to upload data which is of type INT4 using ws_upload into SAP. But in debugging mode I can see that the format of the (INT4) data is being changed.
Any suggestions??
Regards,
Vinod.

Hi,
call method <b>GUI_UPLOAD</b> of <b>CL_GUI_FRONTEND_SERVICES</b>
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
        EXPORTING
          FILENAME                = 'C:MY.TXT'
          FILETYPE                = 'ASC'
          HAS_FIELD_SEPARATOR     = 'X'
*          HEADER_LENGTH           = 0
*          DAT_MODE                = SPACE
*          CODEPAGE                = SPACE
*          IGNORE_CERR             = ABAP_TRUE
*          REPLACEMENT             = '#'
*          READ_BY_LINE            = 'X'
*        IMPORTING
*          FILELENGTH              =
*          HEADER                  =
        CHANGING
          DATA_TAB                = ITAB1
*        EXCEPTIONS
*          FILE_OPEN_ERROR         = 1
*          FILE_READ_ERROR         = 2
*          NO_BATCH                = 3
*          GUI_REFUSE_FILETRANSFER = 4
*          INVALID_TYPE            = 5
*          NO_AUTHORITY            = 6
*          UNKNOWN_ERROR           = 7
*          BAD_DATA_FORMAT         = 8
*          HEADER_NOT_ALLOWED      = 9
*          SEPARATOR_NOT_ALLOWED   = 10
*          HEADER_TOO_LONG         = 11
*          UNKNOWN_DP_ERROR        = 12
*          ACCESS_DENIED           = 13
*          DP_OUT_OF_MEMORY        = 14
*          DISK_FULL               = 15
*          DP_TIMEOUT              = 16
*          NOT_SUPPORTED_BY_GUI    = 17
*          ERROR_NO_GUI            = 18
*          others                  = 19
      IF SY-SUBRC <> 0.
*       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
Regards
vijay

Similar Messages

  • Problem in uploading a file using Ws_upload.

    Hi Experts,
                        I am using WS_UPLOAD for uploading .xls file into SAP Standard table T558A.
    Problem is file is not uploaded to DB table.....getting error like
    ERROR DURING FILE UPLOAD/DOWNLOAD as  pop up message.....
    can any boady please help on this issue.
    Regards,
    Praveena.

    Hi,
    If you want to upload the data using EXCEL file use the function module ALSM_EXCEL_TO_INTERNAL_TABLE.
    Examples for ALSM_EXCEL_TO_INTERNAL_TABLE.
    http://wiki.sdn.sap.com/wiki/display/Snippets/Howtouse+FM'ALSM_EXCEL_TO_INTERNAL_TABLE'

  • Error while uploading the data using FM"upload"

    Hi,
    I encountering an error while uploading the data using text file with FM " UPLOAD"
    The error is "File does not exist or cannot be opened "
    But there is a file with name and extenstion right.
    Regards
    Vishnu

    You have to create RC29P-IDNRK(var) using concatenate statement. Try this.
    DATA: new_mark TYPE bdcdata-fnam.
    CONCATENATE 'RC29P-IDNRK(' var ')' INTO new_mark.
    PERFORM bdc_field USING new_mark W_BOM-QTY

  • Upload the data using BAPI in LSMW

    Hi
      I want to upload the data using the BAPI in LSMW,but i dont know what value should be passed in
      1- Business Object
      2- Method
    fields.
    Ex- Suppose i want to upload the Material Master Data then what should be the value of these two fields.
    Thanks
    Mrutyunjaya Tripathy

    Hi
      Sorry to say that i am little bit confuse with your answer
    1-The business object already contains some object name wheather i have to give object names or different,As you have mentioned to give the tcode than what tcode that would be
    2-If i am giving any internal table name in the method field it is giving me error because this field is related to the business object field
    Thanks
    Tripathy m

  • Upload XML data using XSQL and HTTP Post ?

    Upload XML data using XSLQ and HTTP Post: is that possible ?
    An xsql contains an <xsql:insert-request table="aTable">
    The XML data file follows the ROWSET/ROW paradigm.
    What is the HTML form to upload the xml file to the XSQL ?
    I tried:
    <form action="myXSQL.xsql" method="POST" ENCTYPE="multipart/form-data">
    XML data file to upload: <input type="file">
    <input type="submit">
    </form>
    But the answer of myXSQL is:
    <xsql-status action="xsql:insert-request" result="No posted document to process" />
    Where is the problem ?
    Thank you.

    Hello,
    You are posting your XML file as a parameter therefore you should use the <xsql:insert-params/> tag, not the <xsql:insert-request/>. The insert-request can only handle data not posted via a parameter.
    Usage:
    <form action="myXSQL.xsql" method="GET" ENCTYPE="multipart/form-data">
    XML data file to upload: <input type="file" name="myXML">
    <input type="submit">
    </form>
    in combination with
    <xsql>
    <xsql:insert-params name="myXML" table="your table"/>
    </xsql>
    2 remarks:
    I was not able to succesfully POST the form. The answer was <xsql-status action="xsql:insert-request" result="No posted document to process" />. With GET is was succesfull.
    Second, if you use MSInternet explorer 5 or higher use could post the XML directly (not aw parameter) using an ActiveX object.
    Regards,
    Harm Verschuren

  • Error!! uploading .txt file using WS_upload

    Hi Friends,
       I am trying to upload a .txt file with 5 fields into a ztable using WS_upload. In debug mode i see that the internal table itab has all the fields clustered together seperated by a # symbol. How do i remove this # symbol so that i can upload it into ztable properly .
    For eg the error i m getting is
    ibm#1042#krj#04-19-2006#PS. All these 5 fields get clustered under material column and not in their respective columns.
    Your opinion and advice is greatly appreciated .
    Thank you

    Suppose you have the data from the file in i_text and i_vendor is a structure similar to the database, then you use the following logic to split the text with hash as delimiter.
    loop at i_text.
    split i_text-text at '#' into i_vendor-lifnr
                                  i_vendor-ekorg
                                  i_vendor-ktokd
                                  i_vendor-name1
                                  i_vendor-sortl
                                  i_vendor-land1
                                  i_vendor-spras
                                  i_vendor-waers.
    append i_vendor.
    clear :i_vendor,
           i_text.
    endloop.
    Let me send you a sample code. Let me know if this helps.
    Award points if the answer helped you !
    Session Method: ( Batch Input)
    3 Function Modules are there.
    1)     BDC_OPEN_GROUP
    2)     BDC_INSERT
    3)     BDC_CLOSE_GROUP
    Instead of all the Call Transactions we use the Function modules here.
    1)     Go for MK01
    2)     Go for recording.  M4567,0001,0001 enter; test1, abcd, us, en, enter; usdollars; save.
    3)     Save and come back.
    4)     Select Vendor and Click on PROGRAM button . Stest_01
    5)     Select Transfer from recording button.
    6)     Save as local object
    7)     Copy the code into a Report program and execute it.
    Example:
    1) Create a text field having the following entries
    t3456,0001,0001,testt3456,abcd123,US,E,USD and save the entries for 4-5 lines of these type.
    2) Create a Program.
    Report ZBDC_MK01.
    *& Report  ZBDC_MK01
    REPORT  ZBDC_MK01.
    * Internal table for file
    data : begin of i_text occurs 0,
           text(255) type c,
           end of i_text.
    * Internal table for MK01 Transaction
    data : begin of i_vendor occurs 0,
           lifnr(10) type c,
           ekorg(4) type c,
           ktokd(4) type c,
           name1(40) type c,
           sortl(10) type c,
           land1(3) type c,
           spras(1) type c,
           waers(3) type c,
           end of i_vendor.
    * Internal table for BDCDATA
    data i_bdcdata like bdcdata occurs 0 with header line.
    data : v_repid like sy-repid.
    parameters p_file like rlgrap-filename.
    INITIALIZATION.
    v_repid = sy-repid.
    at selection-screen on value-request for p_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = v_repid
    *   *   DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_file
    start-of-selection.
    * Get the data from file to internal table
    perform get_data.
    * Open the session
    perform open_session.
    * Process the bdcdata
    perform process_bdcdata.
    * Call the close_group
    perform close_group.
    *&      Form  get_data
    *       WS_UPLOAD FM
    FORM get_data .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    *   CODEPAGE                      = ' '
       FILENAME                      = p_file
       FILETYPE                      = 'ASC'
    *   HEADLEN                       = ' '
    *   LINE_EXIT                     = ' '
    *   TRUNCLEN                      = ' '
    *   USER_FORM                     = ' '
    *   USER_PROG                     = ' '
    *   DAT_D_FORMAT                  = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = i_text
    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
       NO_AUTHORITY                  = 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.
    else.
    loop at i_text.
    split i_text-text at ',' into i_vendor-lifnr
                                  i_vendor-ekorg
                                  i_vendor-ktokd
                                  i_vendor-name1
                                  i_vendor-sortl
                                  i_vendor-land1
                                  i_vendor-spras
                                  i_vendor-waers.
    append i_vendor.
    clear :i_vendor,
           i_text.
    endloop.
    endif.
    free: i_text.
    ENDFORM.                    " get_data
    *&      Form  open_session
    *       text
    FORM open_session .
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
       CLIENT                    = SY-MANDT
    *   DEST                      = FILLER8
       GROUP                     = 'VENDOR_MK01'
    *   HOLDDATE                  = FILLER8
       KEEP                      = 'X'
       USER                      = sy-uname
    *   RECORD                    = FILLER1
    *   PROG                      = SY-CPROG
    * IMPORTING
    *   QID                       =
    EXCEPTIONS
       CLIENT_INVALID            = 1
       DESTINATION_INVALID       = 2
       GROUP_INVALID             = 3
       GROUP_IS_LOCKED           = 4
       HOLDDATE_INVALID          = 5
       INTERNAL_ERROR            = 6
       QUEUE_ERROR               = 7
       RUNNING                   = 8
       SYSTEM_LOCK_ERROR         = 9
       USER_INVALID              = 10
       OTHERS                    = 11
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " open_session
    *&      Form  process_bdcdata
    *       BDCDATA
    FORM process_bdcdata .
    loop at i_vendor.
    perform bdc_dynpro      using 'SAPMF02K' '0107'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  i_vendor-lifnr.
    perform bdc_field       using 'RF02K-EKORG'
                                   i_vendor-ekorg.
    perform bdc_field       using 'RF02K-KTOKK'
                                  i_vendor-ktokd.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-SPRAS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-NAME1'
                                 i_vendor-name1.
    perform bdc_field       using 'LFA1-SORTL'
                                  i_vendor-sortl.
    perform bdc_field       using 'LFA1-LAND1'
                                  i_vendor-land1.
    perform bdc_field       using 'LFA1-SPRAS'
                                    i_vendor-spras.
    perform bdc_dynpro      using 'SAPMF02K' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFBK-BANKS(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPMF02K' '0310'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFM1-WAERS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFM1-WAERS'
                                  i_vendor-waers.
    perform bdc_dynpro      using 'SAPMF02K' '0320'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-LIFNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    * Call the transaction code.
    perform bdc_insert.
    refresh i_bdcdata.
    endloop.
    ENDFORM.                    " process_bdcdata
    *&      Form  bdc_dynpro
    *       text
    *      -->P_0264   text
    *      -->P_0265   text
    FORM bdc_dynpro  USING    p_prog
                              p_scrn.
    clear i_bdcdata.
    i_bdcdata-program = p_prog.
    i_bdcdata-dynpro = p_scrn.
    i_bdcdata-dynbegin = 'X'.
    append i_bdcdata.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
    *       text
    FORM bdc_field  USING    p_fnam
                             p_fval.
    clear i_bdcdata.
    i_bdcdata-fnam = p_fnam.
    i_bdcdata-fval = p_fval.
    append i_bdcdata.
    ENDFORM.                    " bdc_field
    *&      Form  bdc_insert
    *       text
    FORM bdc_insert .
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
       TCODE                  = 'MK01'
    *   POST_LOCAL             = NOVBLOCAL
    *   PRINTING               = NOPRINT
    *   SIMUBATCH              = ' '
    *   CTUPARAMS              = ' '
      TABLES
        DYNPROTAB              = i_bdcdata
    EXCEPTIONS
       INTERNAL_ERROR         = 1
       NOT_OPEN               = 2
       QUEUE_ERROR            = 3
       TCODE_INVALID          = 4
       PRINTING_INVALID       = 5
       POSTING_INVALID        = 6
       OTHERS                 = 7
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " bdc_insert
    *&      Form  close_group
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM close_group .
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    * EXCEPTIONS
    *   NOT_OPEN          = 1
    *   QUEUE_ERROR       = 2
    *   OTHERS            = 3
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " close_group
    4)     Save and activate.
    5)     Go to SM35 and see the session created. Vendor_MK01 (group name which was given)
    6)     Need to go to SM35. Select the Session name and Click on Process. Select BACKGROUND.
    7)     Click on PROCESSED Tab.
    8)     For seeing the log file select the session and click on LOG. Click on Display.
    Difference between Call Transaction and Sessions Method.:
    1) In CT if mode is ¡¥A¡¦ then there wont be log messages. In sessions method we can get log messages in Foreground and Background too.
    2) In session method until and unless session Is created it wont update the data. But in CT data is updated immediately.
    3) In CT for log messages have to write BDCMSGCOLL structure and Format_Messages function module. Logs are created automatically in Session method.
    4) Data UPDATION in CT is Asynchronous. In Session method its Synchronous.
    5) In CT we have to split the file. In Session method we need not split the file.
    6) In CT we use BEND in Session we have to use END
    Real time most of the times its SESSION Method.
    Use CT method when: 
    a)     Run time Validation.  Example: We are creating a sales order. Here we are validating when selecting Payment Terms etc.
    DIRECT INPUT Method:
    If anything modified in SAP transaction don¡¦t use DI method. Updation is very fast.
    There is no Restart mechanism in DI method.
    Ex: have 10 records. 6,7 are error. In session method we needent go to the file. We have to go to BI and process again. Process in Foreground and during this time change at run time.
    We need to go for the file. Delete the first files, last files and then upload the data and run again.
    Main Transaction Code for DI is SXDB
    1)     Click on GoTo-----„³ DX Tools
    2)     Object type---Select G/L Account ; Task type: Load Data; Program type: Batch Input; Program: RFBISA00 .
    Q) How to copy files from SAP server to local?
    Ans) Bcos we don¡¦t get authorization for AL11 transaction. If we know file directory and File name. We can see structure.
    In SXDB.
    1)     Click on GoTo-----„³ DX Tools
    2)     Object type---Select G/L Account (BUS 3006) ; Task type: Load Data; Program type: Batch Input; Program: RFBISA00 .
    Go for Copy file. Give the Application Server file name and also he presentation server name and location.
    *& Report  ZBDC_MM01
    REPORT  ZBDC_MM01.
    * Constants
    constants : c_x type c value 'X'.
    * Internal table for file
    data : begin of i_text occurs 0,
           text(255) type c,
           end of i_text.
    * iNTERNAL TABLE FOR MATERIAL LOAD
    DATA : BEGIN OF I_MATERIAL OCCURS 0,
           MATNR(18) TYPE C,
           MBRSH(1) TYPE C,
           MTART(4) TYPE C,
           MAKTX(40) TYPE C,
           MEINS(3) TYPE C,
           MAKTL(3) TYPE C,
           END OF I_MATERIAL.
    * INTERNAL TABLE FOR BDCDATA
    DATA I_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    * internal table for for logs
    data i_bdcmsg like bdcmsgcoll occurs 0 with header line.
    * Report id
    data : v_repid like sy-repid,
           v_msg(255) type c.
    * Internal tabel for log records
    data : begin of i_log occurs 0,
           text(255) type c,
           end of i_log.
    * Selection-screen
    selection-screen : begin of block blk with frame title text-001.
    parameter p_file like rlgrap-filename.
    selection-screen : end of block blk.
    * fill the defaut value
    INITIALIZATION.
    v_repid = sy-repid.
    * F4 value for File
    at selection-screen on value-request for p_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = v_repid
    *   DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_file
    start-of-selection.
    * get the data from file to internal table
    perform get_data_itab.
    * tO PROCEESS BDCDATA
    PERFORM PROCESS_BDCDATA.
    end-of-selection.
    * Process the data into file
    perform download_file.
    *&      Form  get_data_itab
    *    ws_upload
    FORM get_data_itab .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    *   CODEPAGE                      = ' '
       FILENAME                      = P_FILE
       FILETYPE                      = 'ASC'
    *   HEADLEN                       = ' '
    *   LINE_EXIT                     = ' '
    *   TRUNCLEN                      = ' '
    *   USER_FORM                     = ' '
    *   USER_PROG                     = ' '
    *   DAT_D_FORMAT                  = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = I_TEXT
    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
       NO_AUTHORITY                  = 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.
    ELSE.
    LOOP AT I_TEXT.
    SPLIT I_TEXT-TEXT AT ',' INTO I_MATERIAL-MATNR
                                  I_MATERIAL-MBRSH
                                  I_MATERIAL-MTART
                                  I_MATERIAL-MAKTX
                                  I_MATERIAL-MEINS
                                  I_MATERIAL-MAKTL.
    APPEND I_MATERIAL.
    CLEAR : I_MATERIAL,
            I_TEXT.
    ENDLOOP.
    ENDIF.
    ENDFORM.                    " get_data_itab
    *&      Form  PROCESS_BDCDATA
    *      bdcdata
    FORM PROCESS_BDCDATA .
    LOOP AT I_MATERIAL.
    * First Screen
    perform f_get_program using 'SAPLMGMM' '0060'.
    perform f_get_field   using 'BDC_CURSOR' 'RMMG1-MATNR'.
    perform f_get_field  using 'BDC_OKCODE' '=AUSW'.
    perform f_get_field  using 'RMMG1-MATNR' i_material-matnr.
    perform f_get_field  using 'RMMG1-MBRSH' i_material-mbrsh.
    perform f_get_field  using 'RMMG1-MTART' i_material-mtart.
    * Second screen
    perform f_get_program using 'SAPLMGMM' '0070'.
    perform f_get_field   using 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(01)'.
    perform f_get_field  using 'BDC_OKCODE' '=ENTR'.
    perform f_get_field  using 'MSICHTAUSW-KZSEL(01)' c_x.
    * third screen
    perform f_get_program using 'SAPLMGMM' '4004'.
    perform f_get_field   using 'BDC_CURSOR' 'MAKT-MAKTX'.
    perform f_get_field  using 'BDC_OKCODE' '=BU'.
    perform f_get_field  using 'MAKT-MAKTX' i_material-maktx.
    perform f_get_field  using 'MARA-MEINS' i_material-meins.
    perform f_get_field  using 'MARA-MATKL' i_material-maktl.
    ** call transaction
    call transaction 'MM01'
         using i_bdcdata
         mode 'N'
         messages into i_bdcmsg.
    refresh i_bdcdata.
    * Log message
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = SY-MSGID
       LANG            = '-E'
       NO              = SY-MSGNO
       V1              = SY-MSGV1
       V2              = SY-MSGV2
       V3              = SY-MSGV3
       V4              = SY-MSGV4
    IMPORTING
       MSG             = v_msg
    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.
    i_log-text = v_msg.
    append i_log.
    clear: i_log,
           v_msg.
    ENDLOOP.
    ENDFORM.                    " PROCESS_BDCDATA
    *&      Form  f_get_program
    *       Program ,Screen no, Dynbegin
    *      -->P_0206   text
    *      -->P_0207   text
    FORM f_get_program  USING   p_prog
                                p_scrn.
    clear : i_bdcdata.
    i_bdcdata-program = p_prog.
    i_bdcdata-dynpro = p_scrn.
    i_bdcdata-dynbegin = c_x.
    append i_bdcdata.
    ENDFORM.                    " f_get_program
    *&      Form  f_get_field
    *      field name ,field value
    *      -->P_0217   text
    *      -->P_0218   text
    FORM f_get_field  USING   p_fnam
                              p_fval.
    clear i_bdcdata.
    i_bdcdata-fnam = p_fnam.
    i_bdcdata-fval = p_fval.
    append i_bdcdata.
    ENDFORM.                    " f_get_field
    *&      Form  download_file
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM download_file .
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    *   BIN_FILESIZE                  = ' '
    *   CODEPAGE                      = ' '
       FILENAME                      =
       'C:Documents and SettingsAdministratorDesktoplog.txt'
       FILETYPE                      = 'ASC'
    *   MODE                          = ' '
    *   WK1_N_FORMAT                  = ' '
    *   WK1_N_SIZE                    = ' '
    *   WK1_T_FORMAT                  = ' '
    *   WK1_T_SIZE                    = ' '
    *   COL_SELECT                    = ' '
    *   COL_SELECTMASK                = ' '
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = i_log
    *   FIELDNAMES                    =
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_WRITE_ERROR              = 2
       INVALID_FILESIZE              = 3
       INVALID_TYPE                  = 4
       NO_BATCH                      = 5
       UNKNOWN_ERROR                 = 6
       INVALID_TABLE_WIDTH           = 7
       GUI_REFUSE_FILETRANSFER       = 8
       CUSTOMER_ERROR                = 9
       NO_AUTHORITY                  = 10
       OTHERS                        = 11
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " download_file

  • What is the Tcodes for Uploading of data using BDC & CATT

    PP members:
    I was going through the <b>cutover activities</b> ,  and what I understood is  we transfer all the legacy system data into SAP before going live
    The data upload follows certain steps (depends on the organizational design load strategies)
    First we upload all the master data ( material master, BOM, W/C's & Routings)
    Then the transaction data ( Ideally speaking, there should no open orders i.e. WIP as on the day of cutoff )
    If the WIP (Work in Process) is unavoidable then the materials consumed shall be treated as <b>materials of the previous stage</b> and necessary adjustments shall be made after cutover day
    At this point, I could not able to understand what does the author mean <b>materials of the previous stage</b>
    Now comming to the uploading of data into SAP from legacy system, we use tools like LSMW, CATT & BDC
    Is it a must to use <b>only LSMW tool</b> to upload master data or any other upload tools are fine
    Lastly,. I am not sure about the Tcode of CATT & BDC
    Summary of the questions:
    1.What does the author mean  <b>material of previous stage</b>, for WIP materials during cutover activities
    2. Is it mandatory to use only LSMW tool for uploading for master data
    3. What are the Tcodes for upload tools CATT & BDC ?
    Thanks for your time
    Suren R

    Dear,
    1.What does the author mean material of previous stage, for WIP materials during cutover activities - as i understood, what is the stage of material..like it must have gone through 2 work centers and other 2 is left. i.e. you need to create Production order with only 2 operation as other 2 is already over. - usually it is done in such a way that we will create Production order and confirm till 2 operations and WIp is calculated so thatb FI will tally the books in SAP and lagacy.
    2. Is it mandatory to use only LSMW tool for uploading for master data - no you can use any tool as required and suits yr requirement
    3. What are the Tcodes for upload tools CATT & BDC- BDC through a prog in SE38. CATT through - SCEM.

  • Upload time data using bdc

    hi hr gurus,
    plz help
    we have 3 shifts like 6-2,2-10,10-6.
    while uploading time data to sap from third party system.
    do we need to take care of the shifts times in BDC?
    or do we need to manage it in configurations
    if you have any code please send me
    regards

    Hi,
    As above said was the also procedure to do the BDC recording.Hope you understand the precedure in detail else have a look @ this.
    1.Goto transaction shdb for recording.
    2.There give the recording name starting with Z or Y letter.
    3.Click "New Recording" button in the left extreme Application tool bar.
    4.You will get a new pop up window Create Recording there give Recording Name"Z r Y" and give the transaction code that you going to record for e.g (PA30,XK01).
    5.Leave the Mode as it  is and click "Start Recording".
    6.Here you will get the transaction code window for e.g if you are  giving PA30 it will call the corresponding transaction.
    7.Start recording by entering the values which you want to record.
    8.After recording save the recording and give back.
    9.There you find the list of process which is done.
    10.Enter your recording name and press enter you will get the program name.
    11.Select the program name and press "program" button in the application tool bar.It will ask abt the prgm name and give read from file.
    12.You will get the coding in se38 for recording.
    13.Edit your program for uploading the flat file from you legacy system to application server by using CALL FUNCTION "GUI_UPLOAD".
    14.Get the flat file and fill it in internal table and pass the internal table values by giving "loop at internal table" after READ DATASET statement.
    15.Select the call transaction for small no. of data for large no. of data we have to use session method.(Refer some links for difference between session and call transaction).
    16.There by executing the program we will get the output which record are created.
    Thanks,
    Sakthi.C
    *Rewards if usefull--*

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

  • Upload the data using bapi

    hi,
    i am new for bapi , can anyone tell me how to upload data using bapi with example?
    plz tell how to find bapi & how to use in coding to upload the data?

    Hi ,
             To find Bapi There a tcode Bapi which will take you to bapi Explorer From there you can find required
              the Bapi Function Module and its Documentation .
      [  www.sap-img.com/abap/bapi-step-by-step-guidance.htm ]
    [http://www.sappro.com/tag.cfm?session=&tag=bapi%20programming]
    [https://wiki.sdn.sap.com/wiki/display/Snippets/SalesordercreationusingBAPI]
    Regards
    Nilesh

  • How to upload a data using BAPI_SALESORDER_CREATEFROMDAT2 without using LSM

    Hi,
           I want to upload a data from an input file on the presentation server using BAPI_SALESORDER_CREATEFROMDAT2 first uploading the data and then creating sales orders out of it.
           I will be highly obliged if anyone can guide me with it.
           I have tried the same using LSMW got succeeded in posting the idocs correctly and now I want to do it without using LSMW. The main intention of not using LSMW is that after creating sales orders, I want to display the messages related to number of sales order created, Number of records uploaded, Number of records.

    Hi
    BAPI_SALESORDER_CREATEFROMDAT2
    Text
    Sales order: Create Sales Order
    Functionality
    You can use this method to create sales orders.
    You must enter at least sales order header data (via ORDER_HEADER_IN structure) and partner data (via the ORDER_PARTNERS table) as input parameters.
    Enter the item data via the ORDER_ITEMS_IN table. You can allocate item numbers manually, by filling in the relevant fields, or the system does it, according to the settings for Customizing, by leaving the relevant fields blank.
    If you have configurable items, you must enter the configuration data in the ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF and ORDER_CFGS_VALUE tables.
    Credit cards can be transferred via the BAPICCARD structure, on the one hand, data for card identification, on the other, data for a transaction which has taken place in an external system.
    Once you have created the sales order successfully, you will receive the document number (SALESDOCUMENT field). Any errors that may occur will be announced via the RETURN parameter.
    If no sales area has been created in the sales order header, then the system creates the sales area from the sold-to party or ship-to party, who has been entered in the partner table. If a clear sales area cannot be created, you will receive a system message, and the sales order will not be created.
    Notes
    1. Mandatory entries:
    ORDER_HEADER_IN : DOC_TYPE     Sales document type
                       SALES_ORG    Sales organization
                       DISTR_CHAN   Distribution channel
                       DIVISION     Division
    ORDER_PARTNERS..: PARTN_ROLE   Partner role, SP sold-to party
                       PARTN_NUMB   Customer number
    ORDER_ITEMS_IN..: MATERIAL     Material number
    2. Ship-to party:
    If no ship-to party is entered, use the following: Ship-to party =
    sold-to party.
    3. Commit control:
    The BAPI does not have a database commit. This means that the relevant application must leave the commit, in order that can be carried out on on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.
    4. German key words:
    The following key words must be entered in German, independantly of
    the logon language:
    DOC_TYPE     Sales document type, for example: TA for standard order
    PARTN_ROLE   Partner role, for example: WE for ship-to party
    Further Information
    You can find further information in the OSS. The note 93091 contains general information on the BAPIs in SD.
    Parameters
    SALESDOCUMENTIN
    ORDER_HEADER_IN
    ORDER_HEADER_INX
    SENDER
    BINARY_RELATIONSHIPTYPE
    INT_NUMBER_ASSIGNMENT
    BEHAVE_WHEN_ERROR
    LOGIC_SWITCH
    TESTRUN
    CONVERT
    SALESDOCUMENT
    RETURN
    ORDER_ITEMS_IN
    ORDER_ITEMS_INX
    ORDER_PARTNERS
    ORDER_SCHEDULES_IN
    ORDER_SCHEDULES_INX
    ORDER_CONDITIONS_IN
    ORDER_CONDITIONS_INX
    ORDER_CFGS_REF
    ORDER_CFGS_INST
    ORDER_CFGS_PART_OF
    ORDER_CFGS_VALUE
    ORDER_CFGS_BLOB
    ORDER_CFGS_VK
    ORDER_CFGS_REFINST
    ORDER_CCARD
    ORDER_TEXT
    ORDER_KEYS
    EXTENSIONIN
    PARTNERADDRESSES
    Regards
    Raj

  • Upload the data using sessoin method

    HI All,
      i have a flat file of 1000 records i uploaded 1000 records using session method but some records are missing.In error log i got some errors.then now how can i update the error records.

    You haven't provided much information.  What transaction?  What upload method? Custom program or standard?  You either need to process the transactions in foreground or errors only mode to fix them OR you need to fix the errors at the source and re-run them.  A good developer always programs for errors and reprocessing with prevention of duplicates, so that you could run the entire file again without issue.  Did you tag the records/documents with an identifier to prevent duplicates?

  • Error while uploading the data Using LSMW - Idoc method

    Hi Experts,
       I am working on LSMW using Idoc method. Till 12th step (Display converted data) i wasn't got any problem. For the Idoc method, I have to specify details to Idoc inbound processing from the menu settings.
    In that screen I have to specify file port, partner type and partner no. I have created a file port ZFILE. Can u tell me what ahould I pass in that screen? Where should be the file i.e in the application server or presentation server? What should be the directory and function  module. Can u provide step by step?
    After that I have to specify partn.type. What should I select for that?
    After that I have to specify partner no. Whether it is inbound or outbound?
    I got No data found for the following detials.
    port - ZFILE
    in the inbound file tab, e:\ as physical directory; EDI_PATH_CREATE_USERNAME as function module.
    Partner type - US
    Parnter no.  - LSMW with the inbound parameters message type - MATMAS and Process code - MATM.
    Please tell me how can I upload properly? Please don't ignore as i am asking same question again becasue I have gone through related threads also. But i didn't find the exact requirement.
    proper documentation will be rewarded.
    Thanks in Advance.
    James.

    Hello,
    I could identify the error. It was due to incorrect UOM. Problem resolved.
    Thanks,
    Madhura

  • Problem in Upload of data using FBZ5 which is for cheque form printing

    hi Gurus,
         I have done recording for uploading of the documents for printing of the cheques, using FBZ5 to code. now the problem is it is not picking up the items continuously one after the other and at the same time the cheques are not printing. what could be the problem and the code is given below. Please check out and let me know how to do. Like one by one document has to be generated and at the same time the cheque has to be printed.
    perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    perform bdc_field       using 'BDC_CURSOR'       'OPAYF-PPRIZ'.
    perform bdc_field       using 'BDC_OKCODE'       '/00'.
    perform bdc_field       using 'BKPF-BELNR'     CHK_TAB-BELNR.    "  '2807000006'.
    perform bdc_field       using 'OPAYF-BUKRS'    CHK_TAB-BUKRS.    "  '1000'.
    perform bdc_field       using 'BKPF-GJAHR'     CHK_TAB-GJAHR.    "  '2007'.
    perform bdc_field       using 'OPAYF-RZAWE'      'C'.
    perform bdc_field       using 'OPAYF-PSTAP'    CHK_TAB-PSTAP.    "  '1'.
    perform bdc_field       using 'OPAYF-PZFOR'      'ZF110_D_SCHECK13'.
    perform bdc_field       using 'OPAYF-PPRIZ'    CHK_TAB-PPRIZ.    "  'LOCL'.
    perform bdc_field       using 'OPAYF-PSOFO'      'X'.
    perform bdc_field       using 'OPAYF-PPRIA'      'locl'.
    perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    perform bdc_field       using 'BDC_CURSOR'       'BKPF-BELNR'.
    perform bdc_field       using 'BDC_OKCODE'       '=DRUK'.
    perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    *perform bdc_field       using 'BDC_CURSOR'       'BKPF-BELNR'.
    perform bdc_field       using 'BDC_OKCODE'       '=NEW'.    "'/EEND'.
    **perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    **perform bdc_field       using 'BDC_OKCODE'       '=DRUK'.      "'/EEND'.
    **perform bdc_field       using 'BDC_CURSOR'       'BKPF-BELNR'.
    Thanks
    Syama

    HI
    I am sending the full code. now it is printing continuously, but it is not printing the check from the cheque printer, but the invoice is printed on the A4 sheet. What wuold be the problem.
    report ZCHECK
           no standard page heading line-size 255.
    DATA : BEGIN OF CHK_TAB OCCURS 100,
              BELNR LIKE BKPF-BELNR,
              BUKRS LIKE OPAYF-BUKRS,
              GJAHR LIKE BKPF-GJAHR,
              PSTAP LIKE OPAYF-PSTAP,
              PPRIZ LIKE OPAYF-PPRIZ,
           END OF CHK_TAB.
    DATA: v_opt LIKE ctu_params,
          v_ltext1(70) TYPE c,
          v_ltext2(70) TYPE c,
          v_tabix LIKE sy-tabix.
    *-- Internal Table for including the structure alsmex_tabline
    DATA: BEGIN OF i_excel OCCURS 0.
            INCLUDE STRUCTURE alsmex_tabline.
    DATA: END OF i_excel.
          Batch input data
    DATA:   bdcdata LIKE bdcdata   OCCURS 0 WITH HEADER LINE.
          messages of call transaction
    DATA:   messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
    PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY,
                start TYPE i OBLIGATORY, end TYPE i OBLIGATORY,
                dismode TYPE ctu_params-dismode DEFAULT 'A' OBLIGATORY.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
       EXPORTING
         program_name        = syst-repid
        DYNPRO_NUMBER       = SYST-DYNNR
        FIELD_NAME          = ' '
        STATIC              = ' '
        MASK                = ' '
        CHANGING
          file_name           =  p_file
       EXCEPTIONS
         mask_too_long       = 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.
    START-OF-SELECTION.
      DATA l_file TYPE string.
      CLEAR l_file.
      l_file = p_file.
    *-- Calling the function ALSM_EXCEL_TO_INTERNAL_TABLE
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_file
          i_begin_col             = 1
          i_begin_row             = start
          i_end_col               = 50
          i_end_row               = end
        TABLES
          intern                  = i_excel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 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.
    END-OF-SELECTION.
      DATA: v_opltext(600) TYPE c,
            v_ipltext(600) TYPE c,
            v_len TYPE i,
            r_count(2) TYPE c,
            v_rowcount(2) TYPE c,
            v_screenfld(132) TYPE c,
            msg_txt(150) TYPE c.
    LOOP AT i_excel.
        CASE i_excel-col.
          WHEN '0001'.
            CHK_TAB-BELNR = i_excel-value.
          WHEN '0002'.
            CHK_TAB-BUKRS = i_excel-value.
          WHEN '0003'.
            CHK_TAB-GJAHR = i_excel-value.
          WHEN '0004'.
            CHK_TAB-PSTAP = i_excel-value.
          WHEN '0005'.
            CHK_TAB-PPRIZ = i_excel-value.
    ENDCASE.
        AT END OF row.
          APPEND CHK_TAB.
          CLEAR CHK_TAB.
        ENDAT.
      ENDLOOP.
      v_opt-dismode = dismode.
      v_opt-updmode = 'S'.
    LOOP AT CHK_TAB.
        CLEAR: v_tabix.
        v_tabix = sy-tabix.
    perform bdc_dynpro      using 'SAPMFCHK'       '0750'.
    perform bdc_field       using 'BDC_CURSOR'     'BKPF-GJAHR'.
    perform bdc_field       using 'BDC_OKCODE'     '/00'.
    perform bdc_field       using 'BKPF-BELNR'      CHK_TAB-BELNR.   "'2807000008'.
    perform bdc_field       using 'OPAYF-BUKRS'    CHK_TAB-BUKRS.    "'1000'.
    perform bdc_field       using 'BKPF-GJAHR'     CHK_TAB-GJAHR.    "'2007'.
    perform bdc_field       using 'OPAYF-RZAWE'    'C'.
    perform bdc_field       using 'OPAYF-PSTAP'    CHK_TAB-PSTAP.    "'1'.
    perform bdc_field       using 'OPAYF-PZFOR'    'ZF110_D_SCHECK13'.
    perform bdc_field       using 'OPAYF-PPRIZ'    CHK_TAB-PPRIZ.    "'locl'.
    perform bdc_field       using 'OPAYF-PSOFO'    'X'.
    perform bdc_field       using 'OPAYF-PPRIA'    'locl'.
    perform bdc_dynpro      using 'SAPMFCHK'       '0750'.
    perform bdc_field       using 'BDC_CURSOR'     'BKPF-BELNR'.
    perform bdc_field       using 'BDC_OKCODE'     '=DRUK'.
    **perform bdc_field       using 'BKPF-BELNR'     '2807000008'.
    **perform bdc_field       using 'OPAYF-BUKRS'    '1000'.
    **perform bdc_field       using 'BKPF-GJAHR'     '2007'.
    **perform bdc_field       using 'OPAYF-RZAWE'    'C'.
    **perform bdc_field       using 'OPAYF-PSTAP'    '1'.
    **perform bdc_field       using 'OPAYF-PZFOR'    'ZF110_D_SCHECK13'.
    **perform bdc_field       using 'OPAYF-PPRIZ'    'locl'.
    **perform bdc_field       using 'OPAYF-PSOFO'    'X'.
    **perform bdc_field       using 'OPAYF-PPRIA'    'locl'.
    perform bdc_dynpro      using 'SAPMFCHK'       '0750'.
    perform bdc_field       using 'BDC_OKCODE'     '/EEND'.
    perform bdc_field       using 'BDC_CURSOR'     'BKPF-BELNR'.
    **perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    **perform bdc_field       using 'BDC_CURSOR'       'OPAYF-PPRIZ'.
    **perform bdc_field       using 'BDC_OKCODE'       '/00'.
    **perform bdc_field       using 'BKPF-BELNR'     CHK_TAB-BELNR.    "  '2807000006'.
    **perform bdc_field       using 'OPAYF-BUKRS'    CHK_TAB-BUKRS.    "  '1000'.
    **perform bdc_field       using 'BKPF-GJAHR'     CHK_TAB-GJAHR.    "  '2007'.
    **perform bdc_field       using 'OPAYF-RZAWE'      'C'.
    **perform bdc_field       using 'OPAYF-PSTAP'    CHK_TAB-PSTAP.    "  '1'.
    **perform bdc_field       using 'OPAYF-PZFOR'      'ZF110_D_SCHECK13'.
    **perform bdc_field       using 'OPAYF-PPRIZ'    CHK_TAB-PPRIZ.    "  'LOCL'.
    **perform bdc_field       using 'OPAYF-PSOFO'      'X'.
    **perform bdc_field       using 'OPAYF-PPRIA'      'locl'.
    **perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    **perform bdc_field       using 'BDC_CURSOR'       'BKPF-BELNR'.
    **perform bdc_field       using 'BDC_OKCODE'       '=DRUK'.
    **perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    **perform bdc_field       using 'BDC_CURSOR'       'BKPF-BELNR'.
    **perform bdc_field       using 'BDC_OKCODE'       '=NEW'.    "'/EEND'.
    **perform bdc_dynpro      using 'SAPMFCHK'         '0750'.
    **perform bdc_field       using 'BDC_OKCODE'       '=DRUK'.      "'/EEND'.
    **perform bdc_field       using 'BDC_CURSOR'       'BKPF-BELNR'.
    '=ENTE'. '=BU'.
    CALL TRANSACTION 'FBZ5' USING bdcdata
          OPTIONS FROM v_opt MESSAGES INTO messtab.
          WRITE:/10 'ROW:' COLOR 4,v_tabix.
          LOOP AT messtab.
            CALL FUNCTION 'FORMAT_MESSAGE'
              EXPORTING
                id        = messtab-msgid
                lang      = sy-langu
                no        = messtab-msgnr
                v1        = messtab-msgv1
                v2        = messtab-msgv2
                v3        = messtab-msgv3
                v4        = messtab-msgv4
              IMPORTING
                msg       = 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.
            IF messtab-msgtyp EQ 'E'.
              WRITE:/10 messtab-msgtyp,msg_txt COLOR 6.
            ELSEIF messtab-msgtyp EQ 'S'.
              WRITE:/10 messtab-msgtyp,msg_txt COLOR 5.
            ELSEIF messtab-msgtyp EQ 'W'.
              WRITE:/10 messtab-msgtyp,msg_txt COLOR 3.
            ELSE.
              WRITE:/10 messtab-msgtyp,msg_txt COLOR 4.
            ENDIF.
            CLEAR msg_txt.
          ENDLOOP.
          ULINE.
          REFRESH:bdcdata,messtab.
      ENDLOOP.
    *&      Form  BDC_DYNPRO
          text
         -->PROGRAM    Program name
         -->DYNPRO     Screen number
    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
          Insert batch input data
         -->FNAM       Screen Field Name
         -->FVAL       Field Value
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    **perform bdc_transaction using 'FBZ5'.
    **perform close_group.

  • Uploading Master Data using Flexible upload.

    Hi All,
    I am trying to post my current project scenario, in simple terms. Please guide me with inputs or pointers....
    I have two flat files
    File1, has - Emp Number, Emp Name, Emp Salary.
    FIle2, has - Emp Number, Emp SSN, Emp ph #, Short text, Medium text, Long Text.
    Now I need to upload these two flat files into an InfoObject(EmployeeNumber ). Such that Emp Number, Emp Name, Emp Salary, Emp SSN, Emp ph # - fields get into the EmployeeNumber InfoObject - Attributes table.
    And Short text, Medium text, Long Text gets into the Text table of the EmployeeNumber InfoObject.
    I think, this is an ideal scenario for flexible upload of master data. But I donno wat steps I need to follow to accomplish this. I would appreciate if someone can help me with a detailed solution or any pointers.
    Thanks
    -kiran
    ps : All useful replies will be awarded points.

    Hi Kiran,
    Welcome to SDN !!
    I believe you have already created the master data info-objects and assigned the attributes to the master data. Select short, medium and long text in the info-object definition.
    Next step would be to insert the master data (attributes and texts) as info-providers in the info-provider section of AWB. Go to the info-area -> right click -> insert characteristics as data target (select the info-object from the list) (you should switch on the text and master data in the definition itself).
    Next step, create two flat file info-sources for the two files. Create the update rules for the two info-sources and create the info-package to extract the master data.
    Hope it helps.
    Thanks
    Soumya

Maybe you are looking for