on 08-04-2015 2:21 PM
Hello Experts ,
We are using Sourcing 10 and using RFX module . We have the requirement to create RFX lineitem Specifications automatically based on certain parameters while RFX is created . We are trying with the below code in save target but getting an error -
import com.frictionless.api.common.log.*;
import java.util.HashMap;
import com.frictionless.sap.integration.exporter.ExporterIfc;
import com.frictionless.sap.integration.exporter.SmartExporter;
import java.util.List;
import java.math.BigDecimal;
import com.sap.odp.api.common.types.*;
import com.sap.eso.api.doccommon.ont.types.*;
import com.sap.eso.api.projects.ProjectIBeanIfc;
import com.sap.eso.api.projects.ProjectIBeanHomeIfc;
import com.sap.odp.api.ibean.IBeanHomeLocator;
import com.sap.eso.api.rfx.*;
import com.sap.odp.api.ibean.IBeanIfc;
import com.sap.odp.api.ibean.IBeanHomeIfc;
import com.sap.odp.api.ibean.*;
import com.sap.odp.api.common.types.TypeFactory;
import com.sap.odp.api.doc.IapiDocumentLockManager;
import com.sap.eso.api.rfx.lineitem.*;
import com.sap.eso.api.rfx.*;
import com.sap.eso.api.doccommon.spec.*;
import com.sap.eso.api.doccommon.doc.question.QuestionTypeEnumType;
import com.sap.eso.api.doccommon.specItemSpecIBeanIfc;
rfx_docline = doc.getLineItems().create();
OrderedSubordinateCollectionIfc specgroup =(OrderedSubordinateCollectionIfc) rfx_docline.getBuyerSpecGroup();
QuestionTypeEnumType Q = new QuestionTypeEnumType(1);
lineItemSpec=specgroup.create();
lineItemSpec.setDisplayName("hello");
lineItemSpec.setQuestionType(Q);
lineItemSpec.setWidth(50);
specgroup.add(lineItemSpec);
Error :
import com.frictionless.api.common.log.*; i . . . '' : Error in method invocation: Method setQuestionType( com.sap.eso.api.doccommon.doc.question.QuestionTypeEnumType ) not found in class'com.sap.eso.api.doccommon.spec.ItemSpecGroupIBeanImpl'
Can you please suggest if any mistake in the code or anything we would need to add ?
Thanks
Sudipta
Hello Sudipta,
There is a problem with your code:
You will have to do:
lineItemSpec=specgroup.create(); // this is the Spec Group
groupItemSpecs = lineItemSpec.getItemSpecs();
itemSpecBo = groupItemSpecs.create(); // this is the Spec
itemSpecBo.setQuestionType(Q);
...
groupItemSpecs.add(itemSpecBo);
specgroup.add(lineItemSpec);
Two extra recommendations:
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much Bogdan for suggestions . I have tried this below code in RFX save target . This time no error appearing but no litem specifications are being added also in RFX setup->Line Item Specifications tab . Can you please suggest ?
QuestionTypeEnumType QstnType = new QuestionTypeEnumType(1);
rfx_docline = doc.getLineItems().create();
OrderedSubordinateCollectionIfc specgroup =(OrderedSubordinateCollectionIfc) rfx_docline.getBuyerSpecGroup();
lineItemSpec=specgroup.create(); // this is the Spec Group
groupItemSpecs = lineItemSpec.getItemSpecs();
itemSpecBo = groupItemSpecs.create(); // this is the Spec
itemSpecBo.setDisplayName("Test Description");
itemSpecBo.setWidth(50);
itemSpecBo.setQuestionType(QstnType);
groupItemSpecs.add(itemSpecBo);
specgroup.add(lineItemSpec);
Thanks for your help .
Hello Sudipta,
That is what I was explaining about the 'Saved' target. Even if it works correctly it will not display in your open document:
This is what happens technically:
My suggestion is to put the script in target 'Validate' or 'Created' depending on your requirements.
Bogdan
Hmm, seems like I was also looking in the wrong place.
ItemSpecs are defined in Document->Setup also for RFX. On the line item itself they will be automatically picked up once created in Setup.
In your case, you should have:
setupOption = doc.getCollectionMetadata("SETUP_OPTIONS").get(doc).get(0);
specgroup = specgroup.getBuyerSpecGroup();
...
As soon as you'll create a line item then item specs will be displayed as they are defined in Setup.
Bogdan
Thanks for your reply .
Not sure if I am clear on my requirement -
We need to create line item specification(RFX setup) automatically during the RFX is created . Line litem specification navigation path: RFX -> setup -> Line Item Specifications tab .
The above coding I have placed in RFX created phase to test if the lineitem specifications are getting created or not .Once the code works , I would place the other conditions to select specification name to be generated dynamically. The same specifications will be reflected in lineitems and user can enter value against them.
Now , while I create RFX , the coding is executed in creation phase and no error also . But when I go to setup -> line item specifications tab to check if the record is created , it's appearing blank ..
According to the coding it should have created a row in item specification tab in RFX -
Name : Test Description
Question type : freetext
Width : 50
Please correct me if I am misunderstanding your explanation .
Thanks
Sudipta
Hello Sudipta,
This is the script I used to create LI Spec:
import com.sap.eso.api.doccommon.doc.question.QuestionTypeEnumType;
//
setupBean = doc.getCollectionMetadata("SETUP_OPTIONS").get(doc).get(0);
//
buyerSpecGroup = setupBean.getBuyerSpecGroup().create();
buyerSpecGroup.setDisplayName("Test Group BTOMA");
//
itemSpec = buyerSpecGroup.getItemSpecs().create();
itemSpec.setPrompt("Test Spec BTOMA");
itemSpec.setQuestionType(new QuestionTypeEnumType(1));
itemSpec.setWidth(50);
//
buyerSpecGroup.getItemSpecs().add(itemSpec);
setupBean.getBuyerSpecGroup().add(buyerSpecGroup);
Bogdan
Bogdan,
We have requirement to create line item specification while createing Rfx from ECC Rfq. I went through this blog and code that you provided which is really help full.
I have a question regarding below statement
setupBean = doc.getCollectionMetadata("SETUP_OPTIONS").get(doc).get(0);
till doc.getCollectionMetadata("SETUP_OPTIONS") I understood can you help understand what get(doc) and get(0) will be doing.
How can we map this particular line item specification to corresponding line item ?
Thanks,
Venu.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.