cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Badi to replicate MOVE DM package

sap_user62
Active Participant
0 Likes
339

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Likes

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.

Answers (3)

Answers (3)

sap_user62
Active Participant
0 Likes

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

sap_user62
Active Participant
0 Likes

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 😞

former_member186338
Active Contributor
0 Likes

Incorrect code! I will provide you some sample!

former_member186338
Active Contributor
0 Likes

"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