2013 Mar 20 6:17 PM
Hi Experts,
I am working on an ABAP report where in I need to create a database table. Inside the database table I have to create a field called "employee worked hours" which should be in the format of 14.5 (i.e employee worked 14 and half hours). I was struck in creating a new z data element/domain for this. Please help me in creating one. What datatype do I need to give here.
Thanks,
Nani
Hi Experts,
I am working on an ABAP report where in I need to create a database table. Inside the database table I have to create a field called "employee worked hours" which should be in the format of 14.5 (i.e employee worked 14 and half hours). I was struck in creating a new z data element/domain for this. Please help me in creating one. What datatype do I need to give here.
Thanks,
Nani
2013 Mar 20 6:41 PM
Hi Nani,
you should use a Decimal Data Type with 1 or 2 decimal places.
But about half hour, you will have to convert 30 minutes in 0.5 hours. Not a big problem, just convert everything to minutes and then divide by 60.
Regards,
Frisoni
2013 Mar 20 6:41 PM
Hi Nani,
Here is how to create a simple domain :
1 - go to transaction SE11
2 - select the radio button for domain and type the name you want for you domain.
3 - click on create.
4 - enter the description and then enter the data type. in your case i guess "DEC" (no. characters : 8, Decimal place : 4) should work
5 - then simply activate it. (CTRL+F3)
I hope this can help you!
Best Regards,
Max
2013 Mar 20 6:46 PM
Hi Nani,
Would suggest you to use predefined type DEC or FLTP (then set number of integer and decimal places) in your data element.
Regards,
Edgar
2013 Mar 21 4:20 AM
Hi,
You can have a look at standard available domains and use it. One such domain is 'P15_HMINA'. Please try to find if any standard domain exists to suit your requirement, if it does not then take help of standard domains and create a custom domain.
Regards,
Kartik
2013 Mar 21 5:38 AM
Hi Nani,
Go to transaction SE11 and create domain and select datatype as DEC and specify no of characters and decimal places you want. And create data element and specify this domain in data element and use this data element in you z table.
DEC is used to hold the decimal places
2013 Mar 21 5:42 AM
HI,
You can do it without creating data element as well. Please check the following screenshot
Regards
Purnand
2013 Mar 21 6:23 AM
Hi,
The best way for this,as already been suggested by many, is to create a new domain with DEC type and specify the no. decimal places required.
BR
Nitin
2013 Mar 21 6:34 AM
Create a Domain with
data type DEC
no. of characters 8
decimal places 2
in case you want to enter data as 14,30 but save as 14.5 then you need conversion routines for this.
2013 Mar 21 6:50 AM
Why do you want to create a new data element? If you are sure of your requirement, did you take a look at already existing data element - CATSHOURS?
Regards,
Kumud
2013 Mar 21 2:15 PM
Hi,
I don't much experience in ABAP. I just have a question. Do we need to create a data element only when we don't have any standard data element of the data type and length which we require? Its not a must although. Secondly, ex- if I require a data element with char 10, how do I find the standard data element with the same data type and length?
Regards
Purnand
2013 Mar 21 2:36 PM
Dear Purnand,
i think there are no particular steps to find, you need to search it.
You can create in following ways:-
1) you can add field in a ztable without creating data element by choosing pre-defined data type.
2) you can create z* data element without creating domain by selectin pre-defined data type.
3) you can create z* data element without creating z*domain by selecting standard domain like we have CHAR010.
4) you can create z* data element and z* domain too.
Hope it helps you.
Kindly let me know your feedback.
Thanks & Regards,
Vignesh Yeram
2013 Mar 21 2:48 PM
Hi,
Thank you for the reply but my question was that suppose i need the data element/predefined type of char 10. There are many standard data elements with this data type and length. Is there any way to find it? Like above she has suggested CATSHOURS.
Regards
Purnand
2013 Mar 25 11:39 AM
Dear Purnand,
I think there no standard way to find it, you just need to go where data element and predefined and do F4 which will show all the list.
Thanks & Regards,
Vignesh Yeram
2013 Mar 21 7:15 AM
I prefer directly insert field like 'ZWHR' in table & assign the data element as 'P15_HMINA' as mentioned above or create separate DE as datatype DEC.
for ex.
2013 Mar 21 10:24 AM
Dear Nani,
You can create z* domain of data type DEC or while defining data element you can choose the radiobutton predefined type as DEC or Directy while adding fields in a table without entering data element you can give data type as DEC.
Hope it helps you.
Kindly let me know your feedback.
Thanks & Regards,
Vignesh Yeram
2013 Mar 25 11:55 AM
Hi Nani,
You don't need to create a new domain for this.
You could copy an existing data element from the Time elements of infotype 0007 like: MOSTD, WOSTD, STDTG etc to a customer data element.
Then rename it and set your own descriptions and texts.
Pay attention for the translations...
Best regards,
Jonathan
2013 Mar 25 5:00 PM
Hello Everybody,
Thankyou so much for all the replies you sent me. Upon reviewing all replies, I went ahead and created a custom data type (ZHOURS) with custom domain (ZHOUR_DOM). I have given the data type as DEC and decimal places 1.
Now, when I execute my ALV grid report, the output by default shows as 0.0 for that hours coloum. Now, lets say I enter remove 0.0 and enter 5 on one of the row. I debugging mode my ALV internal table is showing 5 as 0.5 (which is wrong). I am not sure where the conversion is taking place for this and changing 5 to 0.5....Any good suggestions?
Thanks,
Nani
2013 Mar 26 2:38 PM
Hi Experts,
Can anyone please shed some light on this.....?
Thanks,
Nani
2013 Apr 24 11:27 AM
put as 5.0 and try. i faced this problem once so i did a conversion routine.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |