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

Write validations in Table maintenance generator

Former Member
0 Likes
1,355

Dear Experts,

How do we write our own validations (In which event) in table maintenance generator.

My problem was, I have created Ztable with fields UNIT and Desc and created table maintenance generator to maintain the table... So I am able to create new entrieas and delete existing entries from the table...

Now my questation was:

When i am deleting unit from my table I need to check wether this unit is used in another table or not...If so I should not allow for the deletion and throw error message...

Regards,

Rayudu

7 REPLIES 7
Read only

Former Member
0 Likes
1,007

Hi,

Go to Se80 and in the function group in which u have created the table maintenance.

Then in the PAI of the table maintenance screen create a

'MODULE before_save ON CHAIN-REQUEST'. This will be in the chain-endchain.

In this module you can put your validation code.

Regards,

Sandeep

Read only

0 Likes
1,007

Hi Sandeep,

thnaks for info... but

Table maintenance generated following code....

Validation is:

SELECT SINGLE yunit INTO LV_UNIT

FROM YQ002

WHERE YUNIT = YQ001-YUNIT.

IF SY-SUBRC EQ 0.

MESSAGE E000(ZM) with ' UOM used in table 'YQ002' '.

ENDIF.

Table maintenance code as like this:

PROCESS BEFORE OUTPUT.

MODULE LISTE_INITIALISIEREN.

LOOP AT EXTRACT WITH CONTROL

TCTRL_YQ001 CURSOR NEXTLINE.

MODULE LISTE_SHOW_LISTE.

ENDLOOP.

*

PROCESS AFTER INPUT.

MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.

MODULE LISTE_BEFORE_LOOP.

LOOP AT EXTRACT.

MODULE LISTE_INIT_WORKAREA.

CHAIN.

FIELD YQ001-YUNIT .

FIELD YQ001-YDESC .

MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.

ENDCHAIN.

FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.

CHAIN.

FIELD YQ001-YUNIT .

MODULE LISTE_UPDATE_LISTE.

ENDCHAIN.

ENDLOOP.

MODULE LISTE_AFTER_LOOP.

Read only

Former Member
0 Likes
1,007

Hi,

In a Table Maintenance generator, you can do the required validations in the Flow Logic of the screen ( either in the PBO or the PAI). But I guess the better way to implement this functionality would be to code the required logic in the <b>events</b>. If you are new to the <b>events</b> concepts, go to SE11>Display Table>Utilities>Table Maintenance Generator>Environment-->Events. Please get back incase you have further doubts with regads to this.

Thanks & Regards

Saikiran

Read only

0 Likes
1,007

Hi saikiran,

I tried events 03 and 01 .. but I am not getting selected lines from table control to validate...

And when I throw error message I am not able to edit further....

Can you help me out on this...

Rayudu

Read only

0 Likes
1,007

HI Guys,

I am trying to use event 03 to do validations...But I am not getting proper data from field symbols...

Can any body help me....

Here is some help..

Event 03: Before Deleting the Display Data

Use

This event occurs before selected entries are sent to the trash with the 'Delete' function. Other activities can be performed, for example checking whether the entries can be deleted.

Realization

This event has no standard routine. The following global data is available for the realization of the user routine:

internal table EXTRACT... But I didnt understant properly....

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

Thanks,

Rayudu

Read only

0 Likes
1,007

Hi rayudu,

1. internal table EXTRACT... But I didnt understant properly.

we have to use offset concept.

2. like this

LocID = Extract+3(6)

where mandt would be occuping first 3 charactes

the next six would be our location id.

3. EXTRACT contains

all the characters of our table,

4. we have to fetch the data

using offset concept.

regards,

amit m.

Read only

0 Likes
1,007

Yes Amith,

Correct We need to use offset address... But the problem here is I am not getting correct record in <EXTRACT>.... Its always contains last record of table....

Rayudu