Você está na página 1de 9

durairaj.

athavanraja: Execute BW query using


ABAP Part II
Posted by Durairaj Athavan Raja 3 Apr, 2005
In the Execute BW query using ABAP Part I we have seen how to
execute BW query using ABAP. Now in this part we will see how the result in XML
format can be transformed to internal table format and also sample code for
testing the whole solution.
<!column ><xsl:apply-templates/></column>
<xsl:copy>
<xsl:apply-templates select="@||text()"/>

<!column ><xsl:apply-templates/></column>
<xsl:copy>
<xsl:apply-templates select="@||text()"/>

2836 Views

Mahesh Madhavan in response to Durairaj Athavan Raja on page 1


23 Jul, 2011 11:37 PM
Dear Durairaj,
Thank you for your reply.
My requirement is to extract the workbook contents into an internal table, just as it appears in the workbook. Is
there really a way to do so?
All my research regarding the extraction of data from a BW workbook into an internal table has so far been
futile.
Is there really a way out?
Thank you for your time.
Regards,
Mahesh M.S.
Durairaj Athavan Raja in response to Mahesh Madhavan on page 2
23 Jul, 2011 10:37 PM

Generated by Jive on 2015-10-26+01:00


1

durairaj.athavanraja: Execute BW query using ABAP Part II

Dear Mahesh,
Sorry for the delayed reply. What do you want to do with the read workbook content, open in excel? from where
an ABAP program or web app? In my case i have a BSP page which lists the workbook and on clicking it will
open the particular workbook in excel. Is this something you would like to do ?
Mahesh Madhavan in response to Durairaj Athavan Raja on page 2
20 Jul, 2011 10:25 AM
Dear Durairaj,
Thank you so much for your reply!
In fact I've used a function module RRMX_WORKBOOK_READ to read the above mentioned table for getting
the workbook contents. But it's there in a binary format. So using neither the FM nor reading the table directly
will make any difference.
Could you please suggest a way to convert this binary format to the readable format? The conventional FMs for
doing this, provided SAP is not yielding any result.
Thank you again, for you time.
Regards,
Mahesh M.S.
Durairaj Athavan Raja in response to Mahesh Madhavan on page 2
19 Jul, 2011 9:39 PM
For extracting the workbooks, you can just read them from the tables
RSRWBINDEXT = worbooks header table
RSRWBSTORE = workbook contents
Durairaj Athavan Raja in response to Mahesh Madhavan on page 2
19 Jul, 2011 9:38 PM
This is a very old code. Latest code is available at http://wiki.sdn.sap.com/wiki/display/BI/Expose+BI+Query+as
+RESTful+Service
Mahesh Madhavan in response to Michael Hoerisch on page 6
19 Jul, 2011 11:16 AM
Dear Michael,
You have left us in a cloud of confusion! Please reveal the names of those released BAPIs you were talking
about.
Thank you for your time.
Regards,
Mahesh M.S.
Mahesh Madhavan
19 Jul, 2011 11:12 AM
Dear Durairaj,

Generated by Jive on 2015-10-26+01:00


2

durairaj.athavanraja: Execute BW query using ABAP Part II

I'm delighted to find that a way exists for reading BW query using ABAP. Now my doubt is, can a BW
Workbook be also extracted, just as in the case of a BW query, using ABAP?
I have been looking all over, but nobody could crack this.
Thank you for your time.
Regards,
Mahesh M.S.
Richard Gordon
14 Jun, 2011 8:16 AM
I don't know much about ABAP but have been trying to follow this example. I don't understand how to test
it. What am I supposed to do with the last piece of code? Create another FM and run that? I also don't
understand how that ties in with the XSLT Program.
I know this is an old topic but any help would be appreciated
Richard
Durairaj Athavan Raja in response to Vaibhav Kwatra on page 3
20 Apr, 2010 3:06 AM
yes its possible. look at the web api documentation.
you will have to use
VAR_OPERATOR_1
VAR_SIGN_1
VAR_VALUE_LOW_EXT_1
etc
Vaibhav Kwatra
20 Apr, 2010 1:29 AM
Hi Raja,
My query is regarding the parameters we are passing to the FM.
According to the requirement, I have to execute a BI query from CRM system. So I was planning to
use the RFC RRW3_GET_QUERY_VIEW_DATA. I have the query name also the variable names.
The mandatory parameters to execute the query has multiple values. So my doubt here is it possible to
pass the multiple values for a single variable to the input parameter I_T_PARAMETER of the FM RFC
RRW3_GET_QUERY_VIEW_DATA. Please share your thoughts/input.
Ramkumar Valluru
23 Feb, 2009 5:06 AM
Hi,
I want to display the BI report data in bsp or webdynpro abap which is in arabic language.The BI system
doesn't support the non-unicode.so i have to get that report data into unicode sytem in webdynpro or bsp and
encode that data and pass to Bi system.
Is there any functionmodule to encode the data?
How to display that report data in bsp and which UI element support the Browser.

Generated by Jive on 2015-10-26+01:00


3

