Adicionar mais campos no ONTORDDFN.xsd

Perguntas relacionadas a questões técnicas do Oracle EBS. Criação de Concorrentes, Value Sets, Alerts, Forms Personalizations, Configurações, etc
Responder
Avatar do usuário
dr_gori
Moderador
Moderador
Mensagens: 5024
Registrado em: Seg, 03 Mai 2004 3:08 pm
Localização: Portland, OR USA
Contato:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Pessoal

Preciso adicionar alguns campos a mais no seguinte relatório do OM do XML Publisher:
Modelo: "Gabarito RTF da Ordem de Venda" ( ONTORDRTF ) ou "Sales Order RTF Template"
Data Definition: "Arquivo de Definição XSD da Ordem de Venda" ( ONTORDDFN )

O modelo é facil pois é em RTF, mas o Data Definition é um arquivo .XSD ( ONTORDDFN.xsd ).

Estive lendo como adicionar mais campos nesse data definition (CNPJ, Insc. Estadual, etc). Parece que temos que implementar uma classe em java :-(
How to display Project Number And Task Number In The Pdf Document Generated [ID 471026.1]

Applies to:

Oracle Order Management - Version: 11.5.10.2
Information in this document applies to any platform.
Goal

Customer uses Oracle Project Manufacturing and need to show the number of the project and the
task in the layout template generated from Preview and Print Action on Sales Order Form.
Have consulted the source of data : OE_PRN_ORDER_LINES_V and observed that the consultation does not consider the PROJECT_NUMBER and TASK_NUMBER fields.

1. In what part of the file ONTORDDFN.xsd must make the correction, adding the number of project
and task to the lines of the order?

2. With regard to the class that would have to implement (CustomClass, which implements
PrintExtensionObject):

3. How the file ONTORDDFN.xsd refers to this class? . As you pass parameters to this class from
the report?

4. What structure must have the xml returns class?.

5. There is a example of code for the Class, with the code to generate the xml?





Solution

1. You should not be modifying the file ONTORDDFN.xsd to add any new fields ..
TO make such customizations only the following interface has been created.
"PrintExtensionObject" with method
"getPrintExtensionXMLFragment(String busDocId,String busDocType) has been provided for
implementation.

2 & 3.
If you mention the CustomClass name in the profile option
"OM: Printed Document Extension Class Name" at site level It will take care of calling it...

4 & 5.

getPrintExtensionXMLFragment should return a ByteArrayOutputStream which is nothing but a XML
Fragment containing Project Number and Task Number. You can use Oracle XSU to query oe_order_lines
and XSU can create a xml fragment from the db query.

You do not need to modify the xsd. The XML Fragment returned by the Custom Class will be part of
the main XML being returned. Hence you have to modify the RTF template to shows these new values
on the UI.

References

NOTE:341206.1 - How to Modify Seeded Order Managment Xml Template/Data Definition Source.
Então:
1. Vou ter que criar uma classe nova, que implemente a PrintExtensionObject.
2. Vou ter que "linkar" essa classe no profile "OM: Printed Document Extension Class Name"

Achei um exemplo aqui pra me ajudar a implementar a classe:
http://forums.oracle.com/forums/thread. ... ID=3604740

Mas aqui ele está fazendo uma conexão com o banco diretamente. Minha dúvida: Eu quero criar uma classe como essa mas sem esse acesso direto... Alguém que programa em java poderia me ajudar nessa ? Alguém já fez isso ?

VALEU
Avatar do usuário
dr_gori
Moderador
Moderador
Mensagens: 5024
Registrado em: Seg, 03 Mai 2004 3:08 pm
Localização: Portland, OR USA
Contato:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Após muito me quebrar, decidimos criar um relatório do ZERO feito em BI Publisher PURO em vez de customizar esse relatório da oracle devido a uma série de situações.

1. O template principal é em RTF (ótimo), mas existe um sub-template das linhas em XSD. (nhaca). Em nenhum lugar encontramos documentação ou informações de como implementar campos também nas linhas (no meu caso, o IPI precisa estar nas linhas).

2. Pra adicionar novos campos no header, temos que implementar uma classe em java. Aí vai a minha classe de teste:

Selecionar tudo

package oracle.apps.ont.print.server;
 
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;



public class XgXMLOm002 {
   
    public static void main(String[] args) {
        XgXMLOm002 a= new XgXMLOm002();        
        System.out.println( a.getPrintExtensionXMLFragment("a","b") );         
    }
/*   
    public class XgXMLOm002 implements PrintExtensionObject {
        public void XgXMLOm002() {
          System.out.println("In Custom Class");
        }
*/


    /**
     * @param s - Heaerid da tabela oe_order_headers_all
     * @param s1
     * @return XML que sera adicionado e ira para o XML Publisher.
     */
    public ByteArrayOutputStream getPrintExtensionXMLFragment(String s, String s1) {    
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
        String s2 = null;
        String s3 = null;
        String s40 ="VGCCustomClass";
        byte abyte0[] = null;
        byte abyte1[] = null;
        
        try {
            //Registra Driver e conexão
            DriverManager.registerDriver(new  oracle.jdbc.driver.OracleDriver() );      
            Connection conn = DriverManager.getConnection("jdbc:oracle:thin:APPS/senha@172.16.2.88:1571:CRPX");
                        
            //SQL    
            String s41 = "select 'joao' attribute7 , 'silva' attribute8 from oe_order_headers_all where header_id = 1456"; //+ s + " and 'O' = " + s1;
                    
            Statement statement = conn.createStatement();
            ResultSet resultset = statement.executeQuery(s41);
            
            if(resultset.next()) {
              s2 = resultset.getString("attribute7");
              //System.out.println( s2 );
              s3 = resultset.getString("attribute8");
            }    
        } catch(SQLException sqlexception) {
            sqlexception.printStackTrace();
        }
        
        catch (Exception e)  { 
            System.err.println("Got an exception! "); 
            System.err.println(e.getMessage()); 
        }
    
    try {
        
        if(s2 != null) {
            abyte0 = s2.getBytes("UTF-8");
        }        
        if(s3 != null) {
            abyte1 = s3.getBytes("UTF-8");
        }
        
        bytearrayoutputstream.write("<Attribute7>".getBytes("UTF-8"));
        bytearrayoutputstream.write(abyte0);
        bytearrayoutputstream.write("</Attribute7>".getBytes("UTF-8"));
        
        bytearrayoutputstream.write("<Attribute8>".getBytes("UTF-8"));
        bytearrayoutputstream.write(abyte1);
        bytearrayoutputstream.write("</Attribute8>".getBytes("UTF-8"));
    }
    catch(IOException ioexception) {
        ioexception.printStackTrace();
    }    
    return bytearrayoutputstream;
    }
} //classe
Essa classe tem o seguinte problema: Possui uma conexão hardcoded dentro dela. Como essa NÃO É uma Java-Stored-Procedure, eu não posso usar o DriverManager.getConnection("jdbc:default:connection:");. (essa classe tem que ficar num diretório do Sistema Operacional).

3. Outro problema. Conforme documentação, é necessário fazer REBOOT no servidor ao alterar ou incluir a classe java de implementação. (Metalink Note ID 982142.1 )
Metalink Note 982142.1 escreveu:6) Is it necessary that this need to be in a seeded folder? Can we try with a custom folder?
A: You can put it in any folder under $JAVA_TOP.
For example if you have put the CustomClass.class under oracle/apps/ont/custom
then modify the pacakge structure in the java file accordingly.
And the profile should be oracle.apps.ont.custom.CustomClass.

You have to bounce the server to pick the new file. <<<------------
4. Pra completar a saga, ainda tivemos erro ao executar o relatório de teste no sistema. (eu copiei um novo template no XML PUblisher e configure pra este ser o documento padrão). Aí tivemos o famoso "ERRO, contate o administrador". Após debulhar os logs, infelizmente, não encontrei nada.

SOLUÇÃO

Criar um arquivo XML com os data-definitions para o bi-publisher.
USAR o mesmo template da oracle, mas com o data-definition próprio.
Em resumo: fazer o relatório do zero é mais rápido e mais fácil que tentar customizar esse monstro.

Agora a pergunta que não quer calar: "Por que a oracle não faz os seus relatórios diretamente no bi-publisher usando um XML com os selects dentro ?"

:(
Responder
  • Informação
  • Quem está online

    Usuários navegando neste fórum: Nenhum usuário registrado e 10 visitantes