cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping help required.

Former Member
0 Kudos

Hi...

I need one help in mapping.

Below is the input file structure.

Input--


(11)

Invoicedate

PODate

PONumber

InvoiceAmount

GRDetails----(0-unbounded)

GRNumber

GRQuantity

POItem

InvocieLineItem -


(0---unbounded)

POItem

POUnit

ItemAmount

ItemNumber

TaxCode

Below is the output file structure.

Output----


(1.....1)

Item--


(0unbounded)

InvoiceDocumentNumber

POitem

POUnit

RefDocYear

Quanitity

ItemAmount

ItemNumber

Based on the POItem which is in the GRDetails,Invoice Doument Number should get generated.

POItem of both GRDetails and InvoiceLineItem are same.

InvocieDocumentNumber,ItemNumber should change depending on the POItem.

Could you please help me in this mapping issue.

for eg, if we give the details in below format,

Input

InvocieDate---27/11/2008

PODATE----


27/11/2008

InvoiceAmount--100

GRDetails

GRNumber-----GR01

GRQuantity---50

POItem-------00010

InvocieLineItem

POItem-------00010

POUnit-------EA

ItemAmount---20

ItemNumber----0001

TaxCode-----V0

I need to get output as below.

Output----


(1.....1)

Item--


(0unbounded)

InvoiceDocumentNumber----


000001

POitem----


00010

POUnit----


EA

RefDocYear----


2008

Quanitity----


50

ItemAmount----


2000

ItemNumber----


0001

If i have multiple records like below

Input

InvocieDate---27/11/2008

PODATE----


27/11/2008

InvoiceAmount--100

GRDetails

GRNumber-----GR01

GRQuantity---50

POItem-------00010

GRDetails

GRNumber-----GR02

GRQuantity---40

POItem-------00020

InvocieLineItem

POItem-------00010

POUnit-------EA

ItemAmount---20

ItemNumber----0001

TaxCode-----V0

InvocieLineItem

POItem-------00020

POUnit-------EA

ItemAmount---30

ItemNumber----0002

TaxCode-----V0

I need to get output as below.

Output----


(1.....1)

Item

InvoiceDocumentNumber----


000001

POitem----


00010

POUnit----


EA

RefDocYear----


2008

Quanitity----


50

ItemAmount----


2000

ItemNumber----


0001

Item

InvoiceDocumentNumber----


000002

POitem----


00020

POUnit----


EA

RefDocYear----


2008

Quanitity----


40

ItemAmount----


3000

ItemNumber----


0002

Thanks

Leela

Accepted Solutions (1)

Accepted Solutions (1)

SudhirT
Active Contributor
0 Kudos

Hi leela,

you cn acheive this with the index function as below

poitem-removecontext-index with value 00001 and increase by 1--invoicnaccountno(target).

hope it helps.

thanks

Former Member
0 Kudos

Hi Sudhir,

I have tried with the index function. I have given POItem--RemoveContextIndex (initial value00001,increment-1)----Target InvoiceDocNum.

While testing , i am getting the InvoceiDocNum as 1,but not 00001.

Could you please help in this issue.

Regards,

Leela

Edited by: leelaratnam morampudi on Dec 1, 2008 5:56 AM

Former Member
0 Kudos

POItem--RemoveContextIndex (initial value00001,increment-1)----Target InvoiceDocNum.

use formatNumber function with '00000' before target

Regards

Raj

SudhirT
Active Contributor
0 Kudos

Hi Leela,

After Index function use text concat function with constant value as 00000 and concatenate with output of index and then pass it to target or use Format number , both will work..

Thanks!

Former Member
0 Kudos

Hi Raj,

I have done like

POItemRemoveContext-index(initial Value-00001,increment-1)-format('00000')Target(InvoicedocNumber)

if i have only one POITem Item i am getting the value. means

If i have PoItem as 0010, then in target i am getting 000001.

if i have 2 POItems ,like

POItem---0010

POItem--0020

then in target i am getting only one InvocieDocNumber as 000001.

but second one is not cuming.

Source:

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

<ns0:MT_InvoiceApproval xmlns:ns0="http://InvoiceApproval">

<InpurSaveInvoiceRequest>

<InvoiceId/>

<InvoiceNumber/>

