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 event question.

Former Member
0 Likes
470

Hi experts,

We have a custom table in which we have 16 fields. There are 2 fields filed1 and field2 among 16 fields.

Whenever a user goes to table maintenance and deletes an entry we need to check if field1 is X, set field2 to X

and not delete the entry else if field1 is empty delete the entry. We can use before delete table event but how to update and prevent deletion.Please suggest a solution.

Help will be appreciated.

Thanks,

aditya.

3 REPLIES 3
Read only

sitakant_tripathy2
Active Participant
0 Likes
421

Hi Aditya,

Please check if writing the below mentioned code in the perform routine for event 03 helps you...

LOOP AT extract.
  CASE <xact>.
*   Check Deleted/Entry first changed and then deleted.
    WHEN 'GELOESCHT'
    OR   'UPDATE_GELOESCHT'.
*     Check if the row is selected
      IF <xmark> = 'MARKIERT'.
*       Your logic for Field1 and Field2
        IF extract-field1 = 'X'.
          IF extract-field2 IS INITIAL.
            extract-field2 = 'X'.
          ENDIF.
*         Clear the Selected row to not to be considered for deletion
          CLEAR extract-mark.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDIF.
  ENDCASE.
  MODIFY extract.
ENDLOOP.

Regards,

Sitakant

Edited by: Sitakant Tripathy on Sep 24, 2010 11:26 AM

Read only

0 Likes
421

Hi Sitakanth

The extract table has only one field Line so i modified your code like this

LOOP AT extract.

CASE <xact>.

  • Check Deleted/Entry first changed and then deleted.

WHEN 'GELOESCHT'

OR 'UPDATE_GELOESCHT'.

  • Check if the row is selected

IF <xmark> = 'MARKIERT'.

  • Your logic for Field1 and Field2

IF extract+135(1) NE 'X'.

extract+134(1) = 'X'.

  • Clear the Selected row to not to be considered for deletion

CLEAR <xmark>.

ENDIF.

ELSE.

CONTINUE.

ENDIF.

ENDCASE.

MODIFY extract.

ENDLOOP.

But this also doesnt seem to work. Could you suggest anything else.

thanks,

aditya.

Read only

Former Member
0 Likes
421

Hi,

For every table maintaianace there is function group this may be the same table name or some thing..

go to se80>enter the function group of table maintianance gicen in se11>and go to screen

and in the table control ...


"in th PAI..

LOOP AT <TABLE control>
chain.

"Add the custom module...
Module check_delete.

endchain.

Endloop.


MOdule check_delete Input.
  if <tablename>- field1 is X and   <tablename>- field2 to X and SY-ucomm = 'DELE'.
  message 'unable to delte entry because the field1 and field 2 eq 'X'
  ENDIF.
ENDMODULE.

Prabhudas