cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue

Former Member
0 Kudos

Hi Frnds,

Need help pls...

I have source structure like this...

Header

Detail

Control Records.

Here detail records r repeating 2 or 3 times.in that detail records i am getting a field WRBTR(Currency)...

and based on posting key i am sending WRBTR to E1ACK3 segment if posting key =31

and 2nd value sending it to WRBTR to E1ACA3 segment if posting key=40.

But there is no any condition for E1ACT3 segment.but 3rd WRBTR sud be populated in that segment.

sample file is here

0HNZ AP IDS 600HNZ_BATCH 16072011Y/

1FB0112072011KR007 15072011/ AUD /

2ZBSEG2 310000000000799.19/

2ZBSEG2 400000000000799.19/

31 and 40 is posting key...after that value is WRBTR.

if 2 detail records coming means there is no tax since values r same.we need subtract from 1 st value to 2 nd value.

if 3 detail records coming means there is tax since values r diff.that 3rd value sud be tax value.that need to pass to 3rd segment level.

pls advice...

Regards,

Suri

Accepted Solutions (0)

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Suri,

Your thread description not clear, unable to understand your requirement, give some more info like pasting input and target structures.

Regards,

Raj

Former Member
0 Kudos

Hi Raj,

I am getting 2 detail records.in that 2 detail records 2 currency values r getting.

here 1 st value needs to send to K3 segnment and 2nd value need to send it to A3 segment.

1st value -(Minus)2nd value needs to populate in 3rd segment .

note:we r sending the values to K3 and A3 by using the condition with posting key.if it is 31 -->K3

if it is 40--->A3

T3...there is no condition.but we need to generate subtraction of both the values.

Regards,

Naren

Edited by: suri svn on Jan 24, 2012 3:44 AM

baskar_gopalakrishnan2
Active Contributor
0 Kudos

If you get only two records and want to subtract the values, use subtract standard function. Is that your requirement?

Former Member
0 Kudos

yes Bhaskar,

But detail records r repeating in test data.but in source structure WRBTR is existing only once.if i use subtract function which value it will take .it is taking 1 st value for both the times.getting result as 'Zero'.

When ever repeating based on condition i am passing to the particular segments K3 and A3.

But there is no condition for T3 Segment.still we need to pass that subtraction value.

Pls advice.

Suri

Former Member
0 Kudos

And one more thing....if there is no tax only two detail records will come in data.means both the values r same.still i need to pass 'ZERO' in that case.

if tax is there 3rd detail record will exist.that 3rd WRBTR sud be tax amount.that i need to generate.

former_member187339
Active Contributor
0 Kudos

Hi Suri,

Try this:

Duplicate the target node three times. In first and second, do mapping for K3 and A3 segments (this should be straight forward)

for the third node, write a udf with the following code, here input is your WRBTR field from source.


for (i=0;i<input.length;i++) {
   if (i % 2 = 1)
      result.addValue(input<i>-input[i-1]);
}

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

I have used ur logic .but i am not succeeded.even i am not getting WRBTR in T3 segment.

detail records r coming like...

31(newbs)16 digit number(Fixed lenght of WRBTR)----->goes to K3

40(newbs)16 digit number(Fixed lenght of WRBTR)----->goes to A3

if no tax there is no more detail record.but we need to populate T3 WRBTR as 'Zero'

If tax is there then 3 rd detail record as

40(newbs)16 digit number(Fixed lenght of WRBTR but it sud be !st WRBTR-2nd WRBTR)----->goes to T3

Regards,

Naren

former_member187339
Active Contributor
0 Kudos

Hi Naren,

It will be better if you can paste here the input XML message and the output tags (and XML structure) which you are trying to populate.

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

input XML:

<?xml version="1.0" encoding="utf-8" ?>

- <ns:AccountsPayable xmlns:ns="http://gm.com/xi/AS400/OFS/AccountsPayable/1">

- <Recordset>

- <FileHeader>

<RECTYP>0</RECTYP>

<SYSNAM>HNZ</SYSNAM>

<TRANTYPE>AP</TRANTYPE>

<VAR1>IDS</VAR1>

<VAR2>600</VAR2>

<BTCHNAM>HNZ_BATCH</BTCHNAM>

<BTCHID>16072011Y</BTCHID>

<FILLRH>/</FILLRH>

