‎2007 Aug 09 6:47 PM
when I read a data from the internal table I should be able to validate the correct entry
My internal table is like this
Field1 Field2
X
Y
Z
Z
Z
X
Y
Z
Z
Z
The validation is like this it should follow XYZZ or XYZZZZ or XYZZZZZZZ else it should throw an error message
How to identify whether the file format is in the above order or not
Kindly response.
Thanks
Yamini.A
‎2007 Aug 09 7:00 PM
Something like this?
data: begin of itab occurs 0,
field1 type c,
fleld2 type c,
end of itab.
data: istr type table of string with header line..
itab-field1 = 'X'. append itab.
itab-field1 = 'Y'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'X'. append itab.
itab-field1 = 'Y'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'X'. append itab.
itab-field1 = 'Y'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
itab-field1 = 'Z'. append itab.
loop at itab.
if itab-field1 = 'X'
and sy-tabix > 1.
append istr.
clear istr.
endif.
concatenate istr itab-field1 into istr.
at last.
append istr.
endat.
endloop.
loop at istr.
write:/ istr.
if istr(3) <> 'XYZ'.
write:/ 'There is a problem with the format'.
endif.
endloop.
Regards,
Rich Heilman
‎2007 Aug 09 11:29 PM
loop at itab.
case field1.
when 'X'.
if sy-tabix > 1.
*-- skip the first time
if v_zcount < 2.
clear v_zcount.
*-- error
else.
clear v_zcount.
endif.
when 'Y'.
when 'Z'.
v_zcount = v_zcount + 1.
endcase.
endloop.