2006 Mar 10 5:46 PM
Hi, I make a loop..in a table like..
LOOP AT GT_LIST_2 into list_2.
.....
......
MODIFY gt_LIST_2 FROM LIST_2.
ENDLOOP.
The definition of a table I made like:
DATA: BEGIN OF LIST_2 OCCURS 0,
EBELN LIKE EKBE-EBELN,
EBELP LIKE EKBE-EBELP,
GJAHR LIKE EKBE-GJAHR,
BELNR LIKE EKBE-BELNR,
BEWTP LIKE EKBE-BEWTP,
BUDAT LIKE EKBE-BUDAT,
MENGE LIKE EKBE-MENGE,
WRBTR LIKE EKBE-WRBTR,
WAERS LIKE EKBE-WAERS,
WERKS LIKE EKBE-WERKS,
SHKZG LIKE EKBE-SHKZG,
DMBTR LIKE EKBE-DMBTR,
END OF LIST_2.
DATA gt_list_2 LIKE SORTED TABLE
OF list_2
WITH NON-UNIQUE DEFAULT KEY.
But... When the program arrive to MODIFY has a mistake... I don´t know exactly how I can modify the sorted table, can anybody tell me how I can do this?
Thank you.
2006 Mar 10 5:50 PM
Hi
It's very strange because you're trying to modify a table into its loop and it shouldn't have a mistake.
Try to use the index:
LOOP AT GT_LIST_2 into list_2.
TABIX = SY-TABIX.
.............
MODIFY gt_LIST_2 FROM LIST_2 INDEX TABIX
ENDLOOP.
Max
Hi, I make a loop..in a table like..
LOOP AT GT_LIST_2 into list_2.
.....
......
MODIFY gt_LIST_2 FROM LIST_2.
ENDLOOP.
The definition of a table I made like:
DATA: BEGIN OF LIST_2 OCCURS 0,
EBELN LIKE EKBE-EBELN,
EBELP LIKE EKBE-EBELP,
GJAHR LIKE EKBE-GJAHR,
BELNR LIKE EKBE-BELNR,
BEWTP LIKE EKBE-BEWTP,
BUDAT LIKE EKBE-BUDAT,
MENGE LIKE EKBE-MENGE,
WRBTR LIKE EKBE-WRBTR,
WAERS LIKE EKBE-WAERS,
WERKS LIKE EKBE-WERKS,
SHKZG LIKE EKBE-SHKZG,
DMBTR LIKE EKBE-DMBTR,
END OF LIST_2.
DATA gt_list_2 LIKE SORTED TABLE
OF list_2
WITH NON-UNIQUE DEFAULT KEY.
But... When the program arrive to MODIFY has a mistake... I don´t know exactly how I can modify the sorted table, can anybody tell me how I can do this?
Thank you.
2006 Mar 10 5:50 PM
Hi
It's very strange because you're trying to modify a table into its loop and it shouldn't have a mistake.
Try to use the index:
LOOP AT GT_LIST_2 into list_2.
TABIX = SY-TABIX.
.............
MODIFY gt_LIST_2 FROM LIST_2 INDEX TABIX
ENDLOOP.
Max
2006 Mar 10 5:52 PM
Hi
I try with SY-INDEX but has a mistake too.
What other statment can I use?
Thank you
2006 Mar 10 5:56 PM
Hi
Excuse me: but what does it mean to have a mistake?
Remember: if you use a sorted table you haven't to update the fields used to define the key
Max
2006 Mar 10 5:58 PM
Hi again
The mistake say
You tried to insert or change a line at postion 2 in the internal table "\PROGRAM=ZMMRP046_ALICIA\DATA=GT_LIST_2 " (of the kind sorted table). This violate the sort sequence of the table, wich was laid down when the table was declared.
Could you give other option please
Thank you
2006 Mar 10 6:00 PM
Hi
I think you're tryng to update the key fields.
You have define your table in this way:
DATA: BEGIN OF LIST_2 OCCURS 0,
EBELN LIKE EKBE-EBELN,
EBELP LIKE EKBE-EBELP,
GJAHR LIKE EKBE-GJAHR,
BELNR LIKE EKBE-BELNR,
BEWTP LIKE EKBE-BEWTP,
BUDAT LIKE EKBE-BUDAT,
MENGE LIKE EKBE-MENGE,
WRBTR LIKE EKBE-WRBTR,
WAERS LIKE EKBE-WAERS,
WERKS LIKE EKBE-WERKS,
SHKZG LIKE EKBE-SHKZG,
DMBTR LIKE EKBE-DMBTR,
END OF LIST_2.
DATA gt_list_2 LIKE SORTED TABLE
OF list_2
WITH NON-UNIQUE DEFAULT KEY.
So all char fields are key fields.
You should use only the fields you haven't to change as key fields.
Your internal table have fields of EKBE, so only the key fields of EKBE should be used to define the key of your internal table.
WITH NON-UNIQUE KEY EBELN EBELP GJAHR BELNR.
Max
2006 Mar 10 6:04 PM
2006 Mar 10 7:43 PM
I try with the definition of:
DATA: BEGIN OF LIST_2 OCCURS 0,
EBELN LIKE EKBE-EBELN,
EBELP LIKE EKBE-EBELP,
GJAHR LIKE EKBE-GJAHR,
BELNR LIKE EKBE-BELNR,
BEWTP LIKE EKBE-BEWTP,
BUDAT LIKE EKBE-BUDAT,
MENGE LIKE EKBE-MENGE,
WRBTR LIKE EKBE-WRBTR,
WAERS LIKE EKBE-WAERS,
WERKS LIKE EKBE-WERKS,
SHKZG LIKE EKBE-SHKZG,
DMBTR LIKE EKBE-DMBTR,
END OF LIST_2.
DATA gt_list_2 LIKE SORTED TABLE
OF list_2
WITH NON-UNIQUE DEFAULT KEY.
but give a error.
and with
DATA gt_list_2
LIKE SORTED TABLE OF list_2
WITH NON-UNIQUE KEY EBELN EBELP.
give the error:
the error that I told you but in position 4
I need to especify the fields that I need to modify??
Thank you again
2006 Mar 10 7:50 PM
2006 Mar 10 7:52 PM
2006 Mar 10 8:13 PM
With:
DATA gt_list_2 LIKE SORTED TABLE
OF list_2
WITH UNIQUE KEY mandt ebeln ebelp zekkn vgabe gjahr belnr buzei.
I run the program with most than 12 rows...and its seem that will be ok
If I have other problem with more rows..I will told you
Thank you a lot
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |