Skip to Content

SAP PI change field names

Dear SAPiens,

My requirement is to change field name with prefix:fieldName...

Creating data type does not allow : character.

Please help in achieving this.

BR,

Rashmi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 07, 2018 at 11:01 AM

    Hi Rashmi,

    Just try this UDF

    publicString setTargetFieldName(String newTargetFieldName, String Fieldvalue, Container container) 
    {
       LeafStructureNode node =((LeafStructureNode) container.getParameter(“STRUCTURE_NODE”));
      node.setQName(newTargetFieldName);
      return Fieldvalue;
    
    
    }
    

    To add a prefix just pass data to UDF like this

    constant("h:td")---------------\

    setTargetFieldName----------------------><h:td>FIELD VALUE</h:td>

    field------------------------------/

    Please kindly note that all prefix has to be defined in xml before changing the target node name. Such as shown below, h and f are prefixes which has been defined at below at beginning of xml.

    <root xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="https://www.w3schools.com/furniture">
    
    <h:table><h:tr><h:td>Apples</h:td><h:td>Bananas</h:td></h:tr></h:table><f:table><f:name>African Coffee Table</f:name><f:width>80</f:width><f:length>120</f:length></f:table>
    
    </root>

    Regards

    Anupam

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 07, 2018 at 05:05 AM

    Hi Rashmi,

    I would suggest using XSLT/Java mapping to change the field name. I do not think it is possible in standard mapping.

    regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded