on 06-19-2015 2:14 PM
Hi All,
We were loading data to direct update DSO through APD. Recently we are facing error as "Duplication record issue". We have tried aggregation and all similar ways, it didn't work.
Also we don't have unique data for any of the field. So, we planned to have key field as counter in Direct update DSO and this field can be filled by numbers (similar to serial numbers) in order to get unique record.
Could any of you can share a piece of code which will work in APD Routine.
Thanks,
Asamuel
If your source is a Bex query, there is a simpler solution which will avoid any coding: take the list of all characteristics in the output of the query, and ensure that all of those characteristics are in the key field of the target DSO.
If that is not possible for any reason, and if you want to do with the counter concept, then use an ABAP routine as the final step of the APD (before writing to the target DSO). In the ABAP routine, you derive the record number as below. I'm assuming that the field is called COUNTER in the target DSO.
DATA: ctr type i value 1.
LOOP AT it_source INTO ls_source.
MOVE-CORRESPONDING ls_source TO ls_target.
ls_source-counter = ctr.
ctr = ctr + 1.
APPEND ls_target TO et_target.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you are writing the code to update target of APD, then your internal table and work area are,
et_target and ls_target respectively,
you can append a field to your target as zrecord,
in routine,
data l_record type i.
l_record = 1.
loop at et_target into ls_target.
ls_target-zrecord = l_record.
modify et_target from ls_target.
l_record = l_record + 1.
endloop.
clear l_record.
this could would generate unique record number for all records,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you are getting data in et_target internal table, the given code should populate the record number for each record,
if no data came through to et_target as defalt, then you may have to use the code specified by Suhas, which does the following thing,
process every record from source, move to target work area and then target internal tabe,
you can check how the data is flown through APD, at each step of it, by selecting the object in the context menu, display data,
also you can debug the code by keeping a break point at this to check what is happening,
Hi Anish,
Try filter your empty records in key.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anish,
Yes, we can generate sequence number using FM "NUMBER_GET_NEXT", generate number and assign to filed.
Thank you,
Nanda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.