BAdI for Generating Calculated Amounts When Saving a Journal
When saving a journal, you can add or calculate extra amounts by implementing the Business Add-In (BAdI) UJJ_CALCULATED_AMOUNT.
Features
Enhancement Spot
The BAdI is defined in the following enhancement spot: UJJ_CALCULATED_AMOUNT.
When implementing a new BAdI, a filter must be set with the following parameters:
-
Appset_id: Model ID
-
Application_id: Environment
Sample BadI Implementation
A sample implementation is located in the following implementation spot: CALCULATED_AMOUNT_SAMPLE_IMPL.
In the sample, when P & L entries are made, the resulting net profit (loss) impact is generated on the Balance Sheet retained earnings account. This impacts the closing balance flow, every time a balance sheet account is booked.
Interface to Implement
You implement the following interface: IF_UJJ_CALCULATED_AMOUNT.
Method CALCULATE_AMOUNTS:
|
Import Parameter |
Description |
|---|---|
|
IT_JOURNALS Type UJJ_T_BADI_CA_JOURNAL |
A table containing the list of journals to be saved. |
|
Export Parameter |
Description |
|---|---|
|
ET_CALCULATED_AMOUNTS Type UJJ_T_BADI_CA_JOURNAL_AMOUNTS |
A table of calculated amounts containing the amounts to be added to the journal list. The output journal ID must match the input journal list. |
When returning a table of calculated amounts, these amounts must contain only the values for the detail dimensions. If you set a value for a header dimension, the BAdI returns an error.
|
Exception |
Description |
|---|---|
|
CX_UJJ_EXCEPTION |
A journal exception that may be thrown. |
Data Types
UJJ_T_BADI_CA_JOURNAL
Table for UJJ_S_BADI_CA_JOURNAL.
UJJ_S_BADI_CA_JOURNAL
The following fields are defined in the structure:
|
Field |
Type |
Description |
|---|---|---|
|
APPSET_ID |
UJ_APPSET_ID |
Environment ID |
|
APPL_ID |
UJ_APPL_ID |
Model ID |
|
JRN_TMPL_ID |
UJJ_JRNTMPL_ID |
Journal Template ID |
|
JRN_ID |
UJJ_JRN_ID |
Journal ID |
|
DESCRIPTION |
UJ_DESC |
Description |
|
USERC |
UJ_USER_ID |
The user who saves the journal |
|
DATEMODIFIED |
TIMESTAMP |
The modification date |
|
USERP |
UJ_USER_ID |
The ID of the user who has posted the journal |
|
DATEPOSTED |
TIMESTAMP |
The posted date |
|
STATUS |
UJ_DESC |
The status of the journal |
|
IDJ_AUTO_REV |
UJ_ID |
The auto reversed ID |
|
IDJ_OLD |
UJJ_JRN_ID |
The original ID of the journal |
|
IDJ_GROUP |
UJJ_JRN_ID |
The ID of the group to which the journal belongs |
|
AUTO_REVERSED |
UJ_FLG CHAR |
True if the journal is automatically reversed |
|
MUST_BE_BALANCED |
UJ_FLG |
True if the journal must be balanced to be saved |
|
MAY_BE_REOPEN |
UJ_FLG CHAR |
True if the journal may be reopened |
|
EDITABLE |
UJ_DIM_MEMBER |
Multiple header dimension of a journal group |
|
VARIABLET |
UJ_DIM_MEMBER |
Multiple value dimension ID |
|
AMOUNTS |
UJJ_T_BADI_CA_AMOUNT |
Table of amounts |
|
EXTRA_FIELDS |
UJJ_T_KEYMEM |
Table of additional headers |
|
IS_BALANCED |
UJ_FLG CHAR |
True if the journal is balanced |
UJJ_T_BADI_CA_AMOUNT
Table for UJJ_S_BADI_CA_AMOUNT.
UJJ_S_BADI_CA_AMOUNT
The following fields are defined in the structure:
|
Field |
Type |
Description |
|---|---|---|
|
REMARK |
UJ_STRING |
Remark |
|
AMOUNT |
UJ_KEYFIGURE |
The value of the amounts |
|
DEBITCREDIT |
UJJ_DEBITCREDIT |
Set the value to:
|
|
MEMBERS |
UJJ_T_KEYMEM |
This table contains the list of dimensions that defines the journal amount. Both detail and header dimensions are included in this table. |
UJJ_T_KEYMEM
Table of UJJ_S_KEYMEM.
UJJ_S_KEYMEM
The following fields are defined in the structure:
|
Field |
Type |
Description |
|---|---|---|
|
TABKEY |
TABKEY |
The dimension ID |
|
MEMBER |
UJ_VALUE |
The member value |
|
IS_HDR_FLD |
UJ_FLG CHAR |
Set the value to True if the dimension is a header dimension; otherwise it is a detail dimension. |
UJJ_T_BADI_CA_JOURNAL_AMOUNTS
Table for UJJ_S_BADI_CA_JOURNAL_AMOUNTS.
UJJ_S_BADI_CA_JOURNAL_AMOUNTS
The following fields are defined in the structure:
|
Field |
Type |
Description |
|---|---|---|
|
JOURNAL_ID |
UJJ_JRN_ID |
The journal ID |
|
AMOUNTS |
UJJ_T_BADI_CA_AMOUNT |
The table of amounts |