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: 

ztable validation

Former Member
0 Kudos

hi friends,

I have two fields in my ztable calle authouized_by(name of the person who was responsible) and effective date(todays date if not filled)

sould be FILLED automatically filled when its saved.

how could i achieve this? could anyone of you please help me out along with the code.

Thanks

rinky

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

TOTAL is the internal table which has the table values with the modified records also.

Thanks,

Naren

7 REPLIES 7

Former Member
0 Kudos

Hi,

If you are using SM30 for maitaining the table..add a row to the table V_TVIMF with the event '1' and give a subroutine name MOVE_DATE..

In the subroutine add the code to move the user name and date..

add this subroutine to the function group that is created for the table maintenance..

FORM MOVE_DATE.

DATA: S_STRUCTURE TYPE ZTABLE....

LOOP AT TOTAL.

S_STRUC = TOTAL.

S-STRUC-DATE = SY-DATUM.

S_STRUC-USER = SY-UNAME.

TOTAL = S_STRUC.

MODIFY TOTAL.

ENDLOOP.

ENDFORM.

Hope this helps..

Thanks,

naren

0 Kudos

Hi Naren,

could you please let me know what is total?

0 Kudos

hi,

i think u can use table maintenance events for this purpose.

1. go to se11

2. utilities -> table maintenance generator. or SE55

3. now environment -> modifications -> events

here u can select event '05' for validations to be done before saving an entry into DBtable.

here as many already suggested u can code the following.

move <name> to ztable-authorised_by.

if effective_date is initial.

move sy-datum to effective_date.

end if.

u can code in PAI but when table maintenance is regenerated, this coding is lost.

reward if useful....

Former Member
0 Kudos

Hi,

TOTAL is the internal table which has the table values with the modified records also.

Thanks,

Naren

0 Kudos

Hi Naren,

Thanks a lot,problem is solved atlast.

Thanks

Rinky.

ferry_lianto
Active Contributor
0 Kudos

Hi Rinky,

You can code something like this.


...
move sy-uname to ztable-authouized_by.

if ztable-effective_date is initial.
  move sy-datum to ztable-effective date.
endif.

modify ztable.

Regards,

Ferry Lianto

former_member223537
Active Contributor
0 Kudos

Hi,

Assume table name is ZTABLE.

1. Create a Table maintenance through transaction SE11.

2. Once table maintenanace is created, a Function group would be created automatically of the same name ZTABLE.

3. Goto SE80. Select Function Group and Enter the name as ZTABLE.

4. In the Function Group, under PAI event of SAVE, include following code.

ZTABLE-AUTHORIZED = sy-uname.

if ZTABLE-DDATE is initial.

ZTABLE-DDATE = sy-datum.

ENDIF.

This should be included in the PAI EVENT before the MODIFY ZTABLE statement.

Best regards,

Prashant