‎2006 Jul 01 11:05 PM
Hi Friends,
I am sending data to an external system through an internal table(i_input). However the external system can read data only in CHAR format.
For my quantity field when i use quantity as (eg - line item 1 quantity is 3.500 T and for line item 2 quantity field is 1.000 T and when i add line 1 and 2 and modify my internal table the quantity is shown as 4500 T)
i_input like ZSDINPUT occurs 0 with header line.
ZSDINPUT is a structure that i have created in SE11 and for the quantity field i used component type as CHAR15 and has no decimals.
Shejal.
‎2006 Jul 01 11:44 PM
How the data is send as 4500? normally it should not.
Else like laxmana suggested.
Your final internal table data should have 4.500, for this whenever before you are sending data to external system move this data to new internal table, where you move quantity field to character field.
( should have standard interfacing format mapped, like decimal separater is dot or comma )
Regds
Manohar
‎2006 Jul 01 11:10 PM
Hi,
Change the data type of the quantity field to DEC with decimals , after sum , assign the value to character field.
Code :
data : i_input like ZSDINPUT occurs 0 with header line.
data : begin of i_process occurs 0,
fld1 like BSEG-ZBD1P,
end of i_process,
fld2 like BSEG-ZBD1P.
suppose if i_process contains data entries like 1.000,2.500
loop at i_process.
fld2 = fld2 + i_process-fld1.
endloop.
at last move fld2 to i_input table.
i_input-chrfld = fld2.
Laxman
Message was edited by: Laxmana Kumar
‎2006 Jul 01 11:19 PM
Thanks LAxman for your suggestion.
you mean change the char field in SE11 structure and then do the calculation and once the calculation is done change back to CHAR format in the program.
is that what you mean and if thats true how can that be done.
Is it this way,
once i am done with the calculations.
DAtA i_input-quantity like char.
Let me know more in detail.
Shejal.
‎2006 Jul 01 11:44 PM
How the data is send as 4500? normally it should not.
Else like laxmana suggested.
Your final internal table data should have 4.500, for this whenever before you are sending data to external system move this data to new internal table, where you move quantity field to character field.
( should have standard interfacing format mapped, like decimal separater is dot or comma )
Regds
Manohar
‎2006 Jul 01 11:55 PM
Thanks Manohar,
Yaa i thinking of working like lakshman said. But my question is do i need to change my structure in SE11 and once i do the calculation change it back to a char format.
if yes can you guide me how. Do you mean to use 2 internal tables of the same structure.
Shejal.
‎2006 Jul 01 11:57 PM
No, you should not change the data types in SE11. You need two internal tables.
T1 - to do all manipulations in SAP
T2 - is a copy of T1 with changes of quantity to char fields for sending to external system.
Regds
Manohar
‎2006 Jul 02 12:05 AM
Shejal, you do not have to change anything in SE11. From your previous posts, I am under the assumption that you are working in the sales document user exit. These include programs are not set as "Fixed Point Arithmatic" This is the reason for the calculation being 4500 instead of 4.500. There are two ways to work your problem. One, which I would not recommend, is to set the "Fix Point Arithmatic" checkbox in the attributes of the main program. Doing so will fix your issue in the user exit, but may mess other things up. The other way is to do your calculating and divide by 1000. This is a safe way to go. If your fields in the calculation have 3 decimal places, then divide by 1000, if 2, then by 100 an so on.
<b>
result = ( value1 + value2 ) / 1000.</b>
Regards,
Rich Heilman
‎2006 Jul 02 12:18 AM
Thanks Max,
Its the easiest and i guess the safest method.
Thanks again.
Shejal.
‎2006 Jul 02 12:19 AM
‎2006 Jul 03 3:46 PM
Hi Rich,
Yes i am working on the sales user Exit and as you have suggested, to just add the values and divide by 100 or 1000 which ever i need but when i do this the problem i have is its not getting me anything after the decimal. eg
1500.000 LBS and 1000.000 Lbs i get the result as 2500 LBS but i want it to be displayed as 2500.000 LBS.
Any Suggestions on this.
Shejal.
‎2006 Jul 03 4:04 PM
‎2006 Jul 03 4:24 PM