on 10-28-2013 11:19 AM
Hi
I am trying to write a program to insert record into PurchaseRequisition. I am using BAPI_PR_CREATE.
JCO3 help indicates that we should use table.appendRow(). I have tried writing a program but is not working or not giving any results and neither an exception.
Attached is the code i am trying with.
Can someone share any inputs?
Thanks, Ram
Hi,
Table parameter is table type container for both input and output.
In your case it is used as input container, table.appendRow() should be written before executing bapi.
//function.getImportParameterList().setValue(query_input_column1, query_input_column1_value);
JCoTable table = function.getTableParameterList().getTable(targetTableUnderBAPI); //it is taken from the response value of metadata
table.appendRow();
table.setValue(query_input_column2,query_input_column2_value);
//similarly for other columns
try{
function.execute(destination);
}
catch(AbapException e){
System.out.println(e.toString());
return;
}
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This is really helpful. I just modified code. The return table says that i have to supply the inputs for two more columns. I am actually supplying these values (doc_type and plant).
Not able to understand what it is indicating. In fact, i am not able to insert a row using SE37 also (only for BAPI_PR_CREATE).
I get the same error message. What could be the issue?
Thanks, Ram
Hi
Could you get successful return from SE37 ?
Some BAPI needs BAPI_TRANSACTION_COMMIT especially creation BAPI.
I'm not sure about your BAPI_PR_CREATE but you can test from SE37 and select Function Module=>Execute=>Test Sequences.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not able to insert from SE37 also.
Below is the return message i get when i try to insert row:
ID | NUM | Message |
---|---|---|
ME | 083 | Enter Document Type |
BAPI | 001 | No instance of object type PurchaseRequisition has been created. External reference: # 1 |
ME | 083 | Enter Plant |
MESSAGE_V4 | PARAMETER | FIELD |
---|---|---|
PRHEADER | BSART | |
PRHEADER | BSART | |
PRITEM | WERKS |
I get the same message when i use JCo. How can we use BAPI_TRANSACTION_COMMIT while using se37 test sequence?
I have yet to explore how to use commit in JCo. I remember it as JCo context automatically takes care of it.
Any hints? Thanks.
Hi
Maybe you have to enter more parameters except document type and plant.
BAPI call is depend on application customization and error message is not enough kind.
Before using SE37 you had better create purchase requisition from application screen and collect data you have to enter.
Then try from SE37.
Regarding BAPI_TRANSACTION_COMMIT
Some BAPI need explicit commit operation.
for example BAPI_SALESORDER_CREATEFROMDAT2 needs BAPI_TRANSACTION_COMMIT after successful operation.
I'm not sure whether BAPI_PR_CREATE need it or not though.
You can find it as following way.
1) executing BAPI_PR_CREATE successfully from SE37
2) check from "Display Purchase Requisition" if you can find the PR which BAPI made, BAPI_TRANSACTION_COMMIT isn't need.
If you can't find it BAPI_TRANSACTION_COMMIT is need.
I hope this will help you.
Thanks
Ram,
Please go through this pdf, this pdf having how to add SalesOrderItem to BAPI.
Hope this helps!!
Regards
Vijay K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.