Start of Content Area

Background documentation Mapping the Data Structures Locate the document in its SAP Library structure

Before the address data can be imported from the file and into the BW system, the structure of the file must be known in the system.

You do this by defining a new DataSource. The source system is a PC file.

In the SAP standard, DataSource 0ELM_GUID_I_ATTR is provided for this. It has the transfer structure of all fields from 0ELM_GUID_I. The DataSource has one start routine and 3 routines in the transfer rules for attributes 0ELM_GUID_H, 0ELM_LISTID and 0ELM_GUID_I.

Start routine

There is one start routine, in which the file name is used to search for the address list.

Note

If you define your own DataSource, you must assign this start routine to the new DataSource. Copy the following coding to the start routine.

You should always copy the current coding from DataSource 0ELM_GUID_I_ATTR, because subsequent corrections could cause the documentation and the system coding to differ slightly.

Here, two global variables are declared for the ID and the GUID of the address list. These variables are filled in the following routine. The values from the global variables are needed in the transfer rules for attributes 0ELM_GUID_H and 0ELM_LISTID.

* Global code used by conversion rules

*$*$ begin of global - insert your declaration only below this line  *-*

TABLES: elmd_list_file.

DATA: gd_list_id    LIKE elmd_list_file-list_id,

      gd_elm_guid_h LIKE elmd_list_file-list_guid.

*$*$ end of global - insert your declaration only before this line   *-*

The routine first reads the name of the file that is currently being processed from table RSSELDONE.

Then the GUID and ID for the address list are read with the file name from table ELMD_LIST_FILE and both global variables are filled.

FORM STARTROUTINE

  USING    G_S_MINFO TYPE RSSM_S_MINFO

  CHANGING DATAPAK type TAB_TRANSTRU

           G_T_ERRORLOG TYPE rssm_t_errorlog_int

           ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage

*$*$ begin of routine - insert your code only below this line        *-*

  DATA: l_s_errorlog TYPE rssm_s_errorlog_int,

        ld_filename  TYPE rsfilenm.

 

 

  CLEAR: ld_filename,

         l_s_errorlog,

         gd_list_id,

          ABORT.

 

  REFRESH: g_t_errorlog.

 

* Get filename from selections of infopackage

  SELECT filename FROM rsseldone INTO ld_filename

                  WHERE rnr = g_s_minfo-requnr.

    EXIT.

  ENDSELECT.

* Filename not found on infopackage --> Abort upload

  IF sy-subrc NE 0.

    MOVE: 'E'              TO l_s_errorlog-msgty,

          'ELM'            TO l_s_errorlog-msgid,

          '746'            TO l_s_errorlog-msgno,

          g_s_minfo-requnr TO l_s_errorlog-msgv1.

    APPEND l_s_errorlog TO g_t_errorlog.

    ABORT = 4.

    EXIT.

  ENDIF.

 

* Read data base table ELMD_LIST_FILE to get the list_id

  SELECT * FROM elmd_list_file WHERE file_name = ld_filename.

    gd_elm_guid_h = elmd_list_file-list_guid.

    gd_list_id    = elmd_list_file-list_id.

    EXIT.

  ENDSELECT.

* List ID not found in table ELMD_LIST_FILE --> abort upload

  IF sy-subrc NE 0.

    MOVE: 'E'         TO l_s_errorlog-msgty,

          'ELM'       TO l_s_errorlog-msgid,

          '747'       TO l_s_errorlog-msgno,

          ld_filename TO l_s_errorlog-msgv1.

    APPEND l_s_errorlog TO g_t_errorlog.

    ABORT = 4.

    EXIT.

  ENDIF.

 

* abort <> 0 means skip whole data package !!!

  IF NOT gd_list_id IS INITIAL.

    ABORT = 0.

  ELSE.

    MOVE: 'E'         TO l_s_errorlog-msgty,

          'ELM'       TO l_s_errorlog-msgid,

          '745'       TO l_s_errorlog-msgno,

          ld_filename TO l_s_errorlog-msgv1.

    APPEND l_s_errorlog TO g_t_errorlog.

    ABORT = 4.

  ENDIF.

 

* set in 0ELM_GUID_H the attribute LOADED = X

  CALL FUNCTION 'ELM_GUID_H_LOADED_SET'

    EXPORTING

      iv_list_guid    = gd_elm_guid_h

      iv_list_id      = gd_list_id

    EXCEPTIONS

      parameter_error = 1

      error_occurred  = 2

      OTHERS          = 3.

 

  IF sy-subrc <> 0.