<CRLFH />

</FileHeader>

- <DocumentHeader>

<STYPEH>1</STYPEH>

<TCODE>FB01</TCODE>

<BLDAT>12072011</BLDAT>

<BLART>KR</BLART>

<BUKRS>007</BUKRS>

<BUDAT>15072011</BUDAT>

<MONAT>/</MONAT>

<WAERS>AUD</WAERS>

<KURSF>/</KURSF>

<BELNR>/</BELNR>

<WWERT>/</WWERT>

<XBLNR>214225</XBLNR>

<BVORG>/</BVORG>

<BKTXT>STOCK</BKTXT>

<PARGB>/</PARGB>

<AUGLV>/</AUGLV>

<VBUND>/</VBUND>

<XMWST>/</XMWST>

<DOCID>/</DOCID>

<BARCD>/</BARCD>

<STODT>/</STODT>

<SENDE>/</SENDE>

<FILLRH />

<CRLFH />

</DocumentHeader>

- <DocumentDetail>

<STYPED>2</STYPED>

<TBNAM>ZBSEG2</TBNAM>

<NEWBS>31</NEWBS>

<WRBTR>0000000000799.19</WRBTR>

<DMBTR>/</DMBTR>

<WMWST>/</WMWST>

<MWSTS>/</MWSTS>

<MWSKZ>/</MWSKZ>

<KOSTL>/</KOSTL>

<MENGE>/</MENGE>

<MEINS>/</MEINS>

<ZUONR>/</ZUONR>

<SGTXT>For curr 00000000614.5800 exchange 00000.7690 AUD</SGTXT>

<WSKTO>/</WSKTO>

<ZTERM>/</ZTERM>

<NAME1>/</NAME1>

<STRAS>/</STRAS>

<ORT01>/</ORT01>

<PSTLZ>/</PSTLZ>

<HKONT>5KM01</HKONT>

<KSTRG>/</KSTRG>

<CRLFD />

</DocumentDetail>

- <DocumentDetail>

<STYPED>2</STYPED>

<TBNAM>ZBSEG2</TBNAM>

<NEWBS>40</NEWBS>

<WRBTR>0000000000799.19</WRBTR>

<DMBTR>/</DMBTR>

<WMWST>/</WMWST>

<MWSTS>/</MWSTS>

<MWSKZ>/</MWSKZ>

<KOSTL>/</KOSTL>

<MENGE>/</MENGE>

<MEINS>/</MEINS>

<ZUONR>/</ZUONR>

<SGTXT>/</SGTXT>

<WSKTO>/</WSKTO>

<ZTERM>/</ZTERM>

<NAME1>/</NAME1>

<STRAS>/</STRAS>

<ORT01>/</ORT01>

<PSTLZ>/</PSTLZ>

<HKONT>441200001</HKONT>

<KSTRG>/</KSTRG>

<CRLFD />

</DocumentDetail>

</Recordset>

- <Recordset>

- <DocumentHeader>

<STYPEH>1</STYPEH>

<TCODE>FB01</TCODE>

<BLDAT>08062011</BLDAT>

<BLART>KR</BLART>

<BUKRS>007</BUKRS>

<BUDAT>15072011</BUDAT>

<MONAT>/</MONAT>

<WAERS>AUD</WAERS>

<KURSF>/</KURSF>

<BELNR>/</BELNR>

<WWERT>/</WWERT>

<XBLNR>X935346B</XBLNR>

<BVORG>/</BVORG>

<BKTXT>STOCK</BKTXT>

<PARGB>/</PARGB>

<AUGLV>/</AUGLV>

<VBUND>/</VBUND>

<XMWST>/</XMWST>

<DOCID>/</DOCID>

<BARCD>/</BARCD>

<STODT>/</STODT>

<SENDE>/</SENDE>

<FILLRH />

<CRLFH />

</DocumentHeader>

- <DocumentDetail>

<STYPED>2</STYPED>

<TBNAM>ZBSEG2</TBNAM>

<NEWBS>31</NEWBS>

<WRBTR>0000000000833.79</WRBTR>

<DMBTR>/</DMBTR>

<WMWST>/</WMWST>

<MWSTS>/</MWSTS>

<MWSKZ>/</MWSKZ>

<KOSTL>/</KOSTL>

<MENGE>/</MENGE>

