Root creation problem through jndi api
Hi all,
i am using the following code to create the context.
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.NameAlreadyBoundException;
import javax.naming.directory.*;
import java.util.*;
public class MakeContext {
final static String ldapServerName = "xxxxx";
final static String rootContext = "o=jndiTest";
public static void main( String[] args ) {
// set up environment to access the server
Properties env = new Properties();
env.put( Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory" );
env.put( Context.PROVIDER_URL, "ldap://" + ldapServerName + ":11680/dc=seamonkey, dc=bigfish, dc=lan" );
//env.put( Context.SECURITY_PRINCIPAL, rootdn );
//env.put( Context.SECURITY_CREDENTIALS, rootpass );
try {
// obtain initial directory context using the
// environment
DirContext ctx = new InitialDirContext( env );
// now, create the root context, which is just a
// subcontext
// of this initial directory context.
ctx.createSubcontext( rootContext );
} catch ( NameAlreadyBoundException nabe ) {
System.err.println( rootContext + " has already been bound!" );
} catch ( Exception e ) {
System.err.println( e );
But getting the following error.
javax.naming.InvalidNameException: o=jndiTest: [LDAP: error code 34 - Invalid DN]; remaining name 'o=jndiTest'
please anyone help on the same.
thanks in advance
Rama
Hi all,
i am using the following code to create the context.
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.NameAlreadyBoundException;
import javax.naming.directory.*;
import java.util.*;
public class MakeContext {
final static String ldapServerName = "xxxxx";
final static String rootContext = "o=jndiTest";
public static void main( String[] args ) {
// set up environment to access the server
Properties env = new Properties();
env.put( Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory" );
env.put( Context.PROVIDER_URL, "ldap://" + ldapServerName + ":11680/dc=seamonkey, dc=bigfish, dc=lan" );
//env.put( Context.SECURITY_PRINCIPAL, rootdn );
//env.put( Context.SECURITY_CREDENTIALS, rootpass );
try {
// obtain initial directory context using the
// environment
DirContext ctx = new InitialDirContext( env );
// now, create the root context, which is just a
// subcontext
// of this initial directory context.
ctx.createSubcontext( rootContext );
} catch ( NameAlreadyBoundException nabe ) {
System.err.println( rootContext + " has already been bound!" );
} catch ( Exception e ) {
System.err.println( e );
But getting the following error.
javax.naming.InvalidNameException: o=jndiTest: [LDAP: error code 34 - Invalid DN]; remaining name 'o=jndiTest'
please anyone help on the same.
thanks in advance
Rama
Similar Messages
-
Hi all,
i am using the following code to create the context.
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.NameAlreadyBoundException;
import javax.naming.directory.*;
import java.util.*;
public class MakeContext {
final static String ldapServerName = "xxxxx";
final static String rootContext = "o=jndiTest";
public static void main( String[] args ) {
// set up environment to access the server
Properties env = new Properties();
env.put( Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory" );
env.put( Context.PROVIDER_URL, "ldap://" + ldapServerName + ":11680/dc=seamonkey, dc=bigfish, dc=lan" );
//env.put( Context.SECURITY_PRINCIPAL, rootdn );
//env.put( Context.SECURITY_CREDENTIALS, rootpass );
try {
// obtain initial directory context using the
// environment
DirContext ctx = new InitialDirContext( env );
// now, create the root context, which is just a
// subcontext
// of this initial directory context.
ctx.createSubcontext( rootContext );
} catch ( NameAlreadyBoundException nabe ) {
System.err.println( rootContext + " has already been bound!" );
} catch ( Exception e ) {
System.err.println( e );
But getting the following error.
javax.naming.InvalidNameException: o=jndiTest: [LDAP: error code 34 - Invalid DN]; remaining name 'o=jndiTest'
please anyone help on the same.
thanks in advance
RamaHello,
Try creating few organization units/position under your new root id. Then, it should show up in structure search.
Thanks
Ashutosh -
Problem in Creating Default Form Through DI API
Hi All,
I am using the below code to create UDO and make it as Default Form through DI API. But the Default Form property is not getting set, that is the Default Form is not being created. The UDO is getting created. Any help is appreciated.
// Verify that UDO is defined
if (!(oCreateUDO.UDOExist(oCompany, "WEB_USER")))
SAPbobsCOM.UserObjectsMD MyUDO = (SAPbobsCOM.UserObjectsMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD);
//Set Services
MyUDO.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES;
MyUDO.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES;
MyUDO.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES;
MyUDO.CanFind = SAPbobsCOM.BoYesNoEnum.tYES;
MyUDO.CanClose = SAPbobsCOM.BoYesNoEnum.tYES;
MyUDO.CanLog = SAPbobsCOM.BoYesNoEnum.tYES;
MyUDO.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO;
//MyUDO.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES;
MyUDO.Code = "WEB_USER";
MyUDO.Name = "Define Portal User";
MyUDO.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData;
MyUDO.TableName = "PORUSR";
MyUDO.FindColumns.ColumnAlias = "Code";
MyUDO.FindColumns.ColumnDescription = "Code";
MyUDO.FindColumns.Add();
MyUDO.FindColumns.ColumnAlias = "Name";
MyUDO.FindColumns.ColumnDescription = "Name";
MyUDO.FindColumns.Add();
MyUDO.FindColumns.ColumnAlias = "U_name";
MyUDO.FindColumns.ColumnDescription = "Name";
MyUDO.FindColumns.Add();
MyUDO.FindColumns.ColumnAlias = "U_Email";
MyUDO.FindColumns.ColumnDescription = "Email";
MyUDO.FindColumns.Add();
MyUDO.FindColumns.ColumnAlias = "U_Status";
MyUDO.FindColumns.ColumnDescription = "Status";
MyUDO.FindColumns.Add();
MyUDO.FindColumns.ColumnAlias = "U_TAG";
MyUDO.FindColumns.ColumnDescription = "TAG";
MyUDO.FindColumns.Add();
MyUDO.FindColumns.ColumnAlias = "U_bp";
MyUDO.FindColumns.ColumnDescription = "BP Code";
MyUDO.FindColumns.Add();
MyUDO.FindColumns.ColumnAlias = "U_password";
MyUDO.FindColumns.ColumnDescription = "Password";
MyUDO.FindColumns.Add();
if (MyUDO.Add() != 0)
MessageBox.Show("Failed to add UDO");
Thanks and Regards,
Noor HussainDear All,
Thanks a lot. I had forgot to add the form columns to the UDO object while creating UDO.
Regards,
Noor Hussain
Edited by: noor_023 on Mar 1, 2012 11:54 AM -
Problem In Creating Sales Order Through DI API
Hi
I am Creating The Sales Order Through DI API.
the Error Is Coming - " [OACT] , 'No matching records found (ODBC -2028)'"
anyone can help me solving it.Hi vivek,
Have you tried adding the same document with the client ?
OACT is the accounts table and this error message typically indicates that there is an account parameter missing somewhere in the system.
Possible causes include:
- you are using a tax group or warehouse which does not have all the required accounts set
- There is a price rounding and the rounding price account has not been set in the account settings
- etc.
The first things I would check include the tax group settings and the G/L Account determination settings.
Henry -
Anybody know of a way to add or modify Accounting Periods through an API?
I am trying to import and modify Inventory Accounting Periods. Does anybody know of a way to do this through an API? I can't find an API to do this so I'm thinking that I might have to a direct insert. Thanks for the help.
I think that I have figured out a way for 3/4 to be solved. Some background on the problem is that the two Oracle instance are supposed to be in sync with one another. I am currently working on syncing the GL periods and INV periods. For GL periods, I have found GL_PERIODS_PKG.Load_Row for creation and GL_PERIODS_PKG.update_row for opening of a period. For INV, I am going to use CST_ACCOUNTPERIOD_PUB.open_period to do opening however I can't find a seeded creation procedure.
-
Room creation error using Room API
Hi Experts.
We're triying to create a collaboration room through Room API
As a previous step a standard template copy was created (SAP_Information_Site_2) to be used in the room creation through API.
In this template we defined one parameter (FolderPath) which sets the KM navigation path of a specific folder and then we made the mappings of this parameter into the views used by template to show documents.
When Room is created using "Room creation wizard" we set name, description, category, template (SAP_Information_Site_2), FolderPath, etc. this way everything is OK.
The problem is triying to create it when generating the room througn a Webdynpro using Room API, afeter we set all same parameters the room is created with no errors. but despite having put all the parameters like those we place using creation wizard the Room API created Room shows the default folderpath and not we have set through API.
We are able to compare both rooms and they shows same properties except the folderpath.
Here the used code:
private void createRoom(){
String strTemplateName = "Techint_Template";
String strRoleName = "Admin";
String strCategory = "Default_Category";
//Get the Rooms 6.0 API Portal Service
IRooms roomsAPI = (IRooms)PortalRuntime.getRuntimeResources().
getService(IRooms.PORTAL_SERVICE_ID);
//Get Template Related Infos
ITemplate template = null;
IRoomRole role1 = null;
IRoomCategoryFactory cf = roomsAPI.getRoomCategoryFactory();
try {
template = roomsAPI.getRoomTemplate(strTemplateName);
role1 = template.getRoomRole(strRoleName);
//Get an empty RoomInfo object
IRoomInfo roomInfo = roomsAPI.getRoomCreationInfo();
//Fill RoomInfo object with values
roomInfo.setName(wdContext.currentFormDataElement().getProjectCode().trim()+" - "
+wdContext.currentFormDataElement().getRevisionNumber());
String strDescription = wdContext.currentFormDataElement().getTechintDocument();
if (strDescription!=null && strDescription.length()>0)
roomInfo.setDescription(wdContext.currentFormDataElement().getTechintDocument());
else
roomInfo.setDescription(wdContext.currentFormDataElement().getProjectCode().trim()+" - "
+wdContext.currentFormDataElement().getRevisionNumber());
roomInfo.setTemplateName(strTemplateName);
roomInfo.addRoomParameter("FolderPath", "FolderPath",strRevisionFoldePath, false);
//asign the room category
IRoomCategory objRoomCategory = cf.getDefaultRoomCategory();
IRoomCategory objRCA[] = {objRoomCategory};
roomInfo.setCategories(objRCA);
//Set User Role Assignments
com.sap.security.api.IUser owner = UMFactory.getUserFactory().getUserByLogonID("km_user");
roomInfo.setOwnerId(owner.getUniqueID());
roomInfo.addUserToRole(owner.getUniqueID(), role1);
//Finally Create the Room
IRoomDataElement objRoomDE = wdContext.createRoomDataElement();
if(roomInfo.validate()){
IRoom newRoom = roomsAPI.createRoom(roomInfo, true);
objRoomDE.setRoomLink(newRoom.getRoomAccessURLExternal());
}else{
RoomCreationValidationErrors[] errors = roomInfo.getValidationErrors();
for (int i=0; errors.length>i;i++){
logWebDynproMessages(IS_LOG_ENABLED,
//ILoggingConstants.INFO,
4,wdComponentAPI.getMessageManager(),
"ErrorRoom: "+errors<i>.getShortText(), false);
objRoomDE.setRoomLink("ERROR");
wdContext.nodeRoomData().addElement(objRoomDE);
logWebDynproMessages(IS_LOG_ENABLED,
//ILoggingConstants.INFO,
1,wdComponentAPI.getMessageManager(),
"Se creo el room asociado al proceso/revision:"+strRevisionFoldePath, false);
} catch (TemplateInstantiationException e) {
printException(wdComponentAPI.getMessageManager(), e);
e.printStackTrace();
} catch (NoSuchRoleException e1) {
printException(wdComponentAPI.getMessageManager(), e1);
e1.printStackTrace();
} catch (UMException ex){
printException(wdComponentAPI.getMessageManager(), ex);
ex.printStackTrace();
} catch (RoomCreationException ex){
printException(wdComponentAPI.getMessageManager(), ex);
ex.printStackTrace();
} catch (NoSuchRoomCategoryException ex){
printException(wdComponentAPI.getMessageManager(), ex);
ex.printStackTrace();
} catch (Exception ex){
printException(wdComponentAPI.getMessageManager(), ex);
ex.printStackTrace();
This code was created using the following directions
http://help.sap.com/saphelp_nw04s/helpdata/en/7d/c69c42d706c66ae10000000a155106/content.
Any help will be really appreciated and accordingly rewarded
Thaks in advance,
Ramien.-Hi Venkat,
did you check the Initial Configuration Tasks ? especially the portal permisions...
http://help.sap.com/saphelp_nw04/helpdata/en/f6/2604f005fd11d7b84200047582c9f7/content.htm
and there is a SAP Note which references a How To Guide for configuring permissions. The Note number is 766765 and the document it references is "How To... Configure Permissions for Initial Content in SAP Enterprise Portal 6.0 SP9 & Higher."
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance! -
Problem with JNDI in WLS 5.1
Hi all,
i have a problem with JNDI in WLE 5.1.
i am accessing an LDAP on another machine running Netscape Directory Server.
The host URL is ldap://myhost:65535/o=marco, c=fi
i am always getting back the following exception:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory. Root exception is java.lang.ClassCastException: weblog
ic.jndi.WLInitialContextFactory
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
58)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)
and my code is this:
Hashtable _environment = new Hashtable();
try {
environment.put(Context.INITIALCONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
environment.put(Context.PROVIDERURL, "ldap://myhost:65535");
if ((principal!=null) || (credentials!=null)) {
environment.put(Context.SECURITYAUTHENTICATION, "simple");
environment.put(Context.SECURITYPRINCIPAL, principal);
environment.put(Context.SECURITYCREDENTIALS, credentials);
context = new InitialContext(environment);
parser = context.getNameParser(initialCtxFactory);
} catch(Exception e) {
e.printStackTrace();
can anyone help me please??
thanx in advance
marcoTake out the "weblogic.jndi.WLInitialContextFactory" and add the respective factory NAME..
environment.put(Context.INITIALCONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
Cheers,
Naggi
Senthil Kumar S wrote:
http://weblogic.com/docs51/classdocs/API_jndi.html#delegate
Marco wrote:
Hi all,
i have a problem with JNDI in WLE 5.1.
i am accessing an LDAP on another machine running Netscape Directory Server.
The host URL is ldap://myhost:65535/o=marco, c=fi
i am always getting back the following exception:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory. Root exception is java.lang.ClassCastException: weblog
ic.jndi.WLInitialContextFactory
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
58)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)
and my code is this:
Hashtable _environment = new Hashtable();
try {
environment.put(Context.INITIALCONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
environment.put(Context.PROVIDERURL, "ldap://myhost:65535");
if ((principal!=null) || (credentials!=null)) {
environment.put(Context.SECURITYAUTHENTICATION, "simple");
environment.put(Context.SECURITYPRINCIPAL, principal);
environment.put(Context.SECURITYCREDENTIALS, credentials);
context = new InitialContext(environment);
parser = context.getNameParser(initialCtxFactory);
} catch(Exception e) {
e.printStackTrace();
can anyone help me please??
thanx in advance
marco--
http://www.net4tech.com -
Unable to Change Withholding Tax Base Amount while creating Service AP Invoice through DI API?
Dear All,
I am trying to create Service AP Invoice through DI API.
If I post the document without changing SAPPurchaseInvoice.WithholdingTaxData.TaxableAmount the dount ocument is created in SAP without any problem.
But if I change amount in above field then DI API throws error Unbalanced Transaction.
If I post same document in SAP with changed base amount it got posted in SAP without any Issue.
Where I am doing wrong?
please guide.
Using:
SAP B1 version 9 Patch Level 11
Location : India.
Thanks.Hi ,
maybe you can find solution to these note 1812344
1846344 - Overview Note for SAP Business One 8.82 PL12
Symptom
This SAP Note contains collective information related to upgrades to SAP Business One 8.82 Patch Level 12 (B1 8.82 PL12) from previous SAP Business One releases.
In order to receive information about delivered patches via email or RSS, please use the upper right subscription options on http://service.sap.com/~sapidp/011000358700001458732008E
Solution
Patch installation options:
SAP Business One 8.82 PL12 can be installed directly on previous patches of SAP Business One 8.82
You can upgrade your SAP Business One to 8.82PL12 from all patches of the following versions:8.81; 8.8; 2007 A SP01; 2007 A SP00; 2007 B SP00; 2005 A SP01; 2005 B
Patch content:
SAP Business One 8.82 PL12 includes all corrections from previous patches for releases 8.82, 8.81, 8.8, 2007, and 2005.
For details about the contained corrections, please see the SAP Notes listed in the References section.
Notes: SAP Business One 8.82 PL12 contains B1if version 1.17.5
Patch download:
Open http://service.sap.com/sbo-swcenter -> SAP Business One Products -> Updates -> SAP Business One 8.8 -> SAP BUSINESS ONE 8.82 -> Comprised Software Component Versions -> SAP BUSINESS ONE 8.82 -> Win32 -> Downloads tab
Header Data
Released On
02.05.2013 02:34:18
Release Status
Released for Customer
Component
SBO-BC-UPG Upgrade
Priority
Recommendations/additional info
Category
Upgrade information
References
This document refers to:
SAP Business One Notes
1482452
IN_Wrong tax amount was created for some items in the invoice with Excisable BOM item involves
1650289
Printing Inventory Posting List for huge amount of data
1678528
Withholding amount in the first row is zeroed.
1754529
Error Message When Running Pick and Pack Manager
1756263
Open Items List shuts down on out of memory
1757641
Year-end closing
1757690
SEPA File Formats - New Pain Versions
1757898
Incoming Bank File Format
1757904
Outgoing Bank File Format
1762860
Incorrect weight calculation when Automatic Availability Check is on
1770690
Pro Forma Invoice
1776948
Calendar columns are wrong when working with Group View
1780460
OINM column description is not translated
1780486
UI_System crash when you set extreme value of double type to DataTable column
1788256
Incorrect User-Defined Field displayed in a Stock Transfer Request
1788372
ZH: 'Unacceptable Field' when export document to word
1788818
RU loc: No freight in the Tax Invoice layout
1790404
Cash Flow Inconsistency when Canceling Payment
1791295
B1info property of UI API AddonsInstaller object returns NULL value
1791416
Adding a new item to BoM is slow
1794111
Text is overlapping in specific localization
1795595
Change log for item group shows current system date in all the "Created" fields
1797292
Queries in alerts should support more query results
1800055
B1if_ Line break issue in inbound retrieval using JDBC
1802580
Add Journal Voucher to General Ledger report
1803586
Not realized payment is exported via Payment Engine using 'SAPBPDEOPBT_DTAUS' file format
1803751
Period indicator of document series can be changed although it has been used
1804340
LOC_BR_Cannot update Nota Fiscal Model
1805554
G/L Account displayed in a wrong position when unticking the checkbox "Account with Balance of Zero"
1806576
Payment Cannot Be Reconciled Internally
1807611
Cannot update UDF in Distribution Rule used in transactions
1807654
Serial No./Batch inconsistency by canceled Inventory Transfer
1808694
BR: Business Partner Code cannot be updated with CNPJ CPF error
1809398
CR_Cannot Display Related Multi-Value Parameters
1809758
Arrow key not work for Batch/Serial Number Transactions Report
1810099
Tax Amount is Recalculated Even if Tax Code Is Not Changed
1811270
Upgrade fails on Serial And Batches object with error code -10
1811846
Cannot run Exchange Rate Differences when multi branch is activated
1812344
Withholding Tax Amount Is Not Updated in Payment Once Witholding Tax Code Is Changed in Document through DI API
1812740
DI:"Operation Code" show wrong value when add "A/P Tax Invoice" based on "A/P Invoice"
1813029
US_Vendor address on 1099 Summary by Form/Box Report is not updated according to the latest Invoice
1813835
Wrong amounts of Goods Return in Open Item List
1814207
Preliminary page prints setting does not keep after upgrade
1814860
Value "Zero" cannot be imported to "Minimum Inventory Level" field via Excel file
1815535
RFQ: Web front end not displayed in supplier language
1815810
GT: Adding Incoming Payment for Some Cash Flow Relevant Accounts Fails
1816191
BR:System Crashes While Working with Tax Code Determination Window
1816611
CR_Crystal Report Displayed Incorrectly Afte -
How to Create Highlighted text through the API
I am trying to create a script that goes through a document and cut/pastes specific elements to another document in FrameMaker 7.1.
So far, I can open a document and if an element is already highlighted/selected, i can cut the whole element using F_ApiCut().
I am having problems programatically trying to highlight the element that I want to copy.
So far, I have tried using the exampe from the FDKRef:
//grab the selected element and set it to the elementRange
er = F_ApiGetElementRange(FV_SessionId, docId, FP_ElementSelection);
parentId = F_ApiGetId(docId, er.beg.childId, FP_ParentElement);
er.end.parentId = er.beg.parentId = F_ApiGetId(docId, parentId, FP_ParentElement);
// if the selected element is a child of the highest level element, the client returns here
if(!er.end.parentId) return;
er.beg.childId = parentId;
er.beg.offset = er.end.offset = 0;
er.end.childId = F_ApiGetId(docId, parentId, FP_NextSiblingElement);
F_ApiSetElementRange(0, docId, FP_ElementSelection, &er);
F_ApiCut(docId, 0);
but this only grabs an element that is already selected. Is there a way to select an element through the API?
Thanks for any help!TrainingDeveloper,
There most certainly is a way. You can set up any kind of selection that you want, although it is definately a tricky process that can throw off even an experienced FDK developer. Here are my observations based on the code you pasted...
If you want to select an element, the first thing is that you need to have the ID of that element. I don't see anywhere in your code where an element ID is retrieved. All I see is the F_ApiGetElementRange which is getting the current selection, which in turn is likely why you just keep cutting the currently-selected element. If you want to get a specific element, that function call is not applicable. You only need to set up the element range structure to reflect the proper selection and then cut.
With that, assume that "elemId" is the ID of the element you want to cut. To select an entire element, you would do this:
F_ObjHandleT elemId, docId;
F_ElementRangeT er;
/* . . . code here to get elemId, docId, etc. . . . */
//set up the element range structure for whole-element selection
er.beg.childId = elemId;
er.beg.parentId = er.end.parentId = F_ApiGetId(docId, elemId, FP_ParentElement);
er.end.childId = F_ApiGetId(docId, elemId, FP_NextSiblingElement);
er.beg.offset = er.end.offset = 0;
//set the element selection in preparation for the cut
F_ApiSetElementRange(FV_SessionId, docId, FP_ElementSelection, &er);
//... and cut
F_ApiCut(docId, 0);
I'm not sure what the sample you pasted is meant to accomplish. It is somewhere along the right track but it won't get you exactly what you want.
Now, I should say that the process of retrieving the desired element ID is a whole different challenge. I'm not sure if you know how to do that or not so I'll defer any discussion on that until you ask.
Russ -
Updating a sales order through DI API
Hi All,
I have an issue regarding updating a sales order.
The problem is:
If there r 2 items(A00001&A00002) existed in the sales order and if I am adding two more items(A00003 & 4)the sales order is updated in a fashion that first item is replaced with third item and forth item is added as last record.The items to that particular sales order after updating will be like this(A00003,A00002,A00004).My doubt is why the 3rd item is replaced with first record.I am sending the code also i have written.
objRecordSet = SBOCOMUtil.newRecordset(company);
IDocuments oOrder =SBOCOMUtil.newDocuments(company,SBOCOMConstants.BoObjectTypes_Document_oOrders);
objRecordSet.doQuery("select DocEntry from ORDR where DocNum=" + 1111);
DocEntryL =objRecordSet.getFields().item(new String("DocEntry")).getValueInteger().intValue();
str += DocEntryL;
System.out.println(DocEntryL);
if (oOrder.getByKey(new Integer(DocEntryL))) {
//objRecordSet2.doQuery("delete from rdr1 where DocEntry="+DocEntryL);
str += "2";
System.out.println(str);
//oOrder.remove();
oOrder.setDiscountPercent(new Double(5));
oOrder.setComments("success");
System.out.println(str);
IDocument_Lines oOrderLines = oOrder.getLines();
str += "3";
String[] item={"A00005","A00006"};
for (int counter = 0; counter < item.length; counter++) {
// oOrderLines.setCurrentLine(new Integer(counter));
if (counter > 0)
oOrder.getLines().add();
str += "4";
oOrderLines.setItemCode(item[counter]);
System.out.println(item[counter]);
//oOrderLines.setBaseType(new Integer(-1));
//oOrderLines.setBaseEntry(new Integer(0));
//oOrder.getLines().setCurrentLine(new Integer(counter));
//oOrderLines.setQuantity(new Double(1));
//oOrderLines.setPrice(new Double(1500));
//oOrderLines.setCurrency(strCurrency[counter]);
//oOrderLines.setLineTotal(new Double(dblLineTotal[counter]));
str += "5";
//oOrder.getLines().getUserFields().getFields().item("Quantity").setValue(new Integer(2));
System.out.println(str);
int result = oOrder.update();
str += "6" + result;
if (result == 0) {
System.out.println("successfully updated");
company.disconnect();
} else {
company.getLastErrorDescription();
System.out.println(
"Error :" + company.getLastErrorDescription());
company.disconnect();If you are using SBP 2004 there are many threads on this forum talking about bugs when updating sales order lines through DI API. This issue was supposed to be fixed with patch level 45 for 2004 which was recently released.
If u are using 2005 or SP1 I think you may have found a new bug. -
Error while calling activityPrepare:needs to be invoked through an API call
I try to call activityPrepare using PAPI WS from SOAP UI. I get the following error :
An error occurred while processing task '0' for instance '/MyProcess#Default-1.0/4/0' in activity '/MyProcess#Default-1.0/Interactive[AgeFilter]'. The task is external and it needs to be invoked through an API call and not through the Classic WorkSpace.
I have no problem when I invoke activityExecute() but when I try activityPrepare() either from OSB, ADF or soapUI, I get this error.
I don't get what that means. Any idea why this error occurs?
Thanks
JagThe problem is that I did not make the activity 'External'. This can be done by :
Right click the activity -> Main Task -> select External Activity
Then you have to select two methods, one for prepare Activity, the other for commit activity.
For the prepare Activity, select the method you normally select for execute activity.
For the commit activity, create a new method and just write the following line in it :
action = action.OK;
Problem solved.
Jag -
AR Invoice + Payment through DI API
SBO 8.8
Limited Logistic User
In application I can create sales invoice and before click to Add button I can create payment (select account and ammount to be paid). After this document is added, the invocie is paid already.
I cannot find a way how to make this same process through DI API. It is not problem to create Invoice and Payment and link these 2 docuements together, but problem is that I need solution for LIMITED LOGISTIC USER which has no acces to Payment object.
Limited logistic user can create invoice and payment from invoice form (UI), but has no acces to Payments object in DI to create the same.
Exist solution for this? Please help me with ideas, otherwise customer will kill me... (has app. 50 Logistic users)
Thanks for helpHi Petr,
Am I correct in assuming here that you are talking about creating a payment first and then linking it to invoice?
Is there no way of using the WizardPaymentMethods object as it seems this is what the object is intended for?
To give you an idea, we have set a Business Partner to "Cash Basic" terms in SAP and set up this Payment Terms in SAP to open Incoming payment when the invoice is created. In SAP when we capture an invoice for this BP then the Payment Means (not Incoming Payment) window comes up and we can process a Cash payment straight away. Then when we add the invoice an incoming Payment is automatically created in the background. However we are having trouble duplicating this functionality with the DIAPI.
Kind regards,
Greeshma -
Add Activity through di api with assigned to employee
Hello Experts
I am fresher to sap b1 add on development.I got a problem in Adding Activities through di api
the problem is i am not able to get handled by employee property .
by default contacts.handledby is taking assigned to USER but I required Employee.
thanks in advance.Hi,
In order to set the employee correctly, don't use the Contacts object, but instead use the Activity object.
In the Activity object there's a property called HandledByEmployee.
Note that in order to create an Activity object, you should use the ActivitiesService object.
Look here for an example.
Beni. -
How to Update UDO through DI API code
Hello,
I have created UDO through DI API successfully, now I want to update the UDO through DI API code, and want to add some more child tables, but I am unable to do that, its showing me message that UDO successfully updated but when I am checking through B1, I can see that newly created child tables are not ticked in the check boxes. I am pasting my code, Please some one tell me how to fix this problem.
Private Sub AddUDO()
Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tNO
oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tNO
oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.ChildTables.TableName = "DC3_N"
oUserObjectMD.ChildTables.Add()
oUserObjectMD.ChildTables.TableName = "DC4_N"
oUserObjectMD.Code = "UDO_CHECK_N"
oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.Name = "UDO_CHECK_N"
oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_Document
oUserObjectMD.TableName = "DMT_N"
oUserObjectMD.GetByKey("UDO_CHECK_N")
lRetCode = oUserObjectMD.Update()
If lRetCode <> 0 Then
If lRetCode = -1 Then
'chkUDOAfter.SetItemChecked(12, True)
Else
oCompany.GetLastError(lRetCode, sErrMsg)
MsgBox(sErrMsg)
End If
Else
MsgBox("UDO: " & oUserObjectMD.Name & " was updated successfully")
'chkUDOAfter.SetItemChecked(14, True)
End If
oUserObjectMD = Nothing
GC.Collect() 'Release the handle to the table
End Sub
Regards,
Sudeshna.Hi Ian,
I have pasted the line "oUserObjectMD.GetByKey("UDO_CHECK_N")" immediately after "oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
" like below:
oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
oUserObjectMD.GetByKey("UDO_CHECK_N")
but this time it is adding the two new tables in UDO, but some how removing the first Master table from UDO.
Can you tell me how solve this, or can you provide some working code example regarding this.
Regards,
Sudeshna. -
Errror during SSL connection with LDAP using JNDI APIs
Hello,
I have established a client and server certificates cert.arm for LDAP server and client. On client i have created a client.kdb file and on server server.kdb file both containing cert.arm. whwn i give a request
C:\Program Files\IBM\LDAP\bin>ldapsearch -b "o=ibm,c=us" -h 9.182.174.71 -p 636 -D cn=roo
-w root1 -Z -K "C:\Program Files\ibm\ldap\etc\client.kdb" -P client -s sub cn=s* cn sn
it gave me proper results
but using a JNDI API where i specify
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
// Specify LDAPS URL
env.put(Context.PROVIDER_URL, "ldap://"+"9.182.174.71:636");
// Authenticate as S. User and password "mysecret"
env.put(Context.SECURITY_PROTOCOL, "ssl");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=root1");
env.put(Context.SECURITY_CREDENTIALS, "root1");
DirContext ctx = new InitialDirContext(env);
SearchControls constraintssc=new SearchControls();
constraintssc.setSearchScope(SearchControls.SUBTREE_SCOPE);
// performing the search
NamingEnumeration results=ctx.search("o=ibm,c=us","cn=s*",constraintssc);
////etc.........
Its gives me an exception saying that
javax.naming.CommunicationException: simple bind failed: 9.182.174.71:636. Root
exception is javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
Could any body help me out on this
Thank YouYou are attempting to authenticate via an SSL connection to port 636.
The message 'couldn't find trusted certificate' means that your client doesn't trust the certificate it has received from the LDAP server.
In order to establish that trust, you must export a certificate file from the LDAP server, then use Java's keytool.exe to create a keystore file using that certificate. Then your client code must reference that keystore file that you've created.
So essentially, you have to provide your program the LDAP server's credentials. "If the server's certificate looks like this, then you can trust it."
After your program trusts the certificate it receives from the server at runtime, your connection will authenticate.
Maybe you are looking for
-
Hi Guys A situation at work has forced me to learn web dynpro with java. I already have some experience with the ABAP web dynpro . Now the question is how much "java" do i need to learn to learn sap WebDynpro based on java. Should I first
-
No summarization result is selected
Hi all, When Iam trying to fill up setup tables for QM, its giving the error as "No summarization result is selected". I have initailly deleted the setup tables before running the set up. Pls give ur Valuable suggestions.Its urgent. Thanks in advance
-
Editing iPhoto photos in external editor, i.e., PSE
iMac running Mavericks OS. From iPhoto, when I click a photo to edit in external editor (PSE), I am taken to the pse editor, but my photo is not. Why is the photo not appearing?
-
About how javascript and onscript exchange data
I am a new one to Flex, my system need web page(html) exchange data with Flash(flex), because the data is not only a value, so need define a strucure to transfer the data. i dont know which type of data usually worked between javascript and action sc
-
Bei Acrobat 3D bekomme ich immer folgende Fehlermeldung: Kann jemand von euch was damit anfangen?