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

Sy-datum limitations

Former Member
0 Likes
4,647

Hi all experts ,

i have a situation where i want to upload some entries in ztable , all entries are going except the entries which has date after 2013 are not going ,


Please i need a advise on this issue , i think this is an limitation of sy-datum field that it doesnt accept the date entries greater than date of present year ..

1 ACCEPTED SOLUTION
Read only

venkateswaran_k
Active Contributor
0 Likes
4,046

Hi

The problems  should be simple.

I too faced sometimes this kind of date problem. 

the problem lies in the Excel sheet only. 

Please condisder the following in Excel sheet

1. What is the format of the column that contains Date value

2. Make it as Date   or

3. Put values with single quote before that... exampe,,     '21.05.2013

Hope this will work

<Reward request removed by moderator>

Regards,

Venkat

Message was edited by: Vinod Kumar

28 REPLIES 28
Read only

kumud
Active Contributor
0 Likes
4,046

Hello Akshay,

Question is very ambiguous. Sy-datum is a system field which holds the current date of the system.

What's the data element of the field which is storing the date in your Z* table?

Regards,

Kumud

Read only

Former Member
0 Likes
4,046

Hi kumud ,

situation is as below ..

i have program which upload entries from excel sheet to ztable..

in that ztable i have one date field , data element - sydatum..

whenever i run program , entries gets uploaded succesfully , except entries having date e.g. 1.1.2013 or entries containing 2013 are not going to ztable ..

Read only

kumud
Active Contributor
0 Likes
4,046

You may try by changing the data element to ENDDA. It hasn't given me any problem. Also, I assume you are taking care of internal date format conversions.

Regards,

Kumud

Read only

Former Member
0 Likes
4,046

Hi Akshay  ,

    Try using events in table maintained generator.

Follow this link

<link to blocked site removed by moderator>

Implement this below check

form create_entry.

if ztable-datefield ge sy-datum.

ztable-datefield = value passed from upload program.

endif.

endform.

With Regards,

Sudhir S

Message was edited by: Thomas Zloch

Read only

former_member213851
Active Contributor
0 Likes
4,046

Hi Akshay,

Please check the domain of data element of the zfield in which you are storing date.

If any Value table is assigned to that zField then it might be the case that the Dates greater than  year 2012 are not present inside Value table and hence it is not allowing the  zField to store Date greater than Current Year.

Regards,

Sachin

Read only

0 Likes
4,046

hi Sachin ,


I tried that also , but there is no such value table attached to its domain ..

Read only

0 Likes
4,046

Hi Akshay,

Then something is wrong with your upload program only. Check if any condtion check is there for Date which is greater than year 2012 or any operations is carried out on such Dates.

Also, in  excel sheet take only 1 entry that to with year 2013 and place Breakpoint where date is assigned to the table field and check sy-subrc value.It might give us idea about how to proceed further.

Read only

0 Likes
4,046

Hi Sachin ,


I am doing that , in that i have used one FM

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
     EXPORTING
*     I_FIELD_SEPERATOR        =
       i_line_header            'X'
       i_tab_raw_data           it_raw       " WORK TABLE
       i_filename               p_o_file
     TABLES
       i_tab_converted_data     = it_datatab[]    "ACTUAL DATA " CHANGED TO IT_DATATAB BEFORE IT WAS IT1.
    EXCEPTIONS
       conversion_failed        = 1
       OTHERS                   = 2.

this works very well for all other entries, except for the year 2013 , in this case sy-subrc eq 1.if year is 2013 ......

Read only

0 Likes
4,046

Hi Akshay,

Please try using FM ALSM_EXCEL_TO_INTERNAL_TABLE instead of TEXT_CONVERT_XLS_TO_SAP to get excel data into internal table.


Read only

venkateswaran_k
Active Contributor
0 Likes
4,047

Hi

The problems  should be simple.

I too faced sometimes this kind of date problem. 

the problem lies in the Excel sheet only. 

Please condisder the following in Excel sheet

1. What is the format of the column that contains Date value

2. Make it as Date   or

3. Put values with single quote before that... exampe,,     '21.05.2013

Hope this will work

<Reward request removed by moderator>

