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

error in date and time while uploading from excel.

akshayd1998
Participant
5,858

as u can see in the above image the posting date and entered at(time) is not proper please help me to correct this.

Hello ,

For the time field try using the WRITE TO options. Also for your time field CPUTM is field length 6. Increase your data type length. Should work fine for you

Regards,

Juby

12 REPLIES 12
Read only

Sandra_Rossi
Active Contributor
0 Likes
4,821

There's a bug in your code. Unfortunately, I can't fix it for you because you didn't share it. 😉

Read only

ArthurParisius
Contributor
4,821

Without knowing how you're loading the data or what the exact data was in Excel nobody will be able to help you.

Read only

akshayd1998
Participant
4,821

data : date type string value '16.07.2021'.

data: posting_date type budat.

posting_date = date.

================================

data : time type string value '11:00:00'.

data : entered_at type cputm.

entered_at = time.

Please help me now

Read only

abo
Active Contributor
4,821

The column is too narrow for the text to be properly displayed: widen both columns and it will be ok. You could set a minimum width in the catalog, if necessary.

Read only

ArthurParisius
Contributor
4,821

Try debugging your code and you might find the problem yourself.

Read only

4,821

BUDAT is a 8 CHAR field where as DATE is a string with value 10 Char. This assignment is not correct. So correct your code and explain the requirement properly for us to help you out.

Read only

0 Likes
4,821

thanks i have made the changes in date by passing it to fm convert_exit_idate_input. now its working properly.

but i am still facing the issue with time .

when i am passing the excel to fm TEXT_CONVERT_XLS_TO_SAP and getting it into internal table .The time column in excel which have value 11:00:00 is showing as 0.45823 in internal table .

i have taken time field as type string in internal table.

Please help brother.

Read only

former_member598787
Participant
4,821

Hello ,

For the time field try using the WRITE TO options. Also for your time field CPUTM is field length 6. Increase your data type length. Should work fine for you

Regards,

Juby

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,821

So, you are saying that (in duplicate question error in internal table field while getting data from excel using TEXT_CONVERT_XLS_TO_SAP | SAP Comm...😞

  • "when i am passing the excel to fm TEXT_CONVERT_XLS_TO_SAP and getting it into internal table .The posting_time column in excel which have value as 11:00:00 is showing as 0.45722 in internal table ."
  • "i have taken time field as type string in internal table."
Read only

Sandra_Rossi
Active Contributor
0 Likes
4,821

If you declare you time field as type T instead of STRING, it should work, SAP will convert the number 0.45722 (Excel internal value for time 10:58:24) into ABAP time 10:58:24.

Read only

roberto_forti
Contributor
0 Likes
4,821

Hi akshayd1998, great! c5e08e0478aa4727abc4482f5be390b2 and aparisius gave you the best answers! God Look!

Best Regards!

Roberto FORTI Santos

IT Engineer Certified (SAP/PYTHON/SAP)

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,821

In your internal table, declare date and time fields respectively as type D and T instead of STRING, TEXT_CONVERT_XLS_TO_SAP will convert Excel internal values into ABAP date and time format.

e.g. for time 10:58:24, Excel internal value is the number 0.45722 (0 means 00:00:00 and 1 means 24:00:00), it will be converted into ABAP time 10:58:24.

For date 22 08 2011, Excel internal value is the number 40777 (number of days since January 1st, 1900), it will be converted into ABAP date 22 08 2011.