durairaj.athavanraja: Execute BW query using ABAP Part II

Please help me in the same.


Thanking you in advacne..
Ashwin Bhaskar
25 Dec, 2008 2:53 AM
Awesome blog ...!! Its has made a lot of things easier for US ...!!!
Kudos ..!!
nikhil kelkar in response to Durairaj Athavan Raja on page 4
22 Jun, 2006 1:45 AM
Hello sir,<br/>
Thank you for the reply. I am already reading the documentation given in the link
specified by you. <br/><br/>In the statement below<br/><xsl:for-each select="asx:abap[1]/asx:values[1]/
FLIGHT_LIST[1]/"><br/>as we use <xsl:for-each select for loop,<br/>why do we need to need to specify
the first line of the table . why cant we simply say /FLIGHT_LIST instead of /FLIGHT_LIST[1]/.<br/>also
kindly let me know the significance of prefix asx:abap[1]/asx:values[1]. I know that they are used for accessing
abap data but why do we require index in this case.<br/>Awaiting for the favourable response.<br/><br/><br/
><br/><br/><br/>
Durairaj Athavan Raja in response to nikhil kelkar on page 4
22 Jun, 2006 12:07 AM
asx:abap[1]/asx:values[1]/FLIGHT_LIST[1]
is just to read the first record in the loop.
XSLT is not different in SAP (SAP has its own transformation based on XSLT call ST -Simple transformation,
you can choose to use XSLT or ST).
as far learning XSLT, this will be a good start
http://www.w3schools.com/xsl/default.asp
Regards
Raja
nikhil kelkar
21 Jun, 2006 11:37 PM
Hello,<br/> I am a beginer in XSLT programming. I was reading SAP given transformation
STRANSDEMO_FLIGHTS_A2X in was 6.4. Here i was not able to get following statement<br/><xsl:for-each
select="asx:abap[1]/asx:values[1]/FLIGHT_LIST[1]/*"><br/>I know that xsl:for-each select is for loop but<br/
>wats the output of line <br/>asx:abap[1]/asx:values[1]/FLIGHT_LIST[1]<br/>also here why they have used
index .<br/>Even in the example given by you , you have used similar index notation. what is the significance of
this.<br/>
Also Sir, I tried to understand xslt through SAP help but as there is not proper documentation for
each tag , I wasn't able to understand to greater extent. If you have any better documentation about xslt then
please provide the same.<br/>
Thank you.
in response to Ernestina fava on page 5
30 May, 2006 8:21 AM
Could you fix your problem? If so, could you please help me, what to do to fix this problem?

Generated by Jive on 2015-10-26+01:00


4

durairaj.athavanraja: Execute BW query using ABAP Part II

Best Regards
Stefan
Bharat Patel in response to Durairaj Athavan Raja on page 5
23 Sep, 2005 12:14 AM
Hi Raja<br/><br/>Thanks for reply. I did some amount of debugging abd found that it reads dates properly
from query byt while assigning it assigns 10 digits to 8 digits and makes a mess of data.<br/>According to me
following code is not working properly on my side..Bharat
Durairaj Athavan Raja in response to Bharat Patel on page 5
21 Sep, 2005 1:49 AM
hi Bharat,
It should not be a problem, i guess i have tested this scenario as well. Anyhow can you tell me what exactly
happenning- what is meant by not extracting properly.
why dont you just debugg and see where it goes wrong.
Regards
Raja
Bharat Patel
21 Sep, 2005 1:24 AM
Dear Raja
This is really wonderful and also useful. I tried with very simple query and it worked fine. Now the query which i
am trying to download has 2 dates and it is not extracting properly.
Could you please guide on this.
Thanks in advance.
Bharat
Durairaj Athavan Raja in response to Ernestina fava on page 5
2 Aug, 2005 6:28 AM
this is very well handled in the FM. if you look at the code in the Y_EXECUTE_QUERY FM we created from
PART I, when i build the meta table , i get the OUTPUTLEN from BAPI_IOBJ_GETDETAIL.
the details structure returned by this BAPI gives me the right output length. we also have exactly the same
scenario (coarea/costcenter)(4+6). this works very well.
Can you debug and see whats going wrong?
Regards
Raja
Ernestina fava
2 Aug, 2005 6:17 AM
we have a problem with a query where there's a Infoobject with a compound.
Durairaj Athavan Raja in response to Durairaj Athavan Raja on page 6
16 Jul, 2005 3:24 AM

Generated by Jive on 2015-10-26+01:00


5

durairaj.athavanraja: Execute BW query using ABAP Part II

