Dúvida com classes e criação de objetos

21/04/2009

Boa noite Tenho os seguintes objetos abaixo em uma unit:
type   TP_ARQ                  = String[02];         {Tipo do arquivo}
  NR_ARQ                  = String[08];         {Número do arquivo}
  COD_OPER                = String[14];         {CNPJ operador logístico}
  DATA                    = String[08];        
  HORA                    = String[06];           TP_REG                  = String[02];         {Tipo do registro}
  EBELN                   = String[10];         {Número do pedido}
  BLDAT                   = String[08];         {Data do pedido}
  LFSNR                   = String[16];         {Número da nota fiscal de venda}
  BKTXT                   = String[25];         {Número da nota fiscal de venda}
  MATNR                   = String[18];         {Código do material}
  ERFMG                   = String[13];         {Quantidade total do material}
  LGORT                   = String[04];         {Código do almoxarifado}
  TXT50                   = String[50];         {Denominação do imobilizado}
  SERIALNO                = String[18];         {Número de série - RG}
  EQART                   = String[18];         {Tipo do objeto técnico}
  HERST                   = String[30];         {Nome do fabricante}
  SERGE                   = String[30];         {Número de série do fabricante}
  WERKS_L                 = String[04];         {Centro de localização}
  WERKS_P                 = String[04];         {Centro de planejamento}
  WERKS                   = String[04];        
  INGRP                   = String[03];         {Grupo de Planejamento para serviços cliente e manutenção}
  LIFNR                   = String[10];         {Código do fornecedor}   ZSHEADER_ARQ_RF         = class;             
  ZRECEB_FIS_MATERIAL     = class;             
  Z_RECEB_FISICO_MATERIAL = class;                ZSHEADER_ARQ_RF = class(TRemotable)
  private
    FTP_ARQ: TP_ARQ;
    FNR_ARQ: NR_ARQ;
    FCOD_OPER: COD_OPER;
    FDATA: DATA;
    FHORA: HORA;
  published
    property TP_ARQ: TP_ARQ read FTP_ARQ write FTP_ARQ;
    property NR_ARQ: NR_ARQ read FNR_ARQ write FNR_ARQ;
    property COD_OPER: COD_OPER read FCOD_OPER write FCOD_OPER;
    property DATA: DATA read FDATA write FDATA;
    property HORA: HORA read FHORA write FHORA;
  end;   ZRECEB_FIS_MATERIAL = class(TRemotable)
  private
    FTP_REG: TP_REG;
    FEBELN: EBELN;
    FBLDAT: BLDAT;
    FLFSNR: LFSNR;
    FBKTXT: BKTXT;
    FMATNR: MATNR;
    FERFMG: ERFMG;
    FLGORT: LGORT;
    FTXT50: TXT50;
    FSERIALNO: SERIALNO;
    FEQART: EQART;
    FHERST: HERST;
    FSERGE: SERGE;
    FWERKS_L: WERKS_L;
    FWERKS_P: WERKS_P;
    FWERKS: WERKS;
    FINGRP: INGRP;
    FLIFNR: LIFNR;
  published
    property TP_REG: TP_REG read FTP_REG write FTP_REG;
    property EBELN: EBELN read FEBELN write FEBELN;
    property BLDAT: BLDAT read FBLDAT write FBLDAT;
    property LFSNR: LFSNR read FLFSNR write FLFSNR;
    property BKTXT: BKTXT read FBKTXT write FBKTXT;
    property MATNR: MATNR read FMATNR write FMATNR;
    property ERFMG: ERFMG read FERFMG write FERFMG;
    property LGORT: LGORT read FLGORT write FLGORT;
    property TXT50: TXT50 read FTXT50 write FTXT50;
    property SERIALNO: SERIALNO read FSERIALNO write FSERIALNO;
    property EQART: EQART read FEQART write FEQART;
    property HERST: HERST read FHERST write FHERST;
    property SERGE: SERGE read FSERGE write FSERGE;
    property WERKS_L: WERKS_L read FWERKS_L write FWERKS_L;
    property WERKS_P: WERKS_P read FWERKS_P write FWERKS_P;
    property WERKS: WERKS read FWERKS write FWERKS;
    property INGRP: INGRP read FINGRP write FINGRP;
    property LIFNR: LIFNR read FLIFNR write FLIFNR;
  end;   T_ARQ_XI   = array of ZRECEB_FIS_MATERIAL;    { "urn:sap-com:document:sap:rfc:functions" }   Z_RECEB_FISICO_MATERIAL = class(TRemotable)
  private
    FT_HEADER: ZSHEADER_ARQ_RF;
    FT_ARQ_XI: T_ARQ_XI;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property T_HEADER: ZSHEADER_ARQ_RF read FT_HEADER write FT_HEADER;
    property T_ARQ_XI: T_ARQ_XI read FT_ARQ_XI write FT_ARQ_XI;
  end;  
