cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Generate keys in MDG

former_member260552
Active Participant
736

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

bpawanchand
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

former_member260552
Active Participant
0 Kudos

Hi Pavan,

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

Much Thanks

View Entire Topic
bpawanchand
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.

FIELD-SYMBOLS:   <fs_t_data> TYPE STANDARD TABLE,
                 <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>.


ASSIGN COMPONENT 'FPM_KEY_BY_BOL_ENTITY' OF STRUCTURE <fs_s_data> TO   <fs_o_ref>.
lo_bol_ref = <fs_o_ref>.


CALL METHOD lo_bol_ref->if_bol_bo_property_access~set_property
 EXPORTING
   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

vinothkumarravi
Newcomer
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?