Showing results for 
Search instead for 
Did you mean: 

Auto Generate keys in MDG

Active Participant

Hi all,

I am working on BP extension where we have added a new Type-4 Entity. The qualifying key is provided by a Type-3 which is supposed to give a number as qualifying key.

I have tried to generate a number say 0001 in feeder class and passed it to the qualifying key. But the UI refuses to accepth the field and still ask for a key to be input by user.

If anyone has come across any thing like this please share your views on what can be done to generate key by default

Thanks and Regards

Active Contributor
0 Kudos

Hi Mohamed

I am exactly working on the same scenario, will be posting the code soon..... I was successful in doing this.

Thanks, Pavan

Active Participant
0 Kudos

Hi Pavan,

what did you use to achieve this.....feeder or Badi?

Much Thanks

View Entire Topic
Active Contributor

Hi Mohamed,

I am not sure what is your case is. However, I did try to implement the auto generation of a key column, by using feeder class. Here is a brief overview of my scenario

  1. I have a LIST UIBB and ADD button.
  2. There are two columns which are keys for this entity COLA and COLB
  3. Whenever, user clicks on ADD button COLA is the SNO number which must be auto generated by the system, and user enters the COLB value manually.
  4. I Handled this completely from Feeder class GETDATA method as follows.
DATA l_table    TYPE REF TO data.
DATA lv_lines TYPE i.
DATA : lo_bol_ref TYPE REF TO cl_crm_bol_entity.

                 <fs_o_ref>  TYPE any,
                 <fs_s_data> TYPE any.

CREATE DATA l_table LIKE   ct_data.
ASSIGN l_table->* TO <fs_t_data>.
<fs_t_data> = ct_data.
DESCRIBE TABLE <fs_t_data> LINES lv_lines.
READ TABLE <fs_t_data> INDEX lv_lines ASSIGNING <fs_s_data>.

lo_bol_ref = <fs_o_ref>.

CALL METHOD lo_bol_ref->if_bol_bo_property_access~set_property
   iv_attr_name = 'COLA'
   iv_value     = lv_lines.

Please note that the above code is just a snippet. In my case I have written other stuff to adjust the columns if the user deletes the rows from the list.

The problem with the derivation is until and unless you make an entry in the list the BADI's is not getting called. In a way the event loop is triggered only after I enter value in COLA. In my case the derivation BADI's was not so helpful.

Make sure you write the below code after calling the super class's GET DATA method

Thanks, Pavan

0 Kudos

Hi Pavan,
I am trying to do the same requirement and I could not get through. Would you be able help more precisely?