2007 Apr 16 10:27 AM
I'm developing a HR Advances report, need to findout the details advances paid to an employee.i 'm giving example:
an employee has taken advance(10,000) in the compnay and he is paying that amount in subsequent months(Monthly 1000)
he payed in 1st month and second month, but didn't pay in 3rd month and again paid in 4th& 5 months but didn't pay in 6th month .
if he payed means lgart = 4100
if he didn't pay means lgart = 3009.
PERNR BEGDA BEGRT LGART
000000011 01.01.2006 1000 4100(Recoverd)
000000011 01.02.2006 1000 4100(Recovered)
000000011 01.03.2006 -
3009(Non-Recovered)
000000011 01.04.2006 1000 4100(Recovered)
000000011 01.05.2006 1000 4100(Recovered)
000000011 01.06.2006 -
4100(Non-Recovered)
advance amount will store in betrg.
this report has the fields like
Employee Number: pa0015-pernr
Date From pa0015-begda
Cash amount pa0015-betrg
Advance type pa0018-lgart. (whre lgart = 3008)
Advance type recovery (where lgart = 3009)
Advance type NOn recovery. (whre lgart = 4100)
Selection criteria is PA0001-kostl.
I have stuck up how to map lgart = 3008, 3009 & 4100
. .
o/p should look like
PERNR, DATEFROM, CASHAMOUNT, ADVANCE TYPE, ADVANCE TYPE RECOVERED, ADVANCE TYPE nON RECOVERED.
I have stuck up how to map lgart = 3008, 3009 & 4100
i'm giving the code which i have written. please help me in this.
REPORT ZHR_ADVANCES
Message-id zhr_msg_class.
Tables: Pernr.
DATA: Begin of IT_p0001 occurs 0,
pernr like p0001-pernr,
kostl like p0001-kostl,
End of IT_p0001.
DATA: Begin of IT_p0015 occurs 0,
pernr like p0015-pernr,
begda like p0015-begda,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of IT_p0015.
*Data: Begin of it1_p0015 occurs 0,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of it1_p0015.
DATA: Begin of IT_final occurs 0,
pernr like p0001-pernr,
kostl like p0001-pernr,
begda like p0015-begda,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of IT_final.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
Parameters: p_kostl like p0001-kostl.
SELECTION-SCREEN END OF BLOCK blk1.
select pernr
kostl
from pa0001
into table it_p0001
where kostl eq p_kostl.
if sy-subrc NE 0.
Message E000.
endif.
if Not it_p0001[] is initial.
select pernr
begda
betrg
lgart
from pa0015
into table it_p0015
for all entries in it_p0001
where pernr = it_p0001-pernr.
if sy-subrc NE 0.
endif.
endif.
sort it_p0001 by pernr.
case 'it_p0015-lgart'.
when it_p0015-lgart = '3008'.
write:/ it_final-betrg.
when it_p0015-lgart = '3009'.
write:/ it_final-betrg.
when it_p0015-lgart = '4100'.
write:/ it_final-betrg.
endcase.
*if it_p0015-lgart = '3008'.
it_final-betrg = it_p0015-betrg.
elseif it_p0015-lgart = '3009'.
it_final-betrg = it_p0015-betrg.
elseif it_p0015-lgart = '4100'.
it_final-betrg = it_p0015-betrg.
*endif.
Loop at it_p0001.
Read table it_p0015 with key pernr = it_p0001-pernr binary search.
if sy-subrc EQ 0.
IT_final-pernr = it_p0001-pernr.
IT_final-kostl = it_p0001-kostl.
IT_final-begda = it_p0015-begda.
IT_final-betrg = it_p0015-betrg.
IT_final-lgart = it_p0015-lgart.
append IT_final.
clear IT_final.
endif.
ENDLOOP.
loop at it_final.
write: / it_final-pernr,
it_final-begda,
it_final-betrg,
it_final-lgart.
endloop.
I'm developing a HR Advances report, need to findout the details advances paid to an employee.i 'm giving example:
an employee has taken advance(10,000) in the compnay and he is paying that amount in subsequent months(Monthly 1000)
he payed in 1st month and second month, but didn't pay in 3rd month and again paid in 4th& 5 months but didn't pay in 6th month .
if he payed means lgart = 4100
if he didn't pay means lgart = 3009.
PERNR BEGDA BEGRT LGART
000000011 01.01.2006 1000 4100(Recoverd)
000000011 01.02.2006 1000 4100(Recovered)
000000011 01.03.2006 -
3009(Non-Recovered)
000000011 01.04.2006 1000 4100(Recovered)
000000011 01.05.2006 1000 4100(Recovered)
000000011 01.06.2006 -
4100(Non-Recovered)
advance amount will store in betrg.
this report has the fields like
Employee Number: pa0015-pernr
Date From pa0015-begda
Cash amount pa0015-betrg
Advance type pa0018-lgart. (whre lgart = 3008)
Advance type recovery (where lgart = 3009)
Advance type NOn recovery. (whre lgart = 4100)
Selection criteria is PA0001-kostl.
I have stuck up how to map lgart = 3008, 3009 & 4100
. .
o/p should look like
PERNR, DATEFROM, CASHAMOUNT, ADVANCE TYPE, ADVANCE TYPE RECOVERED, ADVANCE TYPE nON RECOVERED.
I have stuck up how to map lgart = 3008, 3009 & 4100
i'm giving the code which i have written. please help me in this.
REPORT ZHR_ADVANCES
Message-id zhr_msg_class.
Tables: Pernr.
DATA: Begin of IT_p0001 occurs 0,
pernr like p0001-pernr,
kostl like p0001-kostl,
End of IT_p0001.
DATA: Begin of IT_p0015 occurs 0,
pernr like p0015-pernr,
begda like p0015-begda,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of IT_p0015.
*Data: Begin of it1_p0015 occurs 0,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of it1_p0015.
DATA: Begin of IT_final occurs 0,
pernr like p0001-pernr,
kostl like p0001-pernr,
begda like p0015-begda,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of IT_final.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
Parameters: p_kostl like p0001-kostl.
SELECTION-SCREEN END OF BLOCK blk1.
select pernr
kostl
from pa0001
into table it_p0001
where kostl eq p_kostl.
if sy-subrc NE 0.
Message E000.
endif.
if Not it_p0001[] is initial.
select pernr
begda
betrg
lgart
from pa0015
into table it_p0015
for all entries in it_p0001
where pernr = it_p0001-pernr.
if sy-subrc NE 0.
endif.
endif.
sort it_p0001 by pernr.
case 'it_p0015-lgart'.
when it_p0015-lgart = '3008'.
write:/ it_final-betrg.
when it_p0015-lgart = '3009'.
write:/ it_final-betrg.
when it_p0015-lgart = '4100'.
write:/ it_final-betrg.
endcase.
*if it_p0015-lgart = '3008'.
it_final-betrg = it_p0015-betrg.
elseif it_p0015-lgart = '3009'.
it_final-betrg = it_p0015-betrg.
elseif it_p0015-lgart = '4100'.
it_final-betrg = it_p0015-betrg.
*endif.
Loop at it_p0001.
Read table it_p0015 with key pernr = it_p0001-pernr binary search.
if sy-subrc EQ 0.
IT_final-pernr = it_p0001-pernr.
IT_final-kostl = it_p0001-kostl.
IT_final-begda = it_p0015-begda.
IT_final-betrg = it_p0015-betrg.
IT_final-lgart = it_p0015-lgart.
append IT_final.
clear IT_final.
endif.
ENDLOOP.
loop at it_final.
write: / it_final-pernr,
it_final-begda,
it_final-betrg,
it_final-lgart.
endloop.
2007 Apr 16 10:42 AM
u cannt map like that , but what u can do is
month 4100 3008 3009
01.2007 500 -
-
02.2007 -
--- -
so for everty emp u have to display like this so ,
only one row which has values.
Regards
Prabhu
2007 Apr 16 10:56 AM
Hai,
Try to make foriegn key relation ships between the Primary table and Secondary Table.
Your problem could be solved.
Regds,
Rama.Pammi
2007 Apr 17 1:14 PM
Hi Vamsi, the below code might be useful.
REPORT ZHR_ADVANCES
Message-id zhr_msg_class.
Tables: Pernr.
DATA: Begin of IT_p0001 occurs 0,
pernr like p0001-pernr,
kostl like p0001-kostl,
End of IT_p0001.
DATA: Begin of IT_p0015 occurs 0,
pernr like p0015-pernr,
begda like p0015-begda,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of IT_p0015.
*Data: Begin of it1_p0015 occurs 0,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of it1_p0015.
DATA: Begin of IT_final occurs 0,
pernr like p0001-pernr,
kostl like p0001-pernr,
begda like p0015-begda,
betrg like p0015-betrg,
lgart like p0015-lgart,
End of IT_final.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
Parameters: p_kostl like p0001-kostl.
SELECTION-SCREEN END OF BLOCK blk1.
select pernr
kostl
from pa0001
into table it_p0001
where kostl eq p_kostl.
if sy-subrc NE 0.
Message E000.
endif.
if Not it_p0001[] is initial.
select pernr
begda
betrg
lgart
from pa0015
into table it_p0015
for all entries in it_p0001
where pernr = it_p0001-pernr.
if sy-subrc NE 0.
endif.
endif.
sort it_p0001 by pernr.
Loop at it_p0001.
Read table it_p0015 with key pernr = it_p0001-pernr binary search.
if sy-subrc EQ 0.
IT_final-pernr = it_p0001-pernr.
IT_final-kostl = it_p0001-kostl.
IT_final-begda = it_p0015-begda.
IT_final-betrg = it_p0015-betrg.
IT_final-lgart = it_p0015-lgart.
append IT_final.
clear IT_final.
endif.
ENDLOOP.
loop at it_final.
write: / it_final-pernr,
it_final-begda,
it_final-lgart.
if it_final-lgart = '3009'.
write: it_final-betrg.
elseif it_final-lgart = '4100'.
write: it_final-betrg.
else.
write: it_final-betrg.
endif.
Award points, if Useful.
regds,
Ravi Sankara kumar.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |