on 2025 Mar 20 10:35 AM
1. In data from Payment, I have below data get from Odata.
<A_OperationalAcctgDocItemCube>
<A_OperationalAcctgDocItemCubeType>
<FiscalYear>2025</FiscalYear>
<Customer>15100100</Customer>
<PostingDate>2025-02-06T00:00:00.000</PostingDate>
<AmountInTransactionCurrency>40000</AmountInTransactionCurrency>
<AccountingDocument>1800000006</AccountingDocument>
<DocumentDate>2025-02-08T00:00:00.000</DocumentDate>
<CompanyCode>1510</CompanyCode>
<AccountingDocumentItem>1</AccountingDocumentItem>
<TransactionCurrency>JPY</TransactionCurrency>
</A_OperationalAcctgDocItemCubeType>
</A_OperationalAcctgDocItemCube>
2. I use General Splitter for the result of data as I want to work with each record of "A_OperationalAcctgDocItemCubeType".
3. In Assign Invoice data, I get the AccountingDocument and AmountInTransactionCurrency and assign the value to the Property variable.
4. I call another odata by using the filter value of AccountingDocument get in step-3.
5. I use Write Variable to store the data.
6. I use Router and if there is data in Step-5, it will goes to next step and if no data, it will end.
7. I used Groovy script to update the Variable declared in Step-5. Below is my groovy script. I want to concatenate the InvoiceID used in step-5 with the InvoiceID get from Property.
import com.sap.gateway.ip.core.customdev.util.Message;
def Message processData(Message message) {
def currentPartialID = message.getProperty("InvoiceID")
def existingIDs = message.getProperty("PartialInvoiceID") ?: ""
existingIDs = existingIDs.tokenize(',') // Convert string to list
if (!existingIDs.contains(currentPartialID)) {
existingIDs.add(currentPartialID) // Append only if new
}
message.setProperty("PartialInvoiceID", existingIDs.join(',')) // Convert list back to string
return message;
}
But when I run my process, the PartialInvoiceID is not concatenate with the InvoiceID and it resets the value when one splitter is finished. And assign only one value.
Is there any way that I can concatenate the PartialInvoiceID?
Request clarification before answering.
Hi @Pyae_Phyo_Thwe ,
With your groovy script you access to the content of a property with name "PartialInvoiceID", but not to the content of the global variable with the same name. To read the content of a global variable you always need to use a Content Modifier before, here you have an example:
Best regards,
Roberto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Pyae_Phyo_Thwe , do you have parallel processing activated in the splitter? With parallel processing I think it cannot work. With sequential processing, you have to Create the property and read the global variable inside the splitter:
If it doesn't work, another option is to add a join+gather at the end of the splitter and concatenate the invoice ids at the end of the iflow.
Hi @robertot4s.
I have tried by Creating the property. But it is the same and the variable is reset after one splitter is finished working. For the another option, join+gather, do I have to add after the groovy script? Could you pls give advice to me?
Thanks in advance.
Pyae
Hi @Pyae_Phyo_Thwe ,
I have tested in my test environment and it is working fine reading and writing the global variable inside the splitter:
Regards,
Roberto
Hi @Pyae_Phyo_Thwe ,
When you write the global variable, in the following step, the name should be "PartialInvoiceID", because it is the name you are using when reading the global variable:
hope it helps!
Roberto
Hi @Pyae_Phyo_Thwe ,
You are deleting the content of PartialInvoiceID in this step, please try removing this step.
Regards,
Roberto
Hi @roberto4s,
Thanks a lot for your help and support. Finally, I got it. I don't even need the Content Modifier 6. But I would like to ask one thing. If I want to use that PartialInvoiceID from another flow, is it possible to use? In my project, I used local process call and PartialInvoiceID is in process call and I want to use that PartialInvoiceID from main flow. I want to call the PartialInvoiceID after the Process Call 1. Is that possible?
Best regards,
Pyae
Hi @Pyae_Phyo_Thwe ,
When you write the global variable, if you have marked the flag "Global scope", you can read the variable from any iflow.
Regards,
Roberto
Hi @Pyae_Phyo_Thwe ,
If it is working fine please mark a comment as 'Accepted Solution' to close de post.
Thanks!
Roberto
Hi Roberto.
I want to delete the value in PartialInvoiceID in my main flow. And so, I use as in below. But there is still value in PartialInvoiceID. Could you please guide me how should I delete the value in PartialInvoiceID. The purpose of deleting the value in PartialInvoiceID is to clear the old value assign in that variable.
Best Regards,
Pyae
Hi @Pyae_Phyo_Thwe ,
With the Content Modifier you can delete a property or a header, not a global variable. If you want to clear the global variable, you can use the "Write Variables" and assign an empty value.
Regards,
Roberto
User | Count |
---|---|
87 | |
11 | |
9 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.