on 08-25-2015 2:49 PM
Hi,
I have DS sending records in following structure:
Item | Category | Group1 | Group2 |
---|---|---|---|
itm1 | cat1 | x | x |
itm2 | cat2 | x |
I need to load data in the InfoObject with following structure:
Item String
Category String
Group Int
And use following algorithm:
1) If Group1 is checked, make 1 record with Group = 1
2) If Group2 is checked, make 3 record with Groups in (2,3,4)
So from the input on top I would get following output:
Item | Categ | Group |
---|---|---|
itm1 | cat1 | 1 |
itm1 | cat1 | 2 |
itm1 | cat1 | 3 |
itm1 | cat1 | 4 |
itm2 | cat1 | 1 |
I was about to load data to DSO first where I can have the Group<Int> field. Then use start routine to multiply records. Im just very new to ABAP and not sure if this could be the right way.
Thank you for advice.
Pavel
Hi Pavel,
I suggest to use the End Routine. Here you have the Characteristic Group available as part of the RESULT_PACKAGE. This is missing in the Start Routine.
Please review SAP Note 1223532 - Design rule: Addition of records to end routine.
Best regards,
Sander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pavel,
My assumption was that the source Characteristics would also be available in the target structure. There are a few options how to proceed:
*) Please refer to SAP Note 1227667 - Guidelines for expert routine: Design rules for design rules.
A Start Routine will not work since it does not have the new Group.
Best regards,
Sander
Hi Sander,
I used DSO as middle structure and then used easy loop to load it there:
data: new_record type _ty_s_TG_1,
new_records_t type table of _ty_s_TG_1.
loop at RESULT_PACKAGE assigning <RESULT_FIELDS>.
if <RESULT_FIELDS>-Group1 eq 'X'.
new_record-Itm = <RESULT_FIELDS>-Itm.
new_record-Cat = <RESULT_FIELDS>-Cat.
new_record-Group = 1.
append new_record to new_records_t.
endif.
if <RESULT_FIELDS>-Group2 eq 'X'..
new_record-Group = 2.
append new_record to new_records_t.
new_record-Group = 3.
append new_record to new_records_t.
new_record-Group = 4.
append new_record to new_records_t.
endif.
endloop.
refresh RESULT_PACKAGE.
RESULT_PACKAGE[] = new_records_t[].
data: i type i.
i = 0.
loop at RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
i = i + 1.
<RESULT_FIELDS>-record = i.
endloop.
Thanks for help,
Pavel
Hi Pavel,
According to SAP Note 1223532 - Design rule: Addition of records to end routine you should use a different way to determine the record no. for a new record. Also the reference to the source record is recommended if the new record can be uniquely linked to one source record.
Best regards,
Sander
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.