Please enable JavaScript to view this site.

The application structure for an own user interface is described in Structure.

In this example invoices are loaded into a staging table from SAP nad then incorporated into the application.

We chose in this example to implement SQL and PL/SQL, but similar functionality can be achieved with any development environment (for example, Microsoft .Net, Informatica PowerCenter or Pentaho Data Integration) which can load data into the database.

Make a table that will contain the full collection of invoices:

 

create table xxsap_in_ftr

( ftr_nummer                 number(15)         not null

, ftr_datum_gefactureerd     date               not null

, lvr_nummer                 number(15)         not null

, ftr_orig_system_reference  varchar2(240 char)

, laad_status                char(1 byte)

, laad_melding               varchar2(2000 char)

, datum_geladen              date               not null

, datum_aangemaakt           date               not null

)

tablespace xxsap

/

 

 

create index xxsap_ifr_n1 on xxsap_in_ftr

( ftr_nummer

)

tablespace xxsap

/

 

 

create unique index xxsap_ifr_nk on xxsap_in_ftr

( ftr_orig_system_reference

)

tablespace xxsap

/

 

Make a stored package in Oracle PL/SQL which will try to add the data in the just created table to the existing data:

 

create or replace package xxsap#in_ftr

as

/*

* $Header: http://svn.invantive.com/repos/p104/trunk/help/nl/manual/Topics/interfacing-voorbeeld.xml 19891 2012-10-09 13:23:03Z gle3 $

*

* (C) Copyright 2004-2012 Invantive Software BV, the Netherlands. All rights reserved.

*/

procedure verwerk

;

end;

/

create or replace package body xxsap#in_ftr

as

/*

* $Header: http://svn.invantive.com/repos/p104/trunk/help/nl/manual/Topics/interfacing-voorbeeld.xml 19891 2012-10-09 13:23:03Z gle3 $

*

* (C) Copyright 2004-2012 Invantive Software BV, the Netherlands. All rights reserved.

*/

--

-- Verwerkt facturen.

--

-- Niet bestaande facturen worden toegevoegd.

-- Verwijderde facturen blijven bestaan.

-- Van gewijzigde facturen wordt niks overgenomen, aangezien de onderliggende tabel

-- grootboek mutaties geen wijzigingen kan bevatten.

--

procedure verwerk

is

 --

 -- Alle facturen die nog toegevoegd moeten worden op basis van nummer.

 --

 cursor c_ftr

 is

 select lfr.*

 ,      lfr.urowid lfr_urowid

 from   xxsap_in_ftr lfr

 where  not exists

        ( select 1

          from   bubs_facturen_v ftr

          where  1=1

          and    ftr.ftr_nummer = lfr.ftr_nummer

        )

 --

 -- Nog niet aangeboden voor laden.

 --

 and    laad_status is null

 ;

 l_cnt_ftr         number(15, 0);

 l_cnt_ftr_bad     number(15, 0);

 l_cnt_ftr_upd     number(15, 0);

 l_cnt_ftr_upd_bad number(15, 0);

 l_laad_status     xxsap_in_ftr.laad_status%type;

 l_laad_melding    xxsap_in_ftr.laad_melding%type;

 l_start_tijd      date := sysdate;

 l_job_seq         bubs_jobs_v.job_seq%type;