Luckily i was able to spare some time. I have simulated the scenario where i had 0costcenter in one column
and a structure for plan/actual/variance colummns. This works fine. i didnt face the problem you are referring
to. The only way out is to debugg.
Regards
Raja
Durairaj Athavan Raja in response to Nicola Commari on page 6
15 Jul, 2005 9:02 PM
I am on a training course for next 5 days. As i have to simulate your case to see whats going wrong, it would
take sometime. In the meantime, you can just debugg and see whats going wrong.
Regards
Raja
Nicola Commari
15 Jul, 2005 8:43 AM
Hi raja,Nicola Commari
Gary Ramage in response to Michael Hoerisch on page 6
16 May, 2005 12:26 PM
Hello Michael,
Could you please provide the name of BAPI's to get data from a query as you suggested.
Thanks,
Gary Ramage
Durairaj Athavan Raja in response to Michael Hoerisch on page 6
25 Apr, 2005 2:23 AM
Thanks for your concerns.
Are you talking about the BAPI methods of ODBO Reporting? (using MDX). My knowledge of MDX is very poor
and transaction MDXTEST dosent help much in generating the required MDX statements.
The solution talked here is a pure custom one. Which uses the standard classes/methods.
The closest FM which i found doing this kind of processing is RRW3_GET_QUERY_VIEW_DATA.
It would be really helpful for us if you could give us the BAPI names which can be used for getting data from
query.
Regards
Raja
Michael Hoerisch
25 Apr, 2005 1:52 AM
Hello,
please use released BAPI's to get data from a query! Your workaround is not supported by SAP.
Kind regards
Michael
SAP RIG

Generated by Jive on 2015-10-26+01:00


6

durairaj.athavanraja: Execute BW query using ABAP Part II

Durairaj Athavan Raja in response to Sheetal Pisolkar on page 8


23 Apr, 2005 3:35 AM
modify the FM code as below.Raja
Bhima Chandra Sekhar Guntla
22 Apr, 2005 1:18 AM
This is really great stuff. It is very usefull.
Sheetal Pisolkar in response to Durairaj Athavan Raja on page 7
18 Apr, 2005 9:37 AM
Sorry for not been clear enough about my problem.
The values of wa_set-chavl is what i was looking for.
Thanks again your weblog was very helpful.
Regards,
Sheetal.
Durairaj Athavan Raja in response to P Apurva on page 8
16 Apr, 2005 12:15 AM
Yes. but needs little modification.
The following method will give the view definition.
CALL METHOD cl_rsz_www_db_interface=>get_view
this would also return the query of the view.
Get the query name and then create instance of cl_rsr_request like below.
CREATE OBJECT r_request
EXPORTING i_genuniid = p_genuniid .
I have checked some of the standard code of SAP this is what they are doing.
For example you can check out the code at
IF_SOAP_APPLICATION_RT~EXEC_PROCESSING
Hope this helps.
Regards
Raja
Durairaj Athavan Raja in response to Sheetal Pisolkar on page 8
15 Apr, 2005 10:02 PM
Hi Sheetal,
Thanks for your comments.
Its really difficult to address your question with the given explanation. If you just debugg the FM, you yourself
will easily resolve the issue.
Regards

Generated by Jive on 2015-10-26+01:00


7

durairaj.athavanraja: Execute BW query using ABAP Part II

Raja
P Apurva
15 Apr, 2005 4:25 PM
Hi raja,
This is really fantastic. Is it also possible to run a query view using abap and get the XML result?
Cheers,
Apurva
Sheetal Pisolkar
13 Apr, 2005 2:33 PM
Hi Raja,Sheetal
Durairaj Athavan Raja in response to Mike Gliebe on page 8
12 Apr, 2005 9:49 PM
Should not be a problem. Just RFC enable the FM. But the calling system has to be on WAS so that you can
use XSLT to parse the resulting XML into itab.
Regards
Raja
Mike Gliebe
12 Apr, 2005 9:28 AM
Raja, very nice. I was wondering if it would be possible to make the FM RFC enabled? We have a need to
query data in BW from an R/3 system via ABAP. Do you have any thoughts on this. Thanks.
Bhavin Shah in response to Durairaj Athavan Raja on page 8
12 Apr, 2005 4:20 AM
Thanks Raja now it is working very well.
Durairaj Athavan Raja in response to Bhavin Shah on page 8
11 Apr, 2005 3:02 AM
META table will just have the structre definition of the output. the actual output is in xml_out as xml.Raja
Bhavin Shah
11 Apr, 2005 2:48 AM
Dear Raja,I am not getting the values. Can you help me out?
Durairaj Athavan Raja in response to Deepu Sasidharan on page 9
8 Apr, 2005 10:16 PM
Hi Deepu,
thanks for the comments.
Now that the query results are in a internal table you could generate PDF either using OTF to PDF (Smart
form) or spool to PDF.
I haven't tried XSL FO. Thats my next target, i will post the results once its done.
Regards
Raja

Generated by Jive on 2015-10-26+01:00


8

durairaj.athavanraja: Execute BW query using ABAP Part II

Deepu Sasidharan
7 Apr, 2005 7:37 PM
Hi Raja,
This is really great stuff.
Can we get the PDF o/p of the query result. I have seen your related articles in the BSP forum, can we use the
smart forms functionality along with BW to get the PDF o/p. Also have you tried XSL FO which can produce
PDF o/p.
Thanks.
-Deepu

Generated by Jive on 2015-10-26+01:00


9

Você também pode gostar