Skip to Content
0

Auto Generate keys in MDG

May 31, 2017 at 04:57 PM

90

avatar image

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

10 |10000 characters needed characters left characters exceeded

Hi Mohamed

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

Thanks, Pavan

0

Hi Pavan,

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

Much Thanks

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

senthil kumar Jun 05, 2017 at 07:15 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Pavan Bhamidipati Jun 06, 2017 at 11:22 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded