Friday, July 11, 2008

ISU Master Data Template: How to create an EDM Profile

This mini article explains how you can create a simple master data template and a simple ABAP program to create an EDM Profile.

First step is to create the master data template.

To create a new master data template go to transaction EPRODCUST


Choose the MD Template Category as EDM_PROFHEAD. Unfortunately this MDT exists only in ECC6.0.







Configure the Template’s attributes as in the image below.

Save the Template.

Let’s now test the template.

In the same transaction EPRODCUST press the test button.


Fill in the parameters and then press Adopt button.
Now press execute.




The Master Data Template was executed successfully and by pressing on the log button we can see the profile which has been created.



Let’s display the profile header. Go to transaction EEDM08

Voila!


You have created a profile using the master data template.



Now, let’s create a small ABAP report to create the profile.
The FM we need to call is ISU_PRODUCT_IMPLEMENT.
We need to provide 2 parameters: Master Data Template and the container.

In the container we need to specify all the parameters we created in the master data template and theirs values. For this we create an internal table it_container and fill each line with a parameter. The parameters must be provided in the table in the ascending order.



DATA it_container TYPE CCMCONT_T.
DATA wa_container LIKE LINE OF it_container.
DATA it_NEW_KEYS_TAB TYPE ISU_PROD_NEWOBJECT_KEYS_TAB.
DATA wa_NEW_KEYS_TAB LIKE LINE OF it_NEW_KEYS_TAB.
DATA it_DONE_NODE_TAB TYPE ISU_EPDNODE_TAB.

DATA : l_LOGID TYPE GUID_32,

l_SCRIPT_INFO_TAB TYPE ISU_SCRIPT_INFO_TAB,
l_IDE_STARTED TYPE EBA_FLAG,
l_MDG_COMPLETED TYPE EBA_FLAG.

clear wa_container.
wa_container-element = 'DATEFROM'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = '20080101'.
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'DAY_OFFSET'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = '000000'.
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'INTSIZEID'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = 'DAY'.
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'MASS'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = 'KWH'.
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'PROFILE'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'PROFTEXT'.
wa_container-elemlength = '255'.wa_container-type = 'C'.
wa_container-value ='Profile Test FOR SAP BLOG'.
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'PROFTYPE'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = '21' .
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'PROFVALCAT'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = '1' .
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'SPARTE'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = '02' .
Append wa_container to it_container.

clear wa_container.
wa_container-element = 'TIMEFROM'.
wa_container-elemlength = '255'.
wa_container-type = 'C'.
wa_container-value = '000000' .
Append wa_container to it_container.


CALL FUNCTION 'ISU_PRODUCT_IMPLEMENT'
EXPORTING
X_PRODID = 'Z_PROFIL'
X_CONTAINER = it_container
X_RAISE_NO_EVENT = 'X'
X_NO_BPCONTACT = 'X'
* X_CONTRACTDATA =
X_NO_ENV_SELECT = 'X'
X_INDUSTRY = 'U'
IMPORTING
Y_LOGID = l_LOGID
Y_SCRIPT_INFO_TAB = l_SCRIPT_INFO_TAB
Y_IDE_STARTED = l_IDE_STARTED
Y_MDG_COMPLETED = l_MDG_COMPLETED
CHANGING XY_NEW_KEYS_TAB = it_NEW_KEYS_TAB
XY_DONE_NODE_TAB = it_DONE_NODE_TAB
EXCEPTIONS
GENERAL_FAULT = 1
INPUT_ERROR = 2
AMBIGUOUS_ENVIRONMENT = 3
OTHERS = 4.


IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

clear it_container.
READ TABLE it_NEW_KEYS_TAB index 1 into wa_NEW_KEYS_TAB.
move wa_NEW_keys_tab-VALUE to P_l_profile.refresh it_new_keys_tab.refresh it_DONE_NODE_TAB.