cancel
Showing results for 
Search instead for 
Did you mean: 

code to diplay and down load links from table.

Former Member
0 Kudos

Hi

using below code to display and download current year and past year form16 using table controller.But using below code iam able to display and download only one form16.But i have maintained two form 16 in KM.when iam executing rfc in backed rfc is getting two form16.But from frontend iam gettting only one form16 using below code.Please guide me.

public void wdDoInit()

{

//@@begin wdDoInit()

wdThis.wdGetComp_Form_16Controller().executeZess_Form16_File_Details_Input();

wdThis.wdGetComp_Form_16Controller().executepersonalrfc();

wdContext.currentContextElement().setCa_pernr(wdContext.currentOutput12Element().getPernr());

wdContext.currentContextElement().setCa_name(wdContext.currentOutput12Element().getEmpname());

try {

// Getting the useru2026u2026

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

IUser sapUser = wdClientUser.getSAPUser();

com.sapportals.portal.security.usermanagement.IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);

// Getting the Resourceu2026u2026u2026

IResourceContext resourseContext = new ResourceContext(ep5User);

IResourceFactory resourseFactory = com.sapportals.wcm.repository.ResourceFactory.getInstance();

// execute RFC...

int size = wdContext.nodeIt_Files1().size();

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

{

IPrivateForm_16View.IIt_Files1Node node = wdContext.nodeIt_Files1();

IPrivateForm_16View.ICa_nodeElement ele = wdContext.createCa_nodeElement();

String file_path = wdContext.nodeIt_Files1().getIt_Files1ElementAt(i).getZfile_Name();

//Get a RID for the file

RID file = RID.getRID("/documents/FORM16/" + file_path );

//get the file itself from KM

IResource resource = resourseFactory.getResource(file, resourseContext);

//collections can not be opened, therefore we have to ignore them

if(!resource.isCollection())

{ byte[] bcontent = this.getByteArrayFromResource(resource);

//get resource type

WDWebResourceType resourceType = WDWebResourceType.getWebResourceTypeForFileExtension(resource.getRID().extension());

IWDResource iwdResource = null;

//resource type is known

if (resourceType != null)

{ iwdResource = WDResourceFactory.createResource(bcontent, resource.getName(), resourceType );

}

else

{ iwdResource = WDResourceFactory.createResource(bcontent, resource.getName(), WDWebResourceType.PDF);

}

ele.setCa_path(iwdResource.toString());

ele.setCa_company(wdContext.nodeIt_Files1().getIt_Files1ElementAt(i).getButxt());

//ele.setCa_year(wdContext.nodeIt_Files1().getIt_Files1ElementAt(i).getZyear());

ele.setCa_year(wdContext.nodeIt_Files1().getIt_Files1ElementAt(i).getZyear());

ele.setCa_pernr(wdContext.nodeIt_Files1().getIt_Files1ElementAt(i).getPernr());

if( ""== ele.getCa_path())

{

// wdContext.currentContextElement().setCa_error("Letter Does not Exist!!") ;

ele.setCa_link( false);

}

else{

ele.setCa_link( true);

}

}

wdContext.nodeCa_node().addElement(ele);

}

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportWarning("No Form16 exist, please contact ASK-HR at ");

}

}

Edited by: Mahesh Shirke on Jun 2, 2011 10:23 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

solved