Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Bohdan
Active Contributor
Dear SAPers,

Recently, I was working on a requirement to add additional fields into ALV report for transaction FINT and the blog post by marek.turczynski saved me a lot of time for this task. That requirement was addressed by implementation of the BADI FI_INT_CUS01. Upon further analysis of the BADI interface, I found an interesting extension option, which can be used to extend the functionalities of standard interest calculation program. Blog post below describes these findings in detail.

Overview of the resulting changes


Essentially, it is possible to add custom buttons to the toolbar of the FINT report and link custom functionality to these buttons. Screenshot below shows a sample toolbar of the transaction before & after the changes:

Additionally, this new option will be added into the menu “Environment”:

When you press the button, the program will open a new ALV report within the same program with the following aggregated values:




Adding new buttons to the toolbar


Starting point for this enhancement is the transaction SE18, where we manage the implementation of the BADI. You can add up to three custom buttons on the “FCodes”.

Note: The program name in your system might be different. S4 Hana program name is SAPLFI_INT_USERCOMMAND, but that does not change the concept behind this solution.

Technically speaking, SAP put three placeholders into a PF-status INT_GRID for program SAPLFI_IN. These placeholders / buttons are not visible in the report unless they are activated in BADI.

Note: screenshot above shows only one placeholder +CU1 for this PF-status. Additional placeholders can be added via implementation of OSS-note 3143202FINT: FCODE +CU2/+CU3 in BAdI FI_INT_CUS01 is missing at GUI-status INT_GRID.

A new button can be added, when BADI is deactivated. Double click o the line and provide the attributes of the new button. Most of the fields are descriptions apart from icon name. You can execute the standard program SHOWICON (via SE38) and it will show you the list of standard icon names that can be used for this field.

Confirm the selection of the button in a prompt:

Save the changes & activate the BADI. New button will be visible on selection screen immediately after this step.




Link custom functionality to the new button


BADI interface offers three methods INT_LIST_0X. These methods are triggered when the user presses the buttons associated with the function codes defined by the users i.e. function code +CU1 triggers the method IF_EX_FI_INT_CUS01~INT_LIST_01.

The screenshot below shows the interface of the method. As you can see, when this method is triggered, it will receive all information related to calculation of interest including all transactional details (e.g., CT_ITEMS) & master data (e.g., IT_KNA1).

Sample source code for this method can be found below:
  method if_ex_fi_int_cus01~int_list_01.

types:
begin of ty_item,
bukrs type bukrs,
account type kunnr,
name1 type ad_name1,
name2 type ad_name2,
int_amount type int_amount,
end of ty_item.
types: tt_items type standard table of ty_item with default key.

constants:
begin of lc_status,
noint type int_status value 'NOINT',
ready type int_status value 'READY',
process type int_status value 'PROCESS',
error type int_status value 'ERROR',
clearing type int_status value 'CLEARING',
new type int_status value 'NEW',
done type int_status value 'DONE',
nopay type int_status value 'NOPAY',
reverse type int_status value 'REVERSE',
bundled type int_status value 'BUNDLED',
end of lc_status .

data lt_items type tt_items.

field-symbols: <i> like line of ct_items.
field-symbols: <j> like line of lt_items.

if lines( ct_items ) = 0.
return.
endif.

loop at ct_items assigning <i>.

if <i>-int_status <> lc_status-ready and <i>-int_status <> lc_status-process.
continue.
endif.

if lines( lt_items ) = 0.
append initial line to lt_items assigning <j>.
move-corresponding <i> to <j>.
continue.
endif.

if <i>-account <> <j>-account.
append initial line to lt_items assigning <j>.
move-corresponding <i> to <j>.
continue.
endif.

<j>-int_amount = <j>-int_amount + <i>-int_amount.
endloop.

field-symbols <md> like line of it_kna1.
loop at lt_items assigning <j>.
read table it_kna1 with key kunnr = <j>-account assigning <md>.
if sy-subrc = 0 and <md> is assigned.
<j>-name1 = <md>-name1.
<j>-name2 = <md>-name2.
endif.
endloop.

data lo_view type ref to zcl_alv_factory.
lo_view = zcl_alv_factory=>create(
i_tab = lt_items
iv_title = 'Aggregated details' ).
lo_view->display( ).

endmethod.

Note: the class ZCL_ALV_FACTORY is a wrapper class around standard method CL_SALV_TABLE=>FACTORY( ), which can be used for easy generation of ALV report. This wrapper class is not subject of this post and the source code will not be provided.

The example in this post might look trivial. This post might be a bit complicated for functional consultants, but it demonstrates how this standard report can be extended. And I hope it can serve as a useful reference point for those who are looking for options to extend this report.

I hope you do net regret the time you spent if you reached the end of this post and you learnt something useful. I’m looking forward to your comments and remarks.

Regards,

Bohdan
Labels in this area