Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
markus_greutter
Participant
In MDG-projects it is always necessary to read some data. This can be done in a convenient way using the Read-API. From my point of view it is easier to use that the Model API or the Governance API.

Princpally you only need the required Entity Type, the key structure for the selection criiterea and the structure of the expected result. The structures are the generated ones from the MDGIMG.

  • Fill the key table

  • Call the required method.


The following methods are provided:



 

The following example shows how to read the active relationships of a Contact Person (Data Model BP, Entity Type BP_REL):

DATA:
lt_relations_key TYPE SORTED TABLE OF /mdgbp/_s_bp_ky_bp_rel
WITH UNIQUE KEY partner1
partner2
bp_rel,
ls_relation_key LIKE LINE OF lt_relations_key,
lt_contact_relations TYPE SORTED TABLE OF /mdgbp/_s_bp_pp_bp_rel
WITH UNIQUE KEY partner1
partner2
bp_rel,
lo_read_api TYPE REF TO if_usmd_read_api.

*--------------------------------------------------------------------*

CHECK iv_contact_id IS NOT INITIAL.

ls_relation_key-partner2 = lv_contact_id.
ls_relation_key-bp_rel = if_mdg_bp_constants=>gc_relation-contact_person.
INSERT ls_relation_key INTO TABLE lt_relations_key.

lo_read_api = cl_usmd_read_api=>get_instance( iv_model_name = if_mdg_bp_constants=>gc_bp_model ).
CHECK lo_read_api IS BOUND.

lo_read_api->read_active_data(
EXPORTING
iv_entity_type = if_mdg_bp_constants=>gc_bp_model_entity-relation
it_entity_key = lt_relations_key
IMPORTING
et_data = lt_contact_relations
).

 

To be honest until today I only used it once to read custom entity type data during the outbound processing. So feel free to post your experiences with this API in the comments!

 

Have fun!

Markus
4 Comments
Labels in this area