cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Badi implementation in fb70

Monikakathore
Explorer
0 Kudos
562

I am implementing badi edoc_adaptor for changing edoc type in fb70 ...but in badi importing parameter io_source is object ... referring class cl_edoc_source  and cl_edoc_source has method get_data ... holding field symbol es_data ...so basically i wanted to access field symbol using get_data method but i dont know the approach 

1000157945.jpg

Accepted Solutions (0)

Answers (1)

Answers (1)

Sandra_Rossi
Active Contributor
0 Kudos

So, you mean that you don't know the type of the variable returned by the method GET_DATA of CL_EDOC_SOURCE, because the type is generic:

  methods GET_DATA
    exporting
      value(ES_DATA) type ANY .

Hopefully you can get the data reference via GET_DATA_REFERENCE:

  methods GET_DATA_REFERENCE
    returning
      value(RD_DATA) type ref to DATA .

Your code will be:

DATA(ld_data) = io_source->get_data_reference( ).
ASSIGN ld_data->* TO FIELD-SYMBOL(<ls_data>).

If you have an old version of CL_EDOC_SOURCE which doesn't contain the GET_DATA_REFERENCE method, you may create a custom one via the enhancement framework named e.g. ZZGET_DATA_REFERENCE, with this code:

  METHOD zzget_data_reference.

    rd_data = md_data.

  ENDMETHOD.

 

Monikakathore
Explorer
0 Kudos
Thank you very must...i got this method previously but i was looking the way to implement it ...
Monikakathore
Explorer
0 Kudos
DATA(lt_data) = io_source->get_data_reference(rd_data). ASSIGN id_data->* to FIELD-SYMBOL(<ls_data>). Is this correct ...bcoz it is showing error that get_data_reference is unknown
Sandra_Rossi
Active Contributor
0 Kudos
You can see in my answer that I have taken the method definition from my system, so it exists, and it's a public method. Probably you have an older version.
Sandra_Rossi
Active Contributor
0 Kudos
I have edited my answer about how to create a method equivalent to GET_DATA_REFERENCE.
Monikakathore
Explorer
0 Kudos
It is working with previous solution but after getting data how i can access perticular field ..
Monikakathore
Explorer
0 Kudos
CALL METHOD zcl_fi_intercompany_invoice=>set_edoc. CALL METHOD read->validate_edoc EXPORTING iv_bukrs = bukrs iv_kunnr = kunnr iv_blart = blart IMPORTING ev_edoc_type = cv_edoc_type. .....i am trying to access these
Monikakathore
Explorer
0 Kudos
I wanted to read bukrs from field symbol..but error is showing that doesn't have structure for field symbol so don't have bukrs field in that
Sandra_Rossi
Active Contributor
0 Kudos

Are you saying that your system has the standard method GET_DATA_REFERENCE? I guess you had checked twice before asking me to confirm, so better check three times.

ASSIGN COMPONENT 'XXXX' OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<XXXX>).

There are lots of documentation, blog posts and answers about field symbols.