Quando tento montar este objeto em minha outra unit (abaixo), que possui um Header (T_HEADER)
e vários itens (T_ARQ_XI), está dando acesso violado na linha *** (ArqSap.T_ARQ_XI[i] := ItensSap;) Abaixo a unit onde estou tentando montar o objeto:       function Tfsincroniza.gera_mensagem_sap_rf:boolean;
var HeaderSap     : ZSHEADER_ARQ_RF;
    ItensSap      : ZRECEB_FIS_MATERIAL;
    ArqSap        : Z_RECEB_FISICO_MATERIAL;
    i             : Integer;
begin    result := true;    i      := 0;    modulo_visa.sap_h_rf.close;
   modulo_visa.sap_h_rf.Params.ParamByName('tipo_arquivo').value      := modulo_sincroniza.fila_sapTipo_arquivo.value;
   modulo_visa.sap_h_rf.Params.ParamByName('num_sequen').value        := modulo_sincroniza.fila_sapNum_sequen.value;
   modulo_visa.sap_h_rf.Params.ParamByName('cnpj_op_logistico').value := modulo_sincroniza.fila_sapCnpj_op_logistico.value;
   modulo_visa.sap_h_rf.open;    modulo_visa.sap_i_rf.close;
   modulo_visa.sap_i_rf.Params.ParamByName('tipo_arquivo').value      := modulo_sincroniza.fila_sapTipo_arquivo.value;
   modulo_visa.sap_i_rf.Params.ParamByName('num_sequen').value        := modulo_sincroniza.fila_sapNum_sequen.value;
   modulo_visa.sap_i_rf.Params.ParamByName('cnpj_op_logistico').value := modulo_sincroniza.fila_sapCnpj_op_logistico.value;
   modulo_visa.sap_i_rf.open;    if (not modulo_visa.sap_h_rf.IsEmpty) and (not modulo_visa.sap_i_rf.IsEmpty) then begin       // Criando a header       HeaderSap := ZSHEADER_ARQ_RF.Create;
      HeaderSap.TP_ARQ      := modulo_visa.sap_h_rfTipo_arquivo.AsString;
      HeaderSap.NR_ARQ      := modulo_visa.sap_h_rfNum_sequen.AsString;
      HeaderSap.COD_OPER    := modulo_visa.sap_h_rfCnpj_op_logistico.AsString;
      HeaderSap.DATA        := modulo_visa.sap_h_rfData_geracao.AsString;
      HeaderSap.HORA        := remove_char(modulo_visa.sap_h_rfHora_geracao.AsString);       ArqSap                := Z_RECEB_FISICO_MATERIAL.Create;
      ArqSap.T_HEADER       := HeaderSap;       while not modulo_visa.sap_i_rf.eof do begin          inc(i);          ItensSap           := ZRECEB_FIS_MATERIAL.Create;
         ItensSap.TP_REG    := modulo_visa.sap_i_rfTipo_registro.AsString;
         ItensSap.EBELN     := modulo_visa.sap_i_rfNum_pedido.AsString;
         ItensSap.BLDAT     := modulo_visa.sap_i_rfData_pedido.AsString;
         ItensSap.LFSNR     := modulo_visa.sap_i_rfNum_not_fisc_ven.AsString;
         ItensSap.BKTXT     := modulo_visa.sap_i_rfNum_not_fisc_rem.AsString;
         ItensSap.MATNR     := modulo_visa.sap_i_rfCod_material.AsString;
         ItensSap.ERFMG     := modulo_visa.sap_i_rfQtd_tot_mat.AsString;
         ItensSap.LGORT     := modulo_visa.sap_i_rfCod_almoxa.AsString;
         ItensSap.TXT50     := modulo_visa.sap_i_rfDen_imobilizado.AsString;
         ItensSap.SERIALNO  := modulo_visa.sap_i_rfNum_serie.AsString;
         ItensSap.EQART     := modulo_visa.sap_i_rfTipo_obj_tecnico.AsString;
         ItensSap.HERST     := modulo_visa.sap_i_rfNome_fab.AsString;
         ItensSap.SERGE     := modulo_visa.sap_i_rfNum_serie_fab.AsString;
         ItensSap.WERKS_L   := modulo_visa.sap_i_rfCentro_localizacao.AsString;
         ItensSap.WERKS_P   := modulo_visa.sap_i_rfCentro_plan.AsString;
         ItensSap.WERKS     := modulo_visa.sap_i_rfCentro.AsString;
         ItensSap.INGRP     := modulo_visa.sap_i_rfGrup_plan_serv_cli_man.AsString;
         ItensSap.LIFNR     := modulo_visa.sap_i_rfCod_fornecedor.AsString; ***         ArqSap.T_ARQ_XI[i] := ItensSap;    **** nesta linha está dando access violation          modulo_visa.sap_i_rf.next;
      end;
   end;    try
      GetRecebimento_Fisico_WS_Req_MI.Recebimento_Fisico_WS_Req_MI(ArqSap);
   except
      result := false;
   end;    HeaderSap.Free;
   ItensSap.Free;
   ArqSap.Free;
