Skip to Content
0
Former Member
May 14, 2008 at 11:35 AM

Updating Z-table

86 Views

Hi All,

Good Moring,

My task is to update a custom Z-table with respect to the given flatfile. First, I have to upload the flatfile data and then compare & update the Z-table on the basis of the common record.

To do the above task, I have created one internal table for the flatfile data and one more internal table for the Z-table data.

First, I want to compare the both internal tables for the common records, and then, modify the Z-table from the internal table.

Now, I have written the code for comparing the internal tables,

even though there are common records (checked in the debugging mode using the tables option) this Sy-Subrc = 4 always showing 4.

Plesas, give me some use ful hint, I am pasting the code below.........

REPORT ZPPBLORD.

*Tables

TABLES: ZBCTBLORDK, " Blend Orders For Honeywell blending in BCT

ZBCTSTATUS. " BCT - Status code table for blend orders

*Internal Tables

DATA: BEGIN OF IT_DBTAB OCCURS 0,

AUFNR(12), " like zbctblordk-aufnr,

SMARTCRDID(12), " like zbctblordk-smartcrdid,

AEDAT(10), " like zbctblordk-aedat,

AEUHR(8), " like zbctblordk-aeuhr,

STATUS LIKE ZBCTBLORDK-STATUS,

END OF IT_DBTAB.

DATA: BEGIN OF IT_FLFILE OCCURS 0,

AUFNR(12), " like zbctblordk-aufnr,

SMARTCRDID(12), " like zbctblordk-smartcrdid,

AEDAT(10), " like zbctblordk-aedat,

AEUHR(8), " like zbctblordk-aeuhr,

STAT_CODE LIKE ZBCTSTATUS-STAT_CODE,

STAT_TEXT LIKE ZBCTSTATUS-STAT_TEXT,

END OF IT_FLFILE.

START-OF-SELECTION.

SELECT AUFNR

SMARTCRDID

AEDAT

AEUHR

STATUS FROM ZBCTBLORDK INTO TABLE IT_DBTAB.

*Upload data from the specified file to internal table

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'P:\ZBCT.TXT'

FILETYPE = 'DAT'

TABLES

DATA_TAB = IT_FLFILE

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

OTHERS = 8.

END-OF-SELECTION.

CLEAR: IT_FLFILE, IT_DBTAB.

  • BREAK-POINT.

LOOP AT IT_DBTAB.

READ TABLE IT_FLFILE WITH KEY AUFNR = IT_DBTAB-AUFNR

SMARTCRDID = IT_DBTAB-SMARTCRDID.

IF SY-SUBRC = 0.* SY-SUBRC always showing 4, and getting in-side

  • I want to use Modify internal table command here

WRITE:/ IT_DBTAB-AUFNR,

IT_DBTAB-SMARTCRDID,

IT_DBTAB-AEDAT,

IT_DBTAB-AEUHR,

IT_DBTAB-STATUS.

ENDIF.

ENDLOOP.

ENDLOOP.