Skip to Content
author's profile photo Former Member
Former Member

how to 'remember' a field value inside a BAdI?

Hi all,

We need to implement some code in a BAdI for Healthcare. The BAdI is active in the PBO of transaction NV2000. We need to read the value of one field and, if this field has a certain value, default another field with a certain value.

The problem is - this BAdI reads each time another structure which you can change, but the two fields in question are in two different structures. So it's like:

CASE i_structure_name.

...

WHEN 'RNBADI_ADM'.

MOVE c_data TO ls_rnbadi_adm.

*here I could read the value of my controle field which can be found in ls_rnbadi_adm

...

WHEN 'RNBADI_EXTDOC_ADM'.

MOVE c_data TO ls_rnbadi_extdoc_adm.

  • here I could change my other field which can be found in ls_rnbadi_extdoc_adm

  • give changed data back

c_data = ls_rnbadi_extdoc_adm.

...

The problem is, in the step where structure ls_rnbadi_extdoc_adm is filled, structure ls_rnbadi_adm is empty so the value of the control field is not accessible any more. The control field is also not an interface parameter so I don't really know its value at runtime... it can be changed so selecting it from the database is not a good idea...

I thought to declare a 'static' variable and give it the value of the control field in the step where ls_rnbadi_adm was filled, so the program would remember it in the step where ls_rnbadi_extdoc_adm was filled. But the ABAP Editor gives a syntax error 'you can't declare statics inside an instance method'.

So any idea how to 'remember' the value of that control field?

Thanks in advance,

Ioana

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2004 at 03:11 PM

    Hi Ioana,

    You can add your own variables in the implementation of your BADI. Go to the class interface of your implementation, hit the tab 'Attributes' and add the control field you need.

    Regards,

    John.

    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.