<InvoiceRefNumber/>

<VendorCode/>

<Currency/>

<InvoiceDate/>

<PONumber>12/12/2008</PONumber>

<PODate/>

<invoiceAmount/>

<paymentTerms/>

<ApprovalStatus/>

<CreatedBy/>

<CreatedDate/>

<CustomerProcess/>

<PurchaseGroup/>

<PurchaseOrganization/>

<GRDetails>

<GRNumber/>

<GRQuantity>3</GRQuantity>

<POItem>0010</POItem>

</GRDetails>

<GRDetails>

<GRNumber/>

<GRQuantity>4</GRQuantity>

<POItem>0020</POItem>

</GRDetails>

<InvoiceLineItem>

<InvoiceId/>

<POItem>0010</POItem>

<Material/>

<MaterialName/>

<Plant/>

<Quantity/>

<NetPrice/>

<POUnit/>

<ItemAmount>3</ItemAmount>

<ItemNumber/>

<TaxCode/>

<GR_Number/>

<Year/>

</InvoiceLineItem>

<InvoiceLineItem>

<InvoiceId/>

<POItem>0020</POItem>

<Material/>

<MaterialName/>

<Plant/>

<Quantity/>

<NetPrice/>

<POUnit/>

<ItemAmount>2</ItemAmount>

<ItemNumber/>

<TaxCode/>

<GR_Number/>

<Year/>

</InvoiceLineItem>

<InvoiceDoc_Item/>

<HeaderText/>

<CompanyCode/>

<ApprovedBy/>

<ApprovedDate/>

<ModifiedBy/>

<ModifiedDate/>

<IsValidFlag/>

<Remarks/>

<FiscalYear/>

</InpurSaveInvoiceRequest>

</ns0:MT_InvoiceApproval>

Target

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

<ns1:Z_INVOICE_CREATE xmlns:ns1="urn:sap-com:document:sap:rfc:functions">

<HEADERDATA>

<INVOICE_IND>X</INVOICE_IND>

<DOC_DATE></DOC_DATE>

<PSTNG_DATE></PSTNG_DATE>

<REF_DOC_NO></REF_DOC_NO>

<COMP_CODE></COMP_CODE>

<CURRENCY></CURRENCY>

<GROSS_AMOUNT></GROSS_AMOUNT>

<CALC_TAX_IND>X</CALC_TAX_IND>

<PMNTTRMS></PMNTTRMS>

<BLINE_DATE></BLINE_DATE>

<HEADER_TXT></HEADER_TXT>

</HEADERDATA>

<ITEMDATA>

<item>

<INVOICE_DOC_ITEM>00001</INVOICE_DOC_ITEM>

<PO_NUMBER>12/12/2008</PO_NUMBER>

<PO_ITEM>0010</PO_ITEM>

<REF_DOC></REF_DOC>

<REF_DOC_YEAR></REF_DOC_YEAR>

<REF_DOC_IT></REF_DOC_IT>

<TAX_CODE></TAX_CODE>

<ITEM_AMOUNT>3</ITEM_AMOUNT>

<QUANTITY>9</QUANTITY>

<PO_UNIT></PO_UNIT>

</item>

<item>

<PO_ITEM>0020</PO_ITEM>

<REF_DOC></REF_DOC>

<REF_DOC_YEAR></REF_DOC_YEAR>

<REF_DOC_IT></REF_DOC_IT>

<TAX_CODE></TAX_CODE>

<ITEM_AMOUNT>2</ITEM_AMOUNT>

<QUANTITY>8</QUANTITY>

<PO_UNIT></PO_UNIT>

</item>

</ITEMDATA>

</ns1:Z_INVOICE_CREATE>

SudhirT
Active Contributor
0 Kudos

Hi Leela,

You need to use SplitByValue after format number function then it will work.

Thanks!

Former Member
0 Kudos

Hi Sudhir,

Thank u . If i use split by Value then it is working fine.

Problem is the Target InvocieDocNumber length is only 5

so if we give 9 POItem details, it is wrking fine.

POITem-0010


InvoiceDocNumber--00001

POITem-0020


InvoiceDocNumber--00002

.

.

.

.

.

POITem-0090


InvoiceDocNumber--00009

POITem-0100


InvoiceDocNumber--000010