<MEINS>/</MEINS>

<ZUONR>/</ZUONR>

<SGTXT>For curr 00000000642.1000 exchange 00000.7701 AUD</SGTXT>

<WSKTO>/</WSKTO>

<ZTERM>/</ZTERM>

<NAME1>/</NAME1>

<STRAS>/</STRAS>

<ORT01>/</ORT01>

<PSTLZ>/</PSTLZ>

<HKONT>5NA01</HKONT>

<KSTRG>/</KSTRG>

<CRLFD />

</DocumentDetail>

- <DocumentDetail>

<STYPED>2</STYPED>

<TBNAM>ZBSEG2</TBNAM>

<NEWBS>40</NEWBS>

<WRBTR>0000000000833.79</WRBTR>

<DMBTR>/</DMBTR>

<WMWST>/</WMWST>

<MWSTS>/</MWSTS>

<MWSKZ>/</MWSKZ>

<KOSTL>/</KOSTL>

<MENGE>/</MENGE>

<MEINS>/</MEINS>

<ZUONR>/</ZUONR>

<SGTXT>/</SGTXT>

<WSKTO>/</WSKTO>

<ZTERM>/</ZTERM>

<NAME1>/</NAME1>

<STRAS>/</STRAS>

<ORT01>/</ORT01>

<PSTLZ>/</PSTLZ>

<HKONT>441200001</HKONT>

<KSTRG>/</KSTRG>

<CRLFD />

</DocumentDetail>

</Recordset>

- <Recordset>

- <DocumentHeader>

<STYPEH>1</STYPEH>

<TCODE>FB01</TCODE>

<BLDAT>15062011</BLDAT>

<BLART>KR</BLART>

<BUKRS>007</BUKRS>

<BUDAT>15072011</BUDAT>

<MONAT>/</MONAT>

<WAERS>AUD</WAERS>

<KURSF>/</KURSF>

<BELNR>/</BELNR>

<WWERT>/</WWERT>

<XBLNR>X935554</XBLNR>

<BVORG>/</BVORG>

<BKTXT>STOCK</BKTXT>

<PARGB>/</PARGB>

<AUGLV>/</AUGLV>

<VBUND>/</VBUND>

<XMWST>/</XMWST>

<DOCID>/</DOCID>

<BARCD>/</BARCD>

<STODT>/</STODT>

<SENDE>/</SENDE>

<FILLRH />

<CRLFH />

</DocumentHeader>

- <DocumentDetail>

<STYPED>2</STYPED>

<TBNAM>ZBSEG2</TBNAM>

<NEWBS>31</NEWBS>

<WRBTR>0000000067816.92</WRBTR>

<DMBTR>/</DMBTR>

<WMWST>/</WMWST>

<MWSTS>/</MWSTS>

<MWSKZ>/</MWSKZ>

<KOSTL>/</KOSTL>

<MENGE>/</MENGE>

<MEINS>/</MEINS>

<ZUONR>/</ZUONR>

<SGTXT>For curr 00000052225.8100 exchange 00000.7701 AUD</SGTXT>

<WSKTO>/</WSKTO>

<ZTERM>/</ZTERM>

<NAME1>/</NAME1>

<STRAS>/</STRAS>

<ORT01>/</ORT01>

<PSTLZ>/</PSTLZ>

<HKONT>5NA01</HKONT>

<KSTRG>/</KSTRG>

<CRLFD />

</DocumentDetail>

- <DocumentDetail>

<STYPED>2</STYPED>

<TBNAM>ZBSEG2</TBNAM>

<NEWBS>40</NEWBS>

<WRBTR>0000000067816.90</WRBTR>

<DMBTR>/</DMBTR>

<WMWST>/</WMWST>

<MWSTS>/</MWSTS>

<MWSKZ>/</MWSKZ>

<KOSTL>/</KOSTL>

<MENGE>/</MENGE>

<MEINS>/</MEINS>

<ZUONR>/</ZUONR>

<SGTXT>/</SGTXT>

<WSKTO>/</WSKTO>

<ZTERM>/</ZTERM>

<NAME1>/</NAME1>

<STRAS>/</STRAS>

<ORT01>/</ORT01>

<PSTLZ>/</PSTLZ>

<HKONT>441200001</HKONT>

<KSTRG>/</KSTRG>

<CRLFD />

