Skip to Content

Badi to replicate MOVE DM package

Hi Friends,

Env- BPC10.1/Custom logic badi

I am trying to achieve the functionality of Move in BPC Badi.

Example. - original record in the bpc cube

Account Company Time Category CC Signeddata

XXXX YYYY 2017.09 Actual 10101 $500

we need this result

Account Company Time Category CC Signeddata

XXXX YYYY 2017.09 Actual 10101 $0

XXXX ZZZZ 2017.09 Actual 10101 $500

Company code needs to be updated on the original transaction. We get company from a property of CC.

I am able to update the signeddata to zero on the original transaction, but I am not able to update the company code on the original transaction.

LOOP AT ct_data ASSIGNING <ls_data>.

CLEAR lw_cc.

READ TABLE it_CC INTO lw_cc WITH KEY ID = <ls_data>-cc BINARY SEARCH.

IF sy-subrc EQ 0.

lw_temp = <ls_data>.

<ls_data>-company = lw_cc-company //try 1-not updating

<lw_temp>-company = lw_cc-company //try 2 -not updating

lw_temp-signeddata = 0. //works

APPEND lw_temp TO it_temp.

CLEAR lw_temp.

ENDIF.

ENDLOOP.

APPEND LINES OF it_temp TO ct_data.

Thanks

Ed

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Sep 06, 2017 at 02:06 PM

    Steps:

    1. Create a new standard table to store new records like ct_data - for example <lt_new_records>. With line <ls_new_record>

    2. LOOP ct_data ASSIGNING <ls_record>.

    3. Copy: <ls_new_record> = <ls_record>.

    4. Change company for <ls_new_record>

    5. APPEND <ls_new_record> TO <lt_new_records>.

    6. ENDLOOP.

    7. LOOP AT <lt_new_records> ASSIGNING <ls_new_record>.
    APPEND <ls_new_record> TO ct_data.
    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 06, 2017 at 06:30 AM

    "I am able to update the signeddata to zero on the original transaction, but I am not able to update the company code on the original transaction." - you have to create a new record with required company code and add it to ct_data!

    P.S. You can't "update" the company code on the original transaction

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 06, 2017 at 01:17 PM

    Thanks Vadim for your reply.

    Do I need to take a copy of the existing line and update the company code to it, then append it back to ct_data.

    This is what I did, <lw_temp1> is a copy of the a line of ct_data, (<ls_data>)

    when I try to assign a value to it, it does not update while I am debugging the code

    lw_temp1 = <ls_data>.

    <lw_temp1>-company = lw_cc-company." - does not update the value of <lw_temp1>-company

    <lw_temp1>-company = '1000' . " hard coded- does not update the value <lw_temp1>-company

    Does the assignment need to be done a different way

    I could not find threads in sdn related to this topic :-(

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 07, 2017 at 03:21 PM

    Thanks Vadim, it worked well. I was able to clear an intersection of data as well as update the company by creating additional records.

    Add comment
    10|10000 characters needed characters exceeded