‎2007 May 23 2:49 AM
Hi SDN's
i get some dates from an excel sheet into internal table.
internal table declaration is as below:
DATA : BEGIN OF it_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
leabg TYPE anla-leabg,
END OF it_tab.i use the FM : ALSM_EXCEL_TO_INTERNAL_TABLE to get data frm excel to internal table format.
suppose i have a date 12.05.2007 but now when i write the date to the internal table LEABG its taking only 12.05.20
because the FM stores the value in type STR. now my question is how do i update the value LEABG in internal table with the correct date (12.05.2007)
Regards
Pratyusha
‎2007 May 23 2:53 AM
Hi,
Change your internal table declaration as
DATA : BEGIN OF it_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
<b>leabg(10) TYPE C,</b>
END OF it_tab.
Reward points if useful.
Regards,
Atish
‎2007 May 23 2:53 AM
Hi,
Change your internal table declaration as
DATA : BEGIN OF it_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
<b>leabg(10) TYPE C,</b>
END OF it_tab.
Reward points if useful.
Regards,
Atish
‎2007 May 23 2:57 AM
Hi
Try to Change your Internal Table Declaration like below..
DATA : BEGIN OF it_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
leabg(10),
END OF it_tab.
If this is not working Goto your EXCEL_FILE
goto file save as(text -tab delimited...)
Now You can use GUI_UPLOAD...This is the easy method this will work properly..
Reward All helpfull Answers........
‎2007 May 23 3:29 AM
DATA : BEGIN OF temp_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
leabg(10),
END OF temp_tab.
DATA : BEGIN OF it_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
leabg TYPE anla-leabg,
END OF it_tab.
Call the function module and get data in temp_tab.
Then,
LOOP AT TEMP_TAB.
MOVE-CORRESPONDING TEMP_TAB TO IT_TAB.
CONCATENATE TEMP_TAB-LEABG6(4) TEMP_TAB-LEABG3(2) TEMP_TAB-LEABG+0(2) INTO IT_TAB-LEABG.
APPEND IT_TAB.
ENDLOOP.
‎2007 May 23 5:27 AM
Hi all,
thanks you for the replies..
i tried all these things.. but finally i need to pass that date to a BAPI. If i delcare as leabg(10) type C. the BAPI is giving an error saying that Date should be in format '__.__.____'. other formats are not allowed.
but while debug i see that the LEABG is containing the date as '12.02.20' where as 07 is missing.
Regards
Pratyusha
‎2007 May 23 5:31 AM
This will not give an error in BAPI as it_itab contains leabg as type d.
Please see the code carefully below.
DATA : BEGIN OF temp_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
leabg(10),
END OF temp_tab.
DATA : BEGIN OF it_tab OCCURS 0,
bukrs LIKE anla-bukrs,
anln1 LIKE anla-anln1,
anln2 LIKE anla-anln2,
grufl LIKE anla-grufl,
leabg TYPE anla-leabg,
END OF it_tab.
Call the function module and get data in temp_tab.
Then,
LOOP AT TEMP_TAB.
MOVE-CORRESPONDING TEMP_TAB TO IT_TAB.
CONCATENATE TEMP_TAB-LEABG6(4) TEMP_TAB-LEABG3(2) TEMP_TAB-LEABG+0(2) INTO IT_TAB-LEABG.
APPEND IT_TAB.
ENDLOOP.
Call the BAPI after this and it should not give an error
‎2007 May 23 5:34 AM
Hi
data : date like sy-datum,
data1(10) type c.
call function 'CONVERT_DATE_TO_INTERNAL'
exporting
date_external = date1
importing
date_internal = date
exceptions
date_external_is_invalid = 1
others = 2.
This should fix ur problem
Thanks
Venki
‎2007 May 23 5:34 AM
Hi
Assign One more variable like below showing..Keep lebag as character10...
data: Var_dat type sy-datum.
then
concatenate leabg0(2) leabg2(2) leabg+4(4) into var_dat.
Do the masking perfectly ,means you should get the 8 digits into var_dat...
Now pass this into bapi..This Will Work.
Reward All Helpfull Answers.........
‎2007 May 23 5:35 AM
Hi Pratya,
Define earlier date leabg as char 10 only
and let me know which BAPI you are using, I will let you know how to code for it.
Reward all useful answers.
Regards,
Atish
‎2007 May 23 5:35 AM
Hi Pratyu ,
Please check when you upload the data using the FM ALSM_EXCEL* what is the lenght of the feild into which you move the date feild , since you have modified the date feild in the internal table to CHAR 10 , so the entire data will be taken.
Please check this and still if you have problems please do revert back.
Regards
Arun
‎2007 May 23 5:40 AM
I use the BAPI : BAPI_FIXEDASSET_CHANGE
even now i get the same error.
Error : Entry too long (please enter in the format __.__.____)
this is the it_return for the BAPI
TYPE C 1 E
ID C 20 00
NUMBER N 3 089
MESSAGE C 220 Entry too long (please enter in the format __.__.____)
LOG_NO C 20
LOG_MSG_NO N 6 000000
MESSAGE_V1 C 50 __.__.____Regards
Pratyu
‎2007 May 23 6:28 AM
Hi Pratyu,
You should define the date in internal table as char 10, but while passing the date to this BAPI change the date using FM
CONVERT_DATE_TO_INTERNAL
and pass the same to this BAPI.
It will surely resolve the issues.
Do reward points to all useful answers.
Regards,
Atish