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

Birthday problem

Former Member
0 Likes
1,015

Dear all,

I have a necessiy that I want to search the pa0002 table for records corresponding to present day and current month to obtain birthday of people.

The gbmon and gbtag fields of pa0002 are the month and day of birth of the people.

So we can find the no. of people who were born on that day.

But I am facing a problem as I am not able to get any values in the internal table under consideration.

Please do help me as soon as possible.

Thanks and Regards,

Soumyadeep.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
953

Hello Ghosh,

Please try the following code

TABLES : pa0002.
data: it_bbuddies like standard table of p0002 with header line.

data: date type sy-datum,
date1(2) type n,
date2(2) type n.
date = sy-datum.

date1 = date+4(2).
date2 = date+6(2).

SELECT vorna FROM pa0002 INTO CORRESPONDING FIELDS OF table it_bbuddies
 WHERE gbmon = date1 AND gbtag = date2.

LOOP AT it_bbuddies.
write:/ it_bbuddies-vorna.
ENDLOOP.

When u see in the debug mode i observed tht gbmon and gbtag are becoming zeros. But check it in the table entries. The entries are correct.

Hope it helps you

Regards

Indu.

Edited by: Indu Rayepudi on Jun 30, 2008 3:30 PM

8 REPLIES 8
Read only

Former Member
0 Likes
953

why r u not able to get the values in internal table. Maybe ur coding error...

check out once.

Read only

GauthamV
Active Contributor
0 Likes
953

hi,

what is ur problem.

if u give day and month details u will get details from that table so based on that write simple select statement.

Read only

Former Member
0 Likes
953

TABLES : pa0002.

IF mode = 'DIS'.

date = sy-datum.

date1 = date+4(2).

date2 = date+6(2).

date3 = date+5(1).

LOOP AT it_bbuddies.

SELECT SINGLE vorna FROM pa0002 INTO CORRESPONDING FIELDS OF it_bbuddies WHERE gbmon = date1 AND gbtag = date2.

APPEND it_bbuddies.

ENDLOOP.

This is the code Im using . Please do let me know what is the problem with this code.

ENDIF.

Read only

Former Member
0 Likes
953

GBJHR Year

GBMON Month

GBTAG Day

Are the fields from the table PA0002

take the values into internal table.

Now u can do anything with this field like

finding the no. of ppl having Bday on month of 10 (ie oct)

with where GBMON = '10'

or day nd month

where GBMON = '10'

and GBTAG = '26'.

U can do anything

Thanks & Regards

vinsee

Read only

0 Likes
953

I know what ur saying Vinsee. But my requirement is that I have to select people whose birthday is on the current day.

n the code which i attached is not working.

Read only

Former Member
0 Likes
953

select query is wrong..

into corressponding fields of table itab.

Read only

Former Member
0 Likes
954

Hello Ghosh,

Please try the following code

TABLES : pa0002.
data: it_bbuddies like standard table of p0002 with header line.

data: date type sy-datum,
date1(2) type n,
date2(2) type n.
date = sy-datum.

date1 = date+4(2).
date2 = date+6(2).

SELECT vorna FROM pa0002 INTO CORRESPONDING FIELDS OF table it_bbuddies
 WHERE gbmon = date1 AND gbtag = date2.

LOOP AT it_bbuddies.
write:/ it_bbuddies-vorna.
ENDLOOP.

When u see in the debug mode i observed tht gbmon and gbtag are becoming zeros. But check it in the table entries. The entries are correct.

Hope it helps you

Regards

Indu.

Edited by: Indu Rayepudi on Jun 30, 2008 3:30 PM

Read only

Former Member
0 Likes
953

Thanks a lot Indu,

it helped.

i will stay in touch with u in future for any abap related issues. Hope u dont mind.