cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Download data into Excel File

Former Member
0 Kudos

Hi Friends,

I have one doubt on WDJ.

I have got the data from the Back and display the data into Table UI Element. Depending upon po_status equals to OA Pending that time conf_Ship_date Column is Empty. That time we can Select All Checkbox Click on Download Button Excel file is not download. Why it not download? Conf_Ship_date Column is Empty. Conf_Ship_date Column is data available that time data download into Excel File.

My Req: if Conf_Ship_date Column is empty that time click on Download that data will download in to Excel. In Excel Conf_Ship_date Column will display in NULL or 00.00.0000 Like this also.

Code:ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date());

This means I am getting date from PoDetails_OutTab(StockEle)this node and add this date to PoDetails_ExcelData(ExcelEle) this node.Finally the date will available in PoDetails_ExcelData this node. By Using this node I will download data.

How to do this work?

Regards

Vijay

Accepted Solutions (1)

Accepted Solutions (1)

p330068
Active Contributor
0 Kudos

Hi Vijay,

Can you please post some more line of the code....

>Code:ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date());

What is the problem you are getting with the above code

Hope it helps

Regards

Arun

Former Member
0 Kudos

Hi Arun,

For Example in Table 4 rows and 14 columns data is available. Select all check boxes click on download button total 4 rows and 14 columns data is downloaded.

Table 4 rows and 14 columns data is available. But in some cells data not available in that time I m getting null values from ECC System. That time I am not able to download.

In Particularly this problem I am getting only date colums.

So now I have develop this code

public void onActiondownloadToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActiondownloadToExcel(ServerEvent)

IPrivatePO_Details_ResultView.IPoDetails_ExcelDataNode ExcelNode = wdContext.nodePoDetails_ExcelData();

IPrivatePO_Details_ResultView.IPoDetails_ExcelDataElement ExcelEle;

IPrivatePO_Details_ResultView.IPoDetails_OutTabNode StockNode = wdContext.nodePoDetails_OutTab();

IPrivatePO_Details_ResultView.IPoDetails_OutTabElement StockEle ;

for(int i = 0 ;i<StockNode.size();i++)

{

StockEle = StockNode.getPoDetails_OutTabElementAt(i);

if(StockEle.getCheckBox()== true)

{

ExcelEle = ExcelNode.createPoDetails_ExcelDataElement();// Create Element

if(StockEle.getConf_Shp_Date()==null)

{

java.sql.Date deliverydate1=new java.sql.Date(0,0,0);

ExcelEle.setConf_Shp_Date(deliverydate1);

}

else

{

ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date());

}

By using this code i have to download total Records but in this Conf_Shp_Date colums i am getting 31-12.1899 this output in Excel. But i need in Excel to print Null or 00.00.0000 like

ExcelEle.setQuantity(StockEle.getQuantity());

ExcelEle.setDeliv_Date(StockEle.getDeliv_Date());

if(StockEle.getExpt_Shp_Date()==null)

{

java.sql.Date deliverydate2=new java.sql.Date(0,0,0);

ExcelEle.setExpt_Shp_Date(deliverydate2);

}

else

{

ExcelEle.setExpt_Shp_Date(StockEle.getExpt_Shp_Date());

}

ExcelEle.setVendor_Material(StockEle.getVendor_Material());

ExcelNode.addElement(ExcelEle);

}

}

if(ExcelNode.size()>0)

{

wdThis.wdGetCO_POPendingController().downloadData(wdContext.nodePoDetails_ExcelData());// This is for Downalod data Method

wdThis.wdGetCO_POPendingController().DownLoadToExcel();// This is for Open Popup Window

wdContext.nodePoDetails_ExcelData().invalidate();

}

else

{

wdComponentAPI.getMessageManager().reportException("Please select any one po item from the table",true);

}

//@@end

}

Regards

Vijay

Edited by: KalluriVijay on May 18, 2010 10:05 AM

Former Member
0 Kudos

Hi Arun,

For Example in Table 4 rows and 14 columns data is available. Select all check boxes click on download button total 4 rows and 14 columns data is downloaded.

Table 4 rows and 14 columns data is available. But in some cells data not available in that time I m getting null values from ECC System. That time I am not able to download.

In Particularly this problem I am getting only date colums.

So now I have develop this code

public void onActiondownloadToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActiondownloadToExcel(ServerEvent)

IPrivatePO_Details_ResultView.IPoDetails_ExcelDataNode ExcelNode = wdContext.nodePoDetails_ExcelData();

IPrivatePO_Details_ResultView.IPoDetails_ExcelDataElement ExcelEle;

IPrivatePO_Details_ResultView.IPoDetails_OutTabNode StockNode = wdContext.nodePoDetails_OutTab();

IPrivatePO_Details_ResultView.IPoDetails_OutTabElement StockEle ;

for(int i = 0 ;i<StockNode.size();i++)

{

StockEle = StockNode.getPoDetails_OutTabElementAt(i);

if(StockEle.getCheckBox()== true)

{

ExcelEle = ExcelNode.createPoDetails_ExcelDataElement();// Create Element

if(StockEle.getConf_Shp_Date()==null)

{

java.sql.Date deliverydate1=new java.sql.Date(0,0,0);

ExcelEle.setConf_Shp_Date(deliverydate1);

}

else

{

ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date());

}

By using this code i have to download total Records but in this Conf_Shp_Date colums i am getting 31-12.1899 this output in Excel. But i need in Excel to print Null or 00.00.0000 like

if(StockEle.getExpt_Shp_Date()==null)

{

java.sql.Date deliverydate2=new java.sql.Date(0,0,0);

ExcelEle.setExpt_Shp_Date(deliverydate2);

}

else

{

ExcelEle.setExpt_Shp_Date(StockEle.getExpt_Shp_Date());

}

ExcelEle.setVendor_Material(StockEle.getVendor_Material());

ExcelNode.addElement(ExcelEle);

}

}

if(ExcelNode.size()>0)

{

wdThis.wdGetCO_POPendingController().downloadData(wdContext.nodePoDetails_ExcelData());// This is for Downalod data Method

wdThis.wdGetCO_POPendingController().DownLoadToExcel();// This is for Open Popup Window

wdContext.nodePoDetails_ExcelData().invalidate();

}

else

{

wdComponentAPI.getMessageManager().reportException("Please select any one po item from the table",true);

}

//@@end

}

Regards

Vijay

p330068
Active Contributor
0 Kudos

Hi Vijay,

Please try this with Date field :

if(StockEle.getConf_Shp_Date() != null)

{

ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date());

}

else

{

ExcelEle.setConf_Shp_Date(null);

}

Hope it helps

Regards

Arun

Former Member
0 Kudos

Hi Arun,

Its Not Working

Regards

Vijay

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi KalluriVijay,

Please find the below link for help

https://wiki.sdn.sap.com/wiki/display/WDJava/UploadingexcelfileusingWebDynproforJava

Regards

Dibyakanta Deo