cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Build - how to update the value of element/object of each item in an list

ranjith_kumar89
Participant
0 Kudos
501

I've got the output from execute-BAPI activity. I think it'll be JSON object format. I tried to loop each item using for-each loop which works fine.

I want to update one of the element in an item for ex: BAPIResponse[0]["LOW"] = "100" like in the image. I tried with set variable but it not allowing to assign variable parameter like currentMember["LOW"]

How to achieve this? I want to update the value of "LOW" element of each item in BAPIResponse variable.

Accepted Solutions (0)

Answers (2)

Answers (2)

chwostian
Participant

Hi Ranji, yes. This is tricky. This is not going to work like this though I wish it did. After the execute BAPI you need to add a custom script and add the BAPI response as an input parameter. You have to then program your logic there in javascript and return your output parameter. You want for every record to change the value of LOW to "100"?

If you get stuck with it write me some more and I can help you with the script if necessary.

ranjith_kumar89
Participant
0 Kudos

Thanks jakub.konstantynowicz

I used the below custom code and it worked...

var Valutabl;
for(var i = 0; i < BAPIResponse.length; i++)
{
    if(BAPIResponse[i].SELNAME == "S_BEDAT")
    {
        BAPIResponse[i].LOW = Config.startDocDate;
        BAPIResponse[i].HIGH = Config.endDocDate;
    }
}
Valutabl = BAPIResponse;
return Valutabl;