cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Class to read marketing area of contact

former_member355106
Active Participant
0 Kudos

Hello together,

does anybody knows if there exists a class to get the marketing area of a contact by using the ID_ORIGIN and ID? Our contacts all have just one marketing area assigned.

BR/

former_member355106
Active Participant
0 Kudos

Thank you. Forgot to mention we have to use this class inside BADI CUAN_IA_REVISE_FOR_IMPORT.

BR/

former_member355106
Active Participant
0 Kudos

Also forgot to mention we are on SAP Marketing Cloud 1902.

Accepted Solutions (1)

Accepted Solutions (1)

former_member355106
Active Participant
0 Kudos

Nice. Thank you tim.nusch . Coding works perfectly fine:

DATA: lv_marketing_area type c length 40.

IF interaction_data-mkt_area_id is initial 
OR interaction_data-mkt_area_id EQ 'GLOBAL'.

SELECT SINGLE InteractionContactMktgArea FROM I_MKT_IntactnCntctMktgArea
WHERE InteractionContactOrigin EQ @interaction_data-id_origin
AND InteractionContactId EQ @interaction_data-id
AND InteractionContactUUID EQ @interaction_data-contact_key
INTO @lv_marketing_area.

*   Set Marketing Area into Interaction
interaction_data-mkt_area_id = lv_marketing_area.


ENDIF.

Answers (3)

Answers (3)

former_member197728
Active Participant

Hello Oliver,

it seems that you have opened two questions for this topic. This one here and https://answers.sap.com/questions/778859/badi-cuan-ia-revise-for-import-how-to-read-marketi.html# --> It would be great if you could close the other question.

Regarding your question. It's a two-step process:

1. Identify a custom CDS view providing you the Marketing Area assignment for the ID_ORIGIN & ID tuple.

1.1 Either use the standard CDS view I_MKT_IntactnCntctMktgArea for this (standard set of fields)

1.2 Or create a custom CDS view joining the two CDS Views I_Mkt_Contact and I_Mkt_ContactFacet (if you want to select additional fields)

2. Read from CDS view from 1.1 or 1.2 in SAP Marketing Cloud BAdI similar to this example:

select ***MARKETING_AREA*** from ***CDS_VIEW_NAME*** into ***FIELD*** where InteractionContactOrigin = ***ID_ORIGIN*** and InteractionContactId = ***ID***.

Best regards,

Tim

former_member355106
Active Participant
0 Kudos

Dear Tim, thank you so much.

Can we use also standard CDS View I_MKT_IntactnCntctMktgArea inside the BADI?

BR/

former_member197728
Active Participant
0 Kudos

Hi Oliver,

Yes, do can!

Actually I was looking for that one but didn't find it. You can then skip step 1 and read from this standard CDS view in your BAdI.

I will update and improve my answer above. Please mark your question as answered, if my comment helped.

Thanks and best regards,

Tim

andreasfranz
Advisor
Advisor
0 Kudos

Hello Oliver, Tim,

just be aware of two things:

  • The BadI CUAN_IA_REVISE_FOR_IMPORT is very performance critical, as it is called for each an every interaction. So, if possible, try to restrict additional database selects (e.g. only for certain Interaction Types)
  • it could happen that an ID/ID_ORIGIN returns more then one contact (depending on data and system-setup). This needs to be taken care within the BadI (depending on what you plan to do)

best regards

Andreas

former_member267312
Contributor
0 Kudos

tim.nusch , johannes.hirling , surajit.mitra could you please help Oliver?