on 2024 Dec 02 1:49 PM
I have written a script to store a column of csv payload in a property but getting the following error. any help will be appreciated.
import com.sap.it.api.mapping.*;
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
def csvpayload = message.getpayload(java.lang.String.class)
def csvRows = csvpayload.split('\n')
def lastRow = csvRows[csvRows.size()-1]
def lastRowCoulmns = lastRow.split(',')
def lastCoulmn = lastRowCoulmns[lastRowCoulmns.size()-1]
message.setHeader('lastColumn', lastColumn)
retun message
}
Error:
java.lang.NoSuchMethodException: No signature of method: com.sap.gateway.ip.core.customdev.processor.MessageImpl.getpayload() is applicable for argument types: (java.lang.Class) values: [class java.lang.String]
Request clarification before answering.
It is getBody not getpayload.
There are other small mistakes. Test your script in https://groovyide.com/cpi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.