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: 

Issuing an Error in Table Maintenance Event

Former Member
0 Kudos

Hi,

How can I issue an error in the table maintenance event without exiting the screen.

When an event is triggered (Before Save), it will perform a check in the data changed or created. It will issue an error when the changes are not correct. But when I press enter or click on the check button, it will exit the table maintenance screen.

What do I have to do in order to issue an error but will still go back to the table maintenance view.

Making the message as information or type I, will not work because it will still save.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

U can try this workaround, get the unchanged values in a temporary record and then whenever a warning message is issued just reassign these values back to the changed record.

Ok did u try setting sy-subrc value in ur code.

set sy-subrc like this

sy-subrc = 4

now issue ur message, this time it should not save

кu03B1ятu03B9к

Edited by: kartik tarla on Mar 18, 2009 8:42 AM

8 REPLIES 8

former_member228751
Contributor
0 Kudos

Hi,

When an event is triggered (Before Save), it will perform a check in the data changed or created. Issue the message as information or type I. Before issuing information message, use ROLLBACK statement. It will not commit the changes made to database. It will just throw pop-up message and will not save data.


IF error.
  ROLLBACK.
  message i000 with ''changes not saved'. 
ENDIF.

Regards,

Sachin

0 Kudos

Hi Thanks for the suggestion but ROLLBACK does not work, i've tried both ROLLBACK WORK and ROLLBACK CONNECTION con. and none of them worked.

former_member632729
Contributor
0 Kudos

Hi Dude,

Table Maintenance Generator Events:

Go through this Link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-8765287250fc]

former_member156446
Active Contributor
0 Kudos

From SAP Help:

All S, I and W messages are ignored in automatic adjustment. As view cluster event error messages must always be sent as S or I messages, the errors are not logged

[ More info>>>|https://help.sap.com/saphelp_nw04/helpdata/en/77/06b11859f511d2a6070000e82deaaa/frameset.htm]

[Sample code for Roll back>>>|http://abap-gallery.blogspot.com/2007/07/dynamic-table-maintenance.html]

Former Member
0 Kudos

U can try this workaround, get the unchanged values in a temporary record and then whenever a warning message is issued just reassign these values back to the changed record.

Ok did u try setting sy-subrc value in ur code.

set sy-subrc like this

sy-subrc = 4

now issue ur message, this time it should not save

кu03B1ятu03B9к

Edited by: kartik tarla on Mar 18, 2009 8:42 AM

0 Kudos

IF v_flag EQ c_x. "It means there's an Error

MESSAGE text-002 TYPE 'S' DISPLAY LIKE 'E'.

ENDIF.

Making it as Type S does not work. It still saves.

But i'm considering to do what you've suggested. The work around.

But if there's an easier way, it's much appreciated.

0 Kudos

Hi Al,

How are you? You can implement the check in the PAI of your table maintenance screen. Hope it helps....

Ex.


PROCESS AFTER INPUT.
    CHAIN.
      FIELD field_a.
      FIELD field_b .
      MODULE check_val ON CHAIN-REQUEST.
    ENDCHAIN.

MODULE check_val.
  IF field_a IS INITIAL
  OR field_b IS INITIAL.
    MESSAGE e398(00) WITH 'test'.
  ENDIF.
ENDMODULE.  

Former Member
0 Kudos

Hi,

I came to the same problem, maybe this will help someone.

You can move check into view cluster event.

1. load the view

     PERFORM vcl_set_table_access_for_obj

          USING 'view'

          CHANGING error_flag.

2. assing to structure

     LOOP AT <vcl_total> INTO ls_view


3. perform check, set VCL_STOP which will stop saving and will display message

     VCL_STOP = 'X'.

     MESSAGE ....