Skip to Content
author's profile photo Former Member
Former Member

Fact Sheet generation - CL_CRM_GENIL_CONTAINER_OBJECT issue

Hi Guys,

We are utilizing functionality of an Activity Management to schedule appointments using Activity Scheduling and Standalone appointment creation as well. We did use automatic Fact Sheet attachments to the appointments.

We introduced an ad hoc generation of PDF Fact sheet attachments into the appointments. We are testing our custom solution but we experienced one issue caused by SAP standard code.

Let me summarize our settings first

1.We turn off automatic FS generation in IMG CRM->Transactions->Settings for activities->Attach Fact Sheet to activities

(Role)G:ZZ:CRM1:SLS_USER; (Trans.Type)Z100; (Short Descriptio)Visit; (Language)EN; (AttchAutom)blank; (AttachMan) flag

2.We do use custom smartform ZCRM_FACTSHEET that is a copy of CRM_ACC_ACCOUNT_OVERVIEW_PRN

3. We created new class ZCL_UIU_PRN_ACCOUNT as a copy of CL_UIU_PRN_ACCOUNT

4. in View CRMV_PRN_CONTROL we have maintained following entries (Role)G:ZZ:CRM1:SLS_USER; (External Object Name)BuilHeader; (Form name) ZCRM_FACTSHEET; (Class/Interface)ZCL_UIU_PRN_ACCOUNT; (View) blank

5. in cluster CRMVC_BUIL_PRT we have maintaned following Related objects ro (Role)G:ZZ:CRM1:SLS_USER and (Ext. Object Name) BuilHeader

(External Object Name)BuilActivity-(Field name)ACTIVITIES; BuilAddress - ADDRESS_OVERVIEW; BuilContactPerson - CONTACTS; BuilInteractionHistory - HISTORY; BuilRelationship - RELATION_TYPES; BuilSalesArrangement - SALES_AREAS

Our custom program ZFCRM_CREATE_FACT_SHEET is basically selecting relevant appointments; Reading information about main partner using FM CRM_PARTNER_READ_OW and calling FM CRM_UIU_BP_PRINT_BACKGROUND. All export parameter are properly filled in.

This FM is basically calling our Z class ZCL_UIU_PRN_ACCOUNT based on above customizing. For simplification reasons imagine that ZCL_UIU_PRN_ACCOUNT is exact copy of standard SAP class CL_UIU_PRN_ACCOUNT where CL_UIU_PRN_ACCOUNT is its superclass

The issue is with the method COLLECT_DATA and section of the code

lr_collection = lr_buil_entity->get_related_entities(

iv_relation_name = <ls_model>-relation_name ).

that returns data for internal tables lt_activities(open activities) and lt_history(closed activities). If we have scenario when we have 3 open and 8 closed activities:

a. When I generate the Fact Sheet from an Account directly in Web UI CL_CRM_BOL_CORE->get_related_entities is returning 3 records for lt_activities(open activities) and 8 lt_history(closed activities).

b. When I called it from our Z program the CL_CRM_BOL_CORE->get_related_entities is returning 11 records for lt_activities(open activities) and 11 lt_history(closed activities). It means mixed bag. And this is the issue.

I did analyze the standard SAP code and the section containing below

code is responsible for the mismatch

  • try to read children

if IV_RELATION_NAME is initial.

if IV_OWNED_ONLY = ABAP_TRUE.

LV_OBJ_LIST = IV_ENTITY->CONTAINER_PROXY-

>IF_GENIL_CONTAINER_OBJECT~GET_OWNED_CHILDREN( IV_AS_COPY = TRUE ).

else.

LV_OBJ_LIST = IV_ENTITY->CONTAINER_PROXY-

>IF_GENIL_CONTAINER_OBJECT~GET_CHILDREN( IV_AS_COPY = TRUE ).

endif.

elseif LV_MODE ne CL_CRM_BOL_ENTITY=>BYPASSING_BUFFER.

  • get relation state

>>this code>> LV_OBJ_LIST = IV_ENTITY->CONTAINER_PROXY-

>IF_GENIL_CONTAINER_OBJECT~GET_RELATION( IV_RELATION_NAME =

IV_RELATION_NAME

IV_AS_COPY = TRUE ).

read table IV_ENTITY->MY_MANAGER_ENTRY->RELATIONS with table key

RELATION_NAME = IV_RELATION_NAME

assigning

<REL_STATE>.

endif.

CL_CRM_GENIL_CONTAINER_OBJLISTCP->CONSTRUCTOR

data: LS_RELATION type GTYPE_RELATION,

LV_PARENT type ref to CL_CRM_GENIL_CONTAINER_OBJECT,

LV_ENTRY type ref to IF_GENIL_CONTAINER_OBJECT,

LV_CHILD_PROXY type ref to CL_CRM_GENIL_CONTAINER_OBJECT.

field-symbols: <REL> type CRMT_GENIL_CONT_RELAT

>>this code>> read table IV_PARENT_DATA_REF->RELATIONS assigning <REL> with table key RELATION_NAME = IS_FILTER-RELATION_NAME.

Table IV_PARENT_DATA_REF->RELATIONS is not filled for scenario b. at all. It is filled for scenario a. For our scenario b. it is missing relationships and that's the reason why we got mixed activities in BuilActivityRel and BuilHistoryRel..

Did you come across similar bug or do you know which note could potentially resolve this issue?

Thank you in advance.

-Milan

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2012 at 08:51 PM

    You might have to put breakpoint in function module CRM_UIU_BP_PRINT_BACKGROUND

    Check the values in parameter - IT_BOL_RELATION

    Also check values returned from querying table crmc_prn_contr2 (its at line 76 in our system).

    Thanks,

    Alwyn

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.