07-04-2009 2:00 PM
Hi!
experts,
how can we transfer error report from a BAPI to the application server? as i am collecting the error report from the BAPI ?
07-04-2009 2:21 PM
Hi,
Get your report in an internal table and to transfer data to application server use OPEN DATASET, TRANSFER and CLOSE DATASET statement.
Regards,
Ankur Parab
07-04-2009 2:21 PM
Hi,
Get your report in an internal table and to transfer data to application server use OPEN DATASET, TRANSFER and CLOSE DATASET statement.
Regards,
Ankur Parab
07-04-2009 2:57 PM
thanks Ankur,
but i have this BAPI "BAPI_ACC_GL_POSTING_POST" where i am posting a GL from a XI proxy structure and i have to use this and post the error report .As i have never done this can you help me with a piece of code to do that.
Thanks
Robert.
07-04-2009 2:59 PM
thanks Ankur,
but i have this BAPI "BAPI_ACC_GL_POSTING_POST" where i am posting a GL from a XI proxy structure and i have to use this and post the error report .As i have never done this can you help me with a piece of code to do that.
Thanks
Robert.
07-04-2009 3:19 PM
Hi,
I am not sure how you can do in the proxy. But teh following link can explain you how to write files on application server.
Basically you will have to take the contents of the return table into an internal table and write on the application server.
[http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3c99358411d1829f0000e829fbfe/frameset.htm]
Regards,
Ankur Parab
07-07-2009 12:55 PM
You can use the following code in your program for your ref:
REPORT ZEX_DATATOFILE .
&----
*& ABAPLOVERS: Data Transfer
&----
Parameters to enter the path
PARAMETERS FILENAME(128) DEFAULT '/usr/tmp/testfile.dat'
LOWER CASE.
Table Declaration
DATA: it_return type table of BAPIRET2.
Data Declaration
DATA D_MSG_TEXT(50).
populate DOCUMENTHEADER and pass to BAPI
*You can call your Bapi here *
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = <header>
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
tables
accountgl =
currencyamount =
return = it_return
EXTENSION1 =
.
collect all the logs in one internal table
ENDLOOP.
Opening the File
OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
MESSAGE D_MSG_TEXT.
IF SY-SUBRC NE 0.
WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
EXIT.
ENDIF.
Transferring Data
LOOP AT it_return to wa_return .
TRANSFER wa_return TO FILENAME.
ENDLOOP.
Closing the File
CLOSE DATASET FILENAME.
Regards
Dhirendra
Edited by: dhirendra pandit on Jul 7, 2009 1:55 PM