But see the last POItem---0100.

For that i need to get 00010

Like Below

POITem-0100


InvoiceDocNumber--00010

POITem-0110


InvoiceDocNumber--00011

POITem-0120


InvoiceDocNumber--00012

POITem-0130


InvoiceDocNumber--00013

.

.

..

.

.

POITem-0200


InvoiceDocNumber--00020

Can you help in this issue.

SudhirT
Active Contributor
0 Kudos

Hi Leela,

That will work in case of values till 5 zeroes like 99999, so what is the problem, if this is not sufficient you can take 6 digits. Please explain where r you stucked?

Thanks!

SudhirT
Active Contributor
0 Kudos

Ok I got it, then use the concat function as in my reply.that will work and will keep 0000 as constant and will keep on increasing the rest digits as requirement.

Thanks!

Former Member
0 Kudos

Hi Sudhir,

Actually my scenario is like File to RFC scenario using BPM

I am calling Z_Invocie_Create Bapi which is custom BAPI.

For this Bapi, the input structure will be like

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

<ns0:MT_InvoiceApproval xmlns:ns0="http://InvoiceApproval">

<InpurSaveInvoiceRequest>

<InvoiceId/>

<InvoiceNumber/>

<InvoiceRefNumber/>

<VendorCode/>

<Currency/>

<InvoiceDate/>

<PONumber/>

<PODate/>

<invoiceAmount/>

<paymentTerms/>

<ApprovalStatus/>

<CreatedBy/>

<CreatedDate/>

<CustomerProcess/>

<PurchaseGroup/>

<PurchaseOrganization/>

<GRDetails>

<GRNumber/>

<GRQuantity/>

<POItem/>

</GRDetails>

<InvoiceLineItem>

<InvoiceId/>

<POItem/>

<Material/>

<MaterialName/>

<Plant/>

<Quantity/>

<NetPrice/>

<POUnit/>

<ItemAmount/>

<ItemNumber/>

<TaxCode/>

<GR_Number/>

<Year/>

</InvoiceLineItem>

<InvoiceDoc_Item/>

<HeaderText/>

<CompanyCode/>

<ApprovedBy/>

<ApprovedDate/>

<ModifiedBy/>

<ModifiedDate/>

<IsValidFlag/>

<Remarks/>

<FiscalYear/>

</InpurSaveInvoiceRequest>

</ns0:MT_InvoiceApproval>

In the above structre, there can be Multiple GRDetails and LineItemDetails.

Based on the POItem, the InvoiceDoc number which is in the target should be mapped.

If i use POItem-RemoveContextIndex(00001,1)Concat(Constant(0000),Index)-SplitbyValue---Target

then for the POItem--0100, the InvocieDocNumber is 000010 but it should be 00010

so i have used IFS Boolean function for that.

I am checking the index value. If it is greater that 9, then i am concating with constant 0000 else with constant 000.

but this works till 00099. after that it will cum like 000100 but it should be like 00100

SudhirT
Active Contributor
0 Kudos

Hi Leela,

I think in this case you can involve more if else conditions to check values greater than 9,99,999,9999 and your purpose will be solved. Use like this only otherwise you will have to write a UDF.

Thanks!

Former Member
0 Kudos

Hi,

Map Like Below..

POItem(Index 1,1,entireDocument)FormatNumber(00000)--Target.

Regards,

Prakasu

Former Member
0 Kudos

POItemRemoveContext-index(initial Value-00001,increment-1)-format('00000')Target(InvoicedocNumber)

if i have only one POITem Item i am getting the value. means

If i have PoItem as 0010, then in target i am getting 000001.

if i have 2 POItems ,like

POItem---0010

POItem--0020

then in target i am getting only one InvocieDocNumber as 000001.

but second one is not cuming.

Use split by value function before target

POItemRemoveContext-index(initial Value-00001,increment-1)-format('00000')Split(ByValue)--Target

Regards

Raj

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Leela,

I'm guessing that you're encountering issues in the nodes InvoiceDocumentNumber and ItemNumber ? Is this correct? Since the solution provided by Sudhir would generate the counting

Regards,

Edited by: dspboys on Nov 27, 2008 2:09 PM

Edited by: dspboys on Nov 27, 2008 2:09 PM