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

selection screen doubt

Former Member
0 Likes
3,204

can anyone help on this:-

i hav tables pa0000, pa0001, pa2001.

my selection screen:-

parameters : S_BTRTL LIKE PA0001-BTRTL,

s_month like ?

how should i get month in the selection screen?

i am callig fun module:-REAL_ESTATE_F4_MONTH to get the month .

so i taken like this

s_month like VVIS_SOPTI-SMONTH.

when i am retriving data from select queries based on selection screen...

eg: - select .... from .. where btrtl eq s_btrtl

<b>smonth eq s_month</b>.

it's showing errror smonth is unknown?

Am I called the right function module?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,943

Hi hari,

i can change the code , but let me explain something.

PA0000 , from where we r selectiong the no of worker, contains two fields , begda and endda.

begda = join date of employee

endda =99991231 by default, that means the employee is still working and has no left the company yet.once he retire or resign the endda for that worker is set to that perticular date.

the present code shows you the employee who are active ie, endda = 99993112, and stat2 = 3.

so it is coming constant for any month selection, since month selection is not oing alter that.

if you craete a new info type and or change the stat2 of any infotype to 3, then you will find diffeent output.

By the way what stat2 =3 stands in your company?

32 REPLIES 32
Read only

Former Member
0 Likes
2,943

which table are you writing the select on?

does it have a column named smonth?

when u say select ....where smonth = s_month, smonth needs to be a field in the concerned table

check it...

rgds,

PJ

Read only

0 Likes
2,943

tables are pa0000, pa0001, pa2001.

in this tables there is no month field.

my requirement is to get month in the selection screen..so i called func module.

but when i am using select queries...ther is no particular field like smonth.

i used REAL_ESTATE_F4_MONTH.

Is ther any alternative to get month in selc sceen.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
2,943

Hi,

Just try this.It won't show error.

tables vvis_sopti.

parameters s_month like VVIS_SOPTI-SMONTH.

Read only

0 Likes
2,943

i used the same.

tables vvis_sopti.

parameters s_month like VVIS_SOPTI-SMONTH.

but there is no field in the concerned table.

how should i approach

Read only

0 Likes
2,943

hi,

>>parameters s_month like VVIS_SOPTI-SMONTH.

no probs with the above statement

in the query you don't have month field (smonth is not available in PA0001) how you want to fillter the data as per month

only BEGDA,ENDDA are the date fields in the PA0001

cheers,

sasi

Read only

0 Likes
2,943

Hi Hari,

IN PA0002 table,there is a field GBMON.

tables vvis_sopti.

data itab type standard table of pa0002.

parameters s_month like VVIS_SOPTI-SMONTH.

select * from pa0002 into table itab where gbmon = s_month.

Kindly reward points if it helps.

Read only

Former Member
0 Likes
2,943

Whats ur complete select query.

I think u r using PA0001 table..

If yes then there is no field of name 'smonth' in it.

Therefore you are getting this error

Read only

Former Member
0 Likes
2,943

Hi Hari,

Could you post ur code here so we could take a look on it?

Regards,

Ville

Read only

0 Likes
2,943

hi ville ,

i posted the code. plz hav a look.

thank u

your help would be appreciated.

Read only

Former Member
0 Likes
2,943

hi,

the problem not with parameter

check your from ..table has smonth or not

>>smonth eq s_month.

cheers,

sasi

Read only

Former Member
0 Likes
2,943

Hi,

Pop a Date in ABAP Report Selection Screens

REPORT ZPOPDATE.

DATA: V_CODE LIKE SY-SUBRC.

PARAMETER: V_MONTH LIKE ISELLIST-MONTH.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR V_MONTH.

CALL FUNCTION 'POPUP_TO_SELECT_MONTH'

EXPORTING

ACTUAL_MONTH = '200205'

LANGUAGE = SY-LANGU

START_COLUMN = 8

START_ROW = 5

IMPORTING

SELECTED_MONTH = V_MONTH

RETURN_CODE = V_CODE

EXCEPTIONS

FACTORY_CALENDAR_NOT_FOUND = 1

HOLIDAY_CALENDAR_NOT_FOUND = 2