end;   Peço a gentileza de me indicar qual é o procedimento que estou fazendo errado. Este objeto que contém uma header e vários itens, eu tenho que passar para um WebService. Fico aguardando a resposta... Muito obrigado... Denis  
Denis Godoi

Denis Godoi

Curtidas 0

Respostas

Wesley Yamazack

Wesley Yamazack

21/04/2009

Olá Denis,
  Estou analisando o teu código, e também esta dando Access Violation aqui.
  Bom se possível você me mandar o código fonte completo, das Unts seria melhor, pois tem algumas coisas aqui que tem que comentar e tal, por não ter o fonte completo. Mas para te adiantar analise as os objetos que você esta usando, veja se todos eles estão sendo criados antes de serem usados, pois access violation só acontece em 2 casos, quando você quer usar um objeto não criado, ou quando o objeto já foi destruído e você tenta usar o mesmo.
  Aguardo contato.



Att,

Wesley Y
GOSTEI 0
Wesley Yamazack

Wesley Yamazack

21/04/2009

Olá Denis,

  Fiz uma modificação na tua classe, veja se resolve teu problema.

  Z_RECEB_FISICO_MATERIAL = class(TRemotable)
  private
    FT_HEADER: ZSHEADER_ARQ_RF;
    FT_ARQ_XI: T_ARQ_XI;
    procedure SetT_ARQ_XI(const Value: T_ARQ_XI);
    procedure SetT_HEADER(const Value: ZSHEADER_ARQ_RF);
  public
    procedure Add(Item : ZRECEB_FIS_MATERIAL); //Adicione esta procedure
  published
    property T_HEADER: ZSHEADER_ARQ_RF  read FT_HEADER write SetT_HEADER;
    property T_ARQ_XI: T_ARQ_XI  read FT_ARQ_XI write SetT_ARQ_XI;
  end;


procedure Z_RECEB_FISICO_MATERIAL.Add(Item:  ZRECEB_FIS_MATERIAL);
Var
  I : Integer;
begin
  i := High(T_ARQ_XI);
  if I =  length(T_ARQ_XI) then
  begin
     SetLength(FT_ARQ_XI,I+1);
     T_ARQ_XI[I+1] := Item;
  end;
end;


