2006 Sep 30 8:20 AM
hai,
how to validate screen fields from different tables,
the requirement is, if i enter value in first screen, if entry exits in any one of three tables its displays error message in status bar other wise is goes to next screen.plz forward this soultion as early as possible.
hai,
how to validate screen fields from different tables,
the requirement is, if i enter value in first screen, if entry exits in any one of three tables its displays error message in status bar other wise is goes to next screen.plz forward this soultion as early as possible.
2006 Sep 30 8:23 AM
Hi satya,
1. I would personally do like this.
2. data : flag1 type c,
flag2 type c,
flag3 type c.
select * from table1 where condtion.
if sy-subrc = 0.
flag1 = 'X'.
endif.
select * from table2 where condtion.
if sy-subrc = 0.
flag2 = 'X'.
endif.
select * from table3 where condtion.
if sy-subrc = 0.
flag3 = 'X'.
endif.
If flag1 = 'X' or flag2 = 'X' or flag3 = 'X'.
message 'Entry already exists' Type 'E'.
endif.
set screen 2000.
regards,
amit m.
2006 Sep 30 1:44 PM
Hi
do like this
initialization.
data : flag1 type c.
At-selection-screen on <fieldname>.
select * from table1 where condtion.
if sy-subrc = 0.
flag1 = 'X'.
endif.
select * from table2 where condtion.
if sy-subrc = 0.
flag1 = 'X'.
endif.
select * from table3 where condtion.
if sy-subrc = 0.
flag1 = 'X'.
endif.
If flag1 = 'X'
message 'Entry already exists' Type 'E'.
endif.
This will work.
If helpful Pls reward me points.
Regards
Manas Ranjan Panda
2006 Sep 30 7:17 PM
Try:
SELECT SINGLE field1 from tab1 into f1.
IF sy-subrc <> 0.
SELECT SINGLE field1 from tab2 into f1.
IF sy-subrc <> 0.
SELECT SINGLE field1 from tab3 into f1.
ENDIF.
ENDIF.
ENDIF.
IF sy-subrc = 0.
MESSAGE E(001) WITH 'Field exists'.
ENDIF.
This method avoids unnecessary SELECTS.
Rob
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |