on 04-06-2009 9:15 AM
Dear All
I have a requirement in an file to idoc scenario where i have to do the mapping based on whether the current record in the file is last or not.
If the current record is the last I have to put a constant value to a field in idoc or else i have to map another constant to the same field.
I am not able to figure how to find whether the current record is the last one or not.
please help me out.
Sourabh
use the count function to get the total occurance.
The use the index function. It will give you the current index of a record.
So your logic should be if count = index then it is the last record.
Ref:
https://wiki.sdn.sap.com/wiki/display/XI/CountofRecords-%27Countontheeasiestway+through%27
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sourabh Nirmal
The same still applies. If you are mapping a file ot IDOC where you are submitting the IDOC's in a packet 1..n then on the secific field (you mentioned it was a feld meaning one field) you need to check:
RecordSet
Record -
> IDOC
SrcField IF (count(Record) = Index(Record)) ---> Const1 destField
ELSE -
> Const2
The condition in the IF although applied to every line in the file will only hold true on the last line.
Thanks
Damien
Hi Sourabh
maybe 2 options:
1. if you do an xslt this is easy:
<xsl:if test="position()!=last()">
.......
</xsl:if>
2. In a graphical mapping use the index and count functions:
If (index == count)
Then set Constand
Thanks
Damien
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
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.