Skip to Content
0
Former Member
Dec 16, 2004 at 02:53 PM

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

225 Views

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