Skip to Content
author's profile photo Former Member
Former Member

Problem with variable substitution.

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" ?>

- http://www.sat.gob.mx/cfd/2" version="2.0" serie="A" folio="1883" fecha="2009-11-01T17:05:10" sello="NxZCWU8hMJMi Ec2fSZafpS81Z9rUScbBotvJ8lcW76GGpmcD2lFyAV7DlNQKecYMnQJnwMVoHfGjzhpFJrjLuRcyqU3nOnH1mE1JMxY/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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2010 at 11:43 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2010 at 11:14 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 19, 2010 at 11:24 AM

    Hi

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

    Ashutosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2010 at 02:10 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 19, 2010 at 02:15 PM

    /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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2010 at 08:59 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.