</DocumentDetail>

- <DocumentDetail>

<STYPED>2</STYPED>

<TBNAM>ZBSEG2</TBNAM>

<NEWBS>40</NEWBS>

<WRBTR>0000000000000.02</WRBTR>

<DMBTR>/</DMBTR>

<WMWST>/</WMWST>

<MWSTS>/</MWSTS>

<MWSKZ>/</MWSKZ>

<KOSTL>1002</KOSTL>

<MENGE>/</MENGE>

<MEINS>/</MEINS>

<ZUONR>/</ZUONR>

<SGTXT>/</SGTXT>

<WSKTO>/</WSKTO>

<ZTERM>/</ZTERM>

<NAME1>/</NAME1>

<STRAS>/</STRAS>

<ORT01>/</ORT01>

<PSTLZ>/</PSTLZ>

<HKONT>240086100</HKONT>

<KSTRG>/</KSTRG>

<CRLFD />

</DocumentDetail>

- <FileTrailer>

<RECTYP>9</RECTYP>

<DRTOT>0000000182803.19</DRTOT>

<CRTOT>0000000182803.19</CRTOT>

<DOCCNT>0000000047</DOCCNT>

<RECCNT>0000000169</RECCNT>

<FIL1RT />

<FIL2RT />

<CRLFT />

</FileTrailer>

</Recordset>

</ns:AccountsPayable>

Out put XML:

<?xml version="1.0" encoding="UTF-8" ?>

- <ACLPAY01>

- <IDOC BEGIN="">

- <EDI_DC40 SEGMENT="">

<TABNAM>TBD</TABNAM>

<MANDT>200</MANDT>

<DIRECT>TBD</DIRECT>

<IDOCTYP>TBD</IDOCTYP>

<MESTYP>TBD</MESTYP>

<SNDPOR>TBD</SNDPOR>

<SNDPRT>TBD</SNDPRT>

<SNDPRN>TBD</SNDPRN>

<RCVPOR>TBD</RCVPOR>

<RCVPRT>LS</RCVPRT>

<RCVPRN />

</EDI_DC40>

- <E1ACH3 SEGMENT="">

<AWKEY>HNZAPIDS007NZ</AWKEY>

<AWSYS>DE0CLNT200</AWSYS>

<BKTXT>STOCK</BKTXT>

<BUKRS>4020</BUKRS>

<BLDAT>20110712</BLDAT>

<BUDAT>20110715</BUDAT>

<BLART>KR</BLART>

<XBLNR>214225</XBLNR>

<WAERS>NZD</WAERS>

</E1ACH3>

- <E1ACK3 SEGMENT="">

<SHKZG>H</SHKZG>

<LIFNR>5000000003</LIFNR>

<SGTXT>For curr 00000000614.5800 exchange 00000.7690 AUD</SGTXT>

- <E1ACK3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>0000000000799-</WRBTR>

</E1ACK3C>

</E1ACK3>

- <E1ACA3 SEGMENT="">

<HKONT>839006533</HKONT>

<SHKZG>S</SHKZG>

<MWSKZ>I2</MWSKZ>

<TXJCD>NZ</TXJCD>

<PRCTR>4020302000</PRCTR>

- <E1ACA3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>0000000000799</WRBTR>

</E1ACA3C>

</E1ACA3>

- <E1ACT3 SEGMENT="">

<HKONT>839006533</HKONT>

<SHKZG>S</SHKZG>

<MWSKZ>I2</MWSKZ>

<KTOSL>VST</KTOSL>

<TXJCD>NZ</TXJCD>

- <E1ACT3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>799.19</WRBTR>

</E1ACT3C>

</E1ACT3>

</IDOC>

- <IDOC BEGIN="">

- <EDI_DC40 SEGMENT="">

<TABNAM>TBD</TABNAM>

<MANDT>200</MANDT>

<DIRECT>TBD</DIRECT>

<IDOCTYP>TBD</IDOCTYP>

<MESTYP>TBD</MESTYP>

<SNDPOR>TBD</SNDPOR>

<SNDPRT>TBD</SNDPRT>

<SNDPRN>TBD</SNDPRN>

<RCVPOR>TBD</RCVPOR>

<RCVPRT>LS</RCVPRT>

<RCVPRN />

</EDI_DC40>

- <E1ACH3 SEGMENT="">

