Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

READ DATASET

I am reading the file using READ DATASET. I get an error on the 4th MOVE, MOVE gv_row+36(40) TO wa_qualitydata-char_descr.

The current program "ZFS1052IN" tried to access a part of a string using

offset and length.

However, the sum of the offset (36) and length (40) specifications

was greater than the length of the string (64).

This is not allowed.

Any ideas how to solve this?

Thanks

TYPES: BEGIN OF t_qualitydata,
         matnr(18)      TYPE C,
         charg(10)      TYPE C,
         verwmerkm(8)   TYPE C,
         char_descr(40) TYPE C,
         kurztext(40)   TYPE C,
         mean_value(22) TYPE C,
       END OF t_qualitydata.
DATA: i_qualitydata  TYPE STANDARD TABLE OF t_qualitydata,
      wa_qualitydata TYPE t_qualitydata.

DATA: gv_row TYPE string.

OPEN DATASET c_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
  READ DATASET c_file INTO gv_row.
  IF sy-subrc = 0.

    MOVE gv_row+0(18)   TO wa_qualitydata-matnr.
    MOVE gv_row+18(10)  TO wa_qualitydata-charg.
    MOVE gv_row+28(8)   TO wa_qualitydata-verwmerkm.
<b>    MOVE gv_row+36(40)  TO wa_qualitydata-char_descr.</b>

    APPEND wa_qualitydata TO i_qualitydata.

  ELSE.
    EXIT.
  ENDIF.                   "IF sy-subrc = 0.
ENDDO.

CLOSE DATASET gv_row.

HYC26138450      AC7812345 50000700SPECIFIC GRAVITY @ 15.6 C                                                                       1.0600
HYC26138450      AC7812345 50000751BLOT  (PASS)                            Clean
HYC26138450      AC7812345 50000757CLARITY  (CLEAR)                        Slight Haze Pass
HYC26138450      AC7812345 50000761COLOR  3.0 typical                      L 0.5
HYC26138450      AC7812345 50000731VISCOSITY @ 40 C, CST                                                                            69.00
HYC26138450      AC7812345 50000725VISCOSITY @ 100 C, CST                                                                           8.300
HYC26138450      AC7812345 50000429WATER                                                                                0.300
HYC26138450      AC7812345 50000770COPPER STRIP  2C max.                   1A
HYC26138450      AC7812345 50000286NITROGEN                                                                                0.900
HYC26138450      AC7812345 50000322PHOSPHORUS                                                                                1.600
HYC26138450      AC7812345 50000401SULFUR                                                                                30.000
HYC26138450      AC7812345 50000745APPEARANCE  (PASS)                      Tan
HYC26138450      AC7812345 50000264MINERAL OIL                                                                                1.900
HYC26138450      AC7812345 50000398SULFATED ASH                                                                                0.850
HYC26138450      AC7812345 50000469BASE NUMBER                                                                                90.000
HYC26138450      AC7812345 50000524FLASH POINT, C, PMCC                                                                              63.0
HYC26138450      AC7812345 50000531FOAM TEST, SEQ II, STABILITY
HYC26138450      AC7812345 50000530FOAM TEST, SEQ II, TENDENCY
HYC26138450      AC7812345 50000793H2S HEAD AFTER STG  (NEGATIVE)          Negative
HYC26138450      AC7812345 50000778INFRARED EVALUATION  (PASS)             FC-1 Fail Category 1
HYC26138450      AC7812345 50000569LBS PER GAL @ 15.6 C                                                                             8.880
HYC26138450      AC7812345 50000782ODOR AFTER STORAGE  (STRONG)            Strong
HYC26138450      AC7812345 50000617POUR POINT, C                                                                                -24.0
HYC26138450      AC7812345 50000713SPECIFIC GRAVITY FACTOR                                                                      0.0007200

Tags:
Former Member
Former Member replied

Hi,

change gv_row from string to char say length 250.

Thanks,

Deepak.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question