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

Duplicate records from DSO to cube. DSO doesn't have any duplicate records.

Hi Gurus,

I have a data flow from DSO to cube.

In DSO, i have key figures populated column wise for fiscal periods as below

cost controlling segment FiscalYear balance for balance for ....... balance for

center area Fiscperiod1 Fiscperiod2 Fiscperiod12

CC1 CA1 S1 2015 100 200 300

CC2 CA2 S2 2015 400 500 600

In cube i have to populate it as:

cost controlling segment FiscalYear Fiscal Period Balance

center area

CC1 CA1 S1 2015 2015001 100

CC1 CA1 S1 2015 2015002 200

.

.

CC1 CA1 S1 2015 2015012 300


CC2 CA2 S2 2015 2015001 400

CC2 CA2 S2 2015 2015002 500

.

.

CC2 CA2 S2 2015 2015012 600


to populate the data as above i have written the below code in end routine:


TYPES:

_ty_t_TG_1 TYPE STANDARD TABLE OF _ty_s_TG_1

WITH NON-UNIQUE DEFAULT KEY.


lv_count = 0.

loop at RESULT_PACKAGE into wa.

if wa-/bic/zwkg001 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg001.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '001'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg002 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg002.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '002'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg003 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg003.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '003'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg004 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg004.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '004'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg005 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg005.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '005'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg006 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg006.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '006'.

lv_count = lv_count + 1.

wa-record = lv_count.

move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg007 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg007.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '007'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg008 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg008.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '008'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg009 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg009.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '009'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg010 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg010.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '010'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkg011 is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkg011.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '011'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

if wa-/bic/zwkgsp is not initial.

clear wa-record.

wa-BALANCE = wa-/bic/zwkgsp.

wa-FISCPER+0(4) = wa-fiscyear.

wa-FISCPER+4(3) = '012'.

lv_count = lv_count + 1.

wa-record = lv_count.

* move-corresponding wa to wa.

append wa to r_table.

endif.

clear wa.

endloop.

sort r_table by AC_LEDGER OBJNR FISCYEAR VTYPE VERSION COSTELMNT

/BIC/ZHRKFT /BIC/ZVRGNG PCOMPANY PBUS_AREA DB_CR_IND CO_AREA /BIC/ZPERBL

FISCPER.

delete adjacent duplicates from r_table comparing AC_LEDGER OBJNR

FISCYEAR VTYPE VERSION COSTELMNT /BIC/ZHRKFT /BIC/ZVRGNG

PCOMPANY PBUS_AREA DB_CR_IND CO_AREA /BIC/ZPERBL FISCPER.

refresh RESULT_PACKAGE[].

RESULT_PACKAGE[] = r_table[].

*$*$ end of routine - insert your code only before this line *-*

ENDMETHOD. "end_routine




I was successful in getting the data as desired. But I'm getting duplicates when I run the data as delta without any selections(I am getting 2 similar rows for same characteristics and same balance).


But when I run the DTP with selections for company code, its working fine. I am getting correct data without any duplicates


Please let me know if any of you have faced similar situation and help me resolve the issue.


Thanks,

Ravi.

Add a comment
10|10000 characters needed characters exceeded

Related questions

7 Answers

  • Best Answer
    Posted on Mar 30, 2015 at 09:40 AM

    Hi Ravi,

    Sorry did not read your code because based on your example, we can achieve your requirement by using RULE GROUP instead of END ROUTINE..

    Do you know how to use that?

    We will just make a FIELD ROUTINE to your FISCAL PERIOD like:

    concatenate SOURCE_FIELD-FISCALYEAR '01' into RESULT.

    Then just map your keyfigure BALANCE FOR THE FISCPERIOD1 to your BALANCE keyfigure..

    Add another rule group, make the field routine:

    concatenate SOURCE_FIELD-FISCALYEAR '02' into RESULT.

    Then just map your keyfigure BALANCE FOR THE FISCPERIOD2 to your BALANCE keyfigure..

    and so on up to 12 (DECEMBER)..

    Some documents that will help you about RULE GROUP:

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d085fa63-f54c-2c10-b5ba-cc4ac231512b?overridelayout=t…

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90754b76-bcf1-2a10-3ba7-b299b2be09f2?QuickLink=index&…

    Just post here if you encountered any problem..

    Regards,

    Loed

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2015 at 10:37 AM

    I don't get what your problem is exactly.

    Your delta process generates identical records i understand.
    I expect in delta process only key figures that are changed contain values.
    Is that what you see at the starting point of the loop in the end routine?

    Assuming that r_table is equal to result_package i dont see what sorting and deleting adjacent duplicates are necessary for.

    And if you do delta with a DTP selection on 0COMP_CODE it does work?
    That doesn't make sense to me.

    Next to this i do agree with Loed Despuig

    that using rule groups would be a better solution (because of no ABAP coding required).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2015 at 04:04 PM

    the code above worked.. i moved the sort statement above to the beginging of the code. that means i sorted the fields first then populated the data. It worked.

    Loed Despuig: Thank you for the post. I will try using rule groups as well and see which one works better.

    Thank you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 31, 2015 at 05:52 PM

    @Loed Despuig : Rule group has worked as well. Thank you.. I will continue to use this option. Thank you for the helpful post.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2015 at 07:48 AM

    Hi Ravi,

    once check in Temporary storage DTP in the Check Error Records,

    So that u can get a idea.

    Regards

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2015 at 08:06 AM

    Im not getting any error.... the records are getting multiplied and coming into cube. with same characteristics and key figure values

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 30, 2015 at 08:19 AM

    Hi Ravi,

    Can you try with Sematic group setting based on Cost Center in DTP.

    Thanks,

    Vengal.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.