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

Table maintenance generator, events?

Former Member
0 Likes
486

Hello all,

I created a table maintenance generator for a custom table. Then I created an event that is executed when the data is saved. A form that is executed when the event is reached is currently displaying an error message. The code currently rejects all of the entries if any one of them fails the validation test. How can I preserve the entries that passed the validation and just flag the entries that are in error, allowing them to be reprocessed?

The form is executed at step 01, before saving the data in the database.

Here is the code in the form.

form 01_b4_save.

*

data: f_index like sy-tabix.

data: begin of l_total.

include structure zrepo_val.

include structure vimtbflags.

data end of l_total.

*

data: s_record type zrepo_val.

*

loop at total into l_total.

if l_total-vim_action = aendern " Change

or

l_total-vim_action = neuer_eintrag. " New entry

*

move-corresponding l_total to s_record.

if s_record-hkont = '0001406374'.

message e000(zf) with

'GL 0001406374 is forbidden'.

endif.

read table extract with key l_total.

if sy-subrc eq 0.

f_index = sy-tabix.

else.

clear f_index.

endif.

move-corresponding s_record to l_total.

modify total from l_total.

check f_index gt 0.

modify extract index f_index from l_total.

endif.

endloop.

*

endform.

Thanks

Bruce

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
425

If you want other entries to be saved and this one entry to be flagged out, it will not conform to how transactions are coded (if there is an error, the screen stays till the user has rectified the error. It doesn't save the correct parts/records).

I think adding code to validate the records in the PAI section would be a good idea. If you look at the PAI code for the screen, there is likely a CHAIN--ENDCHAIN for validation, you can add your module for this additional validation.

1 REPLY 1
Read only

Former Member
0 Likes
426

If you want other entries to be saved and this one entry to be flagged out, it will not conform to how transactions are coded (if there is an error, the screen stays till the user has rectified the error. It doesn't save the correct parts/records).

I think adding code to validate the records in the PAI section would be a good idea. If you look at the PAI code for the screen, there is likely a CHAIN--ENDCHAIN for validation, you can add your module for this additional validation.