SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Downloaden Sie, um offline zu lesen
BAPI
Business Application Programming Interface




                Compiled by Y R Nagesh   1
What is BAPI

   A Business Application Programming Interface is a
precisely defined interface providing access process
and data in Business Applications Systems Such as
SAP R/3




                     Compiled by Y R Nagesh            2
Benefits of BAPI
Can be used in diverse languages / Development Environments
(ABAP, Visual Basic, Java, C++, etc.)
Can be called from diverse platforms (COM, CORBA, Unix)
Reduced development cost
Reduced maintenance cost
“Best-of-both-worlds” approach
   Rich functionality of the R/3 system
   User-specific front-ends


                       Compiled by Y R Nagesh             3
Where BAPIs can be used




          Compiled by Y R Nagesh   4
Return Code Information

Usually a structure, sometimes a table
Data dictionary structures used
    BAPIRETURN
    BAPIRETURN1
    BAPIRET1
    BAPIRET2



                Compiled by Y R Nagesh   5
BAPI Return Structure
 Type Message type
    blank or "S"=Success
   "E"=Error
   "W"=Warning
   "I"=Information
   "A"=Abort
Message                    Message text
Log_No                     Application Log Number
Log_Msg_No                 Application Log Message Serial Number
Message_V1 - V4            Message variables

                       Compiled by Y R Nagesh                      6
SAP transactions
BAPI Business Object Browser (BAPIs only)
SWO1 Business Object Builder (all objects)
SWO2 Business Object Browser (all objects)
SE11 Data Dictionary
SE37 Function Builder




                       Compiled by Y R Nagesh   7
JCO Overview
High-performance JNI-based middleware
Support R/3 3.1H and higher.
Supports inbound and outbound calls.
Supports client pooling.
Supports desktop and web/application server applications.
Multi-platform
Complete and correct code page handling
Easy to install and deploy


                      Compiled by Y R Nagesh                8
Installation and Deployment
Required files in WINNTsystem32:
    librfc32.dll (at least 46D, build 263)
    jRFC11.dll (JDK 1.1)
    jRFC12.dll (JDK 1.2 and 1.3)
Required files in Java class path:
    jCO.jar




                     Compiled by Y R Nagesh   9
BAPI step by step procedure

STEP 1 - Define Structure For The BAPI
STEP 2 - Write Function Module
STEP 3 - Create the API Method Using The BAPI WIZARD
STEP 4 – Final Steps




                        Compiled by Y R Nagesh         10
About the Example
About the Example:
     Front End : Java Servlets (Web Application)
   Web Server : Apache Tomcat


The Servlet takes Vendor number and passes it to the BAPI which
in turn fetches the Vendor information from the LFA1 table and
returns it in BAPIRET2 format to the servlet, the servlet fetches the
data from return structure and displays it.



                            Compiled by Y R Nagesh                      11
Step 1 : Define a Structure for BAPI

 In this step structures for the parameters and tables of the
 function module used for the BAPI are defined.

  USE TCODE : SE11 then Data type -> Structure

   Define the structure Name : Ex: ZVEND
Important note: You will have to define a structure for
every parameter in the BAPI. You cannot use the same
structures used in existing applications because BAPI
structures are frozen when BAPIs are released and then
there are restrictions on changing them.
                         Compiled by Y R Nagesh                 12
Creating a Structure



                                        Enter the
                                        Structure
                                          name




                                    Click on Create
           Compiled by Y R Nagesh
                                        Button 13
Creating a Structure



                                         Select
                                        Structure


  Click on
Check Button




               Compiled by Y R Nagesh               14
Creating a Structure

                                    Activate the
                                     Structure




           Compiled by Y R Nagesh            15
Step 2 : Write Function Module


Each BAPI must have its own function group.
Under the attributes tab remember to select Processing Type Remote
Enabled module, otherwise the function module cannot be invoked via
RFC and used as a BAPI
Import/Export parameters can only be BY VALUE for an RFC enabled
function module




                          Compiled by Y R Nagesh                      16
Creating Function group




          Compiled by Y R Nagesh   17
Creating Function group




          Compiled by Y R Nagesh   18
Creating Function module


                                            Click on
                                             Create




   Click on Save
                   Compiled by Y R Nagesh        19
Creating Function module




