Skip to Content
0
Jul 13, 2007 at 12:25 PM

Sorting in TMG - Using Events

178 Views

Hi All,

This is regarding a Table maintainence i have created.

The table used keeps track of 3 levels of Approval

How do i sort a table in TMG according to a field?

I have 11 fields in my table,

ESG_GROUPING

PSA_GROUPING

SERVICE

APPROVERTYPE

APPROVER

ENDDA

BEGDA

PERIOD

LEVELS

FINAL

out of which the first 6 are key fields.

1) How do i make the TMG to sort on basis of the fields Service and level?

I have created maintained an event 01 (Before Saving the data in the database) and written the code.

I don't know how "extract" works in this context, i checked the stand code and this is what i found.

The only code i have added is :

<b>SORT extract.</b> "Added Code for sorting

The rest i have used the code for debugging purpose.

was refering the link :

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9f1235c111d1829f0000e829fbfe/frameset.htm

Has "extract" used in TMG linked to the extract mentioned in the link?

-


FORM before_save.

DATA: f_indx LIKE sy-tabix.

LOOP AT total .

READ TABLE extract WITH KEY <vim_xtotal_key>.

IF sy-subrc EQ 0.

f_indx = sy-tabix.

ELSE.

CLEAR f_indx.

ENDIF.

  • (make desired changes to the line total)

MODIFY total.

CHECK f_indx GT 0.

extract = total.

MODIFY extract INDEX f_indx.

ENDLOOP.

SORT extract. "Added Code for sorting

sy-subrc = 0.

ENDFORM.

-


2) If i delete a level 2, the levels should re-arrange accordingly

which means if i delete an approver at a level the TMG should arrange accordingly.

Ie, level 3 should become 2....

If i get a solution to (1), i can sort out (2)

If there is any other work around this problem, please suggest.

I am not specific in using Events to get hold of the problem.

Please help.

Regards,

Remi