*   message comes out of the function module

    MOVE: sy-msgty  TO  l_s_errorlog-msgty,

          sy-msgid  TO  l_s_errorlog-msgid,

          sy-msgno  TO  l_s_errorlog-msgno,

          sy-msgv1  TO  l_s_errorlog-msgv1,

          sy-msgv2  TO  l_s_errorlog-msgv2,

          sy-msgv3  TO  l_s_errorlog-msgv3,

          sy-msgv4  TO  l_s_errorlog-msgv4.

    APPEND l_s_errorlog TO g_t_errorlog.

    ABORT = 4.

  ENDIF.

*$*$ end of routine - insert your code only before this line         *-*

 

ENDFORM.

Transfer rule for 0ELM_GUID_H

The transfer rule for 0ELM_GUID_H uses routine Determine InfoObject ELM_GUID_H from Global Data.

In this routine, the value from the global variable gd_elm_guid_h is assigned to attribute 0ELM_GUID_H. The value of the variable was filled in the start routine.

Note

If you define your own DataSource, you must assign this routine to the new DataSource. Copy the following coding to the routine for 0ELM_GUID_H.

You should always copy the current coding from DataSource 0ELM_GUID_I_ATTR, because subsequent corrections could cause the documentation and the system coding to differ slightly.

* Global code used by conversion rules

*$*$ begin of global - insert your declaration only below this line  *-*

TABLES: elmd_list_file.

DATA: gd_list_id    LIKE elmd_list_file-list_id,

      gd_elm_guid_h LIKE elmd_list_file-list_guid.

*$*$ end of global - insert your declaration only before this line   *-*

 

*$*$ begin of routine - insert your code only below this line        *-*

* DATA: l_s_errorlog TYPE rssm_s_errorlog_int.

 

  RESULT = gd_elm_guid_h.

* returncode <> 0 means skip this record

  RETURNCODE = 0.

* abort <> 0 means skip whole data package !!!

  ABORT = 0.

*$*$ end of routine - insert your code only before this line         *-*

 

Transfer rule for 0ELM_LISTID

The transfer rule for 0ELM_LISTID uses routine Determine InfoObject ELM_LISTID from Global Data.

In this routine, the value from the global variable gd_elm_list_id is assigned to attribute 0ELM_LIST_H. The value of the variable was filled in the start routine.

Note

If you define your own DataSource, you must assign this routine to the new DataSource. Copy the following coding to the routine for 0ELM_LISTID.

You should always copy the current coding from DataSource 0ELM_GUID_I_ATTR, because subsequent corrections could cause the documentation and the system coding to differ slightly.

* Global code used by conversion rules

*$*$ begin of global - insert your declaration only below this line  *-*

TABLES: elmd_list_file.

DATA: gd_list_id    LIKE elmd_list_file-list_id,

      gd_elm_guid_h LIKE elmd_list_file-list_guid.

*$*$ end of global - insert your declaration only before this line   *-*

 

*$*$ begin of routine - insert your code only below this line        *-*

* DATA: l_s_errorlog TYPE rssm_s_errorlog_int.

 

  RESULT = gd_list_id.

* returncode <> 0 means skip this record

  RETURNCODE = 0.

* abort <> 0 means skip whole data package !!!

  ABORT = 0.

*$*$ end of routine - insert your code only before this line         *-*

 

Transfer rule for 0ELM_GUID_I

The transfer rule for 0ELM_GUID_I uses routine Get GUID for InfoObject 0ELM_GUID_I.

In this routine, a new GUID is assigned to attribute 0ELM_GUID_I. Function module GUID_CREATE is used for this.

One GUID must be assigned as a unique key to every data record in 0ELM_GUID_I. This key is the primary key for the master data table to which 0ELM_GUID_I is assigned.

If the data are transferred to SAP CRM using Segment Builder, then this GUID is used when deciding whether the data record already exists in the CRM system.

Note

If you define your own DataSource, you must assign this routine to the new DataSource. Copy the following coding to the routine for 0ELM_GUID_I.

You should always copy the current coding from DataSource 0ELM_GUID_I_ATTR, because subsequent corrections could cause the documentation and the system coding to differ slightly.

 

* Global code used by conversion rules

*$*$ begin of global - insert your declaration only below this line  *-*

TABLES: elmd_list_file.

DATA: gd_list_id    LIKE elmd_list_file-list_id,

      gd_elm_guid_h LIKE elmd_list_file-list_guid.

*$*$ end of global - insert your declaration only before this line   *-*

 

*$*$ begin of routine - insert your code only below this line        *-*

* DATA: l_s_errorlog TYPE rssm_s_errorlog_int.

 

  CALL FUNCTION 'GUID_CREATE'

    IMPORTING

      ev_guid_32 = RESULT.

 

