Application Development 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: 

calculate working time in hours per month

former_member190689
Contributor
0 Kudos
234

Hello Gurus,

      I am creating a module pool program , where I am trying to calculate working time in hours per month for every employee.On screen I have provided 12 months with DAYS format.and finally calculating the number of hours in a field with QUAN having length 3 decimal 2.Now when user is providing the values in single digits its working fine but when user is providing 2 digit values its giving a dump of type p.Even I tried changing the DE of the final field like HOURS or CURR but still its giving dump.Could you please tell me about the domain which I should use for months and even for final calculation.

Thanks

Gaurav

1 ACCEPTED SOLUTION

former_member190689
Contributor
0 Kudos
174

Hello Allz,

    Issue solved. Thanks all for your concern and time.Changing the field type doesn't change the screen length.So I did changed it manually and then it worked.

thread closed

Thanks all.

Gaurav Gautam

20 REPLIES 20

gouravkumar64
Active Contributor
0 Kudos
174

Hi,

You can try with NUMC.

data: p_numc(3) type n.

replace numc with your field name.

Thanks

Gourav.

paul_bakker2
Active Contributor
0 Kudos
174

Hi,

   Did you try making your QUAN data element bigger? If you have length 3 with decimals 2, I suspect it will dump when it goes over 9.99.

Try length 6.

cheers

Paul

cheers

Paul

jogeswararao_kavala
Active Contributor
0 Kudos
174

The totaling might be the reason for dump. Try using data type like 'P decimals 2' or increase length in your datatype like 6 decimals 2.

Jogeswara Rao K

0 Kudos
174

Hi Paul & Jogeswara,

   I tried using a standard domain of length 13 decimal 3. of Quan type but still its giving an error.Do i have to make my all fields of QUAN type or only the final calculated field.

Thanks

Gaurav

arindam_m
Active Contributor
0 Kudos
174

Hi,

It looks like an issue of allowing more values before decimal. Why dont you create you own custom data type. Also will a Float or Decimal not suffice the situation?  Also please post the DUMP texts and try to see what code line gives the dump this will help all to get a better understanding of your issue.

Cheers,

Arindam

0 Kudos
174

Hi Gaurav,

Try with Domain DYAVG for your final calculation.

0 Kudos
174

Hi Sarvesh,

    I used the domain but when I am providing value 9 in all the months its giving an error

42 module SCREEN_DISABLE output.

43   IF chk ne 'X' or chk = 'SAVE'.

44     LOOP AT SCREEN .

45       SCREEN-INPUT = '0'.

46       MODIFY SCREEN.

47     ENDLOOP.

48   ENDIF.

49

50   IF chk = 'X'.

51     LOOP AT SCREEN.

52       SCREEN-INPUT = '1'.

53       MODIFY SCREEN.

54     ENDLOOP.

55   ENDIF.

56

57 *zext_rpt_wa-as_on_date = sy-datum.

58

>> endmodule.                 " SCREEN_DISABLE  OUTPUT

look here i didn't get this error.

Thanks

Gaurav

former_member184569
Active Contributor
0 Kudos
174

For the number of hours you can use the data element MOSTD, or domain STDAZ

0 Kudos
174

Hi Susmitha,

    I tried with the above DE but still it showing the error.Do I have to keep remaining DE for months with same Domain.As I am using Days for months, and for final I am using your's given DE.

0 Kudos
174

i would suggest to keep it uniform throughout. At least with respect to the total length and number of decimal places

0 Kudos
174

Hi Susmitha,

     You mean to say should I change the domain of every month.In my program I have created 12 rows for every month and calculating the values in final.

Like

((jan+Feb+mar+april.....) + tec _ons)/8 = final.

Above format I am using but when I am trying to fill more values final gives a dump.

I have kept all the months + tec_cons in days format and as you suggested for final I used MOSTD.

Its giving overflow conversion error.

Thanks

Gaurav

0 Kudos
174

Could you share more of your code with screen shot of your screen?

Also the exact error message?

former_member184958
Active Participant
0 Kudos
174

Hi,

Try to increase the length of your DE. Kindly post the exact error screen shot.

Kind regards,

John.

0 Kudos
174

Hello John And Susmitha,

   Sorry I am not able to add images here I don't know what's wrong.If you could provide me your id's I can forward you there.

Gaurav

0 Kudos
174

Hi Gaurav Gautam

You can add images while reply back to user's

see the below screen shot



former_member190689
Contributor
0 Kudos
174

Hello John n Susmitha,

   Please do have a look to below doc.I have copied every thing there. I hope you must get an idea.

Thanks

Gaurav Gautam

0 Kudos
174

0 Kudos
174

Hi for your final, you just need to put a data element of length 6 or 7 (6would be sufficient) and decimals 3. It will work fine.

Try DE ABRST, ANZHL,These are all decimals 2.

Go to Se11, and click F4 on dataelement, giving datatype as dec and length 6 or 7, Choose a data element with 3 decimals

0 Kudos
174

Hi Susmitha,

   

  I did as what you said but still its giving the same error as value of final goes above 9.99.When I checked into my ztable in sm30.The final value there is above 9.99.But why doesn't it shows on screen.In table control I have used work area fields.But I don't think using work area fields in table control would effect for calculation.Correct me if I am wrong.

  I tried every possible way but still can't able to understand why its giving overflow conversion.

Thanks

Gaurav

former_member190689
Contributor
0 Kudos
175

Hello Allz,

    Issue solved. Thanks all for your concern and time.Changing the field type doesn't change the screen length.So I did changed it manually and then it worked.

thread closed

Thanks all.

Gaurav Gautam