Posts

Showing posts with the label Sum varchar(20) Column

Using BAPI upload excel file for t-code AS02 in SAP

Using BAPI " BAPI_FIXEDASSET_CHANGE " create a zprogram to upload excel file for mass change fixed asset in SAP. REPORT  ZAS02_ASSET_CHANGE_UPLOAD . TYPE-POOLS :  truxs . " Structure for Excel data TYPES :  BEGIN  OF  ty_excel ,          anln1  TYPE  anln1 ,          bukrs  TYPE  bukrs ,          kostl  TYPE  kostl ,          werks  TYPE  werks ,          prctr  TYPE  prctr ,         END  OF  ty_excel . DATA :  lt_excel     TYPE  TABLE  OF  ty_excel ,       ls_excel     TYPE  ty_excel ,     ...

How to Sum varchar(20) Column

Image
Hello Everyone !!! Hope you are doing well in your programming life.Today I am discussing a short query.This is really so easy but not come in time.I am describing the scenario first,then give solution. Suppose you have a table with having some  data field,you need to sum a column value.in normal case we use : select sum(column_name) from table name where column_name ='condition'  We can use the upper query when the data type is int.If we need to sum varchar data type then the mention query is not working.At that time we need to convert it float type.That time we are able to get the desired result.I am adding a screen short and also the query. The query is look like: Select sum(convert(float,column_name)) from table name where column_name='condition'