cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with variable substitution.

Former Member
0 Kudos

Hello,

I asked this before but now I want to change the question focus.

I have scenario from IDOC to XML file.

The scenario is digital invoice for our company in Mexico and I end this scenario with java mapping that I import from SAP marketplace.

Now I have request to add to the XML file name the content of the field "<ODN_NUMBER>" from the XML data.

I try to use with variables substitution.

My payload is:

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

- <ZINVOIC02>

- <IDOC BEGIN="1">

- <EDI_DC40 SEGMENT="1">

<TABNAM>EDI_DC40</TABNAM>

<MANDT>400</MANDT>

<DOCNUM>0000000006599015</DOCNUM>

<DOCREL>700</DOCREL>

<STATUS>30</STATUS>

<DIRECT>1</DIRECT>

<OUTMOD>2</OUTMOD>

<IDOCTYP>INVOIC02</IDOCTYP>

<CIMTYP>ZINVOIC02</CIMTYP>

<MESTYP>INVOIC</MESTYP>

<STDMES>ZEDI</STDMES>

<SNDPOR>SAPDEV</SNDPOR>

<SNDPRT>LS</SNDPRT>

<SNDPRN>DEV400ECC</SNDPRN>

<RCVPOR>SAPDEV</RCVPOR>

<RCVPRT>LS</RCVPRT>

<RCVPFC>LS</RCVPFC>

<RCVPRN>MX_INV</RCVPRN>

<CREDAT>20100118</CREDAT>

<CRETIM>075931</CRETIM>

<SERIAL>20100118075931</SERIAL>

</EDI_DC40>

- <E1EDK01 SEGMENT="1">

<CURCY>USD</CURCY>

<HWAER>MXN</HWAER>

<WKURS>10.55530</WKURS>

<ZTERM>0090</ZTERM>

<KUNDEUINR>ACH971209KRA</KUNDEUINR>

<BSART>INVO</BSART>

<BELNR>0100017295</BELNR>

<BRGEW>0.045</BRGEW>

<GEWEI>KGM</GEWEI>

<FKART_RL>LR</FKART_RL>

<RECIPNT_NO>0000012977</RECIPNT_NO>

<FKTYP>L</FKTYP>

- <Z1EDK01 SEGMENT="1">

<XML_VERSION>2.0</XML_VERSION>

<ODN_PREFIX>A</ODN_PREFIX>

<ODN_NUMBER>1883</ODN_NUMBER>

<DATE_TIME>2009-11-01T17:05:10</DATE_TIME>

<DOC_SUB_TOTAL>4.22</DOC_SUB_TOTAL>

<DOC_DISCOUNT>3.00</DOC_DISCOUNT>

<DOC_TOTAL>1.40</DOC_TOTAL>

</Z1EDK01>

And the xml that I create is:

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

- <Comprobante xmlns="http://www.sat.gob.mx/cfd/2" version="2.0" serie="A" folio="1883" fecha="2009-11-01T17:05:10" sello="NxZCWU8hMJMiEc2fSZafpS81Z9rUScbBotvJ8lcW76GGpmcD2lFyAV7DlNQKecYMnQJnwMVoHfGjzhpFJrjLuRcyqU3nOnH1mE1JMxY/MjLkal0Ybo2aRKCorQxx+F/Vy5ucvyeDDFAt2gx0PeHJhFS3tJ6ssc6nryz3iUr8c=" noAprobacion="49806" anoAprobacion="2009" formaDePago="Pago en una sola exhibiciףn" noCertificado="00001000000100891274" condicionesDePago="90 DAYS FROM BILL OF LADING" subTotal="4.22" descuento="3.00" motivoDescuento="Customer DiscountCustomer Discount" total="1.40" tipoDeComprobante="ingreso">

- <Emisor rfc="NMS940324RY6" nombre="Netafim Mexico S.A. de C.">

<DomicilioFiscal calle="Leibnitz" noExterior="20" noInterior="901" colonia="Anzures" localidad="Mexico city" municipio="Miguel Hidalgo" estado="Distrito Federal" pais="Mexico" codigoPostal="11590" />

</Emisor>

- <Receptor rfc="ACH971209KRA" nombre="AGRICOLA 5 HERMANOS SA DE CV">

<Domicilio calle="JUAN DE LA BARRERA NO 1249 NORTE" localidad="COL. CHAPULTEPEC" municipio="CULIACAN" estado="Sinaloa" pais="Mexico" codigoPostal="80040" />

</Receptor>

- <Conceptos>

I try to use with this variable:

