Skip to Content

BADI for virtual KF

Hi All,

I need to implement 3 virtual Key Figures in a cube.

So far I have implemented one using the BADI and it is working fine. However when I enhance the same BADI to populate the second KYF the values is not getting populated. I have added the second key figure in the attributes section on the the BADI.

Does this mean I need to implement 3 separate BADI's for the 3 key figures ?

My sample code in the Compute section is as follows:

FIELD-SYMBOLS: <fs_zvkfs> TYPE ANY,
<fs_chas> TYPE ANY,
<fs_zvkfe> TYPE ANY,
<fs_chae> TYPE ANY.

IF p_cha_0crm_begdat > 0.

ASSIGN COMPONENT p_cha_0crm_begdat OF STRUCTURE c_s_data TO <fs_chas>.
ASSIGN COMPONENT p_kyf_zsdat_kyf OF STRUCTURE c_s_data TO <fs_zvkfs>.
<fs_zvkfs> = <fs_chas>.

ENDIF.

IF p_cha_0crm_enddat > 0.

ASSIGN COMPONENT p_cha_0crm_enddat OF STRUCTURE c_s_data TO <fs_chae>.
ASSIGN COMPONENT p_kyf_zedat_kyf OF STRUCTURE c_s_data TO <fs_zvkfe>.
<fs_zvkfe> = <fs_chae>.

ENDIF.

Using this only the first KF zsdat_kyf is getting populated. When I debug this code I found that
p_cha_0crm_enddat is not getting any value.


Please suggest what needs to be done.


Thanks,

Amrita

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 20, 2014 at 08:39 AM

    Hi Amrita,

    I expect that instance attribute p_cha_0crm_enddat is causing the problem. Did you correctly define the instance attribute p_cha_0crm_enddat? Did you include appropriate coding in method DEFINE to fill instance attribute p_cha_0crm_enddat?

    Please have a look at the following SAP Notes for more information (even if it is written for enhancement RSR00002):

    Last but not least, try to analyze the problem with the debugger (activate a break-point in your coding and run the query with t/code RSRT). I assume that you are already doing that.

    Best regards,

    Sander


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 20, 2014 at 05:25 AM

    Hi Amrita,

    You need not to write 3 BADI's for 3 Virtual KFs. You can achieve all in one BADI. I think you have not included this new KF in "Define" method. Your "Compute" method seems to be OK.

    While debugging, you can just make an entry for p_cha_0crm_enddat and execute and see whether it populates data for new KF or not. This is just to investigate.

    Regards,

    Suman

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.