BAPI In Jave Program

Hi,
  I am a doing a java program to make sales order by useing BAPI BAPI_SALESORDER_CREATEFROMDATA.
  i am not able to handle some condition in jave program before pass to BAPI.
  Can i hanlde that condition through user exit MV45AFZZ.
Thanks

Try providing a little more detail of what you are trying to achieve. "some condition" isn't exactly clear.

Similar Messages

  • Is RFC destination is required for accessing BAPI from java/VB program.

    I am not able to understant that all BAPI are Remote enabled ,but no where I observed that RFC destination is required.
    Can any body tell me exact flow and things step by step.
    Any example/full source code so that I can call from java program.
    I have tried some java code posted here but not able to understand ..
    please provide me setttings also in SAP and java system

    Hi Nagaraju,
    Thank you very much. your post resolve one of my basic need .really appreciate your post.
    I was not able to execute bapi BAPI_MATERIAL_GETLIST but I executed BAPI_PO_GETDETAIL succesfully.
    Still I have 2 doubt.
    [1]. I called BAPI function module(BAPI_PO_GETDETAIL) from simple java program,But I need to call API method ( GETDETAIL) created for this BAPI not direct BAPI function module.
    [2] this is something apart from original topic.
    I have tested your java code in java as well as similar in ECC 6.0
    But I am not getting any output in JAVA program.
    I am getting output in ECC6.0 only when I will take internal table lt_mara[] with header line.
    if I will take separate workarea output is not coming. I think this is the problem in JAVA also.
    Please see the code and tell me where I am wrong.
    REPORT ZTEST1.
    types: begin of ty_mara .
       include STRUCTURE BAPIMATRAM.
    TYPES: END OF ty_mara.
    types: begin of ty_list .
      include STRUCTURE BAPIMATLST.
    TYPES: END OF ty_list.
    data: lt_mara type STANDARD TABLE OF ty_mara with HEADER LINE.
    data: lt_list type STANDARD TABLE OF ty_list,
          ls_list like LINE OF lt_list.
    START-of-SELECTION.
    lt_mara-SIGN = 'I'.
    lt_mara-option = 'EQ'.
    lt_mara-matnr_low = '000000000000000088'. "'P1001087'.
    lt_mara-matnr_high = ''.
    APPEND lt_mara.
    lt_mara-SIGN = 'I'.
    lt_mara-option = 'EQ'.
    lt_mara-matnr_low = '000000000000000089'. "'P1001087'.
    lt_mara-matnr_high = ''.
    APPEND lt_mara.
    CALL FUNCTION 'BAPI_MATERIAL_GETLIST'
    TABLES
      MATNRSELECTION                     = lt_mara
      MATNRLIST                          = lt_list[]   .
    WRITE / 'output:  '.
    LOOP AT lt_list into ls_list .
      write: ls_list .
    ENDLOOP.
    REPORT ZTEST2.
    types: begin of ty_mara .
       include STRUCTURE BAPIMATRAM.
    TYPES: END OF ty_mara.
    types: begin of ty_list .
      include STRUCTURE BAPIMATLST.
    TYPES: END OF ty_list.
    data: lt_mara type STANDARD TABLE OF ty_mara, ">> Without header line
           ls_mara like line of lt_mara.
    data: lt_list type STANDARD TABLE OF ty_list,
          ls_list like LINE OF lt_list.
    START-of-SELECTION.
    ls_mara-SIGN = 'I'.
    ls_mara-option = 'EQ'.
    ls_mara-matnr_low = '000000000000000088'. "'P1001087'.
    ls_mara-matnr_high = ''.
    APPEND ls_list to lt_mara.
    ls_mara-SIGN = 'I'.
    ls_mara-option = 'EQ'.
    ls_mara-matnr_low = '000000000000000089'. "'P1001087'.
    ls_mara-matnr_high = ''.
    APPEND ls_list to lt_mara.
    CALL FUNCTION 'BAPI_MATERIAL_GETLIST'
    TABLES
      MATNRSELECTION                     = lt_mara
      MATNRLIST                          = lt_list[]          .
    WRITE / 'output:  '.
    LOOP AT lt_list into ls_list .
      write: ls_list .
    ENDLOOP.

  • How to call SAP Webservice in standalone java program

    Hi,
    In our Java application, we want to use the SAP Webservices. I dont know much about authentication mechanism used by SAP. Can any one please help me with any sample code how to Call SAP webservice in Standalone Jave Program. I searched alot on the web regarding this, but helpless. Please help me.
    Thanks,
    Mohan

    Hi Mohan,
    You need an account for the ES Workplace. I'm afraid this is not free, e.g. check [SAP NetWeaver, Composition Subscription|https://www.sdn.sap.com/irj/sdn/subscriptions/composition].
    But I thought you wanted to play with a WSDL [you already had at hand|Sample code to access BAPI Web services from JAVA required;?

  • Access SAP Tables from Java Program

    Hi All,
    We have a requirement to integrate attendance portal(which is done in java) with SAP.
    Our problem is how to access SAP tables from a Java program?
    Database is Sybase.
    Please suggest us a good solution.
    Thanks in advance...

    Did you go through Sap Help?
    Calling BAPIs from Java - BAPI User Guide CA-BFA) - SAP Library
    Regards,
    Philip.

  • SAP database updations through Java program

    Hi All,
    From Java program, I want to access SAP database batch RFC
    Please tell me which batch RFC's I have to use for read and update of a table.
    Please also tell me how to find out a batch RFC for a particular table.Is there any way to find it out like BAPI.
    What are the steps and settings ?
    Detailed steps help the requirement.
    Thanks,
    Giri

    Giri,
    Ya...Java APP sents data to XI and XI needs to insert the data into the database.
    Before the next round of data is sent by the Application, Xi should sent back info on the status of the records.
    Is this what you want?
    This will be like I have pointed earlier possible without a BPM. But, make the call from the sending application Synchronous. And then map the JDBC response to the calling aplication.
    But this updation is only possible through XI.
    If i got the requirement wrong can you let me know in more detail, what is it that you are trying?
    Reward if solved

  • About bapi with java

    hi expert's ,
             i wanted to know how we can do bapi with java ...?
             how we can retrive data from java.
              means what will be the coding for java?
                   may be m not able to explain but plz help me with this...
    Regards
    Pankaj.

    Hi
    lets see if this helps.
    Calling BAPIs from Java
    This is an example program for calling a BAPI from the IBM development platform, Access Builder for SAP R/3.
    Detailed program examples are shipped with the Access Builder for R/3.
    Access Builder for SAP R/3
    //Importing the required classes:
    import com.sap.rfc.*;
    import com.sap.rfc.exception.*;
    import com.ibm.sap.bapi.*;
    import com.ibm.sap.bapi.generated.*;
    //Connecting to the R/3 System:
    static private IRfcConnection establishConnection(MiddlewareInfo aMiddlewareInfo)
         throws JRfcRemoteException
         IRfcConnection aConnection = null ;
         ConnectInfo aConnectInfo = null ;
         UserInfo aUserInfo = null ;
         String orbServerName = aMiddlewareInfo.getOrbServerName() ;     
         // Please adjust the values written in UPPERCASE LETTERS
         // in the lines below so that they fit to your needs!
         // If you don't know the correct values ask your system
         // administrator!
         // After correcting these values you should change the
         // <bAdjusted> variable in the following line
         // from "false" to "true".
         // Then you can re-compile ("javac SampleCompanyCode.java") and
         // re-run ("java SampleCompanyCode -conn JNI") this sample...
         boolean bAdjusted = true;
         if (!bAdjusted) {
              throw (new JRfcRfcConnectionException (
                   "Please adjust the Connection-Parameters to your
                     needs! (See method \"establishConnection\")"));
        //Connection information:
         aConnectInfo = new ConnectInfo (
              3,          // int aRfcMode 3=R/3 or 2=R/2
              null,          // String aDestination
              "9.7.12.7",     // String aHostName YOUR  HOSTNAME (e.g. IP-
                         //address)
              0,          // int aSystemNo YOUR SYSTEM-NUMBER
              null,                    // String aGatewayHost
              null,                    // String aGatewayService
              null,                    // String aSystemName
              null,                    // String aGroupName
              null,                    // String aMsgServer
              false,               // Boolean isLoadBalancing
              true);               // Boolean isCheckAuthorization
        //User information:
         aUserInfo = new UserInfo (
              "MUSTER",          // String aUserName,      YOUR USERID
              "IDES",          // String aPassword,      YOUR PASSWORD
              "800",          // String aClient, YOUR CLIENT NUMBER
              "e",                // String aLanguage, YOUR PREFERRED
                                //LANGUAGE
              1103);          // int aCodePage YOUR REQUIRED CODEPAGE     
        //Technical conversion for the selected middleware;
        // Open connection:
         IRfcConnectionFactory aConnectionFactory = FactoryManager.getSingleInstance().getRfcConnectionFactory() ;
         aConnection = aConnectionFactory.createRfcConnection(aConnectInfo, aUserInfo) ;
         aConnection.open() ;
       //Returning the connection:
         return aConnection ;
    //Calling the main method:
    public static void main (java.lang.String[] args)
      //Setting up the connection using the selected middleware:
         MiddlewareInfo aMiddlewareInfo = new MiddlewareInfo(args) ;
         FactoryManager aFactoryManager = FactoryManager.getSingleInstance() ;
         aFactoryManager.setMiddlewareInfo(aMiddlewareInfo) ;
        //Initializing the connection object:      
         IRfcConnection aConnection = null ;
         try
              aConnection = establishConnection(aMiddlewareInfo) ;
         catch (Exception ex)     
              System.out.println("ERROR : Could not create connection : " + ex) ;
              System.exit(-1) ;
         System.out.println("Connection established.");
       // --- TEST CODE (start) -
         try
              printList(aConnection) ;
    //Calling the BAPI:
      //Declare an empty Object ID for the Business Object
      //CompanyCode:          
              objectId = CompanyCode.getEmptyObjectId() ;
         //Entering a value in the object ID:     
              objectId.getKeyField("COMPANYCODEID").setString("1000") ;
         //Instantiate the object CompanyCode with the object ID:
              companyCode = new CompanyCode(objectId) ;     // Create 2nd
             CompanyCode
              System.out.println ("Successfully created new CompanyCode : '" + companyCode + "'") ;
              printDetails(companyCode, aConnection) ;
         // --- TEST CODE (end) -
         catch (Exception ex)
              System.out.println ("Unexpected exception occurred:");
              System.out.println (ex);
    private static void printDetails(CompanyCode companyCode, IRfcConnection connection)
         try     
        //Declare the parameters of the BAPI CompanyCode.GetDetail:
              CompanyCodeGetdetailParams aCompanyCodeGetdetailParams =
                   new CompanyCodeGetdetailParams() ;
        //Aufruf des BAPIs CompanyCode.GetDetail auf die Objektinstanz:
              companyCode.getdetail(connection,      aCompanyCodeGetdetailParams);
          //Splitting the parameter object into its separate components
          //(Struktur):
              Bapi0002_2Structure struct = aCompanyCodeGetdetailParams.getCompanycodeDetail() ;
              System.out.println ("The details of the companycode are : ") ;
          //Splitting the structure into individual fields:          
              System.out.println ("CompCode :           '" + struct.getCompCode()  + "'" );
              System.out.println ("CompName :           '" + struct.getCompName()  + "'" );
              System.out.println ("City1 :              '" + struct.getCity()  + "'" );
              System.out.println ("Country1 :           '" + struct.getCountry() + "'" );
              System.out.println ("Currency :           '" + struct.getCurrency() + "'" );
              System.out.println ("Langu1 :             '" + struct.getLangu() + "'" );
              System.out.println ("ChrtAccts :          '" + struct.getChrtAccts() + "'" );
              System.out.println ("FyVariant :          '" + struct.getFyVariant() + "'" );
              System.out.println ("VatRegNo :           '" + struct.getVatRegNo() + "'" );
              System.out.println ("Company :            '" + struct.getCompany() + "'" );
              System.out.println ("AddrNo :             '" + struct.getAddrNo() + "'" );     
              System.out.println() ;
         catch (Exception ex)     
              System.out.println("Exception in printDetails() : " + ex) ;
         return;
    private static void printList(IRfcConnection connection)
         try     
          //Declaring the parameter object:           
              CompanyCodeGetlistParams aCompanyCodeGetlistParams =
                   new CompanyCodeGetlistParams() ;
          //Actual BAPI call:
              CompanyCode.getlist(connection, aCompanyCodeGetlistParams);
          //Splitting the parameter objects into its separate components
          //(Table):
              Bapi0002_1Table table = aCompanyCodeGetlistParams.getCompanycodeList();
              int rowCount = table.getRowCount() ;
              System.out.println ("Returned table has " + rowCount + " lines.");
          //Evaluating the table row by row:
              for (int i = 0; i < rowCount; i++)
                   Bapi0002_1TableRow row = table.getRow(i) ;
                   System.out.println("\t" + row.getCompCode() + "\t" + row.getCompName()) ;
              System.out.println() ;
         catch (Exception ex)     
              System.out.println("Exception in printList() : " + ex) ;
         return;
    Regards
    Neha

  • Connect Java programs to ABAP generated Web Services

    Hi everybody again!
    This time I write looking for code examples about connecting my java programs in Netweaver to Abap generated web services.
    Could anyone send me any example, please?
    Thanks in advance again!
    Alberto.

    Hi,
    I'm also looking for code examples about connecting Java programs to ABAP generated Webservices... could you, please, send it to me ?
    actually, I need to call bapi from a java Web site.
    (as an SOAP request ...)
    is it better to <b>generate webser</b>vices from the Bapi then call it,
    Or shall i keep the Bapi, and call it from a java webservices based on <b>JCO/RFC</b> calls ...
    what's more efficient ?
    java webservices + Jco calls to the bapi ?
    or direct calls to generated abap webservices ?
    thanks
    saber

  • Executing a webservice through Java Program

    Hi,
    I need to execute an webservice in my java program.
    I also have the requirmnet of executing a BAPI.
    I am using JCO for executing BAPI.
    Can anyone help me out in executing a webservice in Java Program.
    Regards
    Praveen

    Hi,
    Check
    http://help.sap.com/saphelp_nw04/helpdata/en/24/d0ff2f5d872a468b4643e1fa740569/frameset.htm
    and
    http://java.sun.com/developer/technicalArticles/J2EE/j2ee_ws/
    for consuming a WS
    Check http://help.sap.com/saphelp_nw04/helpdata/en/76/4a42f4f16d11d1ad15080009b0fb56/frameset.htm for BAPI called from Java
    Eddy
    PS. Which type of SDN Ubergeek/BPX suit are <a href="/people/eddy.declercq/blog/2007/05/14/which-type-of-sdn-ubergeekbpx-suit-are-you">you</a>?

  • Error while running a Java Program

    Can anyone help me,
    I am getting the following error while running a Java program, Below is the exception thrown, please help.
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RESummer1.run(RESummer1.java:505)
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RECollectCont.run(RECollectCont.java:304)

    Ok, let's see. Write the following class:
    public class Grunt {
      public static void main(String[] args) {
        System.out.println("Hello Mars");
    }Save it as "C:\Grunt.java", compile by typing:
    javac c:\Grunt.javaRun by typing:
    java -classpath "C:\" GruntDoes it say "Hello Mars"? If yes, go back to your program and compare for differences (maybe you used the "package" statement?).
    Regards

  • Running a java program a set number of times

    This is a general question. Is it possible to make a java program run only 5 times for the sake of arguement.
    Basically I want to write a program that will give the user some flexibility when it will actually run another Java program, but I only want them to be able to say "not now' for a set number of times. When the last time comes the other program will launch. I was initially thinking of the Do Whilw loop, but this needs to work when the program is restarted.
    Program starts, it has 5 times it will run before it does something else(doesn't really matter now I think). User takes option "Not Now" and the program ends, but warns the user this will run 4 more times before you will need to do something.
    This process will repeat until the user takes the option "Ok install now" or the time limit expires and the install occurs anyway. Can someone point me in the right direction.

    ok I see so it's like one those programs that you download for free on the internet and they give you a set amount times to use it before you have to pay for it. but in this case when the number of times you use it equals 5 (or when the user clicks ok) a different java app will open automatically.
    My first thought would be to Write a Serialized object to disk using objectOutputStream that stores the number of times the application has been opened. and each time the program runs it checks for the serialized object and then you can do something like what I posted before. of course if were worried about security the user could always look for the object and erase it, if so then I guess we would have to come up with another plan of attack
    Hope this helps

  • Running a java program

    This shows how dumb i am.
    I have a java program all wrote. How can i run it without using the compiler? Can i have a .exe file or something that I just have to click on to run??
    Thanks again
    Agdude

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    C:\Documents and Settings\awaguespack>cd jbproject\untitled1\classes\untitled1
    C:\Documents and Settings\awaguespack\jbproject\untitled1\classes\untitled1>java
    form
    Exception in thread "main" java.lang.NoClassDefFoundError: form (wrong name: unt
    itled1/form)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    C:\Documents and Settings\awaguespack\jbproject\untitled1\classes\untitled1>dir
    Volume in drive C has no label.
    Volume Serial Number is C065-81CA
    Directory of C:\Documents and Settings\awaguespack\jbproject\untitled1\classes\
    untitled1
    07/24/2003 02:21 PM <DIR> .
    07/24/2003 02:21 PM <DIR> ..
    07/24/2003 02:21 PM 7,655 form.class
    1 File(s) 7,655 bytes
    2 Dir(s) 36,031,016,960 bytes free
    C:\Documents and Settings\awaguespack\jbproject\untitled1\classes\untitled1>echo
    %classpath%
    %classpath%
    C:\Documents and Settings\awaguespack\jbproject\untitled1\classes\untitled1>

  • Running a java program at "Start Up"

    Besides running an html file with an applet in it. Are there any simple ways to launch a java program every time the computer is turned on.
    I am not asking for specific directions, but rather just an idea, and i will go find my own guide.

    Well two ideas (if ur on windows) u could try are -
    one, if you had a class file you could simply create a
    batch file on windows that says java <class> and then
    put that batch file in your startup so that the class
    is run at startup or else you could think of modifying
    the registry keys on windows to run this class at
    startup - whichever works for you.Or you could just jar the program up, adding a Main-Class indicator in the manifest, and then add a shortcut to the jar to the startup folder, as someone else stated. Theres little need to go messing around with DOS batch in modern windows.

  • Running a java program from an icon

    I want to run my program from an icon on my desktop. I have a .bat file that I've built a shortcut to and it works.MY GUI program does display and run when I click on the icon. The problem is that the DOS window also shows up behind my GUI.
    Is there anyway to prevent the DOS window from showing? Or is there another way to run a Java program without resorting to a DOS command line or running it through FORTE or another IDD?

    Chris's solution worked well, with one small problem. Once my GUI starts, it takes up the whole screen. Normally when I run it, it appears as a small window.
    not a big problem, I can reduce it easily after it starts. But does anyone know a way to make it come up in the reduced size it norally comes up in when I run it from my IDE?

  • Running a java program via a batch file

    I am unable to run a java program from a batch file that I created.
    spiderpackage.EntryPoint is a class file which I am trying to run with a -v option to output something.What should I do to get the output?
    echo ^<html^>^<body^>
    echo hello^<br^>
    call java spiderpackage.EntryPoint -v
    echo ^</body^>^</html^>

    This has nothing to do with java programming. Have a look at the windows help for the call command.
    The echo <html> stuff doesn't make sense. What's it for?
    The command in you batch file should be:
    java -cp . spiderpackage.EntryPoint -v
    assuming that java is in the system path, and the EntryPoint.class is in a directory called spiderpackage which is a subdirectory of your current working directory

  • Running a Java program at startup in Linux

    Hello
    How do I run a Java program at startup in Linux? I know in Windows I can put a .bat file in C:\Windows\Start Menu\Programs\StartUp\ directory, but in Linux I have no idea how it is done.
    Thank you,
    Mihai

    This is really a Linux question, not Java.
    And then it depends on the version of Linux you are using.
    Maybe this will help, otherwise you should try on a forum for your version of Linux.

Maybe you are looking for

  • Wrong commitment reduction when clearing down payments

    Hi, we are implementing PSM-FM in ERP version 6.0. We have BCS and online payment update activated. We are having problems regarding down payment clearings.The commitment reduction is not working properly. Detailed explanation: 1. We created a purcha

  • IPad 2 16, or 32 GB?

    All I want to do is have a movie or a few tv shows, listen to music (less than 1 GB), take pics, have gaming apps, and text my friends. I've been told that I should get the 32 GB. But I don't wanna pay the extra money. But I will if I'll need it even

  • Assigned Object text not displayed in Multi-Level Notification Lists (QM19)

    Hello Everyone ! Today, i would like to share an issue I am facing in regards to Assigned objects in QM notifications. We are using Assigned objects functionality available in Enterprise Extension PLM, Enhancement Package 4 (EA-PLM 604), to link insp

  • *** Best web settings for an HDV clip online

    Okay, I usually export mpeg-4 but the settings are all different so I have a few questions I'm hoping someone can help me with! Dimmensions of the clip. The footage was shot on a Sony Z1U in HDV. Normally with my 4:3 footage I select a frame size of

  • How to use a link bar or navigation bar for display only?

    My app has a link bar in an Application Control bar that is bound to the view stack of the steps in my application. I would like to use this as a mechanism to show the user which step he is on and how many are left, but NOT to click on it to navigate