e na tua function gera_mensagem_sap_rf:boolean; Você irá adicionar os itens desta forma

      ArqSap.Add(ItensSap);
      ou inves de ArqSap.T_ARQ_XI[i] := ItensSap;


Att,

Wesley Y



GOSTEI 0
Denis Godoi

Denis Godoi

21/04/2009

Bom dia Wesley   Deixei a classe conforme suas instruções (conforme abaixo)       Z_RECEB_FISICO_MATERIAL = class(TRemotable)
  private
    FT_HEADER: ZSHEADER_ARQ_RF;
    FT_ARQ_XI: T_ARQ_XI;
    procedure SetT_ARQ_XI(const Value: T_ARQ_XI);
    procedure SetT_HEADER(const Value: ZSHEADER_ARQ_RF);
  public
    procedure Add(Item : ZRECEB_FIS_MATERIAL); //Adicione esta procedure
  published
    property T_HEADER: ZSHEADER_ARQ_RF  read FT_HEADER write SetT_HEADER;
    property T_ARQ_XI: T_ARQ_XI  read FT_ARQ_XI write SetT_ARQ_XI;
  end;   procedure Z_RECEB_FISICO_MATERIAL.Add(Item:  ZRECEB_FIS_MATERIAL);
  Var
    I : Integer;
  begin
    i := High(T_ARQ_XI);
    if I =  length(T_ARQ_XI) then
    begin
       SetLength(FT_ARQ_XI,I+1);
       T_ARQ_XI[I+1] := Item;
    end;
  end;
