Skip to Content
0
Former Member
Feb 18, 2016 at 06:17 PM

Short Dump in INTO CORRESPONDING FIELDS OF field-symbol structure

390 Views

Dear gurus,

I get a Short Dump error everytime I use this piece of code (Header pasted later):

LOOP AT lt_idocs ASSIGNING <lf_idocs>.

SELECT docnum

counter

segnum

INTO TABLE lt_segmen_init

FROM edid4

WHERE docnum EQ <lf_idocs>-docnum.

LOOP AT lt_segmen_init ASSIGNING <lf_segmen>.

SELECT SINGLE segnam

dtint2

sdata

INTO CORRESPONDING FIELDS OF <lf_segmen>

FROM edid4

WHERE docnum EQ <lf_segmen>-docnum

AND counter EQ <lf_segmen>-counter

AND segnum EQ <lf_segmen>-segnum.

ENDLOOP.

APPEND LINES OF lt_segmen_init TO lt_segmen.

ENDLOOP.

But if I use this one (Using structure)...

DATA: ls_segmen TYPE ty_segmen.

LOOP AT lt_idocs ASSIGNING <lf_idocs>.

SELECT docnum

counter

segnum

INTO TABLE lt_segmen_init

FROM edid4

WHERE docnum EQ <lf_idocs>-docnum.

LOOP AT lt_segmen_init INTO ls_segmen.

SELECT SINGLE segnam

dtint2

sdata

FROM edid4

INTO CORRESPONDING FIELDS OF ls_segmen

WHERE docnum EQ ls_segmen-docnum

AND counter EQ ls_segmen-counter

AND segnum EQ ls_segmen-segnum.

APPEND ls_segmen TO lt_segmen.

ENDLOOP.

ENDLOOP.

...or this one (Choosing individual fields of the field-symbol explicitly)...

LOOP AT lt_idocs ASSIGNING <lf_idocs>.

SELECT docnum

counter

segnum

INTO TABLE lt_segmen_init

FROM edid4

WHERE docnum EQ <lf_idocs>-docnum.

LOOP AT lt_segmen_init ASSIGNING <lf_segmen>.

SELECT SINGLE segnam

dtint2

sdata

INTO (<lf_segmen>-segnam,

<lf_segmen>-dtint2,

<lf_segmen>-sdata)

FROM edid4

WHERE docnum EQ <lf_segmen>-docnum

AND counter EQ <lf_segmen>-counter

AND segnum EQ <lf_segmen>-segnum.

ENDLOOP.

INSERT LINES OF lt_segmen_init INTO TABLE lt_segmen.

ENDLOOP.

...it works fine.

Header here:

TYPES: BEGIN OF ty_idocs,

docnum TYPE edidc-docnum,

credat TYPE edidc-credat,

END OF ty_idocs,

ty_h_idocs TYPE HASHED TABLE OF ty_idocs

WITH UNIQUE KEY docnum,

BEGIN OF ty_segmen,

docnum TYPE edi_docnum,

counter TYPE edi_clustc,

segnum TYPE idocdsgnum,

segnam TYPE edi_segnam,

dtint2 TYPE edi_dtint2,

sdata TYPE edi_sdata,

END OF ty_segmen,

ty_o_segmen TYPE SORTED TABLE OF ty_segmen

WITH UNIQUE KEY docnum

counter

segnum.

CONSTANTS: lc_mestyp TYPE edi_mestyp

VALUE 'ZDEM_SERVICIO_SAC'.

DATA: lt_idocs TYPE ty_h_idocs.

DATA: lt_segmen_init TYPE ty_o_segmen,

lt_segmen TYPE ty_o_segmen.

FIELD-SYMBOLS: <lf_idocs> TYPE ty_idocs,

<lf_segmen> TYPE ty_segmen.

START-OF-SELECTION.

SELECT docnum

credat

FROM edidc

INTO TABLE lt_idocs

WHERE mestyp EQ lc_mestyp

%_HINTS ORACLE 'INDEX("EDIDC" "EDIDC~3")'.

[Here goes the segment selection...]

The error in Dump reads something like the following: '<LF_SEGMEN>-DOCNUM' field is being forced to be overwritten (and fails because it is key of the internal table). But I think I don't try to.

With references fails too.

Does anyone know why?

Thanks a lot!,

Eloi