on 05-23-2008 9:27 AM
Hi,
I have a source message with that structure:
<item>
MATNR
DESCRIPTION
DATE
</item>
And I'm mapping to a target structure with the same fields.
But in my message mapping I want to ignore/delete the items where the value of field DATE is a DATE lower thatn system date.
For example if system date is 23/05/2008:
Source Message:
<item>
MATNR = '30'
DESCRIPTION = 'aaa'
DATE = '22/02/2008'
</item>
<item>
MATNR = '31'
DESCRIPTION = 'bbb'
DATE = '30/09/2008'
</item>
Target Message:
<item>
MATNR = '31'
DESCRIPTION = 'bbb'
DATE = '30/09/2008'
</item>
Hi Marshal
You can do it in normal mapping and you do not require to use any UDF.Always follow a simplest and elegant approch
Follow these steps
1) first you Take Current Date function from DATE category function
2)Then Use Compare Date function from DATE category function
3) Compare current date and Date field using Comapre date function.
4) then use Equals function (for the string) from text second input for Equals function is "TRUE" or u201C1u201D
5) after that use IF function and give the above condition in IF part and assign current date
6) in the else part assign a constant , double click on constant and make empty value to that constant.
By this way you can make comparision and if the value comes true then it will assign current date else it will assign blank value
Hope this may solve your problem
Thanks
Sandeep
If helpful reward points
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again,
I've implemented a solution very similar of Rohit purpose and it worked fine but it's only comparing the first recordset item.
If the 1st Recordset item date is greater than current date the mapping maps all the items to the target
And if the 1st Recordset item date is lower than current date no item is mapped to the target recordset
Hi,
So here came the simplest approach.. just write one UDF and all will be done (as i suggested earlier). It checks values by one by one item and appends it to result. You will never see any problem and you can also reuse it when you need it later. anyway its your decesion but i'll prefer UDF for this case.
I know there is no need to write an UDF but it helps when you do these type of mapping again and again.
Regards
Aashish Sinha
PS : reward points if helpful
Edited by: Aashish Sinha on May 23, 2008 11:40 AM
Hi,
That is context problem to know context refer following link.
http://help.sap.com/saphelp_nw04/helpdata/en/40/7b8e40496f6f1de10000000a1550b0/frameset.htm
Regards,
Rohit.
Reward points if helpful.
Hi Marshal,
Well no need to write UDF for this
Do this mapping for the node "item" at target side
1)take currentDate from date functions
2)take CompareDate give one input to it wil be currentDate and othe will be DATE field of your input structure.
3)use ifwithoutElse(Keeps = true) give one input as output of CompareDate and other as "item" of your input source
now everythiong is done .
Reward points if helpful
Thanks
Sunil Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
u can do it in normal mapping not require to use UDF.
1) Take Current Date function from DATE category.
2) Use Compare Date function from DATE category.
3) Compare current date and Date field using Comapre date function.
4) then use Equals function from text sencond input for Equals function is "1".
5) after that use Not function then use IfWithOutElse function with keeps == true.
5) after that use RemoveContext and map it to parent node (Item).
Regards,
Rohit
Reward points if helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use date function "currentDate" to get the system date.
Then use function "compareDate" and input the 2 dates. Then u can use the value in "if" function
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For this purpose you need to write an advance udf.
Logic,
- it will take ur XML as input (that will be stringlist when you define the UDF)
- check the date of item or put it in some variable for comparision or in string anything you want.
- compare the date
if date is not equal to sysdate
don't add to resultset list
else
add to resultset list
return resultset.
Hope this will help you.
Regards
Aashish Sinha
PS : reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.