Hi All,
In our test environment we are trying to rewrite our DEFAULT.LGF logic as an ABAP code in the write back badi. We started with a very simple scenario:
User enter:
PRICED - some price per page
PAGESD - number of pages
The existing script is calculating in the cube ADVSALES:
GSALESD - gross sales, based on formula GSALESD = PRICED * PAGESD
Then the calculated GSALESD have to be copied to another cube INFILE to the member 2020202020704
Script (working fine):
*WHEN ADV // ADV - account dimension in ADVSALES
*IS "PRICED"
*REC(EXPRESSION=%VALUE%*[ADV].[PAGESD], ADV="GSALESD")
*ENDWHEN
*WHEN ADV
*IS "PAGESD"
*REC(EXPRESSION=[ADV].[PRICED]*%VALUE%, ADV="GSALESD")
*ENDWHEN
// Copy GSALESD to the INFILE member 2020202020704
*DESTINATION_APP = INFILE
*RENAME_DIM ADV = INACCT // INACCT - account dimension in INFILE
*ADD_DIM CORPDIR = DIRECT // additional dimension in the cube INFILE, the rest are the same
*WHEN ADV
*IS "PRICED"
*REC(EXPRESSION=[ADV].[GSALESD], ADV="2020202020704")
*ENDWHEN
*WHEN ADV
*IS "PAGESD"
*REC(EXPRESSION=[ADV].[GSALESD], ADV="2020202020704")
*ENDWHEN
We managed to implement the first part of the script in the badi ending with CT_ARRAY with data coming from input schedule and the calculated member GSALESD. The badi works properly and fast.
But we understand that if we want to write something to another cube we have to do the following things:
1. Write CT_ARRAY explicitly to the cube ADVSALES using write_back_int with i_bypass_badi = abap_true.
2. Compare the resulted et_error_records with CT_ARRAY to remove records from CT_ARRAY that are not written to the cube ADVSALES (Work Status or permissions).
3. Write the remaining records in CT_ARRAY to the cube INFILE replacing account member name using write_back_int with i_bypass_badi = abap_true.
And at the end, we want to tell user number of submitted, accepted and rejected records (in the Excel popup)! That is the issue, because from inside the write back badi we do not have access to the es_status_records. We can populate et_error_records, but to have proper numbers in submitted and accepted records we have to write CT_ARRAY once more (not clear it at the end of our badi).
Does anybody have any idea how to achieve our goal?
B.R. Vadim