Application Development and Automation 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: 
Read only

BAPI - How to save BAPI data

Former Member
0 Likes
2,153

HI all,

We have one interface that is used to create the Sales order ,Purchase requistions,etc...

We create all these using corresponding BAPI.Firstly we fill all the data to BAPI and then execute that BAPI.

Let the BAPI execute successfully then it is ok, but if there is some error then it shows error messages now i want to store all data in corresponding tables if error comes.

so after that we again go to data and correct the particular fields / data and again execute that BAPI with the corresponding data.

Any suggestion welcome,

Regards,

3 REPLIES 3
Read only

Former Member
0 Likes
1,206

hi...

what you can do is your BAPI data must be coming to some internal table.

you can read this internal tble with key = 'E'.

if sy-subrc = 0.

then you cn move the corressponding records t some other internal table and display them if needed.

i am doing a similar case over here.you can check it.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'

EXPORTING

documentheader = i_dochd

IMPORTING

obj_type = header-obj_type

obj_key = header-obj_key

obj_sys = header-obj_sys

TABLES

accountreceivable = i_ar

accountgl = i_accountgl

  • accounttax = i_acctax

currencyamount = i_curramt

return = i_return

extension1 = i_extn.

READ TABLE i_return WITH KEY type = 'E'.

IF sy-subrc EQ 0.

v_tabix = sy-tabix + 1.

ENDIF.

READ TABLE i_return INDEX v_tabix.

IF sy-subrc EQ 0.

LOOP AT izecollect_citi WHERE sel = 'X' AND docno IS initial.

izecollect_citi-errflg = 'E'.

izecollect_citi-errdesc = i_return-message.

MODIFY izecollect_citi.

CLEAR izecollect_citi.

v_error1 = 'X'.

ENDLOOP.

Read only

Former Member
0 Likes
1,206

Navdeep,

BAPI_TRANSACTION_COMMIT

Amit.

Read only

Former Member
0 Likes
1,206

use the function module to save the data to databse.

BAPI_TRANSACTION_COMMIT

Execute external Commit when using BAPIs