cancel
Showing results for 
Search instead for 
Did you mean: 

Initialize MDG UI Fields using API

former_member374952
Participant
0 Kudos

Hi ,

I am trying to set initial value for some of the MDG Screen fields using Governance API . I referred the MDG API manual and In the following example I am trying to set the company code by creating a enhancement in the  feeder class

Still not able to get through it . Here is my Code : I need a syntax to initialize the Company Code Entity using Governance API

*******************************************************************************

**************** Initializing Company Code****Using MDG API********************

TRY

CALL METHOD LO_GOV_API->IF_USMD_GOV_API_ENTITY~CREATE_DATA_REFERENCE

  EXPORTING

    IV_ENTITY_NAME = 'BP_CUS_CC'   "Entity Name to be Initialized

    IV_STRUCT      = LO_GOV_API->GC_STRUCT_KEY_ATTR

  IMPORTING

    ER_STRUCTURE   = LR_CUST_data_STR

    ER_TABLE       = LR_CUST_data_TAB.

CATCH CX_USMD_GOV_API .

ENDTRY.

* Create data structre out of references

assign LR_CUST_KEY_STR->* to <LS_CUST_KEY>.

assign LR_CUST_KEY_TAB->* to <Lt_CUST_KEY>.

assign LR_CUST_data_STR->* to <LS_CUST_data>.

assign LR_CUST_data_TAB->* to <Lt_CUST_data>.

move-corresponding <LS_CUST_KEY> TO <LS_CUST_DATA>.

assign component 'BP_CUS_CC' of structure <LS_CUST_DATA> to <LV_VALUE>.

**************************************************************************

"Initialize the Company Code Data

<LV_VALUE> = '001'.  " Throws an Error while Initializing Company Code '

insert <LS_CUST_DATA> into table <LT_CUST_DATA>.


*******************************************************************************

Write new entity into C/R with created data above

******************************************************************************

  CALL METHOD LO_GOV_API->IF_USMD_GOV_API_ENTITY~WRITE_ENTITY

    EXPORTING

      IV_CREQUEST_ID = LO_CONV_API->MV_CREQUEST_ID

      IV_ENTITY_NAME = 'BP_MLT_AS'

      IT_DATA        = <LT_CUST_DATA>

      .

Regards,

Vicky

Accepted Solutions (0)

Answers (1)

Answers (1)

d024348
Employee
Employee
0 Kudos

Hi, why not use the BAdIs USMD_RULE_SERVICE or USMD_RULE_SERVICE_CROSS_ET to set default values for an entity (first BAdI) or even create new entities (second BAdI)?

Regards, Ingo Bruß

former_member374952
Participant
0 Kudos

Hi Ingo,

I am not quite sure of using USMD_RULE_SERVICE badi so finally managed by having an implicit enhancement and modifying the change the fields of change request which in turn reflected in the MDG screen fields .


Regards,

Vicky