cancel
Showing results for 
Search instead for 
Did you mean: 

Context change log and CATS BAPIs

Former Member
0 Kudos

Hi,

I'm creating small WDA application for CATS. I have a table control where cats record are created, updated and deleted. For each action there is CATS BAPI. For deleting I have to created context node, where I store deleted records before BAPI for deletion deletes them from DB (called after user press "Save changes" button on page). For inserting and deleting I'm using context change log. I have a few problems with it:

1. I can distinguish between updated and inserted records, by reading element attribute counter of CATSDB node. After user press "Save changes" button updated records are readed from context node to TABLE OF bapicats3 and by BAPI_CATIMESHEETMGR_CHANGE are saved back to DB. But If there is a problem, BAPI returns a TABLE OF bapiret2 where the problems are described with row number, where error come. I don't know how to map this number back to context element index to report this error back to user by REPORT_ELEMENT_T100_MESSAGE.

2.Application have read context change log and thru BAPI send update and insert back to DB,but there is error reported to user, but If user in this situation clicks button "Save changes" (where is logic for insert, update and delete) context change log is deleted-> application finds there is nothing to insert or update->no error reported to user-> user thinks everything OK. What is best approach in this scenario?

Many thanks for answer!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

solved by myself by calling BAPI only for one element values in loop thru context node... not a best solution, but working solution....

Many thanks for all replies

Former Member
0 Kudos

HI,

There is a key combintaion to identify the record right...when the error is thrown you need to check with the old tbale contetnts against thekey combintaion..

Or

Before you click on SAVE then try to save the data in another table...based on this the resultant DB changes can be mapped..

Former Member
0 Kudos

Hi,

many thanks for your answer.

My second point can be solved very easily by: context->get_context_change_log( and_reset = abap_false ).

But first point is a bit harder to solve: I have a context node with changed and inserted values:

1. changed

2. inserted - BAPI error

3. changed - BAPI error

4. changed

I split this context node to two itabs, one for change-BAPI one for insert-BAPI. When I call update BAPI I get back in TABLE OF bapiret2 that on row on index 1(zero-bsed index) is error (position 3. in context node). How can I find mapping between row of itab and it's context element (itab is created from context node)?

Many thanks for answer!

Former Member
0 Kudos

In this case, you need to look into the key combination..for ex if you are trying to get teh values from a table, check fir teh primary key combination based on this only you need to get that record...

Former Member
0 Kudos

Hi,

but how can I find element in context if i know primary key? - This will work for update.

For insert - there is no primary key yet (is set after insert-bapi call by system), so how can I find context element in this scenario (i have a row number in bapiret table)?

Many thanks for answer

Former Member
0 Kudos

Interanlly while deisgning the table, we will have one indicator wthere this is inserted or chanegd ..some status..

while insertion we will keep this as I and based on this we will now the added rows..

Can you be more clear...on what exactly you want to have..where are you facing the probelm.