payload:ZINVOIC02,1,IDOC,1,E1EDK01,1,Z1EDK01,1,ODN_NUMBER,1

I received in RWB the error:

Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var_filename

Thank you in advance for your help

Elad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

please make sure the following point

1. Variable substitution is case sensitive. so please check that u use the small case for variable name.

2. the variable should be present in the target message type.

please also check the path u define for the variable value.

regards,

Navneet

Former Member
0 Kudos

Hello Navneet,

Thank you for your answer.

The Variable substitution is in small letters.

I need to take the variable from the target message or from the payload?

I already try this 2 options without any result.

Elad

Former Member
0 Kudos

Hi Elad,

I mean to say that, if ur variable name is ABC than this must be the part of your Target message type.

for Exam

<node 1>

<field 1>

<ABC>test<ABC/>

</field>

</node>

and the value you need to be pick as test

so if you are using file name as %var%.txt,than after variable substitution your target file name is

test.txt.

regards,

Navneet

Edited by: navneet sumit on Jan 19, 2010 1:30 PM

Former Member
0 Kudos

But my target is looks very strange:

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

- <Comprobante xmlns="http://www.sat.gob.mx/cfd/2" version="2.0" serie="A" folio="1883" fecha="2009-11-01T17:05:10" sello="NxZCWU8hMJMiEc2fSZafpS81Z9rUScbBotvJ8lcW76GGpmcD2lFyAV7DlNQKecYMnQJnwMVoHfGjzhpFJrjLuRcyqU3nOnH1mE1JMxY/MjLkal0Ybo2aRKCorQxx+F/Vy5ucvyeDDFAt2gx0PeHJhFS3tJ6ssc6nryz3iUr8c=" noAprobacion="49806" anoAprobacion="2009" formaDePago="Pago en una sola exhibiciףn" noCertificado="00001000000100891274" condicionesDePago="90 DAYS FROM BILL OF LADING" subTotal="4.22" descuento="3.00" motivoDescuento="Customer DiscountCustomer Discount" total="1.40" tipoDeComprobante="ingreso">

- <Emisor rfc="NMS940324RY6" nombre="Netafim Mexico S.A. de C.">

<DomicilioFiscal calle="Leibnitz" noExterior="20" noInterior="901" colonia="Anzures" localidad="Mexico city" municipio="Miguel Hidalgo" estado="Distrito Federal" pais="Mexico" codigoPostal="11590" />

</Emisor>

- <Receptor rfc="ACH971209KRA" nombre="AGRICOLA 5 HERMANOS SA DE CV">

<Domicilio calle="JUAN DE LA BARRERA NO 1249 NORTE" localidad="COL. CHAPULTEPEC" municipio="CULIACAN" estado="Sinaloa" pais="Mexico" codigoPostal="80040" />

</Receptor>

I need to add folio field

Elad

Former Member
0 Kudos

Hi,

Please look below link.

/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean

http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot

/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi

Regards,

Navneet

Answers (5)

Answers (5)

Former Member
0 Kudos

Elad,

I am also mplementing the digital invoice scenario for our company in Mexico and have run into the same problem with creating the file name.

I've tried doing Dynamic Configuration but without success. Can you let me know if you were able to create the file name as desired and if so, how did you do it?

Thanks,

Dave

Shabarish_Nair
Active Contributor
0 Kudos

/people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

i am not sure if you have a specific reason to use variable sub. but i suggest using dynamic configuration.

Former Member
0 Kudos

Hello Shabarish,

I think to apply these needs with variables substitution because I prefer don't change the ready made mapping that I received from SAP (note 1296042).

From you answer and from other answers that I received from other people in the forum I'm understand that I'm not have any way to implements this needs without to change this java mapping.

What do you think about my conclusion?

Elad

Shabarish_Nair
Active Contributor
0 Kudos

guess you are right.

You would need to do some amount of customization.

Former Member
0 Kudos

Hello,

As described in link below in SAP PI variable substitution option is designed for refers to an element (not attribute) in the XML schema of the payload

http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6a316af5a23672e10000000a114a6b/frameset.htm

BUT with some modifications you can achive your goal and have ATTRIBUTE from your payload in your file name as variable. One of the variant described in link below.

Combining three different aspects of PI in one shot:

http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot

BR,

Dzmitry

former_member192079
Participant
0 Kudos

Hi

The error briefs that variable used for populating file name value is empty...

Ashutosh

Former Member
0 Kudos

Hi Elad,

Have you checked this threads?

Regards

Ramesh