cancel
Showing results for 
Search instead for 
Did you mean: 

FormCalc, SmartForm: BillingDocument iterate BillingDocumentItem

Stephen_Niemann
Participant
0 Kudos

Hi there,

I need the Gross Weight of the order in my Billing Document and I´m really struggling to iterate over the Items in the datastream. The GrossWeight is to be printed on the header level:


What I did so far:

  • I added a new data field, which brings me GrossWeight of an Item into the data stream
  • I multiplied the gross weight of a Billingdocument position with its quantity and put it into the form, at the position level:


What I am trying:

  • I Understood, that I do not have the gross weight of an order anywhere saved, I am therefore trying to add the values up and then print them to the document
  • My idea is to iterate over the objects in the datastream, but I have no clue how to access it

Here is my code/pseudocode so far:

foreach Item in (BillingDocumentitemNode[*]) do

var tempWeight = Item.YY1_GrossWeightMateria_BDI;
var tempQuantity = Item.Quantity;

var tempResult= tempWeight* tempQuantity;

$.addItem(tempResult, "")

endfor;

--> the bold written part is wrong, I know this, but I don't know how to make it right? And is the rest correct? My Questions:
how can I access the Datastream with formcalc?
Where is my mistake in the code above?
What else to keep in mind?

JulianoRomanato
Product and Topic Expert
Product and Topic Expert

Hello stephen_niemann.

How are you? I have excluded the Tag "SAP S/4HANA Cloud" and included the Tag "SAP S/4HANA Cloud Extensibility" for this question, as Sales Order Form is related to Extensibility.

Regards.

Juliano Romanato.

Marissa
Advisor
Advisor
0 Kudos

Add SAP S/4HANA Cloud for Sales to involve billing experts.

Accepted Solutions (1)

Accepted Solutions (1)

Hi Stephen,

I recommend to use extensibility and then coding in the cloud Badi, because I think the performance is better and the coding in ABAP is easier than the coding in formcalc.

If you really want to do it in Adobe LiveCycle Designer, I once tried a loop over FixPriceJournalEntries in the Professional Service form, and it worked with this coding (it's Java Script):

var oDataItems = xfa.resolveNodes("Form.frmHiddenFixPriceJournalEntries.FixPriceJournalEntriesNode[*]");

for (i=0 ; i < oDataItems.length ;i++ )

{...

Best regards,

Sandra

Daiana_Feiten
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

We helped you to accept the answer, since there were no updates after 7 days. You can unaccept it anytime if you have further questions.

Kind regards,

Daiana

Answers (0)