Make the function
Remote Enabled




                    Compiled by Y R Nagesh   20
Creating Function module
Import Parameters




                                            Check
                                        “ Pass Value”


                    Compiled by Y R Nagesh              21
Creating Function module
Tables




          Compiled by Y R Nagesh   22
Creating Function module
Source Code




              Compiled by Y R Nagesh   23
Creating Function module
Activate Function Module




                  Activate




                   Compiled by Y R Nagesh   24
Releasing Function module
Release the Function Module




                   Compiled by Y R Nagesh   25
Step 2 : Create the API Method Using
       The BAPI WIZARD
  BAPI wizard is used to expose the remote function module as a BAPI
  Wizard will generate some additional code, so the function module is a valid
  method of the BOR. This allows the BAPI to be called as a workflow method
  in addition to be called by an outside program.
  Each function module corresponds to a method in the BOR


Go to the Business Object Builder SWO1.
  You can either create the new Object type as a subtype of an existing business
object or create a new business object from scratch..


                                Compiled by Y R Nagesh                       26
Create new BAPI Object

                                   USE TCODE
                                   SWO1




                                         Supertype not
                                       required as we are
                                     creating a new Object


                                       * for Cross
                                          Apps
          Compiled by Y R Nagesh                      27
Create new BAPI Object
Note that when you create the business object a standard
interface, an attribute ObjectType and the methods
ExistenceCheck and Display are automatically generated.
These cannot be changed !




                             Compiled by Y R Nagesh        28
Adding API method




         Compiled by Y R Nagesh   29
Adding API method




Click
here
                 Compiled by Y R Nagesh   30
Adding API method




         Compiled by Y R Nagesh   31
Adding API method

       Click Yes




API method
  added



                   Compiled by Y R Nagesh   32
Implementing BAPI Object
Select the BAPI object




                         Compiled by Y R Nagesh   33
Implementing BAPI Object
Change release status To implemented




                         Compiled by Y R Nagesh   34
Releasing BAPI Object
Change release status To released




                          Compiled by Y R Nagesh   35
Implementing API Method
Select the API Method




                        Compiled by Y R Nagesh   36
Implementing API Method
Change release status To implemented




                         Compiled by Y R Nagesh   37
Releasing API Method
Change release status To released




                          Compiled by Y R Nagesh   38
Generating API Method


                               Click on Generate
                                     Button




          Compiled by Y R Nagesh                   39
Configuring Apache Tomcat
               Directory Structure
Jakarta-tomcat-4.1.31
      Webapps
          <User Folder> (Vendor)

                 WEB-INF
                       classes
                       lib
                       Web.xml
                 Index.html
                        Compiled by Y R Nagesh   40
Configuring Apache Tomcat

  classes

     This folder contains all the class files created for successful execution
     of the servlet.

  lib

      This folder contains all the library files required i.e
            sapjco.jar
            servlet.jar
Note: While compiling the java code make sure that the Classpath is set to the above to .jar files


                                        Compiled by Y R Nagesh                              41
Configuring Apache Tomcat
                                                               Web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee“
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd“ version="2.4">
    <servlet>
        <servlet-name>Some internal name</servlet-name>
       <servlet-class>display_vend</servlet-class>
    </servlet>
    <servlet-mapping>                                             Servlet name
        <servlet-name>Some internal name</servlet-name>
        <url-pattern>/NameSeenByUser.do</url-pattern>
     </servlet-mapping>
</web-app>                            Compiled by Y R Nagesh                        42
Servlet Program
import statements required

        import javax.servlet.*;
        import javax.servlet.http.*;
        import java.io.*;
        import com.sap.mw.jco.*;




                      Compiled by Y R Nagesh   43
