<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic table update in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212502#M474062</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;               I have to update a custom table using records from flat file and display the number of error as well as success records. Total no.of records updated and no.of error records.&lt;/P&gt;&lt;P&gt;             as i am not performing any recording,plz let me know how to achieve this fuctionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnaks in advance&lt;/P&gt;&lt;P&gt;alson&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 May 2007 06:42:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-03T06:42:34Z</dc:date>
    <item>
      <title>table update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212502#M474062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;               I have to update a custom table using records from flat file and display the number of error as well as success records. Total no.of records updated and no.of error records.&lt;/P&gt;&lt;P&gt;             as i am not performing any recording,plz let me know how to achieve this fuctionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnaks in advance&lt;/P&gt;&lt;P&gt;alson&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 06:42:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212502#M474062</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-03T06:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: table update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212503#M474063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you need to show the errors in a separate log and sucess record in separate log file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whats the functionality for finding out the error records? I mean how will you know that some number of records are invalid?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;nazeer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 06:48:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212503#M474063</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-03T06:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: table update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212504#M474064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alson,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. read the flatfile using GUI_UPLOAD into an internal table (ITAB).&lt;/P&gt;&lt;P&gt;2. MODIFY  dbtab      FROM TABLE itab.&lt;/P&gt;&lt;P&gt;3. Check sy-subrc after modify if its value is 0. successfully added.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    error while updating the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 06:50:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212504#M474064</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-03T06:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: table update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212505#M474065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi What you can do is to create a program and use the function module GUI_UPLOAD to upload your flatfile into an internal table then using that internal table then you can update your custom table. Hope it helps...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. Please award points if it helps...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 06:53:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212505#M474065</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2007-05-03T06:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: table update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212506#M474066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you have to create a custom program, use the gui_upload method of the cl_gui_frontend_services class to read the file in an internal table, loop on this internal table and validate it (if required) and then from this table, use the insert or update or modify sql command to insert this into the table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For success and error messages, you need to check the sy-subrc after insert. in case you want a separate message for each record, you might have to write your sql (insert, update or modify) within the loop on the internal table which is not the most efficient way to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Priyank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 06:55:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212506#M474066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-03T06:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: table update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212507#M474067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;first upload data to an internal table using GUI_UPLOAD,&lt;/P&gt;&lt;P&gt;then use update tablename from table itab(internal table).&lt;/P&gt;&lt;P&gt;check for if sy-subrc &amp;lt;&amp;gt; 0.it means updation is not done and The statement UPDATE sets sy-dbcnt to the number of changed lines.using this you can get number of records updated and records which are not updated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 07:01:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212507#M474067</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-03T07:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: table update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212508#M474068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alson, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have searched my ABAP archives to give you an example on how to do your requirement. I did this report a long time ago but I know it will solve your requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT zfr_update_ztf0196 NO STANDARD PAGE HEADING
                      LINE-COUNT 65
                      LINE-SIZE 255
                      MESSAGE-ID zz.

*-----------------------------------------------------------------------
* Tables
*-----------------------------------------------------------------------
TABLES: ztf0196.       "UDT for ZFR_FR_ACCRUAL_UPLOAD Program

DATA: BEGIN OF it_upload OCCURS 0,
        bukrs LIKE ztf0196-bukrs,
        xref1 LIKE ztf0196-xref1,
        zlas  like ztf0196-zlas,
        zname like ztf0196-zname,
      END OF it_upload.

DATA: wa_upload LIKE ztf0196.

DATA: BEGIN OF it_error OCCURS 0.
        INCLUDE STRUCTURE it_upload.
DATA: msg(50) TYPE c,
      END OF it_error.

*-----------------------------------------------------------------------
* Selection Screen
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK box0 WITH FRAME.
PARAMETERS: p_flnme LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK box0.


*-----------------------------------------------------------------------
AT SELECTION-SCREEN.
*-----------------------------------------------------------------------

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnme.
  CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
            mask             = ',*.*,*.*.'
            mode             = 'O'
            title            = 'File Selection'
       IMPORTING
            filename         = p_flnme
       EXCEPTIONS
            inv_winsys       = 1
            no_batch         = 2
            selection_cancel = 3
            selection_error  = 4
            OTHERS           = 5.

*-----------------------------------------------------------------------
START-OF-SELECTION.
*-----------------------------------------------------------------------
  CLEAR: it_upload.
  REFRESH: it_upload.

  PERFORM upload_data.

  IF NOT it_upload[] IS INITIAL.
    PERFORM update_ztf0196.
  ENDIF.

  IF it_error[] IS INITIAL.
    MESSAGE s000 WITH 'Records successfully updated.'.
  ELSE.
    PERFORM write_error.
  ENDIF.

************************************************************************
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  upload_data
*&amp;amp;---------------------------------------------------------------------*
FORM upload_data.
  CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
            filename        = p_flnme
            filetype        = 'DAT'
       TABLES
            data_tab        = it_upload
       EXCEPTIONS
            file_open_error = 1
            OTHERS          = 2.
  CASE sy-subrc.
    WHEN 1.
      MESSAGE i008 WITH 'Error found when opening dataset' p_flnme.
      STOP.
    WHEN 2.
      MESSAGE i008 WITH 'Error during uploading dataset' p_flnme.
      STOP.
  ENDCASE.
ENDFORM.                    " upload_data
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  update_ztf0196
*&amp;amp;---------------------------------------------------------------------*
FORM update_ztf0196.
  LOOP AT it_upload.
    MOVE-CORRESPONDING it_upload TO wa_upload.
    INSERT INTO ztf0196 VALUES wa_upload.

    IF sy-subrc EQ 4.
      MOVE-CORRESPONDING it_upload TO it_error.
      it_error-msg = 'Record already exists.'.

      APPEND it_error.
    ELSEIF sy-subrc NE 0.
      MOVE-CORRESPONDING it_upload TO it_error.
      it_error-msg = 'Error when inserting to the database.'.

      APPEND it_error.
    ENDIF.

    CLEAR: it_error, wa_upload.
  ENDLOOP.
ENDFORM.                    " update_ztf0196
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  write_error
*&amp;amp;---------------------------------------------------------------------*
FORM write_error.
  WRITE: 'Validation Error'.
  LOOP AT it_error.
    WRITE: / it_error-bukrs,
             it_error-xref1,
             it_error-msg.
  ENDLOOP.
ENDFORM.                    " write_error

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. Please award points if it helps...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2007 07:01:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-update/m-p/2212508#M474068</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2007-05-03T07:01:44Z</dc:date>
    </item>
  </channel>
</rss>

