on 04-10-2015 4:11 AM
Please I need help on the following udf attached screenshot of data which is coming in E1EDP01 . Expecting one Ref segments in target.Getting exception if the Rate is not present in second Z1EKPD1 segment for( i = 0; i < aContractNo.length; i++ ){ if (!aContractNo[i].equals("")){ if ((!aRating[i].equals(""))||(!aRating[i].equals(null))){ resultRef.addValue(""); } } } zzcontractnumber>mapwithdefault> udf > removecontext>splitbyvalue>Ref zzpasrating>mapwithdefault>both context set to E1EDP01
can you try below if it works.
for( i = 0; i < aContractNo.length && i < aRating.length ; i++ )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you it worked but I can't use that condition. There are some other fields in Z1EKPD1 segements which I need to create similar ref segments . first main condition is contractno exist then for the remaining each I need to create ref in target In this case rating doestnot exist but other fields exist so it should create remaining ref in target Z1EKDP1 ZZCONTRACTNUMBER ZZPARSRATING ZZPRIMECONTRACT ZZSQTY
Hi,
I could not get your requirement.below code will send blank to target if ZZPARSRATING has some values in source side.
if ((!aRating[i].equals(""))||(!aRating[i].equals(null))){ resultRef.addValue(""); }
do you want to pass blank to (target)ZZPARSRATING if source xml does not have ZZPARSRATING tag?
you can try below options.
1. ZZPARSRATING -->mapwithdefault-->ZZPARSRATING
so whenever source does not have ZZPARSRATING it will create the tag in the target.
2. if you use udf then modify below code
if ((!aRating[i].equals(""))||(!aRating[i].equals(null))){ resultRef.addValue(""); }
to
if ((aRating[i].equals(""))||(aRating[i].equals(null))){ resultRef.addValue(""); }
Hi Mahesh,
>>>>>first main condition is contractno exist then for the remaining each I need to create ref in target
ZZCONTRACTNUMBER-->exists-->removecontexts-->createif-->Z1EKPD1
ZZCONTRACTNUMBER------>ZZCONTRACTNUMBER
Regards,
Praveen.
It should not create blank value in target and it should not throw exception if the rating field doesnot exist There are two Z1EKPD1 segments in test data as below. It should create segment if the data exist only for all of these four E1EDP01 Z1EKPD1 ZZCONTRACTNUMBER ZZPARSERATING ZZPRIMECONTACT ZZQTY Z1EKPD1 ZZCONTRACTNUMBER ZZPRIMECONTACT ZZQTY In this case for the first Z1EKPD1 , getting 4 refsements which is expected in the second Z1EKPD1 , since there is no ZZAPRSRATING ,getting exception. I am expecting 3 ref segments . Already doing with mapwithdefault for all of these If there is any missing field in first Z1EKPD1 segments ,it doesn't throw exception only in the 2nd Z1EKDP1 segments missing any data ,throws exception first in for loop checking for contactnumber then checking for the all fields not blank then create target for each
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.