MONTH_NOT_FOUND = 3

OTHERS = 4.

Hope it helps u.

Thanks,

Ruthra

Read only

0 Likes
2,943

Hai Ruthra,

thank u for your reply.

but this function module retrieves both <b>month and year.</b>

but i need only month in the seletion screen.

i already tried this fm.

Read only

Former Member
0 Likes
2,943

Hi Hari,

I think if any change is required thats in your select query. the selecton screen is ok, can you send the code.

Read only

0 Likes
2,943

Hi Anid. H R U.

here i am sending :-

PARAMETERS : S_MONTH LIKE VVIS_SOPTI-SMONTH,

S_BTRTL LIKE PA0001-BTRTL.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH.

CALL FUNCTION 'REAL_ESTATE_F4_MONTH'

EXPORTING

I_MONTH = 00

I_POPUP_TITLE = 'Choose Month'

IMPORTING

E_MONTH = P_MONTH

  • E_SEL_OK =

.

S_MONTH = P_MONTH.

I wnt to disply these fields in the report output.

personal sub area text, no. of workers, no.of work days lost based on sel. screen.

no. of workers can be calculated by:-

SELECT COUNT(*) INTO ITAB FROM PA0000

WHERE ENDDA = '99991231' AND STAT2 = '3'.

no. of work days can be calc by:-

SELECT COUNT(*) INTO ITAB FROM PA2001.

if i select btrtl in selection screen...the corresponding text should be displayed in the rep output

please send me how to declare as an internal table and also the code.

your help is appreciated.

Read only

0 Likes
2,943

Hi,

If you need personal sub area text,you can get it from T001P.

types : begin of ty,

btext type t001p-btext,

end of ty.

data itab type standard table of ty.

select BTEXT into table itab from t001p where btrtl = p_btrtl.

Read only

0 Likes
2,943

HI Hari,

i need one more clarification. The month , that you r accepting from user in selection screen, r u going to display the report for records r created

1.only for that month or

2.upto that month or

3.after that months.

please clarify this from your functional team, then we can send the code

Read only

0 Likes
2,943

i wnt to display for that month.

and also there is one more column in the output saying that <b>12month rolling period</b>(means if i select october..it should roll back 12 months. ie., nov2004 to oct2005.

Read only

0 Likes
2,943

Anid..Can we take GBMON as month field in the sel screen which is in the PA0002?

and can we proceed. bcoz it is not showing error.if we select this.

Please send me the code for the above prg. I wait for u.

Thanks again for your valuable time.

your help is appreciated.

Read only

0 Likes
2,943

ya hari, just hang on, i am trying ..i am not fully aware of infotyps of HR thats why, its taking time

Read only

0 Likes
2,943

Hari,

the things you want to display in the report are

1.personal sub area text : is it same as PA0001-BTRTL field that user input in selection screen.

2.no. of workers: thats fine, but in selectio screen you r taking only month , not any year.

each infotype in pa0000 has a begda and endda which states start & end of employement, i think. so i need year also,in addition to month that you are giving in selection screen. does it mean that i have to show records only for selected month of current year.

3.no.of work days lost: is it whole current year, or only selected month of current year.

Message was edited by: Anid

Read only

0 Likes
2,943

PA001-BTRTL is personal subarea.

1) personal subarea text can be found in the table t001p-btext.

user input btrtl in sel scree. the corresponding text should be displayed in the output

2)yes..we have to show only selected month for the current year.

3) work days lost (selected month in the selection screen)

Read only

0 Likes
2,943

u can get subarea text using a query like ...

select single b~btext into (l_btext)

from pa0001 as a join t001p as b on awerks = bwerks and abtrtl eq = bbtrtl where btrtl = p_btrtl.

then use l_btext for the sub area text

your internal table structure will be like...

<b>btext

num_workers

num_days_lost</b>

rgds,

PJ

Message was edited by: Priyank Jain

Read only

0 Likes
2,943

HI hari ,

try this..

i got the sample out put as on my system for a input.

obviously it will different in your system for different input.

Personal Subarea Text: EAI SBU

No of Workers: 3

