Technical Articles
Counter of line items in DMEE tree
Hello, SAPers!
Sometimes when you create custom DMEE tree to meet the requirements of your house bank concerning the format of file with payment orders, you have to configure the field with counter of line items in file. This counter represents a simple field with incremental value from 1 to n, where n equals the number of line items in the payment run. However, there are no standard field in the structures FPAYH, FPAYHX and FPAYP. Therefore you have to use another standard functionality that will be discussed in this document.
The solution described in this blog was initially described back in 2014. Later on i.e. in 2017 SAP issued a standard FM for Brazil i.e. DMEE_EXIT_BR_FEBR_COUNT, which can be used to achieve the same result with less efforts. Thanks to Engin YILMAZ for pointing out this FM in the comments section. You can use this FM and skip this blog. Or you can read it and gain some new knowledge 🙂
In order to create node that will retrieve the consequential number of line item in the payment run the following activities have to be performed:
1) Create technical node
Technical node stores values that are used in other tree nodes (elements or atom) by a reference to this node. However, the values stored in technical nodes are not shown as output in a target file. Thus, you have to create a technical node with the following characteristics:
On the tab Source specify the constant value that equals to 1:
         2) Create element with reference to tree node with the following characteristics:
On the tab Source specify the reference to the technical tree node created previously and insert “3” (Counter reading) in the field Attribute:
The nodes in the tree menu of DMEE structure for your payment medium should look as follows:
Create other nodes as required for payment medium for your bank and activate the tree. Afterwards, when you run the transaction FBPM and create the payment medium, your will have the counter starting at one in the beginning of each line item:
Anyway, I hope this information will be useful. All suggestions are welcome!
P.S. This post can also be found on Medium platform under the following link.
    Best regards,
    The Wirtschaftsmann
Thanks for sharing your knowledge!
Thanks,
also looking for solution like this. Obviously for SAP_APPL 618 it doesn't work. Returns error:
Node SEQNUM: Cannot map to reference node filled with a constant
Perhaps something was changed in the core. Played with this for an hours w/o success.
Rgds.
Hi Bohdan!!!
Nice post !
I have a Q for you.
If I want my counter to start with X+1 (for example number 2 instead number 1) how can achieve this?
thanks in advance!
cheers
Hello Bohdan,
Thanks for sharing, very useful.
I also managed to do it by assigning the function DMEE_EXIT_BR_FEBR_COUNT for the field.
Kind regards,
Engin
Hi Engin YILMAZ,
Thank you ! This is a very good finding. From what I can see, the FM was released around 2017 and at the time when I wrote this post - in 2014 it was not available yet. Anyway, I'll update the post and mention this FM.
Thank you !
Regards,
Bohdan
Hi Bohdan Petrushchak ,
I am only glad to have contributed to this blog. Thanks for the appreciation.
Kind regards,
Engin