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

ztable entries check

Former Member
0 Likes
786

hello abap gurus,

i need to input a date as a parameter.

and check that ztable1 has entries with this date,

if not display an error message " no entries with this date".

can i get the best way of coding this.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
763

Hi,

Try this sample code..



PARAMETERS: P_DATE TYPE SYDATUM.

DATA: T_ZTABLE TYPE STANDARD TABLE OF ZTABLE.

* Start-of-selection.
SELECT * FROM ZTABLE
              INTO TABLE T_ZTABLE
             WHERE DATE = P_DATE.     " Give the correct date field name

IF SY-SUBRC <> 0.
  MESSAGE E208(00) WITH 'No entries with this date'.
ENDIF.

Thanks,

Naren

hello abap gurus,

i need to input a date as a parameter.

and check that ztable1 has entries with this date,

if not display an error message " no entries with this date".

can i get the best way of coding this.

4 REPLIES 4
Read only

Former Member
0 Likes
763

data i_table like ztable occurs 0 with header line.

Parameters : P_date like sy-datum.

select * from ztable into table i_table where date = p_date.

if sy-subrc ne 0.

message.

endif.

Reward Points if it is helpful

Thanks

Seshu

Read only

Former Member
0 Likes
763

Hi,

data itab like ztable1 occurs 0 with header line.

Parameters : p_date like sy-datum.

select * from ztable1 into table itab where date = p_date.

if sy-subrc ne 0.

message E001(00) with 'No Entries in this Date'.

endif.

Regards

SAB

Read only

Former Member
0 Likes
764

Hi,

Try this sample code..



PARAMETERS: P_DATE TYPE SYDATUM.

DATA: T_ZTABLE TYPE STANDARD TABLE OF ZTABLE.

* Start-of-selection.
SELECT * FROM ZTABLE
              INTO TABLE T_ZTABLE
             WHERE DATE = P_DATE.     " Give the correct date field name

IF SY-SUBRC <> 0.
  MESSAGE E208(00) WITH 'No entries with this date'.
ENDIF.

Thanks,

Naren

Read only

Former Member
0 Likes
763

thank you all , seshu, sayed, naren.

thanks for the code.