Skip to Content
avatar image
Former Member

Business Partner address code does not work in java for SAP work Manager 6.3

I am getting a null pointer exception for the below java code on AgeUploadntry java.

" Null object loaded from local variable 'ad'."

public void setAddresses(JCO.Table AddressTbl) throws Exception
	{
		String flag = "";
		String methodLabel = "setAddresses";
		ArrayList<Addr> woAddresses = new ArrayList<Addr>();
	try {
			Logger log = new Logger(_user, methodLabel);
			int numRows = AddressTbl.getNumRows();
			log.info("Number of rows: "+ numRows);
			int i =0;
			for (int x = 0; x < numRows; x++) {
				AddressTbl.setRow(x);
				
				String ad_num = AddressTbl.getString("ADDRNUMBER");
	//			int len = ad_num.length();
	//			String res2 = ad_num.substring(2, len);  // Remove leading OR/QM
	//			String res3 = trimLeadingZeros(res2);
				if (ad_num.equals(getAddrNum()))
				{
					flag = "X";
					Addr ad = (Addr) SAPObjectFactory.create(_user, "Addr");


					ad.setProperties(AddressTbl);
				//    ad.setPartnerID(String.valueOf(i));
				    woAddresses.add(ad);
					i++;
		//		String message = Ex12nManager.getMessage(MessageNames.ADDING_OBJECT_TO_ARRAY,
		//					new Object[] {ad.getPartnerFunctionID()});	
			//		log.info(message);						
				}
			}
		}
 		catch (Exception e) {
	 	_user.rethrowException(e, true);
		} 
	
		if (flag == "X") {
			setAddresses( (Addr[])SAPObjectArrayFactory.createSAPObjectArray( woAddresses, SAPObjectFactory.create(_user, "Addr")));
	}
		
	}
	
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 18, 2017 at 03:21 PM

    Hi Sarita,

    Did you edit this code or is this out of the box?

    Thanks,

    Francisco Hernandez

    SAP Product Support

    Add comment
    10|10000 characters needed characters exceeded