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

validations in table maintance generator

Former Member
0 Likes
1,572

Sir,

           In my TMG there are fields district and warehouse. data was populated in to that TMG from upload program

           the last four digits of the warehouse must be equal to the district code.

       

          The data will be populated in wrong format for the warehouse field . the user will refer the district field and changes the last four digits

          of the warehouse field.

      

         so if he changes according to the district code which was available the data should save.

         other wise it should throw a validation.

         where can i write the validation in the TMG.

      

Thanks & Regards.

1 ACCEPTED SOLUTION
Read only

gouravkumar64
Active Contributor
0 Likes
1,522

Hi,

Some ways is there,

like the event.

this link will help u to understand

http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABLE+MAINTENANCE

other is from table main, screen>system>status>program>in PAI >create a module.

U can write.ur logic/validation.

Hope it helps.

Thanks

Gourav.

Sir,

           In my TMG there are fields district and warehouse. data was populated in to that TMG from upload program

           the last four digits of the warehouse must be equal to the district code.

       

          The data will be populated in wrong format for the warehouse field . the user will refer the district field and changes the last four digits

          of the warehouse field.

      

         so if he changes according to the district code which was available the data should save.

         other wise it should throw a validation.

         where can i write the validation in the TMG.

      

Thanks & Regards.

13 REPLIES 13
Read only

0 Likes
1,522

Hi,

There are events triggered in TMG.

Read only

gouravkumar64
Active Contributor
0 Likes
1,523

Hi,

Some ways is there,

like the event.

this link will help u to understand

http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABLE+MAINTENANCE

other is from table main, screen>system>status>program>in PAI >create a module.

U can write.ur logic/validation.

Hope it helps.

Thanks

Gourav.

Read only

Former Member
0 Likes
1,522

Hi Satish,

Read only

0 Likes
1,522

Hi Satish,

You can use TMG events for your requirement.

You can also create a module in PAI for validating the data.

eg: FIELD <warehouse field> MODULE<your module>.

Here you can put your desired condition and display an error message if the condition fails.

I have tried this and it works perfectly

Read only

0 Likes
1,522

Sir,

         Can pls post the code of what u have written.

Thanks & Regards.

Read only

0 Likes
1,522

<Link removed by moderator>

Check above link..

Regard's

Smruti

Message was edited by: Vinod Kumar

Read only

0 Likes
1,522

hi,

create TMG, goto ENVIRNAMENT -> modifications -> events.

later u will be getting many events select  BEFORE save events.

write code within method generate for the events and do validations there only.

like say you have field XXX of table abc should be 123 else you have through error then write like

if abc-xxx = '123'.

else.

"error'.

exit.

endif.

regards.

lingaraj.

Read only

0 Likes
1,522

Hi Satish,

Please follow the below steps:

1. Go to the FunctionPool of your TMG.(It must have name like ZSAPLTABLE where your table name is ZTABLE).

2. Create a new include with name ZLTABLEF01(This is required as the system gives a message saying 'User xxxxxx is currently editing the program ZSAPLTABLE'). Save and avtivate the program.

3. Now go to the screen flow logic of the TMG screen.

4. You have to write the code in bold as shown below

    

   LOOP AT EXTRACT.
   MODULE LISTE_INIT_WORKAREA.
   CHAIN.
    FIELD dist_code.

    FIELD warehouse MODULE check_distcode(or whatever name you want to give).

5. Now double click on check_distcode and the system will ask if you want to create a new module. Click yes and select the name of the new include you have created in step 2 above.

6. Write the below code in the module

IF ZTABLE-warehouse+length(4) NE ZTABLE-distcode.   (where length is the no. of digits before last 4 digits)

     .... Throw up an error message

ENDIF.

7. Save and activate the module and the main TMG program. Check the validation in SM30.

Hope this helps

Reward points if helpful

Read only

0 Likes
1,522

Sir,

      Thank u i have completed the requirement.

Read only

0 Likes
1,522

Sir,

      Thank u i have completed the requirement.

Read only

0 Likes
1,522

Hi,

So close this thread & mark it answered.

Reagrds

Gourav.

Read only

Former Member
0 Likes
1,522

Hi Satish,

Check this link.

http://help.sap.com/saphelp_47x200/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm

"Before Saving the Data in the Database"

Regard's

Smruti

Read only

0 Likes
1,522

sir,

       thank u i have completed my requirement