Substitution in PLSQL

Hi,
I'm new to PLSQL and have come across a problem.
If I write a simple sql script which contains define statements and run it then it's fine, works OK.
I save this to a script and then in a new session get it and run it.
It doesn't run and complains about the define statments.
Why is it that I can enter this manually and it's fine but once I enter it as a script it doesn't work?
thanks in advance,
Paul.

Hi Paul,
No enough information!! Please list your PL/SQL script.
Regards,
John

Similar Messages

  • PLSQL table name substitution

    I want to create a PLSQL process that deletes rows from a table I identified by an item.
    This does not work....throws the Error:
    ORA-06550: line 4, column 29: PL/SQL: ORA-00903: invalid table name ORA-06550: line 4, column 1: PL/SQL: SQL Statement ignored
    declare
    begin
    delete from staging.:P110_TABLE_NAME;
    end;
    What am I doing wrong here in the P110_TABLE_NAME substitution?
    Edited by: user581839 on Dec 23, 2008 4:32 PM

    Try it this way
    declare
    begin
    Execute immediate 'delete from staging.' || trim( :P110_TABLE_NAME);
    end;Varad

  • How Can i get PLSQL Procedure out values in Shell Script?

    Hi,
    I need to use PLSQL Procedure out values in shell script by using that parameter i need to check and call the other procedure. Please can you guide me how can i?
    #!/bin/ksh
    # Function to call validation program
    SQL_PKG_CALL()
    echo "Inside SQL_PKG_CALL for $file"
    sqlplus -s /nolog << EOF
         whenever sqlerror exit failure
         connect ${APPS_LOGIN}
         variable exit_value NUMBER
         set serveroutput on size 100000
         DECLARE
              l_errbuf VARCHAR2(10000) := NULL; l_retcode NUMBER := NULL;lv_test VARCHAR2(4000) := NULL;
         BEGIN
              fnd_global.apps_initialize ( USER_ID => ${USER_ID}, RESP_ID => ${RESP_ID}, RESP_APPL_ID => ${RESP_APPL_ID}
                             , SECURITY_GROUP_ID => ${SECURITY_GROUP_ID}
              #Calling PLSQL procedure for create and attache document
              XXAFPEEP_SO_DOC_ATTACH_INT.DOCUMENT_ATTACH (p_errbuf => l_errbuf, p_retcode => :RETMSG, p_fileName => $file
                                       , p_debug => 'Y', p_rettest => lv_test);
              # to print the procedure return values
              DBMS_OUT.PUT_LINE('Return Message: '|| lv_test);
              #${RETCODE}=l_retcode;
              print :RETMSG;
         END;
    EXIT 0
    EOF
    # Program starts here
    echo "+---------------------------------------------------------------------------+"
    echo "Program Start"
    APPS_LOGIN=${1} # Apps Login
    USER_ID=${2} # User ID
    RESP_ID=${5} # Responsiblity ID
    RESP_APPL_ID=${6} # Responsiblity Application ID
    SECURITY_GROUP_ID=${7} # Security Group ID
    DIRECTORY_PATH=${8} # Directory --Attached file locations
    DIRECTORY_NAME=${9} # Directory Name for plsql
    echo "User ID : $USER_ID"
    echo "Responsibility ID : $RESP_ID"
    echo "Responsibilith Application ID : $RESP_APPL_ID"
    echo "Security Goup ID : $SECURITY_GROUP_ID"
    echo "Directory Path : $DIRECTORY_PATH"
    echo "Direcotry Name : $DIRECTORY_NAME"
    echo
    #files direcotry
    cd $DIRECTORY_PATH
    echo Present Working Directory: `pwd`
    echo
    #for all file names
    ALL_FILES=`ls *.pdf`
    for file in $ALL_FILES
    do
         if [ -f $file ]
         then
              #log "Processing $file" # future
              echo Processing: $file
              # Calling the PL/SQL Program
              SQL_PKG_CALL;
              #echo "Retcode : $RETCODE"
              echo "RetMessage : $RETMSG"
         else
              log "Skipped $file: invalid file"
              echo "Skipping current file $file: not a valid file."
         fi
    done
    Thanks
    Sudheer

    Saubhik's provided the solution, but just for fun:
    Test procedure:
    create or replace procedure get_ename
       ( p_empno in emp.empno%type
       , p_ename_out out emp.ename%type )
    is
    begin
       select ename into p_ename_out
       from   emp
       where  empno = p_empno;
    end get_ename;Test data:
    SQL> select empno, ename from emp order by 1;
    EMPNO ENAME
    7369 SMITH
    7499 ALLEN
    7521 WARD
    7566 JONES
    7654 MARTIN
    7698 BLAKE
    7782 CLARK
    7788 SCOTT
    7839 KING
    7844 TURNER
    7876 ADAMS
    7900 JAMES
    7902 FORD
    7934 MILLER
    14 rows selectedTest call from SQL*Plus to show it working:
    SQL> declare
      2     v_ename emp.ename%type;
      3  begin
      4     get_ename(7844,v_ename);
      5     dbms_output.put_line(v_ename);
      6  end;
      7  /
    TURNER
    PL/SQL procedure successfully completed.Demo shellscript (borrowing the function idea from Saubhik):
    #!/bin/ksh
    empno=${1:-NULL}
    exec_sql() {
        sqlplus -s william/w@//vm.starbase.local:1521/eleven <<END_SQL
        spool get_out_value.sh.log
        set serverout on size 2000 feedback off
        declare
           v_name emp.ename%type;
        begin
           get_ename(${empno},v_name);        
           dbms_output.put_line('# ' || v_name);
        end;
        spool off
        exit
    END_SQL
    ename=$(exec_sql ${empno} | awk '/^# / {print $2}')
    print Employee ${empno} = ${ename}Demo:
    /Users/williamr: get_out_value.sh 7844
    Employee 7844 = TURNER
    /Users/williamr: get_out_value.sh    
    Employee NULL =Note this substitutes the word NULL if no empno is passed, and it ignores error output or anything else by only looking for lines beginning '# ' and then taking the following word. Error messages will appear in the logfile. (In this example it probably doesn't need the NULL substitution because a missing parameter would cause a syntax error which the script will handle anyway, but it could be useful in more complex examples.)
    For a production script you should probably use an OS authenticated account so you don't have to deal with password strings.

  • Different plsql for different Oracle versions

    Hi everyone,
    I am working on a plsql script which may be run on multiple databases. Unfortunately, I have a need to run one query type if the version is 10g, and another if it is 9i. The 10g query is preferable for the type & amount of information it returns, but 9i does not have the same level of support. I wrote the below (dumbed down for posting purposes) to do this:
    spool sqlLog.txt append
    set heading off;
    SET NEWPAGE 0;
    SET SPACE 0;
    SET LINESIZE 32767;
    SET PAGESIZE 0;
    --SET ECHO OFF;
    SET FEEDBACK OFF;
    SET VERIFY OFF;
    SET HEADING OFF;
    SET MARKUP HTML OFF;
    SET TERMOUT OFF;
    SET TRIMOUT ON;
    SET TRIMSPOOL ON;
    SET WRAP OFF ;
    SET LONG 4000;
    SET LONGCHUNKSIZE 500;
    set serverout on;
    set serveroutput on;
    declare     
    ver VARCHAR2(64);
    BEGIN
    select v.version into ver from product_component_version v where product like '%Oracle%';
    ver:=substr(ver,0,2); --remove anything but the highest version number, a.k.a. 9 or 10.
    dbms_output.put_line('ver: '||ver);
    --10g
    IF to_number(ver)>=10
    THEN
         for csr_10g in (SELECT sql_fulltext, a.parsing_schema_name, b.name, b.value_string
                             FROM V$SQL a left outer join v$sql_bind_capture b ON a.SQL_ID = b.SQL_ID)
              loop
                dbms_output.put_line(csr_10g.sql_fulltext||';'|| csr_10g.parsing_schema_name||';'|| csr_10g.name||';'|| csr_10g.value_string);
             end loop;
    ELSE
    --9i
         for csr_9i in (SELECT a.sql_Text, b.Schemaname
                             FROM v$sqlarea a left outer join v$session b ON a.parsing_schema_id=b.schema#
              loop
                dbms_output.put_line(csr_9i.sql_text||';'|| csr_9i.schemaname||';');
             end loop;
    END IF;
    END;
    --run;
    spool off;
    exit;If I run this on a 10g database, it works correctly, spooling the query return to a file.
    If I run this on a 9i database, it will not run, and i get these errors:
                             FROM V$SQL a left outer join v$sql_bind_capture b ON a.SQL_ID = b.SQL_ID --combine to also find the bound variables used
    ERROR at line 13:
    ORA-06550: line 13, column 35:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 12, column 17:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 27, column 30:
    PLS-00364: loop index variable 'CSR_10G' use is invalid
    ORA-06550: line 27, column 9:
    PL/SQL: Statement ignored
    Am I doing something wrong with my syntax, or is there another way to go about this?
    Thanks!

    Hi,
    Dynamic SQL, like John suggested, might be the most elegant solution, but here are some others to consider:
    (1) Create dummy objects. Your code guarantees that you'll never get a run-time error trying to query v$sql in Oracle 9, but the problem is that you're getting a compile-time error just by referencing it. So create a v$sql: a dummy table in your own schema, a synonym to the Oracle 10 data dictionary via a database link, anything just so it compiles.
    (2) Create real objects. For example, in your Oracle 9 database, create a view called v$sql, based on v$sqlarea and v$session, that has all the same columns you use in Oracle 10. If you can do this, you won't even need an IF statement in your PL/SQL; the same code that runs against the data dictionary v$sql in Oracle 10 will run against your own schema's v$sql in Oracle 9.
    (3) Isolate the problems. Write two different versions of a package, one for each version, and put all version-dependent code in the package. In most of your code, call the procedure to do the version-dependent stuff. For example, don't open a cursor in your program: instead, call the package to open a cursor.
    (4) Comment Out. Klugy but cute. Write your PL/SQL without IF statements, like this:
    BEGIN
    &v10     for csr_10g in (SELECT sql_fulltext, a.parsing_schema_name, b.name, b.value_string
    &v10                         FROM V$SQL a left outer
    &v9     for csr_9i in (SELECT a.sql_Text, b.Schemaname
    &v9                         FROM v$sqlarea a left outer join v$session b ON a.parsing_schema_id=b.schema#
    &v9                                                                                  join v$sql_bind_capture b ON a.SQL_ID = b.SQL_ID)
              loop
    &v10            dbms_output.put_line(csr_10g.sql_fulltext||';'|| csr_10g.parsing_schema_name||';'|| csr_10g.name||';'|| csr_10g.value_string);
    &v9            dbms_output.put_line(csr_9i.sql_text||';'|| csr_9i.schemaname||';');
             end loop;
    END;Compile your PL/SQL in SQL*Plus.
    Define two substitution variables: v10 and v9.
    In Oracle 10, v10 make " " and make v9 "--".
    In Oracle 9, v10 make "--" and make v9 " ".
    You can do the assignments on the fly with the SQL*Plus "COLUMN ... NEW_VALUE" command.
    In either database, code that only works in the other version will be commented out. Your code will look like hell (good spacing and comments will make it less hard to read), but it will compile and work.
    None of these ideas are mutually exclusive. You might want to do dynamic SQL in some places, and use on dummy objects in others, for example.

  • Why substitution variable &input line don't execute on a loop?

    Hi Group,
    Why the line where substitution variable is assigned doesn't execute over the loop. only the first time.
    SET SERVEROUTPUT ON
    DECLARE
         v_flag NUMBER(1):= 0;
         v_counter NUMBER(1):= 0;
    BEGIN
         LOOP                     
              v_flag := &input;
              v_counter := v_counter + 1;
              dbms_output.put_line(v_counter);
              EXIT WHEN v_counter = 9;
         END LOOP;
    END;
    /thanks.

    Hi,
    user12152340 wrote:
    Thanks for your help... so there's no way to interact with the database inside a loop. I was looking a way that PLSQL block asks for different values.No, sorry. PL/SQL can't do any kind of user interaction. That's what front-end tools, like Apex, are for.
    You can have loops in SQL*Plus, but it's not pretty. See this thread:
    Re: How to give the different values to runtime parameters in a loop?

  • Substitution of VO

    I have a requirement where i will have to make the base VO to call my custom plsql package, instead of the standard one. So created a custom VO by extending the base VO and substituted. Ran the jpximport also to verify my extension. It worked.
    My questions are:
    1) how will this survive if we upgrade?
    2) how can i deploy this extension on our production server.

    Hi,
    My questions are:
    1) how will this survive if we upgrade?Substitutions reside in the Database.
    Substituted files would be at $JAVA_TOP/XXcompany/oracle/... path. Which is a custom path.
    Hence your substitutions are totally upgrade safe.
    2) how can i deploy this extension on our production server.refer the following URL
    http://prasanna-adf.blogspot.com/2008/02/deploying-oafwk.html
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • (no inline validation error displayed)) condition type and plsql expression

    Hello all
    Is it possible to use a plsql expression (eg: (:REQUEST = 'PXX_LIST_ITEM')) AND (no inline validation error displayed)) condition type at the smae time ?
    HTMLDB must be testing a substitution variable when the conditional display section is set to 'no inline validation errors displayed'.

    Hello,
    I don't know for sure because I never used it, but I think you can use the pl/sql variable htmldb_application.g_inline_validation_error_cnt. This variable identifies number of inline errors found.
    You can also check if the variable htmldb_application.g_notification contains a value.
    Fred.

  • Pointer to substitution variable

    I don't really know if this is a PLSQL or an APEX question but because I've encountered this problem in APEX so I'm going to ask it here.
    I'm using APEX 3.2 (upgrade is in progress, you know how that goes)
    In my DAO packages I refer to my apex application items so that I don't need to give them to the DAO as a parameter. (Hey they exist in the scope so why shouldn't I call them that way)
    So I begin all my packages like:
      g_naam tbl_contact.naam%type := v('P1_NAAM');Now this works perfectly when I'm working in the page processeses but when I'm in validation g_naam would equal null.
    The strange thing is that v('P1_NAAM') contains the correct value. Now my theorie is that g_naam is loaded before the P1_NAME substitution value had the correct value.
    In other programming languages you would make a pointer variable. This way both variables are always the same. Even if P1_NAME would change the global variable would always contain the correct variable.
    Is something like a pointer possible in Oracle. I know cursors can do it but I'm not really referin to a query.
    Of course this can easily be resolved if you always use the v('P1_NAAM') method. But when the name of your application item would change you're in big troubles :p.
    Any help is greatly appreciated.
    Regards
    Nico

    Stupid me, the variable is not null because of the scope. The variable is null because on declaration an error would occur.
    If name was a varchar2(50) and you would enter 51 characters then on declaration my variable would fail. Functions that are called in global blocks will never result in a error.
    On error they will return null.
    So the correct answer for my problem would be
      g_name varchar2(4000) := v('P1_NAME);Regards
    Nico

  • Filename in J2SE Adapter with Variable Substitution

    Hello,
    Within the J2EE receiver fileadapter (and ftp) from SP13 it is possible to compose the target filename and directory based on the payload of a message using variable substitution.
    I wonder if it is also possible to use variable substitution with the J2SE fileadapter. For this it is not documented but i thougth that the same java libraries are used for the J2EE an J2SE file-adapters.
    Aybody??
    Really Nobody??
    Message was edited by: Emile Hermans

    Hello,
    the J2SE Adapter does not support variable subsition. Therefore we created our own class which gets called from the main SAP XI class "XMB2FileProcessor.class" wich is in the jar "aii_msg_adapter.jar". In your own class you can do what ever you need to chane the file name. In the configuration you can set your own parameter to search the payload for a string you want to replace. We also had to come up with our own timestamp, e.g. file2005-11-10 which SAP does not let you do, only the full timestamp is possible.
    One other nice thing is that you can develop our JAVA class local and test it with your local J2SE Adapter Engine on you PC before you deploy it.
    Steps to do:
    1. JAD the SAP class
    2. Put a call in the SAP class
    3. Compile the class
    4. Put the class back in the archive
    5. Create your own class
    6. Create a jar file for it
    7. Put the jar file in the tech_adapter directory
    8. Change the run_adapter start cmd to include your jar file
    It works great, the only issue is if you patch the J2SE engine you have to do step 1 to 4 again but that should it very easy to do.
    Cheers
    Stefan

  • Error while trying to access a SSWA PLSQL function

    Hi,
    I am trying to access a report as a web page by defining the function as follows :
    Type : SSWA PLSQL FUNCTION
    HTML Call : OracleOASIS.RunReport
    Parameters : report=EMPDET
    This function is attached to the menu and when I try to access the page I get this error.
    "Error: The requested URL was not found, or cannot be served at this time.
    Incorrect usage."
    The URL that shows in the page is as follows(<server:port> I removed the server name and port) :
    http://<server:port>/dev60cgi/rwcgi60?GDEV_APPS+DESFORMAT=HTML+SERVER=GDEV_APPS+report=EMPDET+p_session_id=A9C71A70B9B1D9BD2DCC0FC3AF9BC324+p_user_id=1133+p_responsibility_id=50230+p_application_id=800+p_security_group_id=0+p_language_code=US+NLS_LANG=AMERICAN_AMERICA+NLS_DATE_FORMAT=DD-MON-RRRR+NLS_NUMERIC_CHARACTERS=.%2C+NLS_DATE_LANGUAGE=AMERICAN+NLS_SORT=BINARY+paramform=NO
    Surprisingly other functions which are defined in this manner work fine. Do I need to register my report anywhere or are there any other settings I need to do for the report to show up.
    Can someone let me know.
    Thanks

    Hi ;
    pelase check below which could be similar error like yours
    Troubleshooting of Runtime Errors of Customer Intelligence Reports [ID 284829.1]
    Regard
    Helios

  • Error while consuming PLSQL Webservice through BPEL

    HI ,
    I have created a simple PLSQL Web service called "HelloWorld" and it got successfully deployed .
    When I tried to test this webservice through BPEL Process Manager , its showing me error everytime that ( Could not create object of class 'dimple.HelloWorldWebServiceUser'; nested exception is: java.lang.ClassNotFoundException: dimple.HelloWorldWebServiceUser</summary> ) .
    Please anyone help me out with this problem .
    Thanks
    Prashant Dwivedi

    HI ,
    I have created a simple PLSQL Web service called "HelloWorld" and it got successfully deployed .
    When I tried to test this webservice through BPEL Process Manager , its showing me error everytime that ( Could not create object of class 'dimple.HelloWorldWebServiceUser'; nested exception is: java.lang.ClassNotFoundException: dimple.HelloWorldWebServiceUser</summary> ) .
    Please anyone help me out with this problem .
    Thanks
    Prashant Dwivedi

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

    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

  • Error in Variable Substitution

    Dear All,
    Result Payload:
    <ns1:MT_Level1 xmlns:ns1="http://test.com">
    <Header>
      <Separator>,</Separator>
    </Header>
      <Detail>
      <FileNumber>30</FileNumber>
      <LinkToNextLevel />
      <Expansion1>0</Expansion1>
      <Expansion2>0</Expansion2>
      <Expansion3>0</Expansion3>
      <Expansion4>0</Expansion4>
      </Detail>
    <Detail>
      <FileNumber>30</FileNumber>
      <LinkToNextLevel />
      <Expansion1>0</Expansion1>
      <Expansion2>0</Expansion2>
      <Expansion3>0</Expansion3>
      <Expansion4>0</Expansion4>
      </Detail>
      <FileNode>
      <FileName>test.txt</FileName>
      </FileNode>
      </ns1:MT_Level1>
    I want to use "File Name" in the "File Node" node for my variable substitution.
    In the configuration:
    File Name Scheme = %filename%
    Variable = filename
    reference = payload: Messages, 1, Message, 1, MT_Level1, 1, FileNode, 1, FileName, 1
    Note: I'm using multimapping (1 to N).
    File Name path is /ns0:Messages/ns0:Message2/ns1:MT_Level1/FileNode/FileName ( from right click in the file name --> copy path).
    I got following 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: filename"
    Please advise!
    Best Regards,
    Victor.

    Dear All,
    My problem is solved!
    The issue is because I don't put the interface mappings sequence as the same sequence as the message mappings sequence. Hence the structure name that i put in the variable substitution all are not match with the structure name in the payload even though all have the file name element.
    So what i did is i have to reorder the sequence of my message mappings to be the same sequence as the interface mappings sequence.
    Thanks for all that trying to help!
    Appreciated it guys.
    BTW, for the variable reference it's correct that i no need to put message and message2 as the reference.
    payload:MT_Level1,1,FileNode,1,FileName,1 will do.
    Best Regards,
    Victor.

  • Problem in variable substitution

    Hi experts,
    I need help for a strange problem:
    I have a proxy to file scenario in which I create an xml file; I need to use a field of the mapping to create filename.
    In Receiver CChannel I have used variable substitution, but in message monitoring I got this error:
    Delivery of the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: Folio: 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: Folio.
    FileName Scheme is: DM65_%Folio%.xml
    In variable substitution I have used this reference:
    Folio =    payload:MT_MexicanElectronicInvoice_MyFirm,1,CABFAC,1,Folio,1
    This is the payload of the message that ends in error:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_MexicanElectronicInvoice_MyFirm xmlns:ns0="urn:MyFirm-EDICOM:MexElectronicInvoice">
    - <CABFAC>
      <IdLabel>CABFAC</IdLabel>
      <Version>3.0</Version>
      <Folio>2100000003</Folio>
      <FecHac>16-11-2011 17:11:17</FecHac>
      <FPago>Advance payment</FPago>
      <Subtotal>9.976,00</Subtotal>
      <TotalFac>11.568,16</TotalFac>
    What is the problem? wrong reference?
    thanks
    Fabio

    Hi,
         Everything looks fine.
    Make sure that there is no extra space after your "%Folio%" under the Variable Substitution.
    Make sure that "Adapter Specific message Attributes" is unchecked in the CC.
    You can do a change in message mapping to create a header field<occurence: 1> map to a constant and call it in var substitution.
    As Mickael suggested above make sure using only lowercase on your variant name  %folio% instead of %Folio%.
    For 1:N muti-mapping with variable substition go through the below links:
    Re: 1: N File Scenario..
    Using Variable Substitution
    i hope it will help you.
    regards,
    ganesh.

  • Variable substitution in XI (7.0 version).

    Maybe you could give us a short hint regarding an error we are getting during the variable substituion in an outbound file adapter.                                                                               
    How can we specify a namespace in the variable substituion?
    Without namespace this is working well, but we don't know how to specify the namespace.   
    We get this error essage: #2006-03-17 15:29:07 CET: Message processing failed: Error during      
    variable substitution:com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: FileName                                                                               
    Here comes our file:                                                   
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns1:GMPluTxn xmlns:ns1="http://sap.com/xi/GMStoreConnectivity">
    <GMFileHeader>                                            <StoreNumber>0000002101</StoreNumber>                     <FileName>PluTxn</FileName>                                     </GMFileHeader>                                            <UpdateType>1</UpdateType>                                <PLU>000000000000610733</PLU>                             <RetailPrice>0.99</RetailPrice>                           <QuantityDescription>BX</QuantityDescription>             </ns1:GMPluTxn>                                          
    We set the flag 'enable variable subsitution' and specified the filename
    variable as follows:                                                 
    FileName payload:ns1:GMPluTxn,1,GMFileHeader,1,FileName,1                                                                               
    The FileName variable is used in the File Name Scheme field:           
    %FileName%.asc 
    Thanks in advance.

    Give it like this and see if it works
    FileName payload:GMPluTxn,1,GMFileHeader,1,FileName,1

Maybe you are looking for