cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding DataSource Enhancement using BADI

Former Member
0 Kudos

Dear All,

I am trying to enhance the standard Master Data Data Source : 0MATERIAL_TEXT using BADI.

This is the first time I am using enhancement of data source.

I have followed the below steps:

First I have enhanced the data source with required field by using append structure. The required field is available in MAKT table-maktg field.

I have found out the BADI for the data source, that is:RSU5_SAPI_BADI and created implementation for the BADI.

I know basic ABAP only,Tried to populated the field by using data method in interface.

I have read few documents about enhancements,but i was unable to write the code to populate the data to the data source.

So please provide me the necessary inputs to achieve it.

Thanks

Padmaja

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi,

You can add MAKT-MAKTG as below steps.

1-Go to MDXT_MATERIAL_TEXT program and add breakpoint in line 569.

2-Fields filled to datasource structure in l_t_makt.loop. As shown, this 3 fields are MATNR, SPRAS, TXTMD.

During looping l_t_makt this internal table have field MAKTG as shown below.

3- Summary, Just add MAKTG field to the structure (BIW_MAKT_S) of this datasource. This is enough to get field to this datasource. No any Badi or extra coding effort needed.

Kind Regards,

Cihan Ekin

sander_vanwilligen
Active Contributor
0 Kudos

Hi Padmaja,

You can have a look at document for a good overview of the steps with a coding example.

Please also consider to implement a solid framework to encapsulate the coding for every new BAdI implementation. My document describes how to implement such an approach.

Best regards,

Sander

very good article and very clearly explained

Former Member
0 Kudos

Hi Padmaja,

In BADI, create a implementation and go to method DATA_TRANSFORM.

write below code below and you should be good. You may have to change a little bit but this should suffice your requirement.

----------------------------------

   DATA: l_t_mattext TYPE TABLE OF biw_makt_s.
DATA: l_t_makt TYPE TABLE OF makt.
FIELD-SYMBOLS: <l_s_mattext> TYPE biw_makt_s,
    <l_s_makt> TYPE makt.
CASE i_datasource.
  WHEN '0MATERIAL_TEXT'.
    l_t_mattext[] = c_t_data[].
    SELECT * FROM makt INTO TABLE l_t_makt FOR ALL ENTRIES IN l_t_mattext
    WHERE matnr = l_t_mattext-matnr AND spras = l_t_mattext-spras.
    IF sy-subrc EQ 0.
      LOOP AT l_t_mattext ASSIGNING <l_s_mattext>.
        READ TABLE l_t_makt ASSIGNING <l_s_makt> WITH KEY
        matnr = <l_s_mattext>-matnr spras = <l_s_mattext>-spras.
        IF sy-subrc EQ 0.
          <l_s_mattext>-maktg = <l_s_makt>-maktg.
        ENDIF.
      ENDLOOP.
    ENDIF.
    REFRESH c_t_data.
    c_t_data[] = l_t_mattext[].
ENDCASE.

-------------------------------------

Thanks

Amit

Former Member
0 Kudos

Hi Amit,

Thank you very much for your reply. I have tried the code, but not getting the data into the field.

no syntax errors,no run time errors. I have debug the code. it triggers the data source, but no data is coming into internal tables. I don't know why.

I am very poor in ABAP. I have read  the documents too. I have one doubt ...In the code,

we are declaring that DATA: l_t_mattext TYPE TABLE OF biw_makt_s.

biw_makt_s is a extract structure. here we are declaring a internal table as extract structure.

table stores data, but a structure doesn't store any data, it is just a collection of fields.

Please clarify this, I am struggling to understand this.

Kindly help me.

Regards

Padmaja.

Former Member
0 Kudos

Hi Padmaja,


Did you put a breakpoint on  'CASE i_datasource.' statement? Can you see if you have received data in table c_t_data? This is ideally the table which is populated by standard code and rest is filled up by BADI code.

Do you recieve data in your datasource? or are the records 0 in RSA3? I mean to say that do you have data in your table MAKT?

Coming to next doubt - 'DATA: l_t_mattext TYPE TABLE OF biw_makt_s.' I agree that biw_makt_s is structure but when in our code we define l_t_mattext as a type table of biw_makt_s, then l_t_mattext actually takes the structure of biw_makt_s and gets declared as internal table. So this is ideally a internal table of structure biw_makt_s (i.e. having all fields of this structure).

If when you debug the code and you do not receive any data in c_t_data, then I would think that you do not have relevant data for this datasource in your table MAKT.

Let me know if yoits otherwise.

Thanks

Amit

Former Member
0 Kudos

Hi Amit,

Thanks for your very quick response.

I have data in MAKT table. In RSA3, it is showing some 1000 records. But the enhanced field has no data. but for remaining fields , data is coming.

Yes I had put break point at CASE I_DATASOURCE. but no data is coming to c_t_data while debugging.

I am very new to this, If my understanding is not in a proper way, please guide me.

Thanks a lot

padmaja.

Former Member
0 Kudos

Then we have a probelm

I tried on my system and I could see data in c_t_data even if I have not implemented any enhancement. Can you send the debug screenshot where you are checking if you have any data in c_t_data?

My screenshot is:

This is standard table and it have to have data when calling a BADI.

Can you try using user exit for this change?

Thanks

Amit

Former Member
0 Kudos

Hi Amit,

In RSA3, I have executed the data source in debugmode. here, L_T_DATA has some records.

where as in BADI,after executing, no data in c_t_data at SE19 debugger screen.

I don't know why it is happening....I followed steps correctly, If code is correct or not keep a side...at least I should see the data in c_t_data at SE19 debugger screen,that one too I am not getting....Is there anything means any plugins need to install in my system?

Please clarify it.

AS you said that try it using userexit, But I am trying it in my own system...I have no access key.It is demo version. So I am trying it using BADI.

Thanks

Padmaja

Former Member
0 Kudos

Please any body any inputs to the issue.

Regards

Padmaja