module USER_COMMAND_9000 input."User command fieldDATA OK_CODE TYPE SY-UCOMM.OK_CODE = SY-UCOMM.CASE OK_CODE.WHEN'DELETE'."Retrieving record selectedLOOPAT LT_SOURCE INTO LS_SOURCE WHERE MARK = 'X'."Appending record to be deleted in restore tableAPPEND LS_SOURCE TO LT_RESTORE."Deleting record to be deletedDELETETABLE LT_SOURCE FROM LS_SOURCE."Decrementing table control line by one SOURCE-LINES = SOURCE-LINES - 1.ENDLOOP.

WHEN'SELECT'."Retrieving record being not selectedLOOPAT LT_SOURCE INTO LS_SOURCE WHERE MARK <> 'X'."Making record being selected LS_SOURCE-MARK = 'X'."Updating Changes to source tableMODIFY LT_SOURCE FROM LS_SOURCE TRANSPORTING MARK.ENDLOOP.

WHEN'DESELECT'."Retrieving record being selectedLOOPAT LT_SOURCE INTO LS_SOURCE WHERE MARK = 'X'."Making record being not selected LS_SOURCE-MARK = ''."Updating Changes to source tableMODIFY LT_SOURCE FROM LS_SOURCE TRANSPORTING MARK.ENDLOOP.

WHEN'INVERT'."Retrieving record being selectedLOOPAT LT_SOURCE INTO LS_SOURCE WHERE MARK = 'X'."Setting mark value to temporary value other than 'X' or space( here 'Y') LS_SOURCE-MARK = 'Y'.MODIFY LT_SOURCE FROM LS_SOURCE TRANSPORTING MARK.ENDLOOP."Retreiving record being not selectedLOOPAT LT_SOURCE INTO LS_SOURCE WHERE MARK = ''."Making record being selected LS_SOURCE-MARK = 'X'.MODIFY LT_SOURCE FROM LS_SOURCE TRANSPORTING MARK.ENDLOOP."Retrieving record whose mark value has been set to temporary value( here 'Y')LOOPAT LT_SOURCE INTO LS_SOURCE WHERE MARK = 'Y'."Making record being not selected LS_SOURCE-MARK = ''.MODIFY LT_SOURCE FROM LS_SOURCE TRANSPORTING MARK.ENDLOOP.