cancel
Showing results for 
Search instead for 
Did you mean: 

Read Entity Data

cmetz
Participant
0 Kudos

Hey guys,

I already figured out how to read entity data (for example BP_HEADER - Data Model for Customer) in general, but still have a few detail questions. At the moment I am using Convenience API using following approach:

  1. CONVENIENCE API -> GET_INSTANCE
  2. SET ENVIRONMENT -> Change request number
  3. GET OBJECT LIST -> For entity keys (still not sure if this is the right method?)
  4. GET_ENTITY_STRUCTURE -> Get key components
  5. GET_ENTITY_STRUCTURE -> Get attribute components
  6. Fill key structure
  7. READ_ENTITY_DATA

My Questions:

  1. I am not sure if the approach for getting the entity key data (step 3) is the best way?
  2. Reading Entity AD_EMAIL -> Leading Entity: ADDRNO + BP_HEADER, Qualifying Entity: AD_CONSO

        Where can I get the data of AD_CONSO??

3. Reading Entity AD_POSTAL -> Leading Entity: ADDRNO + BP_HEADER, Qualifying Entity: AD_NATION

        Where can I get the data of AD_NATION?

4. Reading Entity BP_CUSGEN -> Leading Entity: ASSGNM_ID + BP_HEADER

        Where can I get the data of ASSGNM_ID?

Thanks and regards

Chris

Accepted Solutions (1)

Accepted Solutions (1)

michael_theis
Active Contributor

Hi Chris,

what exactly are you trying to do?

GET_OBJECT_LIST returns only objects locked in a change requests. Those are usually only entity types with SUT 1 - you'll never get keys of entities with SUT4.

Best regards

Michael

cmetz
Participant
0 Kudos

Hi MIhcael,

thanks for your answer. Ok then there must be another way. Actually I just want to call method read_entity_data of interface  if_usmd_conv_som_gov_api.

CALL METHOD lo_conv_api->if_usmd_conv_som_gov_entity~read_entity_data

     EXPORTING

*     IV_STRUCT      = GC_STRUCT_KEY_ATTR

*     IF_ACTIVE_DATA = ''

       it_entity_keys = lt_keys

*     IF_SELECT      = ABAP_TRUE

     RECEIVING

       rt_entity_data = lt_data. "<lt_data>


I need to pass table lt_keys. How do I get these values?


Thanks and regards

Chris

michael_theis
Active Contributor
0 Kudos

Hi Chris,

usually you calculate or maintain this list according to a given scenario. Take the common UIs as an example. You search for something and click on a specific link in the result list. Now the system triggers several reads using the key information you've clicked on. E.g. by clicking on a BP, the system reads addresses or bank details for the BP since those are displayed on the BPs main page. In that case it is valid to read using a partial key (BP keys only, leaving addresses or bank keys blank). This results in one to many addresses or bank details (simply depending on the amount of existing records).

Best regards

Michael

cmetz
Participant
0 Kudos

Ok in my case the problem is that I don't have any context or something i clicked on because the Scenario following: Just Show Business Partner Information (General Data, communication etc.) in a Fiori App (By extending the OData Service).

The only Information I have is the ChangeRequest ID. So what I did so far is.... Create instance of Convenience API and then SET_ENVIRONMENT to the passed ChangeRequestID. And I Need to get this key vales (eg. for BP_HEADER) from the Convenience API.

Thanks and regards

Chris

michael_theis
Active Contributor
0 Kudos

Hi Chris,

in that case your initial idea using GET_OBJECT_LIST is valid. The object list should contain the BP_HEADER locked in your current CR. Using the BP_HEADER you're able to read all data you want. Ssee my previous reply: it's sufficient to read with a partial key to get all records. BP_HEADER is part of each entity key in data model BP.

Best regards

Michael

cmetz
Participant
0 Kudos

Thanks Michael, ok we are coming closer ;-). Yes the method returns BP_HEADER, but I also need ADDRNO to get communication and address data (eg. AD_TEL, AD_POSTAL). Any further idea?

Regards

Chris

michael_theis
Active Contributor
0 Kudos

Hi Chris,

I'm sorry, but I have absolutely no idea why you want to determine the ADDRNO? This does not make sense if you want to get ALL records anyways? Why don't you simply use the partial key (as explained already twice)?!

Best regards

Michael

cmetz
Participant
0 Kudos

Thanks Michael, its working 🙂

Answers (0)