No entanto, quando compilo, aparece as mensagens de compilação abaixo:   [Error] u_sincroniza_ws_sap_rf.pas(160): Identifier redeclared: 'Z_RECEB_FISICO_MATERIAL.Add' [Error] u_sincroniza_ws_sap_rf.pas(162): Statements not allowed in interface part [Error] u_sincroniza_ws_sap_rf.pas(164): '(' expected but ')' found [Error] u_sincroniza_ws_sap_rf.pas(165): Missing operator or semicolon [Error] u_sincroniza_ws_sap_rf.pas(166): Undeclared identifier: 'FT_ARQ_XI'             Estou te mandando a unit completa, para você ter uma idéia da estrutura:       // ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : C:\Users\Cognum\Desktop\Clientes\INTEC\VisaNet\WS - Gestao Ativos\Recebimento_Fisico_WS_Req_MI.wsdl
// Encoding : UTF-8
// Version  : 1.0
// (19/04/2009 23:27:54 - 1.33.2.5)
// ************************************************************************ // unit u_sincroniza_ws_sap_rf; interface uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns; type   // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Borland types; however, they could also
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:TP_ARQ          - "urn:sap-com:document:sap:rfc:functions"
  // !:NR_ARQ          - "urn:sap-com:document:sap:rfc:functions"
  // !:COD_OPER        - "urn:sap-com:document:sap:rfc:functions"
  // !:DATA            - "urn:sap-com:document:sap:rfc:functions"
  // !:HORA            - "urn:sap-com:document:sap:rfc:functions"
  // !:TP_REG          - "urn:sap-com:document:sap:rfc:functions"
  // !:EBELN           - "urn:sap-com:document:sap:rfc:functions"
  // !:BLDAT           - "urn:sap-com:document:sap:rfc:functions"
  // !:LFSNR           - "urn:sap-com:document:sap:rfc:functions"
  // !:BKTXT           - "urn:sap-com:document:sap:rfc:functions"
  // !:MATNR           - "urn:sap-com:document:sap:rfc:functions"
  // !:ERFMG           - "urn:sap-com:document:sap:rfc:functions"
  // !:LGORT           - "urn:sap-com:document:sap:rfc:functions"
  // !:TXT50           - "urn:sap-com:document:sap:rfc:functions"
  // !:SERIALNO        - "urn:sap-com:document:sap:rfc:functions"
  // !:EQART           - "urn:sap-com:document:sap:rfc:functions"
  // !:HERST           - "urn:sap-com:document:sap:rfc:functions"
  // !:SERGE           - "urn:sap-com:document:sap:rfc:functions"
  // !:WERKS_L         - "urn:sap-com:document:sap:rfc:functions"
  // !:WERKS_P         - "urn:sap-com:document:sap:rfc:functions"
  // !:WERKS           - "urn:sap-com:document:sap:rfc:functions"
  // !:INGRP           - "urn:sap-com:document:sap:rfc:functions"
  // !:LIFNR           - "urn:sap-com:document:sap:rfc:functions"   TP_ARQ                  = String[02];         {Tipo do arquivo}
  NR_ARQ                  = String[08];         {Número do arquivo}
  COD_OPER                = String[14];         {CNPJ operador logístico}
  DATA                    = String[08];        
  HORA                    = String[06];           TP_REG                  = String[02];         {Tipo do registro}
  EBELN                   = String[10];         {Número do pedido}
  BLDAT                   = String[08];         {Data do pedido}
  LFSNR                   = String[16];         {Número da nota fiscal de venda}
  BKTXT                   = String[25];         {Número da nota fiscal de venda}
  MATNR                   = String[18];         {Código do material}
  ERFMG                   = String[13];         {Quantidade total do material}
  LGORT                   = String[04];         {Código do almoxarifado}
  TXT50                   = String[50];         {Denominação do imobilizado}
  SERIALNO                = String[18];         {Número de série - RG}
  EQART                   = String[18];         {Tipo do objeto técnico}
  HERST                   = String[30];         {Nome do fabricante}
  SERGE                   = String[30];         {Número de série do fabricante}
  WERKS_L                 = String[04];         {Centro de localização}
  WERKS_P                 = String[04];         {Centro de planejamento}
  WERKS                   = String[04];        
  INGRP                   = String[03];         {Grupo de Planejamento para serviços cliente e manutenção}
  LIFNR                   = String[10];         {Código do fornecedor}   ZSHEADER_ARQ_RF         = class;              { "urn:sap-com:document:sap:rfc:functions" }
  ZRECEB_FIS_MATERIAL     = class;              { "urn:sap-com:document:sap:rfc:functions" }
  Z_RECEB_FISICO_MATERIAL = class;              { "urn:sap-com:document:sap:rfc:functions" }   // ************************************************************************ //
  // Namespace : urn:sap-com:document:sap:rfc:functions
  // ************************************************************************ //
  ZSHEADER_ARQ_RF = class(TRemotable)
  private
    FTP_ARQ: TP_ARQ;
    FNR_ARQ: NR_ARQ;
    FCOD_OPER: COD_OPER;
    FDATA: DATA;
    FHORA: HORA;
  published
    property TP_ARQ: TP_ARQ read FTP_ARQ write FTP_ARQ;
    property NR_ARQ: NR_ARQ read FNR_ARQ write FNR_ARQ;
    property COD_OPER: COD_OPER read FCOD_OPER write FCOD_OPER;
    property DATA: DATA read FDATA write FDATA;
    property HORA: HORA read FHORA write FHORA;
  end;   // ************************************************************************ //
  // Namespace : urn:sap-com:document:sap:rfc:functions
  // ************************************************************************ //
  ZRECEB_FIS_MATERIAL = class(TRemotable)
  private
    FTP_REG: TP_REG;
    FEBELN: EBELN;
    FBLDAT: BLDAT;
    FLFSNR: LFSNR;
    FBKTXT: BKTXT;
    FMATNR: MATNR;
    FERFMG: ERFMG;
    FLGORT: LGORT;
    FTXT50: TXT50;
    FSERIALNO: SERIALNO;
    FEQART: EQART;
    FHERST: HERST;
    FSERGE: SERGE;
    FWERKS_L: WERKS_L;
    FWERKS_P: WERKS_P;
    FWERKS: WERKS;
    FINGRP: INGRP;
    FLIFNR: LIFNR;
  published
    property TP_REG: TP_REG read FTP_REG write FTP_REG;
    property EBELN: EBELN read FEBELN write FEBELN;
    property BLDAT: BLDAT read FBLDAT write FBLDAT;
    property LFSNR: LFSNR read FLFSNR write FLFSNR;
    property BKTXT: BKTXT read FBKTXT write FBKTXT;
    property MATNR: MATNR read FMATNR write FMATNR;
    property ERFMG: ERFMG read FERFMG write FERFMG;
    property LGORT: LGORT read FLGORT write FLGORT;
    property TXT50: TXT50 read FTXT50 write FTXT50;
    property SERIALNO: SERIALNO read FSERIALNO write FSERIALNO;
    property EQART: EQART read FEQART write FEQART;
    property HERST: HERST read FHERST write FHERST;
    property SERGE: SERGE read FSERGE write FSERGE;
    property WERKS_L: WERKS_L read FWERKS_L write FWERKS_L;
    property WERKS_P: WERKS_P read FWERKS_P write FWERKS_P;
    property WERKS: WERKS read FWERKS write FWERKS;
    property INGRP: INGRP read FINGRP write FINGRP;
    property LIFNR: LIFNR read FLIFNR write FLIFNR;
  end;   T_ARQ_XI   = array of ZRECEB_FIS_MATERIAL;    { "urn:sap-com:document:sap:rfc:functions" }   // ************************************************************************ //
  // Namespace : urn:sap-com:document:sap:rfc:functions
  // Serializtn: [xoLiteralParam]
  // ************************************************************************ //
  Z_RECEB_FISICO_MATERIAL = class(TRemotable)
  private
    FT_HEADER: ZSHEADER_ARQ_RF;
    FT_ARQ_XI: T_ARQ_XI;
    procedure SetT_ARQ_XI(const Value: T_ARQ_XI);
    procedure SetT_HEADER(const Value: ZSHEADER_ARQ_RF);
  public
    procedure Add(Item : ZRECEB_FIS_MATERIAL); //Adicione esta procedure
  published
    property T_HEADER: ZSHEADER_ARQ_RF  read FT_HEADER write SetT_HEADER;
    property T_ARQ_XI: T_ARQ_XI  read FT_ARQ_XI write SetT_ARQ_XI;
  end;   procedure Z_RECEB_FISICO_MATERIAL.Add(Item:  ZRECEB_FIS_MATERIAL);
  Var
    I : Integer;
  begin
    i := High(T_ARQ_XI);
    if I =  length(T_ARQ_XI) then
    begin
       SetLength(FT_ARQ_XI,I+1);
       T_ARQ_XI[I+1] := Item;
    end;
  end; //  Z_RECEB_FISICO_MATERIAL = class(TRemotable)
