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

Code please(select statements)

Former Member
0 Likes
783

Can somebody please help me out in writing an ABAP program for the following requirement?

Use "select" statement in your ABAP program to select the database table contents depending upon the query that user has entered at the selection screen.

Display the selected records of database table (point 3) on the output report.

Selection screen:

Below are the selection screen parameters/options that you need to provide

for the user

1. Employee ID

2. Employee Name (either Emp ID or name should be mandatory).

3. Employee Dept/ Designation / joining date

4. Another parameter should be "Age". Thus, if user enters 27 on Age field, every employee under 27 age should be displayed on the report.

Output report:

Employee ID with name / dept / designation / joining date and age should be displayed as details.

6 REPLIES 6
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
730

Sounds like a simple report program. Have you tried coding it yourself first?

Regards,

Rich Heilman

Read only

0 Likes
730

This short sample program should get you started.




report zrich_0002.

* declare the internal table
data: ipa0001 type table of pa0001 with header line.


* define the selection screen
select-options: s_pernr for ipa0001-pernr,
                s_SNAME for ipa0001-SNAME.


start-of-selection.

* Select the data from database
select * into corresponding fields of table ipa0001
            from pa0001
                    where pernr in s_pernr
                      and sname in s_sname
                      and ENDDA = '99991231'.


* Write out the data in a list
loop at ipa0001.

  write:/ ipa0001-pernr, ipa0001-sname.
endloop.

Regards,

Rich Heilman

Read only

0 Likes
730

Hi Shailender,

I agree with Rich... it would help you & us if you do the basic coding and then seek the forum for addiotional help.. here is for a start.. create a report & tie it to the logical database PNP.. Use infotype 0002 to get the id ,name & DOB, infotype 0001 to get the Dept & designation and 0041 for joinig date.. it should be a fairly simple report..

Good Luck,

Suresh Datti

Read only

Former Member
0 Likes
730

Hi

Try to see this FM

HRWPC_RFC_PERSONALDATA_GETLIST

and code accordingly...

it is very simple report..

vijay

Read only

Former Member
0 Likes
730

Hi Shailender,

Why to develop custom report when SAP has delivered this report..

Try Birthday List under HR - Information System - Reports - Pers Mgmt - Admin - Employee - Birthday List .. There are many other reports you can look into..

Hope this helps.

-Bharat

Read only

Former Member
0 Likes
730

Data: Itab like ztable occurs 0 with header line.

select-options: s_id for ztable-id.

select-options: s_name for ztable-name.

select-options: s_dept for ztable-dept.

select-options: s_age for ztable-age.

start-of-selection.

select * from ztable into corressponding fields of table itab where id = s_id and name = s_name and dept =s_dept and age = s_age.

At selection-screen.

if s_id is not initial .

message i000(zmsg) with 'Provide id'.

endif.

end-of-selection.

Loop at itab.

write:/ itab-id,itab-name,......

endloop.

regards

vijay