No of Work-days Lost: 0

code

*********************************************************

REPORT BALV_POPUP_TO_SELECT.

PARAMETERS : S_MONTH LIKE VVIS_SOPTI-SMONTH,

S_BTRTL LIKE PA0001-BTRTL.

data: start_date like sy-datum,

end_date like sy-datum.

data: length type i.

data : count_workerno type i,

count_daylost type i,

sub_text(100).

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH.

CALL FUNCTION 'REAL_ESTATE_F4_MONTH'

EXPORTING

I_MONTH = 00

I_POPUP_TITLE = 'Choose Month'

IMPORTING

E_MONTH = s_month .

start-of-selection.

concatenate sy-datum(4) s_month '01' into start_date.

concatenate sy-datum(4) s_month '31' into end_date.

SELECT COUNT(*) INTO count_workerno FROM PA0000

WHERE begda >= start_date and

ENDDA <= end_date and

STAT2 = '3'.

SELECT COUNT(*) INTO count_daylost FROM PA2001

WHERE begda >= start_date and

ENDDA <= end_date.

select single a~btext from t001p as A

inner join PA0001 as B on ABTRTL = BBTRTL

into sub_text

where b~BTRTL = s_BTRTL.

Write:/ 'Personal Subarea Text:', sub_text.

write:/ 'No of Workers:', count_workerno.

Write:/ 'No of Work-days Lost:',count_daylost.

Read only

0 Likes
2,943

only sub area text is displaying..

it's showing no.of workers = 0,

no.of workdays lost = 0.

i tried different options...

but it showing the same

Read only

0 Likes
2,943

sorry one mistake was there,

try this..and see the values in table pa2001, to decide if there is any entry for this month of 2005.

REPORT BALV_POPUP_TO_SELECT.

PARAMETERS : S_MONTH LIKE VVIS_SOPTI-SMONTH,

S_BTRTL LIKE PA0001-BTRTL.

data: start_date like sy-datum,

end_date like sy-datum." VALUE '99991231'.

data: length type i.

data : count_workerno type i,

count_daylost type i,

sub_text(100).

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH.

CALL FUNCTION 'REAL_ESTATE_F4_MONTH'

EXPORTING

I_MONTH = 00

I_POPUP_TITLE = 'Choose Month'

IMPORTING

E_MONTH = s_month .

start-of-selection.

concatenate sy-datum(4) s_month '01' into start_date.

concatenate sy-datum(4) s_month '31' into end_date.

SELECT COUNT(*) INTO count_workerno FROM PA0000

WHERE ENDDA = '99991231' and

STAT2 = '3'.

SELECT COUNT(*) INTO count_daylost FROM PA2001

WHERE begda >= start_date and

ENDDA >= end_date.

select single a~btext from t001p as A

inner join PA0001 as B on ABTRTL = BBTRTL

into sub_text

where b~BTRTL = s_BTRTL.

Write:/ 'Personal Subarea Text:', sub_text.

write:/ 'No of Workers:', count_workerno.

Write:/ 'No of Work-days Lost:',count_daylost.

Read only

0 Likes
2,943

for diff entry..it displaying the same .it's nt taking from sel. screen.

no. of workers : 636.

no. of work days lost : 0

i wntt in a table form.

Ok..Anid. Let try by taking begda and enda in the sel. screen as parameters as u said earlier that for each infotype it should hav begda and enda.

forget abt the month in sel. screen.

Read only

Former Member
0 Likes
2,944

Hi hari,

i can change the code , but let me explain something.

PA0000 , from where we r selectiong the no of worker, contains two fields , begda and endda.

begda = join date of employee

endda =99991231 by default, that means the employee is still working and has no left the company yet.once he retire or resign the endda for that worker is set to that perticular date.

the present code shows you the employee who are active ie, endda = 99993112, and stat2 = 3.

so it is coming constant for any month selection, since month selection is not oing alter that.

if you craete a new info type and or change the stat2 of any infotype to 3, then you will find diffeent output.

By the way what stat2 =3 stands in your company?

Read only

0 Likes
2,943

exactly anid...