//  private
//    FT_HEADER: ZSHEADER_ARQ_RF;
//    FT_ARQ_XI: T_ARQ_XI;
//  public
//    constructor Create; override;
//    destructor Destroy; override;
//  published
//    property T_HEADER: ZSHEADER_ARQ_RF read FT_HEADER write FT_HEADER;
//    property T_ARQ_XI: T_ARQ_XI read FT_ARQ_XI write FT_ARQ_XI;
//  end;   // ************************************************************************ //
  // Namespace : urn:visanet:sap:bapi:rec:fisico
  // soapAction: http://sap.com/xi/WebService/soap1.1
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : Recebimento_Fisico_WS_Req_MIBinding
  // service   : Recebimento_Fisico_WS_Req_MIService
  // port      : Recebimento_Fisico_WS_Req_MIPort
  // URL       : https://vnetspohxi1:51101/XISOAPAdapter/MessageServlet?channel=:OL_Service:OL_Soap_Recebimento_Fisico_Sender&version=3.0&Sender.Service=x&Interface=x%5Ex
  // ************************************************************************ //
  Recebimento_Fisico_WS_Req_MI = interface(IInvokable)
  ['{E56A1040-AFE0-67A6-FBB2-8633ECFCF7DC}']
    procedure Recebimento_Fisico_WS_Req_MI(const parameters: Z_RECEB_FISICO_MATERIAL); stdcall;
  end; function GetRecebimento_Fisico_WS_Req_MI(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): Recebimento_Fisico_WS_Req_MI;