<AWKEY>HNZAPIDS007NZ</AWKEY>

<AWSYS>DE0CLNT200</AWSYS>

<BKTXT>STOCK</BKTXT>

<BUKRS>4020</BUKRS>

<BLDAT>20110608</BLDAT>

<BUDAT>20110715</BUDAT>

<BLART>KR</BLART>

<XBLNR>X935346B</XBLNR>

<WAERS>NZD</WAERS>

</E1ACH3>

- <E1ACK3 SEGMENT="">

<SHKZG>H</SHKZG>

<LIFNR>5000000003</LIFNR>

<SGTXT>For curr 00000000642.1000 exchange 00000.7701 AUD</SGTXT>

- <E1ACK3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>0000000000833-</WRBTR>

</E1ACK3C>

</E1ACK3>

- <E1ACA3 SEGMENT="">

<HKONT>839006533</HKONT>

<SHKZG>S</SHKZG>

<MWSKZ>I2</MWSKZ>

<TXJCD>NZ</TXJCD>

<PRCTR>4020302000</PRCTR>

- <E1ACA3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>0000000000833</WRBTR>

</E1ACA3C>

</E1ACA3>

- <E1ACT3 SEGMENT="">

<HKONT>839006533</HKONT>

<SHKZG>S</SHKZG>

<MWSKZ>I2</MWSKZ>

<KTOSL>VST</KTOSL>

<TXJCD>NZ</TXJCD>

- <E1ACT3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>799.19</WRBTR>

</E1ACT3C>

</E1ACT3>

</IDOC>

- <IDOC BEGIN="">

- <EDI_DC40 SEGMENT="">

<TABNAM>TBD</TABNAM>

<MANDT>200</MANDT>

<DIRECT>TBD</DIRECT>

<IDOCTYP>TBD</IDOCTYP>

<MESTYP>TBD</MESTYP>

<SNDPOR>TBD</SNDPOR>

<SNDPRT>TBD</SNDPRT>

<SNDPRN>TBD</SNDPRN>

<RCVPOR>TBD</RCVPOR>

<RCVPRT>LS</RCVPRT>

<RCVPRN />

</EDI_DC40>

- <E1ACH3 SEGMENT="">

<AWKEY>HNZAPIDS007NZ</AWKEY>

<AWSYS>DE0CLNT200</AWSYS>

<BKTXT>STOCK</BKTXT>

<BUKRS>4020</BUKRS>

<BLDAT>20110615</BLDAT>

<BUDAT>20110715</BUDAT>

<BLART>KR</BLART>

<XBLNR>X935554</XBLNR>

<WAERS>NZD</WAERS>

</E1ACH3>

- <E1ACK3 SEGMENT="">

<SHKZG>H</SHKZG>

<LIFNR>5000000003</LIFNR>

<SGTXT>For curr 00000052225.8100 exchange 00000.7701 AUD</SGTXT>

- <E1ACK3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>0000000067816-</WRBTR>

</E1ACK3C>

</E1ACK3>

- <E1ACA3 SEGMENT="">

<HKONT>839006533</HKONT>

<SHKZG>S</SHKZG>

<MWSKZ>I2</MWSKZ>

<TXJCD>NZ</TXJCD>

<PRCTR>4020302000</PRCTR>

- <E1ACA3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>0000000067816</WRBTR>

</E1ACA3C>

</E1ACA3>

- <E1ACA3 SEGMENT="">

<HKONT>2400861000_MAT</HKONT>

<SHKZG>S</SHKZG>

<MWSKZ>I2</MWSKZ>

<TXJCD>NZ</TXJCD>

<PRCTR>4020302000</PRCTR>

- <E1ACA3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>0000000000000</WRBTR>

</E1ACA3C>

</E1ACA3>

- <E1ACT3 SEGMENT="">

<HKONT>839006533</HKONT>

<SHKZG>S</SHKZG>

<MWSKZ>I2</MWSKZ>

<KTOSL>VST</KTOSL>

<TXJCD>NZ</TXJCD>

- <E1ACT3C SEGMENT="">

<WAERS>NZD</WAERS>

<WRBTR>833.79</WRBTR>

</E1ACT3C>

</E1ACT3>

</IDOC>

</ACLPAY01>

if u see last WRBTR....that sud be tax.

if u check