2008 Mar 10 9:00 PM
Hi friends
Plz any body suggest me
I have to covert the data i am giving in a spread sheet to xls format
the program uses the following routine when the radio button
material from spread sheet are selected
FORM APPEND_SPREAD_TO_XLS .
DATA: p_infile type string.
p_infile = p_file1.
LOOP AT I_SPREADSHEET INTO WA_SPREADSHEET.
WA_FINAL-BID = TEXT-004.
WA_FINAL-ITEM = TEXT-005.
WA_FINAL-DATA = TEXT-006.
WA_FINAL-DOC = SPACE.
WA_FINAL-INDEX = WA_SPREADSHEET-INDEX.
WA_FINAL-LINE = 'D'.
WA_FINAL-SPAC1 = SPACE.
WA_FINAL-chgkey = 'I'.
WA_FINAL-SPAC2 = SPACE.
WA_FINAL-INDEX1 = WA_SPREADSHEET-INDEX.
WA_FINAL-SPAC4 = SPACE.
WA_FINAL-ITDESC = TEXT-007.
WA_FINAL-PROTYP = '1'.
WA_FINAL-PRODESC = TEXT-008.
WA_FINAL-MATNR = WA_SPREADSHEET-MATNR.
WA_FINAL-MAKTX = WA_SPREADSHEET-MAKTX.
WA_FINAL-MATKL = WA_SPREADSHEET-MATKL.
WA_FINAL-WGBEZ60 = WA_SPREADSHEET-WGBEZ60.
WA_FINAL-SPAC5 = SPACE.
wa_final-DDATE = '00/00/0000'.
WA_FINAL-DTIME = '0:00:00'.
WA_FINAL-FDAT = '00/00/0000'.
WA_FINAL-TDAT = '00/00/0000'.
WA_FINAL-QTY = WA_SPREADSHEET-MENGE.
WA_FINAL-MEINS = WA_SPREADSHEET-MEINS.
WA_FINAL-PUNIT = SPACE.
WA_FINAL-CURRY = 'USD'.
wa_final-proid = wa_SPREADSHEET-matnr.
APPEND WA_FINAL TO I_FINAL.
ENDLOOP.
CLEAR I_MATERIAL.
REFRESH I_MATERIAL.
but the problem is when i gave the data in selection screen
Filename to dwnld Spread detl:the excel page vth some data
File name to upload the Spread:some file name
its giving the following error
Error during coversion-field type conflict.
the descrption of the error is
The sending and receiving fields have conflicting types. The receiving field has type P. Value EA was supposed to be transferred to this field, but this conflicts with the type definition for the receiving field.
The incorrect field is field 1 of the receiver structure. Record 7 of the input file contains an error.
plz suggest
any help is highly appreciated
2008 Mar 10 9:10 PM
You're passing a character field, in this case, the unit of measure, to a numeric field, that's the problem.
2008 Mar 10 9:26 PM
Hi ramiro and nirad,
yes when i gave the unit of measure as numeric field 34 instead of EA it worked
but how to make it work both the character field also actuallythe functional consultant wants to give unit of measure as EA only
plz suggest
Any help is highly appreciated
2008 Mar 10 9:30 PM
If the unit of measure can also be numeric, just make the receiving field a character type, the conversion P to C is supported, so no problem with that, make sure the receiving field has enough space to keep the P type (remember the sign and the decimal point)
2008 Mar 10 9:35 PM
You can use conversion routine for data type conversion before moving those field to receiving field.
2008 Mar 10 9:38 PM
Hi ramiro,
Sorry i didnt get you what exactly i have to do Plz let me know clearly
Is anything i have change in the code to work if U/M is EA also
plz let me know clearly
thanq so much
2008 Mar 10 9:41 PM
Hi nirad,
i dont have idea about conversion routine would tell me where i have write that
plz let me know
2008 Mar 10 9:41 PM
WA_FINAL-MEINS = WA_SPREADSHEET-MEINS.
Is this the problematic field right?
Instead of type p, make the wa_final-meins a character type with enough space to keep a numeric type in case you need it.
You need to also change the final table field.
By the way, what type is WA_SPREADSHEET-MEINS?
2008 Mar 10 9:48 PM
Hi ramiro,
yes the field is
WA_FINAL-MEINS = WA_SPREADSHEET-MEINS.
but it is declared like this
WA_SPREADSHEET TYPE T_MATERIAL,
BEGIN OF T_MATERIAL,
INDEX(3) TYPE C,
MATNR TYPE MARA-MATNR, "Material Number
MAKTX TYPE MAKT-MAKTX, "Material description
MENGE TYPE MSEG-MENGE,
MEINS TYPE MARA-MEINS, "Base Unit of Measure
MATKL TYPE MARA-MATKL, "Material group
WGBEZ60 TYPE T023T-WGBEZ60, "Material grp Desc.
END OF T_MATERIAL,
plz suggest how to change from p to c and check for the decimal points
2008 Mar 10 9:53 PM
how are wa_final and i_final declared?.
You need to declare theirs meins the same way as that table, Type MARA-MEINS
2008 Mar 10 9:56 PM
Hi ramiro,
both the wa_final and i_final represents the same table
t_final
BEGIN OF T_FINAL,
BID(30) TYPE C,
ITEM(15) TYPE C,
DATA(30) TYPE C,
DOC(30) TYPE C,
INDEX(3) TYPE C,
LINE(1) TYPE C,
SPAC1(10) TYPE C,
chgkey(1) TYPE C,
SPAC2(10) TYPE C,
INDEX1(3) TYPE C,
SPAC4(10) TYPE C,
ITDESC(30) TYPE C,
PROTYP(1) TYPE C,
PRODESC(30) TYPE C,
MATNR TYPE MARA-MATNR, "Material Number
MAKTX TYPE MAKT-MAKTX, "Material description
MATKL TYPE MARA-MATKL, "Material group
WGBEZ60 TYPE T023T-WGBEZ60, "Material grp Desc.
SPAC5(10) TYPE C,
ddate type d,
dtime type t,
fdat type d,
tdat type d,
qty(3) type c,
MEINS TYPE MARA-MEINS, "Base Unit of Measure
punit(10) type c,
curry(3) type c,
proid type mara-matnr,
END OF T_FINAL.
2008 Mar 10 9:57 PM
2008 Mar 10 10:06 PM
Hi ramiro,
Its only working for numeric fileds when itried giving U/M as 23
its working and bytes transfered
but when i tried using EA as U/M
its getting the same error
what is wrong
plz suggest
2008 Mar 10 10:19 PM
Sorry, my fault
try this
CAll function 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = WA_SPREADSHEET-MEINS.
IMPORTING
output = WA_FINAL-MEINS
2008 Mar 10 10:32 PM
Hi ramiro where exactly i have give that function module
i tried giving in the form before the loop its not working
Plz suggest
2008 Mar 10 10:40 PM
Inside the loop, replace
WA_FINAL-MEINS = WA_SPREADSHEET-MEINS.
But check the result
2008 Mar 11 12:45 AM
Hi ramiro,
plz check this code getting the same error
plz correct me
FORM APPEND_SPREAD_TO_XLS .
DATA: p_infile type string.
p_infile = p_file1.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = WA_SPREADSHEET-MEINS
IMPORTING
OUTPUT = WA_FINAL-MEINS .
EXCEPTIONS
UNIT_NOT_FOUND = 1
OTHERS = 2
LOOP AT I_SPREADSHEET INTO WA_SPREADSHEET.
WA_FINAL-BID = TEXT-004.
WA_FINAL-ITEM = TEXT-005.
WA_FINAL-DATA = TEXT-006.
WA_FINAL-DOC = SPACE.
WA_FINAL-INDEX = WA_SPREADSHEET-INDEX.
WA_FINAL-LINE = 'D'.
WA_FINAL-SPAC1 = SPACE.
WA_FINAL-chgkey = 'I'.
WA_FINAL-SPAC2 = SPACE.
WA_FINAL-INDEX1 = WA_SPREADSHEET-INDEX.
WA_FINAL-SPAC4 = SPACE.
WA_FINAL-ITDESC = TEXT-007.
WA_FINAL-PROTYP = '1'.
WA_FINAL-PRODESC = TEXT-008.
WA_FINAL-MATNR = WA_SPREADSHEET-MATNR.
WA_FINAL-MAKTX = WA_SPREADSHEET-MAKTX.
WA_FINAL-MATKL = WA_SPREADSHEET-MATKL.
WA_FINAL-WGBEZ60 = WA_SPREADSHEET-WGBEZ60.
WA_FINAL-SPAC5 = SPACE.
wa_final-DDATE = '00/00/0000'.
WA_FINAL-DTIME = '0:00:00'.
WA_FINAL-FDAT = '00/00/0000'.
WA_FINAL-TDAT = '00/00/0000'.
WA_FINAL-QTY = WA_SPREADSHEET-MENGE.
WA_FINAL-MEINS = WA_SPREADSHEET-MEINS.
WA_FINAL-PUNIT = SPACE.
WA_FINAL-CURRY = 'USD'.
wa_final-proid = wa_SPREADSHEET-matnr.
APPEND WA_FINAL TO I_FINAL.
ENDLOOP.
CLEAR I_MATERIAL.
REFRESH I_MATERIAL.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = P_INFILE
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_FINAL.
IF SY-SUBRC = 0.
ENDIF.
ENDFORM.
thanks in advance
Edited by: sukruthi raj on Mar 11, 2008 1:26 PM
2008 Mar 10 9:17 PM
Try to save your data in excel in same format as you are transporting .I mean if its numeric data with decimal point then dont save data with character string .That creates a dump.