cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Adding installation or premise data to Master Data Template

cschwensen
Discoverer
0 Kudos
684

We have a Master data template (MDT) based on the BPartner category. When using this template in EC70, we would like to make the contract account category (VKTYP) a virtual attribute. The function module to determine this value requires either the premise or the installation keys associated with the Move-in. How can I configure our MDT to contain this information so that it is accessible during the execution of my virtual attribute function module?

View Entire Topic
FabianJoiris
Active Participant

Hello Corey,

We had the same requirement and here is the way we implemented it:

- Create a custom implementation of the Badi ISU_CSBTIO_PRDOC

- In method IF_EX_ISU_CSBTIO_PRDOC~MDG_CONTAINER_MODIFY, provide the Parked Document ID as a new container element:

IF i_mdg_template_category EQ 'BPARTNER'.
CALL FUNCTION 'SWC_ELEMENT_SET'
EXPORTING
element = 'ZZPRDOC'
field = i_ecamiopr-prdoc
TABLES
container = ct_container
EXCEPTIONS
OTHERS = 1.
ENDIF.

- Then in your custom virtual attribute function module, you can use this code to retrieve the Parked Document ID and get the related Premise

  IF typeid EQ 'CONTRACT_ACCOUNT'.
READ TABLE lt_container ASSIGNING FIELD-SYMBOL(<ls_container>)
WITH KEY element = 'ZZPRDOC'.
IF sy-subrc IS INITIAL.
lv_parkeddoc = <ls_container>-value.
ENDIF.
* Get the premise
SELECT SINGLE premise FROM ecamioprmdkey
INTO lv_premise
WHERE prdoc EQ lv_parkeddoc
AND moveinout EQ 'I'.
ENDIF.


Kind Regards,

Fabian

cschwensen
Discoverer
0 Kudos

Is there no way to add the installation or premise as a key or attribute to the Master Data Template that we are using? The current MDT is based on the BPartner Template category....is there another template category we could or should be using to create the contract account at move-in?