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

can any one write code for this

Former Member
0 Likes
490

i am new to abap, plz help me

if u can write select statement.

=========Logic for calculating daily production glazer fault incentive =========

===== === Calculate the total no. of piece fired in the month by glazing dept ========

Total No. Of Piece Fired = sum (ZHRT_PR_TRAN_002-ZZGLAZED_QTY) from ZHRT_PR_TRAN_002 for ZHRT_PR_TRAN_002-ZZDATE within Start Date and End Date from the Screen

Total No. of faults = COUNT(ZPPT_TRAN_002-ZZDECISION = ‘REF’,’REW’,’PIT” &&

ZPPT_TRAN_002-ZKODE1 = ‘WAVY’,’THIN’,’SPAN’,’CRAW’) from ZPPT_TRAN_002 for

ZPPT_TRAN_002-VERID = ‘1001’ or ‘1002’and ZPPT_TRAN_002-ZDOENTRY within Start Date and End Date from the Screen

Dept Fault% = Total No. of faults/ Total No. Of Piece Fired*100

===========Pick the Fault Slab Amount from ZHRT_MAST_006 ==============

If ZHRT_MAST_006- ZZDEPT =’GLAZING’ and ZHRT_MAST_006- ZZEMP_CATEGORY = ‘GLAZER’ then

{

if Dept Fault% >= ZHRT_MAST_006-ZZSLAB1L && <= ZHRT_MAST_006- ZZSLAB1H

then

Fault Incentive Per Day = ZHRT_MAST_006- ZZSLAB1_AMT

Else if

Dept Fault% >= ZHRT_MAST_006-ZZSLAB2L && <= ZHRT_MAST_006- ZZSLAB2H

then

Fault Incentive Per Day = ZHRT_MAST_006- ZZSLAB2_AMT

Else if

Dept Fault% >= ZHRT_MAST_006- ZZSLAB3L && <= ZHRT_MAST_006- ZZSLAB3H

then

Fault Incentive Per Day = ZHRT_MAST_006- ZZSLAB3_AMT

Else if

Dept Fault% >= ZHRT_MAST_006- ZZSLAB4L && <= ZHRT_MAST_006- ZZSLAB4H

then

Fault Incentive Per Day = ZHRT_MAST_006- ZZSLAB4_AMT

Else if

Dept Fault% >= ZHRT_MAST_006- ZZSLAB5L && <= ZHRT_MAST_006- ZZSLAB5H

then

Fault Incentive Per Day = ZHRT_MAST_006- ZZSLAB5_AMT

Else if

Dept Fault% >= ZHRT_MAST_006- ZZSLAB6L

then

Fault Incentive Per Day = ZHRT_MAST_006- ZZSLAB6_AMT

Else

Fault Incentive Per Day = 0

}

3 REPLIES 3
Read only

Former Member
0 Likes
455

Populate the start and end date into sdate range.

SELECT sum(ZHRT_PR_TRAN_002-ZZGLAZED_QTY) into lfired

from ZHRT_PR_TRAN_002

where zzdate in sdate.

SELECT Count(ZZDecision) into lfaults

from zppt_tran_002

where zdoentry in sdate

and zzdecision in ('REF','REW','PIT') and

zkode1 in ('WAVY','THIN','SPAN','CRAW').

lfperc = lfaults / lfired.

lfperc = lfperc * 100.

As for the second part you can read the data into internal table and use the CASE statement on lfperc field.

Message was edited by: Anurag Bankley

Read only

0 Likes
455

see it as to be done for all the records in the table

plz help me in declearing the loop.

Read only

0 Likes
455

The select statement would sum all the records in the table. As for loop do you mean the second part of your requirement ?

Regards

Anurag