cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate Mapping in CPI

former_member536943
Participant
0 Kudos

Hello SAP,

I tried to simulate my mapping in the CPI

Therefore I need the XML IDOC from the SAP CRM.

Unfortunately I did not find anyway how to download the generated IDOC from the CRM with the xml format.

I was trying the ways in this documentation.

https://sapintegrationhub.com/abap/ale-idoc/how-to-download-idoc-to-xml-file/

but i did not get the IDOC structure I need for the simulation.

Can you please tell me how you do the simulation with a PARTNER IDOC or a PARTNER_REL Idoc from the CRM.

BR Christof

Accepted Solutions (0)

Answers (2)

Answers (2)

michael_henn1
Discoverer

Hi Christof,

you can use function module IDOC_XML_TRANSFORM to create a xml based on your idoc.

  • Open transaction SE37 and enter IDOC_XML_TRANSFORM
  • Choose F8 to test the function module
  • Enter the idoc number as DOCNUM
  • Choose F8 to execute Copy the xml to your preferred text editor like notepad++ to remove blanks and do pretty print (add-on XML Tools for notepad++).
  • Search for section <STATXT>&,&,&,&</STATXT> and replace it with <STATXT></STATXT>
  • Save the file as local xml file

Nevertheless, even with this file, you have to remove some field mappings which are not available during the simulation.

For the CRM Business Partner iflow for intance:

  • Remove function get_header since the header is not available during the simulation
  • Open the target structure of mapping
  • batchParts -> batchChangeSet -> batchChangeSetPart -> headers -> header(5) -> headerValue
  • Remove the get_header function in the middle and connect the constant with the headerValue field.
  • Now you should be able to simulate the mapping.

After the simulation you should close the iflow without saving your changes!

Best Regards

Michael

former_member536943
Participant
0 Kudos

Hello Michael,

Thank you very much for the information: Here some input also now from my side now:

There is an information button on it . Check the details in UserDefinedFunctions.gsh and you got the following code which is related to headervalue.

//This method returns value of a header, expects one input header_name i.e. name of the header to be retrieved

def String get_header(String header_name,MappingContext context) {

def header = context.getHeader(header_name);

return header;

}

And the header_name is related to the Content Modifier part

To make the mapping test work directly,do the changes on UserDefinedFunctions.gsh as below:

//This method returns value of a header, expects one input header_name i.e. name of the header to be retrieved

def String get_header(String header_name,MappingContext context) {

def header = context.getHeader(header_name);

if(header !=null ){

return header;

}

return header_name;


BR Christof