Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how can we transfer error report

Former Member
0 Kudos

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 ?

1 ACCEPTED SOLUTION

former_member555112
Active Contributor
0 Kudos

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

5 REPLIES 5

former_member555112
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos

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.

0 Kudos

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

dhirendra_pandit
Active Participant
0 Kudos

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