Tuesday, 21 August 2018

Exporting Mapping Details as Spreadsheet/Excel in SAP CPI

Exporting Mapping Details as Spreadsheet/Excel in SAP CPI:

Procedure:
  1. In Eclipse >Choose software component version > namespace > Message Mapping.
  2. Select the mapping that you want to export to spreadsheet format.
  3. From that right click on the selected mapping, choose Export as Spreadsheet.
  4. In the Save As dialog, select the location for saving the spreadsheet containing the mapping details.
  5. Choose Save.
Export mapping to Excel is successful.

For SAP PI mapping export to spreadsheet/Excel:

Procedure

  1. Export mapping to XMI file from SAP PI.
  2. Then upload the file in https://figaf.com/services/pi-documenter-pi-diff/
  3. Select the Excel format you need it.
  4. Click on Generate documentation
Export mapping to Excel is successful.




Wednesday, 15 August 2018

SAP_IsIgnoreProperties property use in SAP CPI/ SAP HCI


Tried lot in google about this property, but I couldn't find the usage of this below property used in the script. If anyone has idea can update in below comments will be useful for other too.

Soon I will try to find and update it.

Groovy Script:

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;

def Message processData(Message message) {
//Set header SAP_IsIgnoreProperties
message.setHeader("SAP_IsIgnoreProperties",new Boolean(true));

return message;
}



YMkt application integration via SAP CPI/ SAP HCI

Below is an idea on how we are connecting to the YMkt application/system

There are two ways to connect to YMkt application. Basically YMkt is a ODATA application.

1. Through ODATA adapter in CPI
2.Through HTTP Adapter in CPI

When using ODATA adapter, can directly access the application.
But when accessing via HTTP adapter, then X-CSRF token exchange must be happened.

CSRF token Handling:

By using content modifier at before step, we need to pass in Header parameter as

x-csrf-token - constant - value as fetch

Set Cookie using groovy script:

Even set cookie needed to pass it to Ymkt receiver application.

import com.sap.gateway.ip.core.customdev.util.Message;
import groovy.xml.*;
import java.io.*;

def Message processData(Message message)
{
    def headers = message.getHeaders();
    def cookie = headers.get("Set-Cookie");
    StringBuffer bufferedCookie = new StringBuffer();
    for (Object item : cookie)
    {
        bufferedCookie.append(item + "; ");     
    }
    message.setHeader("Cookie", bufferedCookie.toString());
   
   
    def messageLog = messageLogFactory.getMessageLog(message);
    if(messageLog != null)
    {
        messageLog.setStringProperty("Logging_Cookie", bufferedCookie.toString());
    }
    return message;
}



To set Header using groovy script in SAP CPI/ SAP HCI

You can add this below script and achieve to add the header to the content

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
  message.setHeader("Content-Type", "text/xml" + "; charset=utf-8" );
  return message;

}