Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reading excel file from Application server

former_member761936
Active Participant
0 Likes
1,437

Hi,

I have requirement to read excel file from Application server .I used the procedure mentioned below

https://praveensg8.files.wordpress.com/2015/04/reading-excel-file-from-application-server-into-abap-... .after final Transformation I am getting blank Internal table,

One doubt I have is in the tranformation mentioned in the above link in place of <EXCEL_DATA-FIELD1> what I need to use is this internal table field name or Excel heading name.

Please provide solution which is really helpful for me.

Thanks in Advance

Regards,

Narendra.S

4 REPLIES 4
Read only

matt
Active Contributor
0 Likes
1,169

abap2xlsx - google it

Read only

abo
Active Contributor
1,169

Not really an answer but a suggestion: this is the type of work which abap2xlsx already does.

Specifically, zdemo_excel15 shows how to read a file.

Read only

Zakir_hussain
Explorer
0 Likes
1,169

Hi,

Even I got a task in the same. I went through the same document mentioned above, From base64 converting to xml. Then in strans-> reading xml and converting to interna table. The thing is that in <excel_data-field1> <excel_data-field2>, What data should be passed here.

In this case, background process used. open dataset,close dataset. The data is in base64, We cant read via abap2xlsx. so what should be maintained in data_field.

Here is the xml used.

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:ss="http://schemas.openxmlformats.org/spreadsheetml/2006/main"

xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" exclude-resultprefixes="C" version="1.0">
<xsl:param name="P_SHARED_STRING" select=""/>
<xsl:strip-space elements="*"/>
<xsl:output encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:variable name="V_SHARED_STRING">
<xsl:if test="$P_SHARED_STRING">
<xsl:copy-of select="$P_SHARED_STRING"/>
</xsl:if>
</xsl:variable>
<xsl:template match="/">
<asx:abap version="1.0">
<asx:values>
<LT_DATA>
<xsl:for-each select="ss:worksheet/ss:sheetData/ss:row">
<xsl:if test="position() > 1">
<item>
<EXCEL_DATA-FIELD1>

<xsl:variable name="cell_id" select="concat('A', position())"/>

<xsl:variable name="v_index" select="ss:c[@r=$cell_id][@t='s']/ss:v"/>
<xsl:if test="$v_index">
<xsl:value-of select="$V_SHARED_STRING/sst/si[$v_index + 1]/t"/>
</xsl:if>
<xsl:if test="not($v_index)">
<xsl:value-of select="ss:c[@r=$cell_id]/ss:v"/>
</xsl:if>
</EXCEL_DATA-FIELD1>
<EXCEL_DATA-FIELD2>
<xsl:variable name="cell_id" select="concat('B', position
())"/>
<xsl:variable name="v_index" select="ss:c[@r=$cell_id][@t
='s']/ss:v"/>
<xsl:if test="$v_index">
<xsl:value-of select="$V_SHARED_STRING/sst/si[$v_index + 1]/t"/>
</xsl:if>
<xsl:if test="not($v_index)">
<xsl:value-of select="ss:c[@r=$cell_id]/ss:v"/>
</xsl:if>
</EXCEL_DATA-FIELD2>
<EXCEL_DATA-FIELD3>

<xsl:variable name="cell_id" select="concat('C', position())"/>

<xsl:variable name="v_index" select="ss:c[@r=$cell_id][@t='s']/ss:v"/>
<xsl:if test="$v_index">
<xsl:value-of select="$V_SHARED_STRING/sst/si[$v_index + 1]/t"/>
</xsl:if>
<xsl:if test="not($v_index)">
<xsl:value-of select="ss:c[@r=$cell_id]/ss:v"/>
</xsl:if>
</EXCEL_DATA-FIELD3>
<EXCEL_DATA-FIELD4>
<xsl:variable name="cell_id" select="concat('D', position())"/>

<xsl:variable name="v_index" select="ss:c[@r=$cell_id][@t='s']/ss:v"/>

<xsl:if test="$v_index">
<xsl:value-of select="$V_SHARED_STRING/sst/si[$v_index + 1]/t"/>
</xsl:if>
<xsl:if test="not($v_index)">
<xsl:value-of select="ss:c[@r=$cell_id]/ss:v"/>
</xsl:if>
</EXCEL_DATA-FIELD4>
</item>
</xsl:if>
</xsl:for-each>
</LT_DATA>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
Read only

matt
Active Contributor
1,169

Or use abap2xlsx...