we wnt to calc no.of workers as specified by u..endda = '99991231' and stat2 = '3'.

in our company stat2 = 3 means the workers who are in <b>Active</b> State

but send me your code by taking in an internal table these fields and displaying..

thank u anid.

Read only

0 Likes
2,943

Hi Anid. Just hav a look on this queries to calc. no. of workers and no. of work days lost.

data NO_OF_WORKERS type i.

PARAMETERS : S_BTRTL LIKE PA0001-BTRTL.

SELECT COUNT(*) INTO NO_OF_WORKERS

FROM PA0000 AS a inner join PA2001 as b on apernr = bpernr

inner join PA0001 as c on apernr = cpernr

WHERE aENDDA = '99991231' AND aSTAT2 = '3'

and ( b~awart eq '0591' )

and c~btrtl = s_btrtl.

write NO_OF_WORKERS.

*to get the no. of working days lost

DATA : WORK_DAYS_LOST TYPE P DECIMALS 2.

SELECT COUNT(*) INTO WORK_DAYS_LOST FROM PA2001 AS A

INNER JOIN PA0001 AS B ON APERNR = BPERNR

WHERE ABWTG = PA2001-ABWTG AND

B~BTRTL = S_BTRTL.

WRITE 😕 WORK_DAYS_LOST.

but i want to display it as a internal table along with personal sub area text

Read only

0 Likes
2,943

Hi hari bhai,

Here is the code. almost everything is perfect.except one where condition thats giving error, you check your second select statement and modify it.

the report is ok.

AND PLEASEE reward points, may be 10 to this and 6 to some other also. so much modification wanted.

REPORT ZANID_TEST.

*

PARAMETERS : S_MONTH LIKE VVIS_SOPTI-SMONTH default '03',

S_BTRTL LIKE PA0001-BTRTL default 'EAS'.

data: start_date like sy-datum,

end_date like sy-datum." VALUE '99991231'.

data : BEGIN OF EMP_DATA OCCURS 0, "INTERNAL TABLE

count_workerno type i,

count_daylost type i,

sub_text(100),

END OF EMP_DATA.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH.

CALL FUNCTION 'REAL_ESTATE_F4_MONTH'

EXPORTING

I_MONTH = 00

I_POPUP_TITLE = 'Choose Month'

IMPORTING

E_MONTH = s_month .

start-of-selection.

concatenate sy-datum(4) s_month '01' into start_date.

concatenate sy-datum(4) s_month '31' into end_date.

SELECT COUNT(*) INTO EMP_DATA-count_workerno

FROM PA0000 AS a inner join PA2001 as b on apernr = bpernr

inner join PA0001 as c on apernr = cpernr

WHERE aENDDA = '99991231' AND aSTAT2 = '3'

and ( b~awart eq '0591' )

and c~btrtl = s_btrtl.

SELECT COUNT(*) INTO EMP_DATA-count_daylost FROM PA2001 AS A

INNER JOIN PA0001 AS B ON APERNR = BPERNR

WHERE

*AABWTG = BABWTG AND

B~BTRTL = S_BTRTL.

select single btext from t001p

into EMP_DATA-sub_text

where BTRTL = s_BTRTL.

APPEND EMP_DATA.

Format color COL_HEADING on.

write sy-uline(80).

write:/ sy-vline, ' No of worker ', sy-vline.

write:' No of Lost Work-day', sy-vline.

write: 50 ' Sub-Area text',

80 sy-vline.

write:/ sy-uline(80).

Format color COL_HEADING off.

loop at emp_data.

write:/ sy-vline,

2 EMP_DATA-count_workerno ,

18 sy-vline.

write: 21 EMP_DATA-count_daylost ,

41 sy-vline.

write: 43 EMP_DATA-sub_text ,

80 sy-vline.

endloop.

write:/ sy-uline(80).

Read only

0 Likes
2,943

I have commented that erroneous wher clause, the reports runs fine

Read only

Former Member
0 Likes
2,943

Hi Hari,

Regarding displaying the Text of the field pa0001-btrtl, you can select that from T001P-BTEXT.

You can select this field and display the same based on the input in the Selection Screen.

tell me if this works....