Skip to Content
0
Former Member
Oct 04, 2011 at 11:25 AM

SAP B1 With JCO problem

124 Views

I am new one in SAP B1 with Java I want to get the value of Document using this code given below...

package com.cbs.sap;

import com.sap.smb.sbo.api.*;

public class Test

{

public static IDocuments documents;

public static ICompany company;

public static void main(String[] args) throws Exception {

AddOrder();

}

protected static void AddOrder() throws Exception {

SAPJava conn = new SAPJava();

int rc = conn.con();

if (rc == 0) {

try {

System.out .println(documents""company+"----


");

documents = SBOCOMUtil.getDocuments(company,SBOCOMConstants.BoObjectTypes_Document_oOrders,1);

String addr=documents.getAddress();

System.out .println(addr+"-------");

}

catch (Exception e) {

e.printStackTrace();

}

conn = null;

}

}

}

It gives these error msz.....

java.lang.NullPointerException

at com.sap.smb.sbo.api.SBOCOMUtil.newDocuments(Unknown Source)

at com.sap.smb.sbo.api.SBOCOMUtil.getDocuments(Unknown Source)

at com.cbs.sap.Test.AddOrder(Test.java:20)

at com.cbs.sap.Test.main(Test.java:10)

nullnull----


Thanks.