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

​BADI_UJJ_CALCULATED_AMOUNT does not show the correct journal id

0 Likes
862

Hello,

I have implemented BADI_UJJ_CALCULATED_AMOUNT. When debugging journal id 153, field IT_JOURNALS-JRN_ID keep showing 1 . This prevent me from reversing the entries the BADI has previously updated. Is the a way to get the correct journal id in this BADI?

rgds,

Ester

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Likes

Sorry, but not clear what you are doing! Please provide test code and explain how do you performing debug.

Answers (3)

Answers (3)

former_member186338
Active Contributor
0 Likes

The solution is explained in the note: https://launchpad.support.sap.com/#/notes/2752929

Have to be implemented!

0 Likes

Hi Vadim,

The below is the sample code.If you see the below debug screen, internal table IT_JOURNALS-JRN_ID always shows 1, not Journal id 513. The requirement is when user enters a remark, i need to reverse amount 80 via BADI. I can do so only if IT_JOURNALS-JRN_ID shows journal id 513.

BADI coding:

method IF_UJJ_CALCULATED_AMOUNT~CALCULATE_AMOUNTS.
FIELD-SYMBOLS: <fs_ct_data> TYPE STANDARD TABLE,
<result_value> TYPE any, <lv_field> TYPE ANY,
<fs_result> TYPE any.
field-symbols:
<fs_member> type ujj_s_keymem,
<fs_member_flow> type ujj_s_keymem,
<fs_member_acct> type ujj_s_keymem,
<fs_member_value> type uj_value,
<fs_amount> type ujj_s_badi_ca_amount,
<fs_jrn> type ujj_s_badi_ca_journal.
data:
ls_journal_amounts type ujj_s_badi_ca_journal_amounts,
ls_message type uj0_s_message,
w_msg like IF_T100_MESSAGE=>T100KEY,
member_temp type ujj_s_keymem,
l_tabkey type tabkey, dim_flow type uj_dim_name value 'FLOW',
lo_exception type ref to cx_root, ET_MESSAGE type UJ0_T_MESSAGE,
lox_ex_handler type ref to cx_uj_static_check,
lo_static_check type ref to cx_static_check,
lv_msg type string,
ls_amount type ujj_s_badi_ca_amount.


constants: closing_flow type uj_dim_name value 'F_175'.
DATA:lv.
lv = 1.
try.IF sy-uname EQ 'ESTER'." WHILE ( lv = 1 ).
lv = 1.

loop at it_journals assigning <fs_jrn>.clear ls_journal_amounts.
ls_journal_amounts-journal_id = <fs_jrn>-jrn_id.
clear ls_amount-members.loop at <fs_jrn>-amounts assigning <fs_amount>.

ls_amount = <fs_amount>.


ls_amount-amount = 80.
clear ls_amount-members.loop at <fs_amount>-members assigning <fs_member>.if <fs_member>-is_hdr_fld eq abap_false.

append <fs_member> to ls_amount-members.endif.endloop.
append ls_amount to ls_journal_amounts-amounts.


endloop.
if lines( ls_journal_amounts-amounts ) > 0.append ls_journal_amounts to et_calculated_amounts.endif.endloop.
" ENDWHILE.ENDIF.
catch cx_root into lo_exception.raise exception type cx_ujj_exceptionexporting
previous = lo_exception
textid = cx_ujj_exception=>ex_badi_exception.
endtry.
endmethod.

former_member186338
Active Contributor
0 Likes

OK! Now it's clear! I will test myself.

0 Likes

debug-badi.jpg

Hi Vadim,

I have updated amount 80 to journal id 153 via BADI. I need to reverse back this amount 80 when user enter a remark.I need to go to journal detail table and select journal id 153 to reverse amount 80. When i debug this , i notice field IT_JOURNALS-JRN_ID shows journal id 1 not 153.You can refer to the attached. Is there a way i can get journal id 153 in this BADI?

Rgds,

Esteramount-80-has-been-updated-via-badi.jpg

former_member186338
Active Contributor
0 Likes

First: I don't answer if images are inserted using incorrect "Insert File" instead correct "Insert Image"! I have written about it hundred of times, but looks like nobody is reading posts...

Second: Where is the code???