Servlet Program
public class display_vend extends HttpServlet
 {
  PrintWriter pw;
  public void doPost(HttpServletRequest req, HttpServletResponse res)
     { int num = Integer.parseInt(req.getParameter("rand"));
      String no,name,city,district,po,tele,fax;                                 Unique name for
                                                                             connection pool each
      String SID = "R"+num;
                                                                               time connection is
      String vendno = req.getParameter("vendno");                             established random
                                                                            number is generated in
      IRepository repository; // The repository we will be using               the index.html i.e
                                                                               starting page and
       try {                                                                   value is passed to
                                                                                     servlet
          // Add a connection pool to the specified system
               JCO.addClientPool(SID, 100, "800", "hari", "sapnjoy", "EN", "sapides", "00” );
        // Alias for this pool , Max. number of connections , SAP client , userid
        // password , language , host name

                                      Compiled by Y R Nagesh                                     44
Servlet Program
 repository = JCO.createRepository("MYRepository", SID); // Create a new repository
// Get a function template from the repository
IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZVENDFUN");
// Create a function from the template
JCO.Function function = new JCO.Function(ftemplate);
JCO.Client client = JCO.getClient(SID); // Get a client from the pool
JCO.ParameterList input = function.getImportParameterList(); // Fill in input parameters
input.setValue(vendno, "LIFNR" );
client.execute(function); // Call the remote system
JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
pw = res.getWriter();
pw.println("<html><body bgcolor=#eeeff8><center><hr><h1>Customer Details</h1><hr>");
// Get table containing the data
JCO.Table vend = function.getTableParameterList().getTable("ITAB");
                                      Compiled by Y R Nagesh                               45
Servlet Program
for (int i = 0; i < vend.getNumRows(); i++)
  {
      vend.setRow(i);
      no = vend.getString("LIFNR");
   name = vend.getString("NAME1");
   city = vend.getString("ORT01") ;
   district = vend.getString("ORT02") ;
  po = vend.getString("PFACH") ;
  tele = vend.getString("TELF1") ;
  fax = vend.getString("TELFX") ;
  // Fetching data from SAP database and storing in local variables



                               Compiled by Y R Nagesh                 46
Servlet Program
pw.println("<table border=1><tr><td><B>Vendor Number</B></td><td>"+no+ "</td></tr><tr><td>" +
              "<B>Customer Name</B></td><td>"+name+ "</td></tr><tr><td>" +
              "<B>Customer Address</B></td><td></tr>"+
             "<tr><td>         </td><td><B>City</B></td><td>"+city+"</td></tr>" +
             "<tr><td>         </td><td><B>District</B></td><td>"+district+"</td></tr>"+
             "<tr><td>         </td><td><B>PO Box</B></td><td>"+po+"</td></tr>"+
             "<tr><td><B>Telephone</B></td><td>"+tele+"</td></tr>"+
             "<tr><td><B>TeleFax</B></td><td>"+fax+"</td></tr></table>" );
pw.println("<form name=form1 action='index.html' method=get><input type=submit
value='Back'></form></center></body></html>");       }}
catch (Exception E)
         {
             System.out.println(E);
         }
   } }
                                            Compiled by Y R Nagesh                         47
Index.html
<html>
<head><script language="JavaScript">
function randomnumber() {
    var r=Math.floor(Math.random()*1111)
    if (r!=0) document.form1.rand.value=r; }
</script>
</head>
<body bgcolor=#eeeff8 onLoad="javascript:randomnumber();">
<center><hr><h1>Enter the Vendor Number</h1><hr>
</center><form name=form1 action="NameSeenByUser.do" method=post>
<center><input type=text name=vendno>
<input type=submit value="Submit">
<input type=hidden name="rand"></center>
</form></body></html>
                                   Compiled by Y R Nagesh           48
Output




         Compiled by Y R Nagesh   49
Output




         Compiled by Y R Nagesh   50

Weitere ähnliche Inhalte

Was ist angesagt?

Find out userexits in sap
Find out userexits in sapFind out userexits in sap
Find out userexits in sapDau Thanh Hai
 
08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overview08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overviewsapdocs. info
 
Abap package concept
Abap package conceptAbap package concept
Abap package conceptTobias Trapp
 
Workbench and customising request
Workbench and customising requestWorkbench and customising request
Workbench and customising requestlakshmi rajkumar
 
Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1Panduka Bandara
 
EP_LE_E2617_Replenishment Rebrand of NBB TO MFB inside BWH for multiple aff...
EP_LE_E2617_Replenishment Rebrand of  NBB TO MFB inside BWH for  multiple aff...EP_LE_E2617_Replenishment Rebrand of  NBB TO MFB inside BWH for  multiple aff...
EP_LE_E2617_Replenishment Rebrand of NBB TO MFB inside BWH for multiple aff...Ronen Madar
 
Oracle inventory R12 Setup Guide
Oracle inventory R12 Setup GuideOracle inventory R12 Setup Guide
Oracle inventory R12 Setup GuideAhmed Elshayeb
 
Blue Phoenix Idms Migration
Blue Phoenix Idms MigrationBlue Phoenix Idms Migration
Blue Phoenix Idms MigrationGilShalit
 
People soft workflow by surya 2
People soft workflow by surya 2People soft workflow by surya 2
People soft workflow by surya 2meghamystic
 
Building A Complex Birt Report
Building A Complex Birt ReportBuilding A Complex Birt Report
Building A Complex Birt Reportsvhovater
 

Was ist angesagt? (20)

Find out userexits in sap
Find out userexits in sapFind out userexits in sap
Find out userexits in sap
 
08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overview08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overview
 
Abap package concept
Abap package conceptAbap package concept
Abap package concept
 
Badis
Badis Badis
Badis
 
Workbench and customising request
Workbench and customising requestWorkbench and customising request
Workbench and customising request
 
Module pool programming
Module pool programmingModule pool programming
Module pool programming
 
Lsmw
LsmwLsmw
Lsmw
 
Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1
 
B adi
B adiB adi
B adi
 
Dialog programming ABAP
Dialog programming ABAPDialog programming ABAP
Dialog programming ABAP
 
Workflow for XPages
Workflow for XPagesWorkflow for XPages
Workflow for XPages
 
EP_LE_E2617_Replenishment Rebrand of NBB TO MFB inside BWH for multiple aff...
EP_LE_E2617_Replenishment Rebrand of  NBB TO MFB inside BWH for  multiple aff...EP_LE_E2617_Replenishment Rebrand of  NBB TO MFB inside BWH for  multiple aff...
EP_LE_E2617_Replenishment Rebrand of NBB TO MFB inside BWH for multiple aff...
 
Bi
BiBi
Bi
 
Sap abap tutorials
Sap abap tutorialsSap abap tutorials
Sap abap tutorials
 
Oracle inventory R12 Setup Guide
Oracle inventory R12 Setup GuideOracle inventory R12 Setup Guide
Oracle inventory R12 Setup Guide
 
Abap proxies
Abap proxiesAbap proxies
Abap proxies
 
Blue Phoenix Idms Migration
Blue Phoenix Idms MigrationBlue Phoenix Idms Migration
Blue Phoenix Idms Migration
 
People soft workflow by surya 2
People soft workflow by surya 2People soft workflow by surya 2
People soft workflow by surya 2
 
Gokul bok
Gokul bokGokul bok
Gokul bok
 
Building A Complex Birt Report
Building A Complex Birt ReportBuilding A Complex Birt Report
Building A Complex Birt Report
 

Andere mochten auch

Step by-step creation of a bapi in detailed steps with scr…
Step by-step creation of a bapi in detailed steps with scr…Step by-step creation of a bapi in detailed steps with scr…
Step by-step creation of a bapi in detailed steps with scr…sapsarath612
 
Abap function module help
Abap function module helpAbap function module help
Abap function module helpKranthi Kumar
 
Chapter 05 adding structures1
Chapter 05 adding structures1Chapter 05 adding structures1
Chapter 05 adding structures1Kranthi Kumar
 
Chapter 04 abap dictionary tables in relational databases1
Chapter 04 abap dictionary tables in relational databases1Chapter 04 abap dictionary tables in relational databases1
Chapter 04 abap dictionary tables in relational databases1Kranthi Kumar
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on lineMilind Patil
 
Chapter 07 abap dictionary changes1
Chapter 07 abap dictionary changes1Chapter 07 abap dictionary changes1
Chapter 07 abap dictionary changes1Kranthi Kumar
 
Chapter 02 abap dictionary objects1
Chapter 02 abap dictionary objects1Chapter 02 abap dictionary objects1
Chapter 02 abap dictionary objects1Kranthi Kumar
 
Chapter 06 abap repository information system1
Chapter 06 abap  repository information system1Chapter 06 abap  repository information system1
Chapter 06 abap repository information system1Kranthi Kumar
 
Chapter 01 overview of abap dictionary1
Chapter 01 overview of abap dictionary1Chapter 01 overview of abap dictionary1
Chapter 01 overview of abap dictionary1Kranthi Kumar
 
Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1Kranthi Kumar
 
Chapter 10 online help & documentation1
Chapter 10 online help & documentation1Chapter 10 online help & documentation1
Chapter 10 online help & documentation1Kranthi Kumar
 
Fi enhancement technique how-to-guide on the usage of business transaction ...
Fi enhancement technique   how-to-guide on the usage of business transaction ...Fi enhancement technique   how-to-guide on the usage of business transaction ...
Fi enhancement technique how-to-guide on the usage of business transaction ...Kranthi Kumar
 
0106 debugging
0106 debugging0106 debugging
0106 debuggingvkyecc1
 
Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systemsKranthi Kumar
 
Sujith ~ cross applications
Sujith ~ cross applicationsSujith ~ cross applications
Sujith ~ cross applicationsKranthi Kumar
 

Andere mochten auch (20)

Step by-step creation of a bapi in detailed steps with scr…
Step by-step creation of a bapi in detailed steps with scr…Step by-step creation of a bapi in detailed steps with scr…
Step by-step creation of a bapi in detailed steps with scr…
 
Abap function module help
Abap function module helpAbap function module help
Abap function module help
 
Ale Idoc
Ale IdocAle Idoc
Ale Idoc
 
Chapter 05 adding structures1
Chapter 05 adding structures1Chapter 05 adding structures1
Chapter 05 adding structures1
 
Chapter 04 abap dictionary tables in relational databases1
Chapter 04 abap dictionary tables in relational databases1Chapter 04 abap dictionary tables in relational databases1
Chapter 04 abap dictionary tables in relational databases1
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on line
 
Chapter 07 abap dictionary changes1
Chapter 07 abap dictionary changes1Chapter 07 abap dictionary changes1
Chapter 07 abap dictionary changes1
 
Chapter 02 abap dictionary objects1
Chapter 02 abap dictionary objects1Chapter 02 abap dictionary objects1
Chapter 02 abap dictionary objects1
 
data modelling1
 data modelling1 data modelling1
data modelling1
 
cardinality1
cardinality1cardinality1
cardinality1
 
Chapter 06 abap repository information system1
Chapter 06 abap  repository information system1Chapter 06 abap  repository information system1
Chapter 06 abap repository information system1
 
Chapter 01 overview of abap dictionary1
Chapter 01 overview of abap dictionary1Chapter 01 overview of abap dictionary1
Chapter 01 overview of abap dictionary1
 
05 internal tables
05 internal tables05 internal tables
05 internal tables
 
Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1
 
Chapter 10 online help & documentation1
Chapter 10 online help & documentation1Chapter 10 online help & documentation1
Chapter 10 online help & documentation1
 
Fi enhancement technique how-to-guide on the usage of business transaction ...
Fi enhancement technique   how-to-guide on the usage of business transaction ...Fi enhancement technique   how-to-guide on the usage of business transaction ...
Fi enhancement technique how-to-guide on the usage of business transaction ...
 
0106 debugging
0106 debugging0106 debugging
0106 debugging
 
Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systems
 
Sujith ~ cross applications
Sujith ~ cross applicationsSujith ~ cross applications
Sujith ~ cross applications
 
IDOCS ALE
IDOCS ALEIDOCS ALE
IDOCS ALE
 

Ähnlich wie Bapi jco[1]

GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.pptTabassumMaktum
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoMohd Safian
 
Vladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable ModuleVladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable ModuleZabbix
 
Beyond the Loadable Module
Beyond the Loadable ModuleBeyond the Loadable Module
Beyond the Loadable ModuleVladimir Ulogov
 
Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)Nabi Zamani
 
Net Beans61 Platform
Net Beans61 PlatformNet Beans61 Platform
Net Beans61 Platformsatyajit_t
 
WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1WSO2
 
Continuous delivery from the trenches
Continuous delivery from the trenchesContinuous delivery from the trenches
Continuous delivery from the trenchesMichael Medin
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...Paul Jensen
 
Setting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntuSetting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntukesavan N B
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Waysmalltown
 
Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)Kranthi Kumar
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications Concetto Labs
 
Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...Fwdays
 
Project Presentation on Advance Java
Project Presentation on Advance JavaProject Presentation on Advance Java
Project Presentation on Advance JavaVikas Goyal
 
React Alicante - React Redux a development workflow
React Alicante - React Redux a development workflowReact Alicante - React Redux a development workflow
React Alicante - React Redux a development workflowBraulio Diez Botella
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdfBOSC Tech Labs
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Bohdan Dovhań
 

Ähnlich wie Bapi jco[1] (20)

GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.ppt
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs Railo
 
Vladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable ModuleVladimir Ulogov - Beyond the Loadable Module
Vladimir Ulogov - Beyond the Loadable Module
 
Beyond the Loadable Module
Beyond the Loadable ModuleBeyond the Loadable Module
Beyond the Loadable Module
 
Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)
 
Net Beans61 Platform
Net Beans61 PlatformNet Beans61 Platform
Net Beans61 Platform
 
WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1
 
Continuous delivery from the trenches
Continuous delivery from the trenchesContinuous delivery from the trenches
Continuous delivery from the trenches
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
AEM 6.X (With Basics) Training Syllabus
AEM 6.X (With Basics) Training SyllabusAEM 6.X (With Basics) Training Syllabus
AEM 6.X (With Basics) Training Syllabus
 
Setting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntuSetting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntu
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
 
Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 
Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw "Indexing and searching NuGet.org with Azure Functions and S...
 
Project Presentation on Advance Java
Project Presentation on Advance JavaProject Presentation on Advance Java
Project Presentation on Advance Java
 
React Alicante - React Redux a development workflow
React Alicante - React Redux a development workflowReact Alicante - React Redux a development workflow
React Alicante - React Redux a development workflow
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance
 
Dynamic binding
Dynamic bindingDynamic binding
Dynamic binding
 

Kürzlich hochgeladen

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Kürzlich hochgeladen (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Bapi jco[1]

  • 1. BAPI Business Application Programming Interface Compiled by Y R Nagesh 1
  • 2. What is BAPI A Business Application Programming Interface is a precisely defined interface providing access process and data in Business Applications Systems Such as SAP R/3 Compiled by Y R Nagesh 2
  • 3. Benefits of BAPI Can be used in diverse languages / Development Environments (ABAP, Visual Basic, Java, C++, etc.) Can be called from diverse platforms (COM, CORBA, Unix) Reduced development cost Reduced maintenance cost “Best-of-both-worlds” approach Rich functionality of the R/3 system User-specific front-ends Compiled by Y R Nagesh 3
  • 4. Where BAPIs can be used Compiled by Y R Nagesh 4
  • 5. Return Code Information Usually a structure, sometimes a table Data dictionary structures used BAPIRETURN BAPIRETURN1 BAPIRET1 BAPIRET2 Compiled by Y R Nagesh 5
  • 6. BAPI Return Structure Type Message type blank or "S"=Success "E"=Error "W"=Warning "I"=Information "A"=Abort Message Message text Log_No Application Log Number Log_Msg_No Application Log Message Serial Number Message_V1 - V4 Message variables Compiled by Y R Nagesh 6
  • 7. SAP transactions BAPI Business Object Browser (BAPIs only) SWO1 Business Object Builder (all objects) SWO2 Business Object Browser (all objects) SE11 Data Dictionary SE37 Function Builder Compiled by Y R Nagesh 7
  • 8. JCO Overview High-performance JNI-based middleware Support R/3 3.1H and higher. Supports inbound and outbound calls. Supports client pooling. Supports desktop and web/application server applications. Multi-platform Complete and correct code page handling Easy to install and deploy Compiled by Y R Nagesh 8
  • 9. Installation and Deployment Required files in WINNTsystem32: librfc32.dll (at least 46D, build 263) jRFC11.dll (JDK 1.1) jRFC12.dll (JDK 1.2 and 1.3) Required files in Java class path: jCO.jar Compiled by Y R Nagesh 9
  • 10. BAPI step by step procedure STEP 1 - Define Structure For The BAPI STEP 2 - Write Function Module STEP 3 - Create the API Method Using The BAPI WIZARD STEP 4 – Final Steps Compiled by Y R Nagesh 10
  • 11. About the Example About the Example: Front End : Java Servlets (Web Application) Web Server : Apache Tomcat The Servlet takes Vendor number and passes it to the BAPI which in turn fetches the Vendor information from the LFA1 table and returns it in BAPIRET2 format to the servlet, the servlet fetches the data from return structure and displays it. Compiled by Y R Nagesh 11
  • 12. Step 1 : Define a Structure for BAPI In this step structures for the parameters and tables of the function module used for the BAPI are defined. USE TCODE : SE11 then Data type -> Structure Define the structure Name : Ex: ZVEND Important note: You will have to define a structure for every parameter in the BAPI. You cannot use the same structures used in existing applications because BAPI structures are frozen when BAPIs are released and then there are restrictions on changing them. Compiled by Y R Nagesh 12
  • 13. Creating a Structure Enter the Structure name Click on Create Compiled by Y R Nagesh Button 13
  • 14. Creating a Structure Select Structure Click on Check Button Compiled by Y R Nagesh 14
  • 15. Creating a Structure Activate the Structure Compiled by Y R Nagesh 15
  • 16. Step 2 : Write Function Module Each BAPI must have its own function group. Under the attributes tab remember to select Processing Type Remote Enabled module, otherwise the function module cannot be invoked via RFC and used as a BAPI Import/Export parameters can only be BY VALUE for an RFC enabled function module Compiled by Y R Nagesh 16
  • 17. Creating Function group Compiled by Y R Nagesh 17
  • 18. Creating Function group Compiled by Y R Nagesh 18
  • 19. Creating Function module Click on Create Click on Save Compiled by Y R Nagesh 19
  • 20. Creating Function module Make the function Remote Enabled Compiled by Y R Nagesh 20
  • 21. Creating Function module Import Parameters Check “ Pass Value” Compiled by Y R Nagesh 21
  • 22. Creating Function module Tables Compiled by Y R Nagesh 22
  • 23. Creating Function module Source Code Compiled by Y R Nagesh 23
  • 24. Creating Function module Activate Function Module Activate Compiled by Y R Nagesh 24
  • 25. Releasing Function module Release the Function Module Compiled by Y R Nagesh 25
  • 26. Step 2 : Create the API Method Using The BAPI WIZARD BAPI wizard is used to expose the remote function module as a BAPI Wizard will generate some additional code, so the function module is a valid method of the BOR. This allows the BAPI to be called as a workflow method in addition to be called by an outside program. Each function module corresponds to a method in the BOR Go to the Business Object Builder SWO1. You can either create the new Object type as a subtype of an existing business object or create a new business object from scratch.. Compiled by Y R Nagesh 26
  • 27. Create new BAPI Object USE TCODE SWO1 Supertype not required as we are creating a new Object * for Cross Apps Compiled by Y R Nagesh 27
  • 28. Create new BAPI Object Note that when you create the business object a standard interface, an attribute ObjectType and the methods ExistenceCheck and Display are automatically generated. These cannot be changed ! Compiled by Y R Nagesh 28
  • 29. Adding API method Compiled by Y R Nagesh 29
  • 30. Adding API method Click here Compiled by Y R Nagesh 30
  • 31. Adding API method Compiled by Y R Nagesh 31
  • 32. Adding API method Click Yes API method added Compiled by Y R Nagesh 32
  • 33. Implementing BAPI Object Select the BAPI object Compiled by Y R Nagesh 33
  • 34. Implementing BAPI Object Change release status To implemented Compiled by Y R Nagesh 34
  • 35. Releasing BAPI Object Change release status To released Compiled by Y R Nagesh 35
  • 36. Implementing API Method Select the API Method Compiled by Y R Nagesh 36
  • 37. Implementing API Method Change release status To implemented Compiled by Y R Nagesh 37
  • 38. Releasing API Method Change release status To released Compiled by Y R Nagesh 38
  • 39. Generating API Method Click on Generate Button Compiled by Y R Nagesh 39
  • 40. Configuring Apache Tomcat Directory Structure Jakarta-tomcat-4.1.31 Webapps <User Folder> (Vendor) WEB-INF classes lib Web.xml Index.html Compiled by Y R Nagesh 40
  • 41. Configuring Apache Tomcat classes This folder contains all the class files created for successful execution of the servlet. lib This folder contains all the library files required i.e sapjco.jar servlet.jar Note: While compiling the java code make sure that the Classpath is set to the above to .jar files Compiled by Y R Nagesh 41
  • 42. Configuring Apache Tomcat Web.xml <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee“ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd“ version="2.4"> <servlet> <servlet-name>Some internal name</servlet-name> <servlet-class>display_vend</servlet-class> </servlet> <servlet-mapping> Servlet name <servlet-name>Some internal name</servlet-name> <url-pattern>/NameSeenByUser.do</url-pattern> </servlet-mapping> </web-app> Compiled by Y R Nagesh 42
  • 43. Servlet Program import statements required import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import com.sap.mw.jco.*; Compiled by Y R Nagesh 43
  • 44. Servlet Program public class display_vend extends HttpServlet { PrintWriter pw; public void doPost(HttpServletRequest req, HttpServletResponse res) { int num = Integer.parseInt(req.getParameter("rand")); String no,name,city,district,po,tele,fax; Unique name for connection pool each String SID = "R"+num; time connection is String vendno = req.getParameter("vendno"); established random number is generated in IRepository repository; // The repository we will be using the index.html i.e starting page and try { value is passed to servlet // Add a connection pool to the specified system JCO.addClientPool(SID, 100, "800", "hari", "sapnjoy", "EN", "sapides", "00” ); // Alias for this pool , Max. number of connections , SAP client , userid // password , language , host name Compiled by Y R Nagesh 44
  • 45. Servlet Program repository = JCO.createRepository("MYRepository", SID); // Create a new repository // Get a function template from the repository IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZVENDFUN"); // Create a function from the template JCO.Function function = new JCO.Function(ftemplate); JCO.Client client = JCO.getClient(SID); // Get a client from the pool JCO.ParameterList input = function.getImportParameterList(); // Fill in input parameters input.setValue(vendno, "LIFNR" ); client.execute(function); // Call the remote system JCO.Structure ret = function.getExportParameterList().getStructure("RETURN"); pw = res.getWriter(); pw.println("<html><body bgcolor=#eeeff8><center><hr><h1>Customer Details</h1><hr>"); // Get table containing the data JCO.Table vend = function.getTableParameterList().getTable("ITAB"); Compiled by Y R Nagesh 45
  • 46. Servlet Program for (int i = 0; i < vend.getNumRows(); i++) { vend.setRow(i); no = vend.getString("LIFNR"); name = vend.getString("NAME1"); city = vend.getString("ORT01") ; district = vend.getString("ORT02") ; po = vend.getString("PFACH") ; tele = vend.getString("TELF1") ; fax = vend.getString("TELFX") ; // Fetching data from SAP database and storing in local variables Compiled by Y R Nagesh 46
  • 47. Servlet Program pw.println("<table border=1><tr><td><B>Vendor Number</B></td><td>"+no+ "</td></tr><tr><td>" + "<B>Customer Name</B></td><td>"+name+ "</td></tr><tr><td>" + "<B>Customer Address</B></td><td></tr>"+ "<tr><td> </td><td><B>City</B></td><td>"+city+"</td></tr>" + "<tr><td> </td><td><B>District</B></td><td>"+district+"</td></tr>"+ "<tr><td> </td><td><B>PO Box</B></td><td>"+po+"</td></tr>"+ "<tr><td><B>Telephone</B></td><td>"+tele+"</td></tr>"+ "<tr><td><B>TeleFax</B></td><td>"+fax+"</td></tr></table>" ); pw.println("<form name=form1 action='index.html' method=get><input type=submit value='Back'></form></center></body></html>"); }} catch (Exception E) { System.out.println(E); } } } Compiled by Y R Nagesh 47
  • 48. Index.html <html> <head><script language="JavaScript"> function randomnumber() { var r=Math.floor(Math.random()*1111) if (r!=0) document.form1.rand.value=r; } </script> </head> <body bgcolor=#eeeff8 onLoad="javascript:randomnumber();"> <center><hr><h1>Enter the Vendor Number</h1><hr> </center><form name=form1 action="NameSeenByUser.do" method=post> <center><input type=text name=vendno> <input type=submit value="Submit"> <input type=hidden name="rand"></center> </form></body></html> Compiled by Y R Nagesh 48
  • 49. Output Compiled by Y R Nagesh 49
  • 50. Output Compiled by Y R Nagesh 50