begin

 --

 -- Meldingen voor facturen die gewijzigd zijn na verwerking.

 --

 for r_changed in

 ( select ftr.ftr_nummer                ftr_nummer_old

   ,      lfr.ftr_datum_gefactureerd    ftr_datum_gefactureerd_old

   ,      ftr.ftr_datum_gefactureerd    ftr_datum_gefactureerd_new

   ,      lfr.lvr_nummer                lvr_nummer_old

   ,      ftr.lvr_nummer                lvr_nummer_new

   ,      ftr.ftr_orig_system_reference ftr_orig_system_reference_old

   ,      ftr.ftr_datum_intrf_geladen   ftr_datum_intrf_geladen_old

   from   xxsap_in_ftr lfr

   join   bubs_facturen_v     ftr

   on     lfr.ftr_nummer = ftr.ftr_nummer

   where  1=1

   and    lfr.laad_status is null

   and    ( lfr.ftr_datum_gefactureerd <> ftr.ftr_datum_gefactureerd

            or

            lfr.lvr_nummer             <> ftr.lvr_nummer

          )

 )

 loop

   bubs_job_logging.create_job_melding

   ( substr

     ( 'De factuur met nummer '

       || r_changed.ftr_nummer_old

       || ' is gewijzigd in de primaire administratie na verwerking. Zie de volgende meldingen voor meer informatie.'

     , 1

     , 250

     )

   , 'Y'

   );

   bubs_job_logging.create_job_melding

   ( substr

     ( 'Datum gefactureerd was '

       || to_char(r_changed.ftr_datum_gefactureerd_old, 'dd-mm-yyyy')

       || ', nu '

       || to_char(r_changed.ftr_datum_gefactureerd_new, 'dd-mm-yyyy')

       || ', leverancier was '

       || r_changed.lvr_nummer_old

       || ' nu '

       || r_changed.lvr_nummer_new

       || '. Oorspronkelijke referentie '

       || r_changed.ftr_orig_system_reference_old

       || ', uitgewisseld '

       || to_char(r_changed.ftr_datum_intrf_geladen_old, 'dd-mm-yyyy hh24:mi:ss')

     , 1

     , 250

     )

   , ‘N’

   );

 end loop;

 --

 -- Daadwerkelijke toevoeging.

 --

 <<ftr>>

 l_cnt_ftr     := 0;

 l_cnt_ftr_bad := 0;

 l_cnt_ftr_upd     := 0;

 l_cnt_ftr_upd_bad := 0;

 l_job_seq         := bubs_job_logging.get_current_job_seq;

 for r_ftr in c_ftr

 loop

   bubs_job_logging.create_job_melding('Laden factuur met nummer ' || r_ftr.ftr_nummer, 'N');

   begin

     insert into bubs_facturen_v

     ( ftr_nummer

     , ftr_datum_gefactureerd

     , lvr_nummer

     , ftr_orig_system_reference

     , ftr_datum_intrf_geladen

     , ftr_job_seq_geladen

     )

     values

     ( r_ftr.ftr_nummer

     , r_ftr.ftr_datum_gefactureerd

     , r_ftr.lvr_nummer

     , r_ftr.ftr_orig_system_reference

     , l_start_tijd

     , l_job_seq

     );

     l_laad_status := ‘V’;

     l_laad_melding := '';

   exception

     when others

     then

       bubs_job_logging.create_job_melding(substr('Laden mislukt voor factuur met nummer: ' || r_ftr.ftr_nummer || '. Foutmelding is ' || sqlerrm, 1, 250), 'Y');

       l_cnt_ftr_bad := l_cnt_ftr_bad + 1;

       l_laad_status := ‘F’;

       l_laad_melding := sqlerrm; /* Of dbms_utility.format_error_stack || dbms_utility.format_error_backtrace voor een volledige call stack en foutmelding. */

   end;

   --

   -- Bijwerken laadstatus met uitkomsten van het toevoegen.

   --

   update xxsap_in_ftr

   set    laad_status   = l_laad_status

   ,      laad_melding  = l_laad_melding

   ,      datum_geladen = l_start_tijd

   where  urowid = r_ftr.lfr_urowid

   ;

   l_cnt_ftr := l_cnt_ftr + 1;

 end loop ftr;

 --

 -- Alle niet relevante data verwijderen, evenals succesvol verwerkte data.

 -- Foutief verwerkte records worden na 1 maand verwijderd.

 --

 delete xxsap_in_ftr where laad_status is null;

 delete xxsap_in_ftr where laad_status = ‘V’;

 delete bubs_exact_laad_lvr where datum_geladen < add_months(sysdate, -1);

 commit;

 bubs_job_logging.create_job_melding('Succesvol verwerkte gegevens, evenals niet gewijzigde gegevens zijn verwijderd.', 'N');

 --

 -- Status overzicht.

 --

 bubs_job_logging.create_job_melding('Facturen toegevoegd: ' || to_char(l_cnt_ftr, '999G999G990'), 'N');

 bubs_job_logging.create_job_melding('- met foutmeldingen: ' || to_char(l_cnt_ftr_bad, '999G999G990'), 'N');

 bubs_job_logging.create_job_melding('Facturen gewijzigd : ' || to_char(l_cnt_ftr_upd, '999G999G990'), 'N');

 bubs_job_logging.create_job_melding('- met foutmeldingen: ' || to_char(l_cnt_ftr_upd_bad, '999G999G990'), 'N');

 commit;

