BAPI Call, in oder to bring data?
Hello Friends,
I am facing problem in oder to bring data from SAP system. Actually I am calling a BAPI "BAPI_DEBTOR_GETDETAIL" to show the details of the debtor. Here is the code,
JCO.Repository repository = new JCO.Repository("call" , mConnection);
IFunctionTemplate template = repository.getFunctionTemplate("BAPI_DEBTOR_GETDETAIL");
JCO.Function function = template.getFunction();
function.getImportParameterList().setValue(0000000001 , "DEBTORID");
JCO.Structure str = function.getExportParameterList().getStructure("DEBITOR_GENERAL_DETAIL");
System.out.println("NAME: " + str.getString("NAME"));
The customer 1 is already existed in the system. Please advise me if this the right way, to send the parameter with setValue method (cause atleast it did not give me any exception). And also please advise me how to bring the customer information, cause when i write this
System.out.println("NAME: " + str.getString("NAME"));
It does not print any thing!
Many thanks in advance!
Haider Syed.
Hello,
the problem is in this line:
function.getImportParameterList().setValue(0000000001 , "DEBTORID");
it should be:
function.getImportParameterList().setValue("0000000001" , "DEBTORID");
if you had read the RETURN Structure you would have get more information
JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
System.out.println("BAPI_DEBTOR_GETDETAIL RETURN: " + ret.getString("MESSAGE"));
If you want more information about the Customer I think it's better to use "BAPI_CUSTOMER_GETDETAIL2".
Reagards
Gregor
Similar Messages
-
Unable to run bapis for project status update and date update together
Hi Experts,
I have a requirement to update the dates and status of a project WBS at level 4. I am trying to do update the CJ02 Transaction using standard BAPI available. I need to do both Date update and status update in the same LOOP PASS i am using the below mention bapi. when i am doing so i am getting an error Project 'A._____' has been currently processed by ID i.e. my id.
I have tried putting a wait for 2 seconds in the code but its still not working. please find the order below in which i am calling the bapi.
Loop at itab.
if date_changed = 'X'.
CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
READ TABLE it_error WITH KEY message_type = c_e.
IF sy-subrc <> 0.
Commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x
IMPORTING
return = s_ret.
endif.
endif.
if Status_change = 'X'.
CALL FUNCTION 'BAPI_PS_INITIALIZATION' .
CALL FUNCTION 'BAPI_BUS2054_SET_STATUS'
READ TABLE t_result WITH KEY message_type = c_e.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_PS_PRECOMMIT'
TABLES
et_return = t_ret.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x
IMPORTING
return = s_ret.
ENDIF.
endif.
WAIT UP TO 4 SECONDS.
endloop.Try to use
SET UPDATE TASK LOCAL.
before each BAPI call.
Did you try to debug through your code, leaving sufficient time between BAPI calls? If it does work like that, then the above statement might help. -
Hello,
I am working on a scenario in which a client (abap proxy) sends a message to the integration server, which dispatches the messages to an rfc-adapter, an bapi call.
Therefore I have read the tutorial, which can be found on this site, but unfortunately I have run into problems. Maybe someone can help me at this point. This is what I did:
1.I have imported the BAPI_FLIGHT_CHECKAVAILABILITY as suggested in the tutorial.
2. I created an Message interface named: U2_BAPI_IF
3. For the output message I have chosen: BAPI_FLIGHT_CHECKAVAILABILITY and for the input:
BAPI_FLIGHT_CHECKAVAILABILITY.Response. I have left the fault message field empty.
4. I did no message mapping, since I want to work with the BAPI Response structure in the abap proxy.
5. The Message interface is defined as outbound synchron.
6.In the Integration Directory I created a Receiver Determination with a Service as a sender, the message interface is U2_BAPI_IF. Additionally I configured a "configured receiver" the client with the BAPI.
7.I created a Interface Determination, for the sender the same entries as above and for the configured Inbound Interface I have chosen BAPI_FLIGHT_CHECKAVAILABILITY and the receiver client
8.I created a receiver agreement.
9. Saved the change list.
10. I have generated the abap proxy for the message interface U2_BAPI_IF, without problems
11. I created the following abap program:
data: lv_msg_raus TYPE ZU2_BAPI_IF_BAPI_FLIGHT_CHECK1,
lo_proxy TYPE REF TO ZCO_U2_BAPI_IF,
lv_msg_rein TYPE ZU2_BAPI_IF_BAPI_FLIGHT_CHECKA.
lv_msg_raus-AIRLINEID = 'AA'.
lv_msg_raus-CONNECTIONID = '0017'.
lv_msg_raus-FLIGHTDATE = '20040801'.
create object lo_proxy.
call method lo_proxy->execute_synchronous
exporting
OUTPUT = lv_msg_raus
importing
INPUT = lv_msg_rein.
12. I execute the program and I receive the following error:INTERFACE_REGISTRATION_ERROR, the SAP Stack says:
<SAP:Stack>No implementing class registered for the interface (type ifmmessif, name BAPI_FLIGHT_CHECKAVAILIBILITY, namespace urn:sap-com:document:sap:rfc:functions )</SAP:Stack>
So now my question, do I have to implement a class (proxy) on the receiver side to receive the message and pass it then via bapi call myself, or did I something totally wrong?
I hope somebody can help me,
Thanks
OliverHi Oliver,
I was wondering if you finally got this scenario to work, if Yes. Could you explain how did yo manage to (solve your problem)setup your scenario as described in your earlier note?
Thanks,
Rob. -
Problem facing during BAPI call for an inbound interface.
I have requirement where in i need to make a BAPI call from SRM system using RFC adapter.
After importing the BAPI(Z_INV_REF_PO) in the Integration Repository the structure looks to be a follws,
1.Request
2.Response and
3.Exception (fault) Message types.
In my BPM i did a transformation for my source structure with BAPI request. But while doing a BAPI call it throws me Application error as follows,
RFC adapter is working fine.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Inbound Message
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="RFC_ADAPTER">APPLICATION_ERROR</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="urn:sap-com:document:sap:rfc:functions">Z_INV_REF_PO.Exception</SAP:ApplicationFaultMessage>
<SAP:Stack />
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Please help me out on this. Itz very urgentHi,
As the error is Applcation_error, the data reached the target system but the BAPI call fails. So you mignt not be providing all the mandatory fields to the BAPI.
Perform a standalone testing of your BAPI, with the data being passed from XI See if the BAPI call is successful..
Hope this helps you.
cheers,
Siva Maranani. -
BAPI call to actual cost of work order
Is there a BAPI call to actual cost of work order operations in PM?
I am looking for to read these actual cost in a PM order and populate the data to the none-SAP application.
Any helps appreciate it.
TimI think I have just found it:
IBAPI_ALM_ORDERCOSTS_READ
But, thanks anyway for your quick reply and helpful tips.
points rewarded. -
Keep alive a session between 2 BAPI calls
Hi -
I am calling several BAPIs to maintain data. I am calling from an outside system as I published the BAPIs as Web Services.
I would like that the session between 2 BAPI calls is kept, so I don't miss some session info between call #1 and call #2.
Anyone knows a way of keeping alive a session between 2 BAPI calls?
Thanks !Try this..
<b>ARFC with Resource Management (Parallel Remote Function Call)</b>
CALL FUNCTION 'MYFUNC'
STARTING NEW TASK 'T1'
DESTINATION IN GROUP 'PRFC'
EXPORTING ...
TABLES ...
EXCEPTIONS ...
communication_failure = 100
system_failure = 101
resource_failure = 200.
IF sy-subrc= 102.
wait and retry...
ENDIF.
<b>Define PRFCvia RZ12</b>
Amandeep -
Regarding the BAPI calls without input
Hi all,
We are developing on webdynpro component. I came across a scenario where we call the BAPI through Adaptive BAPI model. This bapi doesnt take any input parameters but returns 7 tables with data.
So, My problem here is i am not getting output in the 7 tables. i am sending a dummy input and executing on the input elements modelobject.
Could anyone ddid this scenario.. ie., calling/executing teh BAPI call which doesnt have any input s but expects output.
Here is what i have
<i><b>Z_Sales_Order_Header_Input bapiSalesOrderHeader=new Z_Sales_Order_Header_Input();
wdContext.nodeZ_Sales_Order_Header_Input().bind(bapiSalesOrderHeader);
wdContext.currentZ_Sales_Order_Header_InputElement().modelObject().execute();
int ilSalesOrderTypeSize=0;
ilSalesOrderTypeSize=wdContext.nodeZ_Sales_Order_Header_Output().nodeSalesordertype().size();</b></i>
Thanks & Regards,
Raghavendra PothulaHi Raghavendra,
If I read you correctly, you are printing the size of the root output node (Z_Sales_Order_Header_Output) and not that of the output node inside your 'Z_Sales_Order_Header_Input' node. When you execute the RFC, the output node inside the 'Z_Sales_Order_Header_Input' node gets populated. so try printing the size of the 'Salesordertype' node inside the 'Z_Sales_Order_Header_Input' node.
-Z_Sales_Order_Header_Input
---output (this is the default name)
---Salesordertype
Infact there is no need to create the 'Z_Sales_Order_Header_Output' node itself in the controller or view.
Hope this helps,
Best Regards,
Nibu. -
Hey experts!
I´m looking for a way to log all BAPI-Calls performed by external tools and R/3 Systems.
Do you have an idea how to do this?
Thx in advance.
OliverTake a look at function module SAPWL_STATREC_READ_FILE which analyzes data memorized by the system. (cluster table MONI)
some of the tables <i>may</i> contents data that you want.
Regards -
Dear all,
I am working in a project where we archive SAP data (outbound documents) and connect some of the documents for SAP R/3 applications from any other resource other than SAP(in bound documents).
Ours is basically a third party tool which supports SAP R/3 documents as well as BW`s documents, certified by SAP.we maintain our own repository for that purpose.The meta data related to the documents is stored in SAP.our requirement now is to have that metadata available in our repository.we need to extract that meta data available in SAP.
can any one know here in which table those data is available? all i know is we need to apply BAPI calls to extract that metadata from SAP to our repository.
is there any method existing other than BAPI to extract that data?if yes what are those and how to go about that type?if not, how to call the BAPI`S from our repository?
Thanks in advance
RaviHello,
You can find out the metadata for tables in table DD03L. I don't know about the BAPI to read these data.
But, you can make one program which downloads the data into flat file. Later you can upload that file into your third party software.
Regards,
Naimesh -
Hi All,
I am using a BAPI Call to SAP in my BLS transaction. One of the action blocks in the transaction is a SQL Query which updates a Oracle table based on the SAP returned values from the previous action block. For the most part, it works fine except once in a blue moon, the values show up as 'null' when in fact I expect some values to be returned from SAP. Is there anyone out there who has faced a similar issue? What would be a quick and easy solution to this? Thanks.
Regards,
V M.Hi Venki,
Possible response segments for CONF_CNT (in DETAIL_RETURN):
1) That BAPI will return "000000" for counter if the confirmation was unable to be processed for some reason, but you were able to connect to SAP. A fairly common reason is the record being locked if you run similar confirmations too close together. It takes time for the confirmation record to be released by SAP.
2) It will return a number "000001 or greater if the confirmation was successful (along with a confirmation number).
3) The circumstances where it will return an empty field are when it is unable to connect to SAP, but you should have a conditional to check for the success flag from the BAPI. This is standard error handling when using a BAPI. This will also leave all fields in the response segment blank.
4) And there is another set of circumstances which will leave the fields blank. This is fairly unusual, but does happen when the error handling inside the BAPI runs into a situation which it can't handle. So the BAPI crashes and never returns any information back to MII.
You will need to decide which of these situations are causing your null data. But put error handling in based on the Success flag for the BAPI for SAP unavailable and for a CONF_CNT = "000000" or blank.
Good luck,
Mike -
Hi,
in our system , a Program runs everyday in R3 system to fill the customized delta tables and we run the process chain to load the data in BW from Delta tables in R3 system.But problem in the above scenario, after completion of R3 Job in R3 system the BW system does not aware of R3 job status so we have schedule the process chain in such a way that the process chain start after 2 Hours of completion of R3 jobs.
to overcome this, i need to implement either of the below requirement.
a BAPI call so that the R3 job can be triggered from BW from a process chain, and then the BW metachains can start once it is finished.
Or
we are using a ABAP program in R3 system to fill Delta table. So at the end of the ABAP code, send an RFC message to BW, which can trigger a job in BW which will start 1 meta chain.
please tell me which is the better option and how can i
Regards
Atulhi
i have tried below logic in R3 side
Create a Customized FM with Remote Enabled in BW system
call that FM with RFC destination and Event name as Export parameter from a ABAP program in R3 Side
i have given the Event name in Variant as same as i have created in BW system SM62
when i had run the Program in R3 side the program run successfully but the process chain did not run in BW system.
please let me know what is the reason behind this.
below code i have written in ABAP program in R3 side
parameters: rfcdest like rfcdisplay-rfcdest,
zevent type char32.
CALL FUNCTION 'Z999B_CB_F_EVENTRAISE' destination rfcdest
EXPORTING
EVENTID = ZEVENT
EXCEPTIONS
BAD_EVENTID = 1
EVENTID_DOES_NOT_EXIST = 2
EVENTID_MISSING = 3
RAISE_FAILED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Below FM i have developed in BW system with Remote Enabled in Attribute tab page of FM.
FUNCTION Z999B_CB_F_EVENTRAISE.
""Local Interface:
*" IMPORTING
*" VALUE(EVENTID) TYPE CHAR32
CALL FUNCTION 'BP_EVENT_RAISE'
EXPORTING
eventid = eventid
EVENTPARM = ' '
TARGET_INSTANCE = ' '
EXCEPTIONS
BAD_EVENTID = 1
EVENTID_DOES_NOT_EXIST = 2
EVENTID_MISSING = 3
RAISE_FAILED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFUNCTION.
Regards
Atul -
The returned value of BAPI call
Hi, experts,
I have a question about returned value of BAPI call.
when the returned value is mapped as an attribute and this return value itsself is of the type: table of a certain structure. Is there any possibility that the value of this table still can be extracted from the mapped attribute? If it is possible, how?
If not, how should this kind of situation be handled:
when the returned value of the function at the backend has more one layer structure?
Thanks and best regards,
FanIn my experience you shouldn't use the service wizard to generate the context of such deeply nested structures. They don't generate or map correctly because it tries to put the table type as the type of the context attribute.
Instead you should propery model the relationship in the context using nested nodes. Here is an example of address <-> address text where you can have multiple address texts per address. From the service this was a returned nested table.
****BP Address and Address Text
data lo_nd_bp_addr type ref to if_wd_context_node.
data lo_nd_bp_addr_text type ref to if_wd_context_node.
data lo_el_bp_addr type ref to if_wd_context_element.
* navigate from <CONTEXT> to <BP_ADDR> via lead selection
lo_nd_bp_addr = wd_context->get_child_node( name = wd_this->wdctx_bp_addr ).
lo_nd_bp_addr->bind_table( wd_this->gt_bp_addr ).
****Add the Address Text Table as Child of each Address Context Record
data element_set type wdr_context_element_set.
field-symbols <wa_set> like line of element_set.
field-symbols <wa_bp_addr> like line of wd_this->gt_bp_addr.
element_set = lo_nd_bp_addr->get_elements( ).
loop at element_set assigning <wa_set>.
read table wd_this->gt_bp_addr index sy-tabix assigning <wa_bp_addr>.
lo_nd_bp_addr_text = <wa_set>->get_child_node( name = if_componentcontroller=>wdctx_bp_addr_text ).
lo_nd_bp_addr_text->bind_table( <wa_bp_addr>-t_text ).
endloop. -
Hi,
In the sales order user exit I want to introduce CALL_BAPI = X .
How should I know in the exit the call to this process is from BAPI.
In online transaction I get sy-tcode = VA02 , VA42 .
But when it is BAPI call , how should I track this, is there any system field? .
Regards
Prashant.I don't have any idea about the system field but you can do it like this:
Before calling the BAPI set some memory in ABAP memory.
Like:
data: l_flag.
L_FLAG = 'X'.
EXPORT L_FLAG to memory id 'ZBAPI'.
In your user exit import this data from memory.
data: l_flag.
IMPORT L_FLAG from memory id 'ZBAPI'.
if l_flag = 'X'.
** called from BAPI.
endif.
free memory id 'ZBAPI'.
Regards,
Naimesh Patel -
BAPI_ALM_ORDER_MAINTAIN error "BAPI call must have a SAVE or DIALOG method"
I have this test code below that I have written to update the work duration on a work order to 5 hours using the BAPI BAPI_ALM_ORDER_MAINTAIN. I however keep getting the error "BAPI call must have a SAVE or DIALOG method". Can someone tell me what I am doing wrong
data: begin of it_methods occurs 0.
include structure bapi_alm_order_method.
data: end of it_methods.
data: begin of it_operation occurs 0.
include structure bapi_alm_order_operation.
data: end of it_operation.
data: begin of it_operation_up occurs 0.
include structure bapi_alm_order_operation_up.
data: end of it_operation_up.
data: begin of it_return occurs 0.
include structure bapiret2.
data: end of it_return.
data: begin of it_et_numbers occurs 0.
include structure bapi_alm_numbers.
data: end of it_et_numbers.
it_methods-refnumber = '0000040000020010'.
it_methods-objecttype = 'OPERATION'.
it_methods-method = 'CHANGE'.
it_methods-objectkey = '0000040000020010'.
append it_methods.
it_operation-duration_normal = '5'.
append it_operation.
it_operation_up-duration_normal = 'X'.
append it_operation_up.
call function 'BAPI_ALM_ORDER_MAINTAIN'
tables
it_methods = it_methods
it_operation = it_operation
it_operation_up = it_operation_up
return = it_return
et_numbers = it_et_numbers.
call function 'BAPI_TRANSACTION_COMMIT'
IMPORTING
RETURN = it_return.
Edited by: Martin Kay on Mar 5, 2009 2:17 PMhello martin
u have to use the save method for saving the contents
in mehtod tabel u have to add method as save
if ur method internal table is it_method then
it_method-method = 'save'.
append it_method .
and also in ur bapi code u have assigned wrong reference number
reference number always should start from 1
it_methods-refnumber = '0000001'
not '0000000400123' which u have used for order number
and after call of bapi u have to call
bapi_transaction_commitn which u have used
hope it solves ur problem -
Yellow transaction sequence block for Bapi call
I am beginning upgrading MII from version 12.0 to 12.1. When I imported my MII project to version 12.1, I get one BAPI call sequence that is yellow and the transaction does not execute. It works fine in version 12.0, but something is wrong in version 12.1. It is not a custom transaction.
The JRA Session Action is called JRA_Start_Session and when I try to execure the transaction, I get the following Error:
[ERROR] [JRA_Start_Session] Link ('JRA_Start_Session.Language' [Assign] from "Transaction.Language") execution threw an exception. Exception: [Variable does not exist: JRA_Start_Session.Language]
[INFO] Transaction Termination Request: [User: MSCOTT] [Reason: Variable does not exist: JRA_Start_Session.Language] [Message: Variable does not exist: JRA_Start_Session.Language]
[INFO] Statistics [Load = 67 ms msec, Parse = 67 ms, Execution = 2 ms, Total = 81 ms]
Both the new version and the old version of MII are pulling for the same data sources, so I'm not sure why 12.0 would work and 12.1 won't. Maybe a known bug??
Any help would be greatly appreciated!Thanks, Mike. I am waiting on some help to try the steps you listed.
In further testing, we have been able to get some of the data from the BAPI, but not all of it. We have also noticed that some of the data paths have changed. For example, the "components" variable that was located in this location in version 12.0:
{/BAPI_PRODORD_GET_DETAIL/INPUT/ORDER_OBJECTS/INPUT/COMPONENTS}
Is located here after importing the project into version 12.1:
{/BAPI_PRODORD_GET_DETAIL/INPUT/ORDER_OBJECTS/COMPONENTS}
Does this information mean anything to you? I did find some forum posts about JRA issues related to NW 7.1.6 and MII 12.1.8. What I'm seeing is that to use MII 12.1.8, we have to roll back to NW 7.1.5.
Can you tell me if this is still accurate?
[Re: JRA "Execute Function" Option in MII 12.1.8.24]
Maybe you are looking for
-
How to find repairs done ( through access key) in SAP ECC 6.0 system
Hi Experts, I have to find the Repairs ( ie standard code is edited with access key ) done in my SAP ECC 6.0 system. I want to find out the repairs which was done my some developer using the access key and also want to segregate the ones which were d
-
Deltas are not capturing for the enchanced field
Hi Friends, We have enchanced 2LIS_11_VAITM datasource with custom field called customer requested date. For initial setup i can see the data for this field in BI. But when user changes the customer requested date then this is capturing in deltas. ca
-
Multiple Unit of Measure in SAP BO
We have a requirement to use multiple unit of measures from one of our client whose business concern is manufacturing and tenneries. We want to measure inventory in units and in meters at same time. For example, if one new unit measuring 50 metres is
-
Sorting exceptional messages in md06
Is it possible to sort according to exceptional message numbers in md06. i have got more message no. 20, i like to sort and delete the same. pls advise how to do that?
-
Uninstall and reinstall iPhoto?
I bought a used 2010 iMac, and don't want to wipe it clean because I would lose the paid apps my friend bought. How do I uninstall and reinstall iPhoto so I can update it with my iTunes acct? Is this possible? suggestions?