Skip to Content

Auto Generate keys in MDG

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jun 05, 2017 at 07:15 AM

    Hello Mohd Samad,

    First of all, passing the key value in the feeder class is not allowed. The reason is, the key values are handled in the MDG Framework. Could you please try passing the value through the derivation badi ?

    Regards

    Senthil

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 06, 2017 at 11:22 AM

    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

    Add comment
    10|10000 characters needed characters exceeded