Regards,

Venkat

Message was edited by: Vinod Kumar

Read only

former_member213851
Active Contributor
0 Likes
4,046

Hi Akshay,

TEXT_CONVERT_XLS_TO_SAP uses FM CONVERT_DATE_TO_INTERNAL internally to convert the  date 10102013 to format 20131010 .

BUT this FM works currently in my system. Please check the separator or date format in excel because if it is not correct then it will  throw error :

Enter a valid date (for example, 02.06.2012)

Otherwise try using FM ALSM_EXCEL_TO_INTERNAL_TABLE instead ofTEXT_CONVERT_XLS_TO_SAP to get excel data into internal table.

Best Regards,

Sachin

Read only

Clemenss
Active Contributor
0 Likes
4,046

Hi Akshay Rankhambe,

you face a problem with your code but you do not post the code. You did not check anything in debugger and you did not explain in detail what went wrong. How do you think people can help you? We can't read your mind and have no superficial power to look at your computer screen. I'd expect something more from an adult creature.

Generally I suggest that the date in excel is in external format. Date fields in SAP are stored as YYYYMMDD which is internal representation of whatever you have in excel and did not tell us.

This means an input conversion must be done for this field.

Do like this:

DATA:

  ls_tabfield   TYPE tabfield.


ls_tabfield-tabname   = 'SYST'.

ls_tabfield-fieldname = 'DATUM'.

CALL FUNCTION 'RS_CONV_EX_2_IN'

  EXPORTING

     input_external                     = <excel field>

     table_field                        = ls_tabfield

*    CURRENCY                           = CURRENCY

  IMPORTING

    output_internal                    = <your table field>

  EXCEPTIONS

    input_not_numerical                = 1

    too_many_decimals                  = 2

    more_than_one_sign                 = 3

    ill_thousand_separator_dist        = 4

    too_many_digits                    = 5

    sign_for_unsigned                  = 6

    too_large                          = 7

    too_small                          = 8

    invalid_date_format                = 9

    invalid_date                       = 10

    invalid_time_format                = 11

    invalid_time                       = 12

    invalid_hex_digit                  = 13

    unexpected_error                   = 14

    invalid_fieldname                  = 15

    field_and_descr_incompatible       = 16

    input_too_long                     = 17

    no_decimals                        = 18

    invalid_float                      = 19

    conversion_exit_error              = 20

    OTHERS                             = 21

           .

Regards,

Clemens

Read only

Former Member
0 Likes
4,046

Hi Clemens,

i checked the code in debugger before posting this question ,

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
     EXPORTING
*     I_FIELD_SEPERATOR        =
       i_line_header            'X'
       i_tab_raw_data           it_raw       " WORK TABLE
       i_filename               p_o_file
     TABLES
       i_tab_converted_data     = it_datatab[]    "ACTUAL DATA " CHANGED TO IT_DATATAB BEFORE IT WAS IT1.
    EXCEPTIONS
       conversion_failed        = 1
       OTHERS                   = 2.

this works very well for all other entries, except for the year 2013 , in this case sy-subrc eq 1.if year is 2013 ......

isnt this information is insufficient , i am again telling you the above code and whole report works fine

for every entry except if entry is having 2013 year. ...

also i knw how SAP stores date , date format in excel sheet is 'yyyymmdd'' only

what details you expect from me more than this ..

Read only

0 Likes
4,046

Dear Akshay

The Sy-subrc eq 01 means , the record not found ... Do you have any reference or constraints built in the Z-table based on teh date field?

Read only

venkateswaran_k
Active Contributor
0 Likes
4,046

Dear Akshay

What is the field name that stores your data in the Ztable.

Can you please let me know the type.

Cam you please change the type to AEDAT

regards,

venkat

Read only

0 Likes
4,046

Hi Venkateswaran,

Yes i allready tried what u suggested , i mean as u said , my column of date in excel sheet is in single quote only & its format is general because that is its requirement..

data type of field in ztable is SYDATUM ..

and also chaging of data type in ztable wont be of use as function module TEXT_CONVERT_XLS_TO_SAP doesnt converting  particular record(2013 year) into internal table..

Read only

