User input in Z fields is not processed in CUSTOMER_ADD_DATA BAdI

3k Views Asked by At

I need to know what to process (save & display) with user input in custom fields.

My Setup:
- new subscreens for Transactions XD.. (e.g. XD02)
- Using badi customer_add_data and customer_add_data_cs
- added some custom fields to tables, e.g. KNA1
- created function Group with dynpros for Transactions XD..
- new customer fields are displayed in XD..

However, nothing I enter into my new fields seems to be processed. I dont know how to continue my implementation.

What I tried in the BADI:

" wokrs, saves data input 
method IF_EX_CUSTOMER_ADD_DATA_CS~GET_DATA.

  "SAPLZSD_FOO_CUSTOMER = my function group
  CONSTANTS: c_foo(50)  VALUE '(SAPLZSD_FOO_CUSTOMER)KNA1-ZZFOO'. 

  FIELD-symbols: <fs> TYPE ANY.
  ASSIGN (c_foo) TO <fs>.
  IF sy-subrc = 0.
    s_kna1-ZZFOO = <fs>.
  ENDIF.
endmethod.

What I tried in the PBO to display the custom field value

 " does not work, stored values are not display in dynpro
 MODULE status_2001 OUTPUT.

  DATA: gf_eori TYPE kna1-zzeori.

  CONSTANTS: c_foo(34)  VALUE '(SAPMF02D)KNA1-ZZfoo'.

  FIELD-SYMBOLS: <fs>.

  ASSIGN (c_foo) TO <fs>.
  IF sy-subrc = 0.
    kna1-zzfoo = <fs>.
  ENDIF.
ENDMODULE. 

What Interface methods of customer_add_data and customer_add_data_cs do I have to use? What has to be written into the PBO/PAI of my dynpros?

How could a solution look, if the new fields are for example: knvv-zfoo & knvv-zbar.

I am new to customizing SAP and Need some quides in General how to use BADIs.

1

There are 1 best solutions below

1
On

The examples above were based on a post I have found on the internet. To solve my problems, I found a working and better solution in one book.

The gist of it is:

  • Use interface methods get_data() and set_data() of IF_EX_CUSTOMER_ADD_DATA_CS
  • Add two functions (getter and setter) to function pool that import and export the customized tables
  • Assign or return the values of the customized fields in those functions

Now, my custom fields are saved and loaded properly.