Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Table maintanance generator problem before saving(Event 01)

Hi Experts,

I have created one custom table with 5 fields

Field1  = Approval no ( Key Field and Editable )-->Auto Populated

Field 2 = Vesrion No ( Non Key filed and Output Only)

Filed 3=  description( Editable Filed)

Filed 4  = Created by(Auto poplated)

Filed 5 = Created_date(Autopopulate).

I have Create TMG for the table and am able to populate field4 field5 using create_entries event01.

My table having 3 records let us assume.

Field1        field2            field3              field4              field5

10001        01                  test               xxxx             12/09/14

10001        02                  test               xxxx             12/09/14

When i try to create same entry 10001 how to maintain vesrion(Field2)  number(Auto Populated). ?

I am trying to create using before save event how to compare TOTAL and EXTRACT tables?

Please find the code which I wrote its not working...

Please correct the below code.

LOOP AT total.

   wa_data1 = <vim_total_struc>.

   lv_index1 = sy-tabix.

   READ TABLE extract with KEY total.

   IF sy-subrc eq 0.

       lv_index2 = sy-tabix.

       wa_data2 = <vim_extract_struc>.

       if  wa_data1-version is INITIAL.

         wa_data1-version = 1.

       else.

          wa_data1-version = wa_data1-version + 1.

       endif.

       wa_data2-version = wa_data1-version.

       <vim_extract_struc> = wa_data2.

       <vim_total_struc> =  wa_data1.

       MODIFY extract INDEX lv_index2.

       MODIFY total index lv_index1.

   ENDIF.

Former Member
Not what you were looking for? View more on this topic or Ask a question