cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP program and FB for value mapping replication

arnold_fritz
Explorer
0 Kudos

Hi,

we are using a 40B system and I want to use the value mapping replication in XI. To refill the data into the XI database I must write an ABAP and a function module to transfer the data out of R/3 into XI (via RFC). Has anybody an example how the program (and the FB) must look like? i.e I want to read table mvke and extract the materialnumber and the prodhierarchy.

Thanks and best regards

Arnold

Accepted Solutions (0)

Answers (1)

Answers (1)

stefan_grube
Active Contributor
0 Kudos

Hi Arnold,

Could you tell me, what the source and target values for the mapping should be?

When you want to extract the material number and the prod hierarchy, is one the source and the other the target?

Regards

Stefan

arnold_fritz
Explorer
0 Kudos

Hi Stefan,

we source field is the materialnumber and the target field the prodhierarchy.

Regards

Arnold

stefan_grube
Active Contributor
0 Kudos

Hi Arnold,

First you need a table type with a structure like follows:

operation
groupid
context
identifier
agency
scheme

(corresponding to the Interface ValueMappingReplication)

All used data elements should have type string or charXX

for example: operation - char10, groupid - char32, rest - char120

Next you create a function module with attribute 'remote-enabled module'.

The import parameter is your new table structure.

Next you create an ABAP program. Here an example:

report z_value_mapping .

tables mvke.

data:
 p_value_mapping type zvalue_mapping,
 p_value_mapping_table type zvalue_mapping_table.


p_value_mapping-operation = 'Insert'.
p_value_mapping-context = 'http://xi.com/Material'.

select * from mvke where matnr between '170' and '501'.

check not mvke-prodh is initial.

* Create a value mapping group to join two entries.
* use a unique 32 digit number.
concatenate '00000000000000' mvke-prodh into p_value_mapping-groupid.
translate p_value_mapping-groupid using ' 0'.

* Store the mapping source as first entry to the group
p_value_mapping-identifier = mvke-matnr.
p_value_mapping-agency = 'SenderAgency'.
p_value_mapping-scheme = 'MATNR'.

append p_value_mapping to p_value_mapping_table.

* Store the mapping target as second entry to the group
p_value_mapping-identifier = mvke-prodh.
p_value_mapping-agency = 'ReceiverAgency'.
p_value_mapping-scheme = 'PRODH'.

append p_value_mapping to p_value_mapping_table.

endselect.

* Push data to XI
call function 'Z_VALUE_MAPPING' in background task
  destination 'IS_XID'
  exporting
    value_mapping       = p_value_mapping_table.

    commit work.

Import the RFC to the Integration Builder, create a mapping between your RFC and the interface ValueMappingReplication.

Check this Blog for additional steps:

/people/sreekanth.babu2/blog/2005/02/23/value-mapping-replication

Choose names for context, agency and scheme which are useful your scenario.

Regards

Stefan