Skip to Content
author's profile photo Former Member
Former Member

Short Dump in INTO CORRESPONDING FIELDS OF field-symbol structure

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

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Best Answer
    Posted on Feb 18, 2016 at 06:48 PM

    Hi Eloi,

    I replicated the example in my system to test and this is the key piece of information from the short dump:

    If you change the table declaration to a standard table it works fine - however, as a note I'm not sure why you would select some fields on EDID4 and then within a LOOP go select more fields on EDID4 instead of simply getting all of the fields you require in one selection.

    Regards,

    Ryan Crosby


    Add comment
    10|10000 characters needed characters exceeded

    • With explicit field names, the system doesn't find docnum key field nor other protected field, so no error. With corresponding option, it seems to consider you are trying to modify whole record structure, so every field and error raised.

      Regards,

      Raymond

  • author's profile photo Former Member
    Former Member
    Posted on Feb 18, 2016 at 06:39 PM

    Rather than "the error in the dump reads something like...", why don't you just post the relevant portion of the dump (the part containing the code plus the error)?

    Rob

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello Elzkie,

      First of all, thanks for your collaboration; but I don't think it will work.

      Your example, as I think, lacks of correlation between table LT_SEGMEN_INIT and LT_SEGMEN.

      How do I know which SEGNAM+DTINT2+SDATA goes with its corresponding DOCNUM+COUNTER+SEGNUM?


      It's a common misconception to think that DB reads return [guaranteed] lines sorted by key.


      Thanks,


      Eloi