end;

/

The following steps need to be taken in order to add new invoices:

Load the data to the staging table xxsap_in_ftr from SAP, using an ETL tool like, for example, Kettle (open source), Microsoft Integration Services or Informatica PowerCenter.

Start a query tool, such as SQL * Plus, Quest TOAD or Microsoft Access.

Sign in with a stored procedure call, such as user ‘system’ that has access to all data. It is also possible to choose a different user, but then only data can be loaded from projects to which the respective user has write rights to:

 

begin

 bubs_session.set_session_info

 ( 'xxsap#in_ftr'                       /* Module. Invullen indien bekend. */

 , 'interface'                          /* Actie. Invullen indien bekend. */

 , 'system'                             /* Aanmeldcode van de gebruiker. */

 , 'various'                            /* Momentele query. Invullen indien bekend. */

 , sys_Filter('userenv', 'ip_address') /* IP adres. Invullen indien bekend. */

 , sys_Filter('userenv', 'host')       /* Hostnaam. Invullen indien bekend. */

 , 'n/a'                                /* URL gekoppeld aan verwerking. Invullen indien bekend. */

 , to_char(sysdate,'yyyymmddhh24miss')  /* Sessie ID. Invullen  indien bekend. */

 );

end;

/

 

Create a job by loading bubs_job_logging.create_job.

begin

 bubs_job_logging.job_logging

 ( 'xxsap.exe'                                                           /* Executable bestandsnaam. Invullen indien bekend. */

 , 'Interface die gegevens vanuit SAP overbrengt naar Invantive Estate.' /* Omschrijving. Invullen indien bekend. */

 , 'xxsap_code'                                                          /* Code. Invullen indien bekend. */

 )

 ;

end;

/

 

Process the invoices by loading xxsap#in_ftr.verwerk.

begin

 xxsap#in_ftr.verwerk;

end;

/

 

Check the results of the process:

select *

from   xxsap_in_ftr

where  laad_status = ‘F’

/

X

Important Safety and Usage Information

Intended Use and Limitations: This software, developed by Invantive, is designed to support a variety of business and information technology data processing functions, such as accounting, financial reporting an sales reporting. It is important to note that this software is not designed, tested, or approved for use in environments where malfunction or failure could lead to life-threatening situations or severe physical or environmental damage. This includes, but is not limited to:

  • Nuclear facilities: The software should not be used for operations or functions related to the control, maintenance, or operation of nuclear facilities.
  • Defense and Military Applications: This software is not suitable for use in defense-related applications, including but not limited to weaponry control, military strategy planning, or any other aspects of national defense.
  • Aviation: The software is not intended for use in the operation, navigation, or communication systems of any aircraft or air traffic control environments.
  • Healthcare and Medicine Production: This software should not be utilized for medical device operation, patient data analysis for critical health decisions, pharmaceutical production, or medical research where its failure or malfunction could impact patient health.
  • Chemical and Hazardous Material Handling: This software is not intended for the management, control, or operational aspects of chemical plants or hazardous material handling facilities. Any malfunction in software used in these settings could result in dangerous chemical spills, explosions, or environmental disasters.
  • Transportation and Traffic Control Systems: The software should not be used for the control, operation, or management of transportation systems, including railway signal controls, subway systems, or traffic light management. Malfunctions in such critical systems could lead to severe accidents and endanger public safety.
  • Energy Grid and Utility Control Systems: This software is not designed for the control or operation of energy grid systems, including electrical substations, renewable energy control systems, or water utility control systems. The failure of software in these areas could lead to significant power outages, water supply disruptions, or other public utility failures, potentially endangering communities and causing extensive damage.
  • Other High-Risk Environments: Any other critical infrastructure and environments where a failure of the software could result in significant harm to individuals or the environment.

User Responsibility: Users must ensure that they understand the intended use of the software and refrain from deploying it in any setting that falls outside of its designed purpose. It is the responsibility of the user to assess the suitability of the software for their intended application, especially in any scenarios that might pose a risk to life, health, or the environment.

Disclaimer of Liability: Invantive disclaims any responsibility for damage, injury, or legal consequences resulting from the use or misuse of this software in prohibited or unintended applications.

  
Disclaimer