Blog Archive

Monday, July 24, 2017

SAP HCI implementation faq for my reference

Om

HCI Faq for my reference

1. implementation of scenario in HCI
( Add one by one step in iflow and test at initial design of the interface, this helps to understand the message modification during iflow transmit ion )
Use soap sender, mail receiver for simulation.

2. Transports in HCI
You need to export required integration project as .jar file from DEV system and import the same as integration content archive in prod/QA if you are using eclipse and deploy the same in respective tenant.some CTS transport kind of mechanism as we do in PI. But, unfortunately, nothing is available there in HCI to automate transport as of now.

3. set and  get parameters for header and property prameters in hci


To Retrieve the Header Value in Message Mapping:


import com.sap.it.api.mapping.*

def String getHeader1(String header,MappingContext context)
{  String HeaderValue = context.getHeader(H_headerName);  

HeaderValue= HeaderValue.toString();  return HeaderValue;}


To Retrieve the Property Value in Message Mapping:
import com.sap.it.api.mapping.*
def String getProperty(String propertyName,MappingContext context){  

String PropertyValue= context.getProperty(Prop_propertyName);  
PropertyValue= PropertyValue.toString();  return PropertyValue;}

Setting the values in header or property through 
groovy script (step) use in above mapping
( create udf , pass constant to udf and get value)
     message.setProperty("JSONData", body.toString());
               def messageLog = messageLogFactory.getMessageLog(message);
           if(messageLog != null){
        messageLog.setStringProperty("BODY1:", body.toString());
                                            }  


Groovy functionally : remove

body = body.replace("{\"element\":", "").replace("__c","").replace(",\"\"",""); 
 i.e. replace {"element": with empty  in code using escape charecter

 to remove last char at end.

body = body.substring(0,body.length() - 1);

 Assigning value of header/ property in mapping using UDF( Code as shown above)

-------------------------------------------------------------------------------------------------------
sample simulation with soap adapter

error:
org.apache.camel.CamelExchangeException: Sequential processing failed for number 0. Exchange[ID-vsa2583002-47028-1500807420271-328-5]. Caused by: [org.apache.camel.CamelExchangeException - Sequential processing failed for number 1. Exchange[ID-vsa2583002-47028-1500807420271-328-9]. Caused by: [java.util.concurrent.RejectedExecutionException - null]], cause: java.util.concurrent.RejectedExecutionException

first content modifier
( place some sample xml data or any data)
receiver connect to your mail ;
to test sample output after each step to identify the output format of the message.( web ui testing).

import com.sap.it.api.mapping.*  
def void extParam(String[] P1, Output output, MappingContext context) { 
     String[] list = P1[0].split(",");    
  if (list.length > 0)     {   
      for (int j = 0; j < list.length; j++)         {    
      output.addValue(list[j]);         } 
    } 
}

---------------------

<Root>         <Data>Apple,Mango,Orange</Data> </Root>
 
import com.sap.it.api.mapping.* 
def void extParam(String[] P1, Output output, MappingContext context)  { 
 String[] list = P1[0].split(","); 
if (list.length > 0)     { 
for (int j = 0; j < list.length; j++)         { 
output.addValue(list[j]);         } 
 } } 

 <Items>     <Fruit>Apple</Fruit>     <Fruit>Mango</Fruit>     <Fruit>Orange</Fruit> </Items>
---------------------------------------------------------------------------------------
DISPLAYING HCI PAYLOAD IN WEBUI  MONITORING WITH HELP OF MONITORINGLOG ( BEFORE AND AFTER INSIDE IFLOW
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {

def payload = message.getBody(java.lang.String) as String;
def messageLog = messageLogFactory.getMessageLog(message);
    if(messageLog != null){
    messageLog.addAttachmentAsString("Salesforce Input", payload, "application/xml");
     }

       return message;
}
------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment