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

validate a field

Former Member
0 Likes
999

Hi Gurus,

I have to validate a paticular field which hold the table name .ie

PARAMETERS : p_table(10) TYPE C. "getting the table name frm the user

FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.

w_tabname = p_table.

i need to validate the p_table ....... How to validate it .Can any one help to do it .

Advance Congrats

Regards

Abeehs

1 ACCEPTED SOLUTION
Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
976

Hi,

What kind of validation u want.?..if u want to see if the table exists then check if this exists in DD02L table . This table holds the SAP Tables name.

keerthi

9 REPLIES 9
Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
977

Hi,

What kind of validation u want.?..if u want to see if the table exists then check if this exists in DD02L table . This table holds the SAP Tables name.

keerthi

Read only

amit_khare
Active Contributor
0 Likes
976

Write a SELECT query with P_TABLE on table DD02L (Please confirm in SE11).

Read only

Sm1tje
Active Contributor
0 Likes
976

could that be any table (or even structure) in SAP? If so, table names can be up to 16 characters long (and structures even more).

Try to use the same type as in SE11 for your parameter, would be nicer (better) for the user for selecting a table (structure) from data dictionary.

Read only

Former Member
0 Likes
976

you can go for.

AT SELECTION-SCREEN ON p_table.

*select statement for that parameter. e.g:

SELECT SINGLE lifnr FROM lfa1 INTO p_lifnr

WHERE lifnr = p_lifnr.

Regards

Read only

Former Member
0 Likes
976

Hi,

thanks for all your reply.. I need to check the table entered in the p_table ..whether the given table name is valid or not if not the nthrought the error message

Read only

0 Likes
976

validate against dd02l

select single tabname

from dd02l into l_v_file where tabname = p_file.

If sy-subrc ne 0.

Print ur error message.

Endif.

Read only

Former Member
0 Likes
976

you can go for.

AT SELECTION-SCREEN ON p_table.

*select statement for that parameter. e.g:

SELECT SINGLE lifnr FROM lfa1 INTO p_lifnr

WHERE lifnr = p_lifnr.

if sy-subrc <> o.

message 'text mesage here' type 'E'.

endif.

Regards

Read only

Former Member
0 Likes
976

you can go for.

AT SELECTION-SCREEN ON p_table.

*select statement for that parameter. e.g:

SELECT SINGLE lifnr FROM lfa1 INTO p_lifnr

WHERE lifnr = p_lifnr.

if sy-subrc <> o.

message 'text mesage here' type 'E'.

endif.

Regards

Read only

Former Member
0 Likes
976

Hi,

Check to see if the table entered on the selection screen is available in the DD02L table.

The database table DD02L holds all the dictionary tables in SAP.

The pseudocode would look like below.

AT SELECTION-SCREEN on p_table.

Select single <tablename> into (g_tabname) from DD02L

where <tablename> = p_table.

If sy-subrc <> 0.

Return Error message.

endif.

Regards,

Vamsee