‎2009 Mar 16 5:38 AM
Hi Experts,
Plz help to solve my problem.
This is my coding as following:
According to this coding i m extracting data properly. KPF , CPF, NPF is contribution. Which is given by employer and Employee in every month. But problem is that some time the employee and employer will not contribute. Infront of those month in the smartform should be display 0.
For Ex. month 9 and 10 they have not contrubute. And in the smartform ZERO should be display in those month . But according to my code the record of (Contribution of)11 and 12 month are taking place of 9 and 10 month(This is wrong.)
SELECT SYEAR SMONTH PERNR KPF CPF NPF FROM ZAPLOAD INTO
(BODY1-SYEAR,BODY1-SMONTH,BODY1-BPERNR,BODY1-KPF,BODY1-CPF,BODY1-NPF)
WHERE ( ( SYEAR = NYEAR AND SMONTH GE '04' )
OR ( SYEAR = SYEAR AND SMONTH LE SMONTH ) )
AND PERNR = SMF1-PERNR
ORDER BY SYEAR SMONTH ASCENDING .
SELECT TMONTH TYEAR EMPLOYEEPF EMPLOYERPF FROM ZTRANS_ENTRY INTO
(TRANSFER_ITAB-TMONTH, TRANSFER_ITAB-TYEAR, TRANSFER_ITAB-EMPLOYEEPF, TRANSFER_ITAB-EMPLOYERPF)
WHERE PERNR = BODY1-BPERNR
ORDER BY TMONTH ASCENDING.
APPEND TRANSFER_ITAB.
ENDSELECT.
APPEND BODY1.
ENDSELECT.
LOOP AT BODY1.
AT FIRST .
MOVE COUNT TO MON1.
ENDAT.
ON CHANGE OF BODY1-SYEAR OR BODY1-SMONTH.
MON1 = MON1 - 1.
BODY1-EMPEEINT = ( BODY1-KPF + BODY1-CPF + BODY1-EMPLOYEEPF ) * '8.5' / 100 * MON1 / 12.
BODY1-EMPERINT = ( BODY1-NPF + BODY1-EMPLOYERPF ) * '8.5' / 100 * MON1 / 12.
MOVE MON1 TO BODY1-MON1.
COUNT = COUNT - 1 .
ENDON.
MODIFY BODY1.
ENDLOOP.
AFTER ENDLOOP i used Smartforms function modules.
Plz help me.
Regards,
Swapnika
‎2009 Mar 16 6:01 AM
I am not smartform expert.
In case you know beforehand number of months you want to display (eg. April - Mar or (Jan - Dec)
then populate a driver internal table with the number of records you want to print.
ITAB
Row1 - 1
Row2 - 2
..
..
Row12 - 12.
Then use this ITAB interna table as a master table to loop through your data internal table. For row number 2 if there was no contribution then you will not be able to get read the details for given employee for that month then you can print 0 and build the internal table.
OTHERWISE
You can build logic to check if all the months for given range are populated for each employee else insert a record for missing month with value 0.
Hope this will give some pointers to build the program.
Regards,
Sunil