* returncode <> 0 means skip this record

  RETURNCODE = 0.

* abort <> 0 means skip whole data package !!!

  ABORT = 0.

*$*$ end of routine - insert your code only before this line         *-*

Transfer rule for 0ELM_NETCOU

The transfer rule for 0ELM_NETCOU uses constant value 1.

For every loaded data record in master data object 0ELM_GUID_I, attribute 0ELM_NETCOU must be set to 1. This improves selection performance when executing queries.

Note If you define your own DataSource, you must assign this constant value to the new DataSource.

Attribute 0BPARTNER

The attribute 0BPARTNER contains the ID of the business partner.

If the data is transferred to SAP CRM using Segment Builder, then business partners are created in CRM. The connection between the business partner and the GUID for an address data record (0ELM_GUID_I) is saved in CRM and then extracted to SAP BW.

This attribute is not filled when the data is imported, because the address file delivered by a data provider does not contain this information. This means that you can delete this field from the DataSource (source system: PC file).

The attribute is used in the Queries provided.

 

Attribute 0ELM_INCADR

Attribute Structure link0ELM_INCADR is not usually filled when the data is imported, because the address file delivered by a data provider does not contain this information. This means that you can delete this field from the DataSource (source system: PC file).

The attribute is filled from the CRM system via DataSource Structure link0CRM_ELM_I.

 

The following attributes are not filled when the data is imported, because the address file delivered by a data provider does not contain this information. This means that you can delete this field from the DataSource (source system: PC file).

·        Structure link0ELM_DUPLIC

·        Structure link0ELM_SUCOAC

·        Structure link0ELM_WONCUS

These attributes are filled from the CRM system via DataSource Structure link0CRM_ELM_I.

The attributes are used in the Queries provided.

 

Attribute 0COUNTRY

This attribute does not need to be filled when the data is imported. It is not used and is only needed for attribute 0REGION.

The country information must be placed in attribute 0COUNTRISO.

 

Attribute 0COUNTRYISO

When the data is imported, this attribute is filled with the information on the country in which this address exists.

If the file does not contain the information on the country in the correct ISO coding, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

 

Attribute 0REGION

When the data is imported, this attribute is filled with the information on the region in which this address exists.

If the file does not contain the information on the region in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

ExampleThe file has region Pennsylvania defined for country USA. In the system, region Pennsylvania is defined with the value PA. The transfer rule must be used to map the string Pennsylvania to value PA.

 

Attribute 0ELM_NATION

When the data is imported, this attribute is filled with the information on the international address version, if the address data exists in an international address version.

If the file does not contain the information on the international address version in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

 

Attribute 0ELM_ORG_TK

When the data is imported, this attribute is filled with the information on the form of address key for the organization.

If the file does not contain the information on the form of address key for the organization in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

ExampleThe file has Company defined as the organization’s form of address key. In the system, the form of address key for Company is defined as value 0003. The transfer rule must be used to map the string Company to value 0003.

 

Attribute 0LEGALFORM

When the data is imported, this attribute is filled with the information on the legal status of the organization.

If the file does not contain the information on the legal status of the organization in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

 

Attribute 0ELM_PERS_T

When the data is imported, this attribute is filled with the information on the form of address key for the person.

If the file does not contain the information on the form of address key for the person in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

 

Attribute 0BP_ACTITL1

When the data is imported, this attribute is filled with the information on the academic title of the person.

If the file does not contain the information on the academic title of the person in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

 

Attribute 0GENDER

When the data is imported, this attribute is filled with the information on the gender of the person.

If the file does not contain the information on the gender of the person in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

 

Attribute 0BP_MAR_ST

When the data is imported, this attribute is filled with the information on the marital status of the person.

If the file does not contain the information on the marital status of the person in the correct values, then an appropriate transfer rule must be used to map the file value to the allowed value in the system.

 

Attribute 0ELM_FCTN

When the data is imported, this attribute is filled with the information on the function description for the contact person.

This attribute only contains the string for the function description. There is no need to map the string to a technical key.

 

Enhancing of 0ELM_GUID_I with your own attributes

If you have enhanced master data object 0ELM_GUID_I with your own attributes, you can use this accordingly when defining the DataSource.

On order to continue to use these new attributes after importing the address data (e.g. during the postal check, when selecting data in Segment Builder), you must complete the following activities:

·        Implement Business Add-In ELM_MAPPING

·        Define your own InfoSet for selecting data via 0ELM_GUID_H and 0ELM_GUID_I

In the SAP standard, InfoSet ELM_INFO_SET is provided for this.

 

 

End of Content Area