implementation function GetRecebimento_Fisico_WS_Req_MI(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): Recebimento_Fisico_WS_Req_MI;
const
  defWSDL = 'C:\Users\Cognum\Desktop\Clientes\INTEC\VisaNet\WS - Gestao Ativos\Recebimento_Fisico_WS_Req_MI.wsdl';
  defURL  = 'https://200.206.208.248:51101/XISOAPAdapter/MessageServlet?channel=:OL_Service:OL_Soap_Recebimento_Fisico_Sender&version=3.0&Sender.Service=x&Interface=x%5Ex';
  defSvc  = 'Recebimento_Fisico_WS_Req_MIService';
  defPrt  = 'Recebimento_Fisico_WS_Req_MIPort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as Recebimento_Fisico_WS_Req_MI);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else begin
      RIO.URL                  := defUrl;
      RIO.HTTPWebNode.UserName := 'win';
      RIO.HTTPWebNode.Password := 'visanet';
    end;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;
constructor Z_RECEB_FISICO_MATERIAL.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end; destructor Z_RECEB_FISICO_MATERIAL.Destroy;
var
  I: Integer;
begin
  for I := 0 to Length(FT_ARQ_XI)-1 do
    if Assigned(FT_ARQ_XI[I]) then
      FT_ARQ_XI[I].Free;
  SetLength(FT_ARQ_XI, 0);
  if Assigned(FT_HEADER) then
    FT_HEADER.Free;
  inherited Destroy;
end; initialization
  InvRegistry.RegisterInterface(TypeInfo(Recebimento_Fisico_WS_Req_MI), 'urn:visanet:sap:bapi:rec:fisico', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Recebimento_Fisico_WS_Req_MI), 'http://sap.com/xi/WebService/soap1.1');
  InvRegistry.RegisterInvokeOptions(TypeInfo(Recebimento_Fisico_WS_Req_MI), ioDocument);
  InvRegistry.RegisterInvokeOptions(TypeInfo(Recebimento_Fisico_WS_Req_MI), ioLiteral);
  RemClassRegistry.RegisterXSClass(ZSHEADER_ARQ_RF, 'urn:sap-com:document:sap:rfc:functions', 'ZSHEADER_ARQ');
  RemClassRegistry.RegisterXSClass(ZRECEB_FIS_MATERIAL, 'urn:sap-com:document:sap:rfc:functions', 'ZRECEB_FIS_MATERIAL');
  RemClassRegistry.RegisterXSInfo(TypeInfo(T_ARQ_XI), 'urn:sap-com:document:sap:rfc:functions', 'T_ARQ_XI');
  RemClassRegistry.RegisterXSClass(Z_RECEB_FISICO_MATERIAL, 'urn:sap-com:document:sap:rfc:functions', 'Z_RECEB_FISICO_MATERIAL');
  RemClassRegistry.RegisterSerializeOptions(Z_RECEB_FISICO_MATERIAL, [xoLiteralParam]); end.  
GOSTEI 0
Wesley Yamazack

Wesley Yamazack

21/04/2009

Olá Denis,

  No momento em que voce declarar

  procedure Add(Item:  ZRECEB_FIS_MATERIAL); // você deve mandar o delphi implementar para você, usando Ctrl + Shift + C; e depois colar o código onde ele implementou.



// Implementation
  Var
    I : Integer;
  begin
    i := High(T_ARQ_XI);
    if I =  length(T_ARQ_XI) then
    begin
       SetLength(FT_ARQ_XI,I+1);
       T_ARQ_XI[I+1] := Item;
    end;


  Você colocou logo abaixo da classe, assim não irá funcionar.
  Quanto a mensagem Identifier redeclared: 'Z_RECEB_FISICO_MATERIAL.Add', osempre que acontecer este tipo de erro, observe se você não esta declarando uma procedure/function com um nome que ja exista na sua class.


Att,

Wesley Y
GOSTEI 0
Wesley Yamazack

Wesley Yamazack

21/04/2009

Olá Denis,
  Podemos fechar este chamado ? Conseguimos resolver o teu problema ?

Att,

Wesley Y
GOSTEI 0
Denis Godoi

Denis Godoi

21/04/2009

Pode sim...   Se você pudesse verificar para mim o 4966, acho que tem a ver com o assunto...   Abraço   Denis
GOSTEI 0
POSTAR