cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Removing NULL from SAP CPI mapping - context

das_sappo
Participant
0 Likes
2,170

Hi Experts,

Please suggest how can I remove the NULL from the context ? tried couple of script but none working.

 

das_sappo_1-1712246005084.png

 

Accepted Solutions (0)

Answers (3)

Answers (3)

Dinu
Active Contributor
0 Likes

Dear @das_sappo,

Could you please explain why you want to do this. My understanding is that this, having NULL in the first row, is normal. You cannot remove it. It represents the previous value when the context changed. For the first change there is no previous value. So it is always NULL. 

Perhaps you should take a step back and look at why you thought it necessary to remove the NULL. 

See Set the Mapping Context | SAP Help Portal 

das_sappo
Participant
0 Likes

das_sappo_0-1712250667981.pngdas_sappo_1-1712250714360.png

 

Andrzej_Filusz
Contributor
0 Likes

Hello,

Could you try the following code please?

def void removeNullFromContext(String[] items, Output output) {
    items.each { String item ->
        if (item != null) {
            output.addValue(item)
        }
    }
}

BR,

Andrzej

das_sappo
Participant
Hi Andrzej, still appearing
rmperatnayake
Discoverer
0 Likes
Please check whether you need to use useOneAsMany in previous mapping steps