10-14-2008 3:09 PM
I keep getting this errors like this one in Extended Check:
LIT_ERRORS stands for 2 fields: Table LIT_ERRORS[] and its header line
Field string LIT_ERRORS is not referenced statically in the program
and the tables have heading line, although i dont want them to have it.
code is:
TYPES:
ty_c(1),
ty_idoc TYPE yidocproc_idocinfo, "shorter name
ty_recipient TYPE yidocproc_rcpnts,
tty_idocs TYPE STANDARD TABLE OF ty_idoc WITH KEY docnum credat, "idocs container
tty_status TYPE STANDARD TABLE OF teds1-status,
tty_recvs TYPE STANDARD TABLE OF soos1, "email recipients
(...)
FORM process_idocs
TABLES
lit_idocs TYPE tty_idocs
lit_errors TYPE tty_errors.
DATA:
lit_bommats TYPE tty_idocs,
lit_other TYPE tty_idocs,
wa_date TYPE sy-datum.
FIELD-SYMBOLS:
<fs_idoc> TYPE ty_idoc.
" loop thru idocs, process them day by day
LOOP AT lit_idocs[] ASSIGNING <fs_idoc>.
" filter out bommats to be processed
IF <fs_idoc>-mestyp EQ 'BOMMAT'
AND ( <fs_idoc>-status EQ '64' OR <fs_idoc>-status EQ '51' ) . "check for not processed ?
INSERT <fs_idoc> INTO TABLE lit_bommats.
ELSE.
INSERT <fs_idoc> INTO TABLE lit_other.
ENDIF.
AT END OF credat.
" check idocs not to be processed for a given day
PERFORM check_idocs
TABLES
lit_other[]
lit_errors[].
IF NOT lit_bommats[] IS INITIAL AND lit_errors[] IS INITIAL.
" process bommats for a given day
PERFORM process_bommats
TABLES
lit_bommats[]
lit_errors[].
ENDIF.
REFRESH: lit_bommats[],
lit_other[].
ENDAT.
ENDLOOP.
the END AT credat doesnt work properly, processed idoc one by one. And i have to constantly remember to use [] when using table body.
I've been stuck on this one for 3h or more, any idea?
10-14-2008 3:48 PM
Is your table sorted, and is the "credat" field at the beginning of the structure, else the AT END will trigger each time any of the previous fields is changing....
Loop at AT END online documentation from Abap editor
AT END OF f.
In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Compatible Work Area with Control Level Processing and Field Symbols Not Allowed as Control Level Criterion.
Effect
f is a sub-field of an internal table processed with LOOP. The sequence of statements which follow it is executed if the sub-field f or a sub-field in the current LOOP line defined (on the left) before f has a different value than in the preceding (AT NEW) or subsequent (AT END OF) table line.
So change to a structure
beginning with "credat" field.
Regards
10-14-2008 3:12 PM
FORM process_idocs
CHANGING "TABLES
lit_idocs TYPE tty_idocs
lit_errors TYPE tty_errors.
ENDFORM.
10-14-2008 3:14 PM
Hi ,
You can directly use the table lit_errors without specifying [] .
Regards,
Sandeep
10-14-2008 3:24 PM
In this case it would address the header line instead of the table, wouldn't it?
Using CHANGING instead of TABLES solved the problem of header lines, but the AT END OF credat still doesn't work 😕
10-14-2008 3:26 PM
Use
LOOP AT lit_idocs into work_area.
if
LOOP AT lit_idocs ASSIGNING <fs_idoc>.
doesn't work..
Edited by: Pawan Kesari on Oct 14, 2008 7:57 PM
10-14-2008 3:25 PM
Hi
LOOP AT lit_idocs[] ASSIGNING <fs_idoc>. <----???????
It shoudl be:
LOOP AT lit_idocs ASSIGNING <fs_idoc>.
Max
10-14-2008 3:35 PM
Neither worked. Maybe there's something wrong with my table declaration?
Anyways i store it sorted by credat, so it should be ok 😕 but it still fires AT END OF credat on every single loop pass.
10-14-2008 3:40 PM
That is probably because CREDAT is not the first field in structure yidocproc_idocinfo and/or the table lit_idocs is not sorted by that field.
Thomas
10-14-2008 3:40 PM
how is your type yidocproc_idocinfo defined..
docnum and credat should be the first and second field in definition..
10-14-2008 3:46 PM
Hi
Just as Thomas said, check in which position is the field CREDAT:
u should consider the statament AT END OF <FIELD> is triggered as soon as a value of field <FIELD> or a field at the left of <FIELD> is changed.
Max
10-14-2008 3:46 PM
It goes
1: docnum
2: status
3: credat
but even if i declare type standard table with key docnum status credat and then sort it by credat (which i did before) it still doesn't work properly. Do i have to declare a new structure based on yidocproc_idocinfo ? or is there a way to miss out on some columns, or change their sequence?
10-14-2008 3:52 PM
AT END OF credat will be trigger if there is a change in any component on the left of credat, which includes docnum and status...
If you intended to summarize on credat then it should be the first field,
if you intended to sumarize on docnum and credat then field docnum and credat should be defined in sequence.
beacause you did sort on docnum and credat i assume you want to sumarize docnum and credat.
10-14-2008 3:48 PM
Is your table sorted, and is the "credat" field at the beginning of the structure, else the AT END will trigger each time any of the previous fields is changing....
Loop at AT END online documentation from Abap editor
AT END OF f.
In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Compatible Work Area with Control Level Processing and Field Symbols Not Allowed as Control Level Criterion.
Effect
f is a sub-field of an internal table processed with LOOP. The sequence of statements which follow it is executed if the sub-field f or a sub-field in the current LOOP line defined (on the left) before f has a different value than in the preceding (AT NEW) or subsequent (AT END OF) table line.
So change to a structure
beginning with "credat" field.
Regards
10-14-2008 4:01 PM
Hey,
I wanted to process idocs day by day, so i needed only AT END OF credat. Docnum is irrelevant in this context. I used it as a key, because most of the tables in db have it as only or first part of key.
By your suggestions i created a new structure with different sequence of columns. It solved the problem perfectly. Thank oyu very much.
Regards,
Michael Szczerbowski