on 05-06-2005 5:06 PM
Hi Gurus,
I have to implemet the follwoing line of code in our user exits in IPC ( for CRM):
TKOMP-RKE_MVGR1 = VBAP-MVGR1
I am new to CRM and user exits. I have tried to make the changes in ItemUserExits.java and PricingUserExits.java.
Below is the code from ItemuserExits.java:
db database = _engineUserExit.getDatabase();
String table = "VBAP";
String table2 = "KOMP";
String RKE_MVGR1FIELD = "RKE_MVGR1 ";
String RKE_MVGR1FIELD_VALUE = "";
String MVGR1FIELD = "MVGR1";
String MVGR1FIELD_VALUE = "";
sys_query_pair[] queryPair = new sys_query_pair[1];
sys_query_pair[] queryPair2 = new sys_query_pair[1];
String[] projection;
String[] projection2;
String productID = itemUserExitAccess.getProduct().getId();
if (vbapTableContent.get(productID) != null) {
MVGR1FIELD_VALUE = (String)vbapTableContent.get(productID);
}
else {
//name of fields with which we select on database
queryPair[0] = new sys_query_pair("PRODUCT_GUID", productID);
queryPair2[0] = new sys_query_pair("PRODUCT_GUID", productID);
//name of field which we want to select from database
projection = new String[]{MVGR1FIELD};
projection2 = new String[];
//selection from database
res resultSet = database.db_read_table(table,
queryPair,
projection);
res resultSet2 = database.db_read_table(table2,
queryPair2,
projection2);
//analysis of selection result
if (!res.db_empty_results_p(resultSet)) {
MVGR1FIELD_VALUE = resultSet.db_get_row_element_string(0);
resultSet.db_finish();
}
else {
log_api.log_write_msg("SPE", "ItemUserExits", 1,
"Coudn't find a value of field MVGR1FIELD_VALUE in table VBAP");
return;
}
//analysis of selection result
if (!res.db_empty_results_p(resultSet2)) {
RKE_MVGR1FIELD_VALUE = resultSet2.db_get_row_element_string(0);
resultSet2.db_finish();
}
else {
log_api.log_write_msg("SPE", "ItemUserExits", 1,
"Coudn't find a value of field RKE_MVGR1FIELD_VALUE in table KOMP");
return;
}
// store in hashtable for further use
vbapTableContent.put(productID, MVGR1FIELD_VALUE);
}
//add new value to item container for use in class PricingUserExit
itemUserExitAccess.addItemAttributeBinding(MVGR1FIELD, MVGR1FIELD_VALUE);
itemUserExitAccess.addItemAttributeBinding(RKE_MVGR1FIELD, RKE_MVGR1FIELD_VALUE);
Here, I am trying to get the values of the two attributes.
Below is the code from PricingUserExits.java:
public String[] determineRelevantAttributesForValueFormula(boolean headerAttributes, int valueFormulaNo)
{
// added by prasoon
String[] relevantAttributes = new String[0];
// switch between header and item attributes
switch (headerAttributes == true? 0 : 1) {
// fix the header attributes
case 0:
// switch between the different value formular numbers
switch(valueFormulaNo) {
case 610:
relevantAttributes = new String[] { "MVGR1FIELD","RKE_MVGR1FIELD" };
// relevantAttributes = new String[] { "MVGR1FIELD" };
break;
}
// fix the item attributes
case 1:
}
return relevantAttributes;
IN method overwrite condition value I added the following lines of code:
case 610:
{
IAttributeBinding attBind1 = null;
IAttributeBinding attBind2 = null;
try {
attBind1 = prItem.getHeaderAttributeBinding(
"MVGR1FIELD");
}
catch (UnsuppliedAttributeException ex) {
}
try {
attBind2 = prItem.
getHeaderAttributeBinding("RKE_MVGR1FIELD");
}
catch (UnsuppliedAttributeException ex1) {
}
attBind2 = attBind1;
return null;
}
and in:
public int[] getConditionValueFormulaNumbers() {
File f = new File("C:
outfilename.log");
try {
BufferedWriter out = new BufferedWriter(new FileWriter(f));
out.write("aString");
out.close();
} catch (IOException e) {
}
Could you please tell me where I am doing wrong? I get no compilation errors. Could you also tell me how to degug my program by writing log files? I have read the docmentation but could not get much help?
I would appreciate any kind of help or suggestion from you guys.
Thanks in advance,
Prasoon
Dear Prasoon,
Your code helped me a lot. I think that you seem to miss something in ItemUserExits.java file. Change the method
public String[] determineRelevantAttributes(boolean isHeaderAttribute) {
return new String[] {"MVGR1FIELD","RKE_MVGR1FIELD" };
}
Hope this will sovle your problem.
Can you please mail me the full code which will further enhance my knowledge on IPC at ajaysgupta@yahoo.com.
Thanks & Regards,
Ajay Gupta
Message was edited by: Ajay Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also working on IPC, but just started doing it. You can put System.out.println("String" + variavble) staments and you can see these in WEB-INF/logs of Pricing folder under your WAS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.