0 Likes
4,046

Hi Akshay

1. just for a elimination strategy, try to change the datatype to EKPO-audat ... and try it..

2. Secondly, please paste your data insert block of your prgarm to find out any validations you put..

Regards,

Venkat

Read only

0 Likes
4,046

Hi Akshay

1. just for a elimination strategy, try to change the datatype to EKPO-audat ... and try it..

2. Also kindly paste the entries - the date value that does not get insert.  Just want to see as a third eye view... ..

   As you said, only 2013 values are not going... that means this is certainly not because of sydatum - but something small mistake which is escaping from your eye.... 

kindly update...

Regards,

Venkat

Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,046

Check date format, I suspect this is the limit of month number to 12 and not the current year that is the problem...

Regards,

Raymond

Read only

Former Member
0 Likes
4,046

Hi Akshay,

It seems problem is not in year(2013). Its due to number '13' which might be taken as the month, when you are trying to save it in ZTable.

Just check once if the decryption of date from Input File is properly done so as to make it compatible to SY-DATUM format.

Regards,

Justfun

Read only

0 Likes
4,046

Hi ,

its taking all entries except year above 2012 are not going ..will post the solution as soon as ill get it...

Read only

0 Likes
4,046

Dear Akshay

Can you please paste the data in excel sheet..  Just a sample of data that where not going inside..

This will help us to narrow down...

Regards,

Venkat

Read only

0 Likes
4,046

hi ,

the problem is solved ,

according to me , the issue was coming because FM , '' TEXT_CONVERT_XLS_TO_SAP ''

i think this FM has a check inbuilt while bringing records into internal table for a date field..

instead of this FM i changed FM to ''ALSM_EXCEL_TO_INTERNAL_TABLE''

Changed code is as below ..

DATA :it_datatab TYPE TABLE OF ALSMEX_TABLINE   WITH HEADER LINE,

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
     EXPORTING
       filename                      = p_o_file
       i_begin_col                   = '1'
       i_begin_row                   = '2'
       i_end_col                     = '256'
       i_end_row                     = '65536'
     tables
       intern                        = it_datatab

this works like a charm ..

still thanks a lot to all , who helped me narrow down problem & come to solution ..

Read only

0 Likes
4,046

Hi Akshay Rankhambe ,

That's what I was suggesting you in my earlier reply.



Read only

0 Likes
4,046

... and that's why the name of the function is TEXT_CONVERT_XLS_TO_SAP

Dates are not TEXT.

Regards

Clemens

Read only

Former Member
0 Likes
4,046

Hi Akshay,

If the data-element is sy-datum i dont see any reason that you cannot add future values cause i do it regularly without issue.

The only thing fishy that i can get is the FM "TEXT_CONVERT_XLS_TO_SAP".

The FM attributes in my system shows that the FM is "not yet released" and i am using ECC 6.4.

If the FM is not yet released i am not sure that you can rely on such a FM, else it seems to be a coding issue. You can try using a different FM which is released by SAP.

Cause the standard dataelement (sydatum) will behave in same way no matter where you use it. If you have created your own data element then above suggestions hold true. Else you have to check for coding issue. I think if you debug just before inserting you should get the answer. if you post something extra information then i think we can check and help.

Please let me know if this helps in any way!!!

Read only

Former Member
0 Likes
4,046

HI Akshay,

One more good option is you can create a test program in which you can create a wa like your ztable (ztable in which you want to insert). Provide some test values with workarea-date as sy-datum.

Before inserting change the value of sy-datum as you wish and then check whether insert fails or not. This will prove to be very useful as lot of options will be taken out of picture.

Ex:

data: itab type TABLE OF ztest_rah,
      wa like line of itab.

wa-name = 'rahul'.
wa-t_date = sy-datum.  " change values and check the ztable

Insert into ztest_rah values wa.

write:'check'.

Read only

Former Member
0 Likes
4,046

Hi ,

please check whether data is coming to internal table.

if it is yes check the format of date what ever in excel sheet and internal table .

      if it is change check whether it is applicable for your custom table field format.

      and better to give date in between && in excel sheet . and change the data type for your custom table field.

Regards,

Venkat.