Compute QTD with Excel's CUBE functions
Hi,
I want to compute QTD Sales using Excel's CUBE functions. Here are the specifics
1. I created a Pivot Table using PowerPivot and then converted the Pivot Table's cells to Formulas (Pivot Table Options > OLAP > Convert to Formulas)
2. I have two slicers - one for Year and another for month
3. If a user selects April in the Month slicer, then the QTD figure should be for that month only. If he selects May, then QTD should be the summation of April and May. If he selects June, then QTD should be the summation of April, May and June.
This should similarly work for other month selections as well.
4. The formula that I currently have for computing the Quantity sold for the month of April is
=IFERROR(CUBEVALUE("ThisWorkbookDataModel",$A10,C$8,C$9),"")
A10 has Quantity Sold
C8 has the Slicer's year selection
C9 has the Slicer's month selection
How can I modify the formula above to compute the QTD Quantity sold?
Thank you.
Regards, Ashish Mathur Microsoft Excel MVP www.ashishmathur.com
I don't consider myself an expert in this area, but the way I've managed to get ranges is the following (please read the caveats as well). First, let me start with some related links:
http://social.technet.microsoft.com/Forums/office/en-US/2333f239-134d-4245-ae24-5621f0ecfe73/excel-2010-cubeset-based-on-range-of-dates?forum=excel
http://social.technet.microsoft.com/Forums/office/en-US/257ad66d-0e41-4b80-b388-1c979da4d861/excel-2010-mdx-using-cubeset-or-cubevalue-to-return-data-within-date-range-even-when-those-date?forum=excel
http://answers.microsoft.com/en-us/office/forum/office_2010-excel/cubeset-date-range/f00317cd-8046-4bb9-8ad3-8cbf922ebb4f
The third link is probably going to be the most helpful for syntax; the problem I was posting about was trying to nail
down specific dates, even if there was no transactional data for that date in the cube. As long as you are working at the year and month level, the syntax should be helpful for you to define a range of months. So the main caveat is that if you are trying to
return a value based on something that doesn't exist in your cube (whether that be a specific day, or future months that don't have placeholders) then I don't know how to do that :)
If you want to base this on your month slicer, I would set up an additional pivot (add it under the same slicer) and have nothing but the year/month in rows, so that when a user selects an item it will be the only returned row label in the new pivot. Use
a MATCH against a static list of months to identify which month is currently showing, and use a formula to get the start month your quarter.
If you are always looking at current year/current quarter, then you don't even need a slicer- from the current date you can calculate current month/year and the quarter start month/year.
Note that I use lots of cubemember formulas in adjacent cells to build my cubevalue formulas. In the syntax below, C2, C4, and E4 are cubemember formulas. M4 and N4 are just text strings that match our cube. Time Period/ Month and Year are also cube-specific,
you will need to use the text used in your cube's heirarchy, which you can get by converting your pivot filters to formulas as well.
=CUBEVALUE("ICSC",$C$2,$C4,$E4,CUBESET("ICSC","[Time Period].[Month and Year].&[" & M4 & "]:[Time Period].[Month and Year].&[" & N4 & "]","YTD 2010",0))
HTH
Similar Messages
-
Slicer Time Dimension Issue with Cube Functions
Hi,
Hoping someone can help me figure out right approach here.
Summary:
Using Excel 2013 connected to a SSAS cube as data source, and cube functions with slicers to create a dashboard.
Have following time dimension slicers; Fiscal Year, Fiscal Quarter, Fiscal Month, Fiscal Week & Date, that are used to slice data based on user selection, along
with a sales measure.
Below is example of Slicer name and CubeMember function for each:
Slicer_Fiscal_Year:
=CUBEMEMBER("Cube","[Date].[Fiscal Year].&[2015]")
Slicer_Fiscal_Quarter:
=CUBEMEMBER("Cube","[Date].[Fiscal Quarter].[All]")
Slicer_Fiscal_Month:
=CUBEMEMBER("Cube","[Date].[Fiscal Month].&[201408]")
Slicer_Fiscal_Week:
=CUBEMEMBER("Cube","[Date].[Fiscal Week].&[201509]")
Slicer_Date:
=CUBEMEMBER("Cube","[Date].[Date].[All]")
Problem:
What I am trying to do is to build a table with cube functions that takes the lowest grain of the slicer time dimension selected, shows the current member, plus
the prior 7 so I can have an 8 period trending view table that I will build a chart from. In the above example that would mean that it would look at Slicer_Fiscal_Week since that is lowest grain that has an attribute other than All, and then show me the prior
7 periods. In this case 201509 means Week 9, so I would want to show in table Week 9 back to Week 2. But if Slicer_Fiscal_Week was set to All, along with Slicer_Date, then Fiscal Month would be lowest grain, so I would want to show Fiscal Months from August
(201408) back to January 2014. I know how to use CubeRankedMember to pull the value from what is selected in the slicer, the problem is figuring out how to pass the lowest grain time dimension so that I can use lag or some other MDX function to get the previous
periods.
Any help on this would be greatly appreciated.
<object height="1" id="plugin0" style=";z-index:1000;" type="application/x-dgnria" width="1"><param name="tabId" value="{28593A5C-70C0-4593-9764-80C76B51795C}"
/></object>Hello,
Thank you for your question.
I am trying to involve someone familiar with this topic to further look at this issue.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Statistical calc with MDX question (Mode function as an excel)
Hi All,
I need to create an MDX Calc to Returns the most frequently occurring, or repetitive, value in an array or range of data.
For example, the mode of 2, 3, 3, 5, 7, 10 is 3.
In Excel I use the MODE() function but I don't know how to do this in MDX and add it as a measure in Universe.
I can't do the formula in WEBI because we have big data volume and I can't retrieve all the customers in WEBI.
We have SAP BW 7.0 and SAP BusinessObjects XI 3.1 fix pack 1.3
Thanks in advance.Hi,
it looks like you created the entry twice so I would suggest you close on of them:
Statistical calc with MDX question (Mode function as an excel)
I don't think that those kind of statistical functions are available in MDX. you can always go to se37 and use the bapi_get_functions to see the list of supported functions.
Ingo -
Excel copy / paste function does not work with Smartview
We recently upgraded to latest version and this is the first tiime we are using Smartview. None of our users can use Excel copy / paste function between worksheets in a file or between files. The function only works within an active worksheet. What is the fix here?
Try THis
Disable the Transition formula evaluation and transition formula options.
In Office 2003:
1. Point to Tools -> Options...
2. Select the Transition tab
3. Deselect the following entries:
- Transition formula evaluation
- Transition formula entry
4. Choose OK
5. Repeat the above steps for each worksheet in the workbook, by selecting each one in turn adn repeating steps 1-4.
In Office 2007:
1. Point to the Office button
2. Choose Excel Options
3. Select Advanced (at the left)
4. In the right-hand pane, scroll to the bottom
5. Under Lotus Compatibility Settings for..., deselect:
- Transition formula evaluation
- Transition formula entry
6. Select the next worksheet in the drop-down menu
7. Repeat steps 5-6 until all worksheets have been processed
8. Choose OK. -
Num pad doesn't work with Excel.
The numeric pad behaves like scrolls and page up, page down buttons every time I use Microsoft's Excel. I looked everywhere but i couldn't find a way to change the pad to work with numbers. Its driving me crazy ...
G5 Dual 2.3GHz Mac OS X (10.4.4)Sounds like you are using a third-party keyboard: the new Apple keyboards do not have a Num Lock key and the numeric keypad always functions as such.
If you're using a third-party keyboard, and if you installed vendor-provided software to customize the keyboard, check its preferences and also check the vendor's Web site to see if there is an updated version of the software for your keyboard.
I cannot reproduce the problem using the latest model of Apple Pro keyboard (the one that came with my computer, which is the same as your computer).
2. You might also want to state the specific keyboard and version of Excel you are using in case someone else has the same configuration and can try to reproduce the problem. I tried it with Excel from Office v.X.
3. You wrote: "* Deleted Excel Preferences"Both of them, yes?
- Home > Library > Preferences > com.microsoft.excel.plist (you may or may not have this one).
- Home > Library > Preferences > Microsoft > Microsoft Excel
Good luck!
Dr. Smoke
Author: Troubleshooting Mac® OS X -
Problem with images in XML with excel output
Hello:
I made an XML concurrent program, with excel output, but i am having a problem:
The rtf template has a logo (bmp image), but it is not showing in the excel (if i execute the concurrent in the oracle applications). However, if i create the xml in Oracle Reports in my computer, and then load that xml in the rdf template in word, i can see the logo in the excel preview. I don't know why is it not showing when i execute the program in applications.
If someone can help me with this, i will be very grateful.
Greetings
Message was edited by:
user632438xml cP, will not give you a image in excel output,..
In RDF there is a placeholder for image, and the image is located in certain location, at runtime it picks and render the output with logo.
but xml CP, will get the data in xml type and merge with rtf to get the output you wanted..
if you have the rtf with logo embedded in it, if output is of pdf or rtf output , then it will display the logo ,.
in excel currently it is not possible to show the logo,..
excel you see could be xml-excel or csv-excel not the true binary excel.
to get the logo embedded ,for that you have to wait on tim for the excel template, which will be release in near future i guess.. -
Is there any hope of apple adding a 're-link with media folder'-type function to iTunes?
Is there any hope of apple adding a 're-link with media folder'-type function to iTunes?
I have 1000s of broken links after installing the latest version of iTunes and updating some files in my media folder. The location of my itunes library has not changed, and all the files are there (I know because I've just waited several hours for the files to be updated by my ultra-slow computer) - by my logic, there should be some menu option that simply re-synchronises with the media folder, just like itunes would do with an ipod - it can't be that hard can it? The only way I can restore a link is by clicking every song (I have over 28,000) and locating the file in the folder that iTunes claims to use as its media folder - the new version 10 option of then using this location to restore all broken links doesn't work because it only looks in the specific album file, and after a couple of times this dialog box no longer even comes up, so I couldn't ask it to do this even if I wanted to. At the moment the only option I can see is to completely wipe iTunes and re-load all my music from scratch - using my tired and over-worked computer this will realistically take around 15 hours that I don't have, and my computer will melt in the process. I wish I'd never tried to 'tidy up' my iTunes library...
PLEASE Apple, how hard can it be to have a function that searches for and restores broken links by itself????? I've told you where the music is - just flipping look for it yourself instead of getting me to do it!You don't have to re-rip, re-import or re-download all your content. You can clear the iTunes library, either by selecting all in the libary and pressing the Delete key, saying "no" when it asks if you want to remove the files themselves, and then use the Add To Library command, selecting the iTunes Media folder (or iTunes Music folder, as applicable to your situation), and that will add back all your content. It shouldn't take more than a few minutes; if it does, something may be amiss with your hard drive or the library file is corrupted (in which case just delete the library file and re-do the Add To Library command).
Regards. -
Error in communicating with Excel Calculation Services
When attempting to use Excel Web Access web part, I get "We're sorry. We ran into a problem completing your request. Please try that again in a few minutes."
Checked event log and found
There was an error in communicating with Excel Calculation Services
http://my server:32843/49082a5d56c141629497dd8b28375f47/ExcelService*.asmx exception: The remote server returned an error: (503) Server Unavailable.
[Session:
User: ].
I googled the error and, as suggested by various sources, rebooted the server. (Same issue occurs) I also tried disabling asp.net impersonation with no change. Ideas?Hi ,
Reason for the error :
The Excel Services Application server computer is in a non-valid state and may need to be restarted.
Resolution : (Before taking the step toward to restart the server, try the below option)
Restart your excel service application app pool/ restart the excel service. (Reference :http://technet.microsoft.com/en-us/library/ee513104(v=office.14).aspx)
If you have more than one application server in the farm , then try start the excel serviceto a different server.
Regards,
Senthil -
Issue in sending e mails with Excel attachment
Hi,
I am facing an issue with one function module - SO_DOCUMENT_SEND_API1. We were using this for sending mails to diff destination with excel sheet attachment contains sales data. This system has been migrated from 4.5B to ECC 5. Now this process is not working like the old one and the excel attachment is not properly formatted. All the data is being written into one cell of excel sheet and it seems only one line is present in output and is corrupted.
Can you please let me know what might be the issue here, any alternate option available or something to be modified in new version with this function module?
Thanks in advance,
UllasHi Ullas,
check this once.
REPORT ZLAXMI_ALVMAIL4 .
TABLES: EKKO.
PARAMETERS: P_EMAIL TYPE SOMLRECI1-RECEIVER
DEFAULT '[email protected]'.
TYPES: BEGIN OF T_EKPO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
END OF T_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF T_EKPO INITIAL SIZE 0,
WA_EKPO TYPE T_EKPO.
TYPES: BEGIN OF T_CHAREKPO,
EBELN(10) TYPE C,
EBELP(5) TYPE C,
AEDAT(8) TYPE C,
MATNR(18) TYPE C,
END OF T_CHAREKPO.
DATA: WA_CHAREKPO TYPE T_CHAREKPO.
DATA: IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1,
GD_ERROR TYPE SY-SUBRC,
GD_RECIEVER TYPE SY-SUBRC.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM DATA_RETRIEVAL.
Populate table with detaisl to be entered into .xls file
PERFORM BUILD_XLS_DATA_TABLE.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
'Example .xls documnet attachment'
'XLS'
'filename'
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM DATA_RETRIEVAL.
SELECT EBELN EBELP AEDAT MATNR
UP TO 10 ROWS
FROM EKPO
INTO TABLE IT_EKPO.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM BUILD_XLS_DATA_TABLE.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
CONSTANTS:
CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
LOOP AT IT_EKPO INTO WA_CHAREKPO.
CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
FORM POPULATE_EMAIL_MESSAGE_BODY.
REFRESH IT_MESSAGE.
IT_MESSAGE = 'Please find attached a list test ekpo records'.
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
Regards,
Laxmi. -
Issue with Excel Attachement in BI 7.0
Hi,
I have developed a custom report to send an e-mail with excel attachment in BI 7.0. When we are trying to open the excel sheet attachment in the e-mail. I am getting a message warning message stating that<b> 'This file is not in a recognizable format'</b>. but if we click on ok button then everything looks fine i.e the data is displaying as expected.
I have developed the same reports in SAP R/3 and SRM but I don't see any issues over there.
Can any one help me on this issue.
Thanks in advance,
Venkat BommaWhen the selection screen pops up choose the KEY only function on the TOOLS on the top right corner of the screen. Then you will be able to enter the values manually.
Hope this helps. -
Problem in excel format while sending mail with excel attachment.
Hi Gurus ,
I am sending a email with Excel attachment using FM SO_DOCUMENT_SEND_API1 or SO_NEW_DOCUMENT_ATT_SEND_API1.
I am able to send a mail with excel attachment with a piece of code which I got from SDN itself.
But the problem is when I am trying to open the attachment, <b>A pop up comes which says that it is not in recognizable format. Would you like to open it?
and several other lines of caution.</b>
When i choose to open it, i get the correct data in one excel sheet. Certain vertical lines of the excel sheet is missing. <b>But no data is missing. </b>
I am attaching the code below. Can any one please tell me where is the problem in this code ?
Thanx in advance
types: begin of t_mara,
matnr type mara-matnr,
matkl type mara-matkl,
mtart type mara-mtart,
meins type mara-meins,
end of t_mara.
data: gt_mara type table of t_mara,
wa_mara like line of gt_mara,
it_packing_list type table of SOPCKLSTI1,
wa_packing_list like line of it_packing_list,
it_receivers type table of SOMLRECI1,
wa_receivers like line of it_receivers,
it_mailbody type table of SOLISTI1,
wa_mailbody like line of it_mailbody,
it_attachment type table of SOLISTI1,
wa_attachment like line of it_attachment.
data: la_doc type SODOCCHGI1.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
* get material
select matnr matkl mtart meins
into table gt_mara
from mara
up to 25 rows.
* Populate the subject/generic message attributes
la_doc-obj_langu = sy-langu.
la_doc-obj_descr = 'Material Details' . "Mail Header
la_doc-sensitivty = 'F'.
la_doc-doc_size = 1.
* Add the recipients email address
CLEAR wa_receivers.
REFRESH it_receivers.
wa_receivers-receiver = 'PCSDEVL'.
wa_receivers-rec_type = 'U'.
wa_receivers-com_type = 'INT'.
wa_receivers-notif_del = 'X'.
wa_receivers-notif_ndel = 'X'.
APPEND wa_receivers to it_receivers.
* Mail Body
CLEAR wa_mailbody.
REFRESH it_mailbody.
wa_mailbody-line = 'Please find the attachment'.
APPEND wa_mailbody to it_mailbody.
* Mail attachmwnt
CLEAR wa_attachment.
REFRESH it_attachment.
CONCATENATE 'MATNR' 'MATKL' 'MTART' 'MEINS'
INTO wa_attachment SEPARATED BY con_tab.
CONCATENATE con_cret wa_attachment INTO wa_attachment.
APPEND wa_attachment to it_attachment.
LOOP AT gt_mara INTO wa_mara.
CONCATENATE wa_mara-matnr wa_mara-matkl
wa_mara-mtart wa_mara-meins
INTO wa_attachment SEPARATED BY con_tab.
CONCATENATE con_cret wa_attachment INTO wa_attachment.
APPEND wa_attachment to it_attachment.
ENDLOOP.
* Describe the body of the message
CLEAR wa_packing_list.
REFRESH it_packing_list.
wa_packing_list-transf_bin = space.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 0.
wa_packing_list-body_start = 1.
wa_packing_list-body_num = 1.
wa_packing_list-doc_type = 'RAW'.
APPEND wa_packing_list to it_packing_list.
* Create attachment notification
wa_packing_list-transf_bin = 'X'.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 1.
wa_packing_list-body_start = 1.
DESCRIBE TABLE it_attachment LINES wa_packing_list-body_num.
wa_packing_list-doc_type = 'XLS'. " To word attachment change this as 'DOC'
wa_packing_list-obj_descr = ' '.
concatenate wa_packing_list-doc_type 'file' into wa_packing_list-OBJ_DESCR
separated by space.
wa_packing_list-doc_size = wa_packing_list-body_num * 255.
APPEND wa_packing_list to it_packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = la_doc
PUT_IN_OUTBOX = 'X'
* SENDER_ADDRESS = SY-UNAME
* SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
tables
packing_list = it_packing_list
* OBJECT_HEADER =
CONTENTS_BIN = it_attachment
CONTENTS_TXT = it_mailbody
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_receivers
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.REPORT Zex5 LINE-SIZE 255 LINE-COUNT 255 .
class CL_ABAP_CHAR_UTILITIES definition load. "-->
TABLES : vbap.
SELECT-OPTIONS: s_vbeln FOR vbap-vbeln.
DATA : BEGIN OF itab OCCURS 1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
END OF itab.
parameters : p_email like somlreci1-receiver
DATA: tlines type i.
DATA: itmessage LIKE solisti1 OCCURS 1 WITH HEADER LINE. "Ok
DATA: itattach LIKE solisti1 OCCURS 2 WITH HEADER LINE. "Ok
DATA: itpacklist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: itreclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
data: itattachment like solisti1 OCCURS 2 WITH HEADER LINE.
start-of-selection.
SELECT vbeln posnr matnr
FROM vbap
INTO TABLE itab
WHERE vbeln IN s_vbeln.
**Make the internal table data to be compatible in excel format .
PERFORM BUILD_XLS_FORMAT.
**Populate message of body text.
clear itmessage.
refresh itmessage.
itmessage = 'Please find attached Excel file'.
append itmessage.
PERFORM send_mail_as_xls_attachment tables itmessage
itattach
using p_email 'Excel Attachment' 'TXT' " 'XLS'
using p_email 'TEXT Attachment' 'TXT' " 'XLS'
'TestFileName'
'SalesOrders' .
*& Form BUILD_XLS_FORMAT
text
--> p1 text
<-- p2 text
form BUILD_XLS_FORMAT.
previosuly we were using for unicode ..now replaced
**Declare constants for the spacing .
*Constants : con1 type x value '0D',
con2 type x value '09'.
Constants : con1 type c
value CL_ABAP_CHAR_UTILITIES=>CR_LF,
con2 type c
value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
**For the Header descriptions.
Concatenate 'SalesORdNo'
'Item'
'Materialno' into itattach separated by con2.
Concatenate con1 itattach into itattach.
Append itattach.
**Now align the items in the itab as above .
Loop at Itab.
concatenate itab-vbeln
itab-posnr
itab-matnr into itattach separated by con2.
concatenate con1 itattach into itattach .
Append itattach.
endloop.
endform. " BUILD_XLS_FORMAT
*& Form send_mail_as_xls_attachment
text
-->P_ITMESSAGE text
-->P_ITATTACH text
-->P_P_EMAIL text
-->P_0116 text
-->P_0117 text
-->P_0118 text
-->P_0119 text
form send_mail_as_xls_attachment tables p_itmessage
p_itattach
using p_email
p_mtitle
p_format
p_filename
p_attdescription.
Data : xdocdata like sodocchgi1,
xcnt type i.
*Fill the document data.
xdocdata-doc_size = 1.
*Populate the subject/generic message attributes.
xdocdata-obj_name = 'SAPRPT'.
xdocdata-obj_langu = sy-langu.
xdocdata-obj_descr = p_mtitle.
*Fill the document data and fetch size of attachment.
clear xdocdata.
read table itattach index xcnt.
xdocdata-doc_size = ( xcnt - 1 ) * 255 + strlen( itattach ).
xdocdata-doc_size = ( xcnt - 1 ) * 255.
xdocdata-obj_name = 'SAPRPT'.
xdocdata-obj_langu = sy-langu.
xdocdata-obj_descr = p_mtitle.
clear itattachment. refresh itattachment.
itattachment[] = p_itattach[].
*Describe the body of the message.
clear itpacklist. refresh itpacklist.
itpacklist-transf_bin = 'X'.
itpacklist-head_start = '1'.
itpacklist-head_num = '0'.
itpacklist-body_start = '1'.
describe table itattachment lines itpacklist-body_num .
itpacklist-doc_type = 'TXT'.
itpacklist-doc_type = 'XLS'.
append itpacklist.
*Create attachment notification.
itpacklist-transf_bin = 'X'.
itpacklist-head_start = '1'.
itpacklist-head_num = '1'.
itpacklist-body_start = '1'.
describe table itattachment lines itpacklist-body_num .
itpacklist-doc_type = p_format.
itpacklist-obj_name = p_filename.
itpacklist-obj_descr = p_attdescription.
itpacklist-doc_size = itpacklist-body_num * 255 .
append itpacklist.
*FIll the receivers list.
Clear itreclist. refresh itreclist.
itreclist-receiver = p_email.
itreclist-rec_type = 'U'.
itreclist-com_type = 'INT'.
itreclist-notif_del = 'X'.
itreclist-notif_ndel = 'X'.
*itreclist-notif_read = 'X'.
append itreclist.
*CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = xdocdata
PUT_IN_OUTBOX = 'X'
commit_work = 'X'
SENDER_ADDRESS = SY-UNAME
tables
packing_list = itpacklist
CONTENTS_BIN = itattachment
CONTENTS_TXT = itmessage
receivers = itreclist
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = xdocdata
PUT_IN_OUTBOX = 'X'
TABLES
packing_list = itpacklist
CONTENTS_BIN = itattachment
CONTENTS_TXT = itmessage
receivers = itreclist
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " send_mail_as_xls_attachment
Just execute the above code and let me know.
What is the sap version u r using .
Vijay -
Sending mail with excel attachment-improper format
Dear experts,
I am sending a mail to outlook with an excel attachment. The mail is sent with attachment and the data, but all in one cell.
I am using SO_NEW_DOCUMENT_ATT_SEND_API1. What parameters do i need to manipulate to have data in different columns of excel? I am using "packing_list" table of FM. But dont know the exact parameters to be passed. Can anyone help with the same please?
Best regards and thanks!
Sumit Nene.Hello Sumit,
I am using same function module to send mail with excel attachment.
Below I am attaching my own code for your reference.
Data which u want to add in excel file is maintain in IT_OBJBIN i.e. document information.
CLEAR :IMESSAGE,IT_OBJBIN,IT_OBJPACK,IT_RECLIST.
REFRESH: IMESSAGE[ ] , IT_OBJBIN[ ] , IT_OBJPACK[ ] , IT_RECLIST[ ].
" populate the text for body of the mail
CLEAR WA_IMESSAGE.
CONCATENATE 'Board : ' P_BOARD ':' 'Please find the excel attached for the list of Material whose routing is created' INTO WA_IMESSAGE-LINE.
APPEND WA_IMESSAGE TO IMESSAGE.
"document information
W_DOC_CHNG-OBJ_NAME = 'Excel'.
IF NOT P_BOARD IS INITIAL.
CONCATENATE 'Board : ' P_BOARD ':' 'List Of Routing Materials' INTO W_DOC_CHNG-OBJ_DESCR.
ELSE.
CONCATENATE 'List Of' ' Routing Materials' INTO W_DOC_CHNG-OBJ_DESCR.
ENDIF.
W_DOC_CHNG-SENSITIVTY = 'F'. " ->Functional object
" displaying material , plant in the excel
CONCATENATE 'BOARD NO : ' P_BOARD INTO WA_OBJBIN.
APPEND WA_OBJBIN TO IT_OBJBIN.
CONCATENATE 'MATERIAL' 'PLANT' 'DESCRIPTION' INTO WA_OBJBIN SEPARATED BY C_TAB.
CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
APPEND WA_OBJBIN TO IT_OBJBIN.
CLEAR : WA_OBJBIN.
LOOP AT IT_DOWNLOAD INTO WA_DOWNLOAD. "It_orders is the internal table to be transferred to excel
CONCATENATE WA_DOWNLOAD-MATNR WA_DOWNLOAD-WERKS WA_DOWNLOAD-DESC INTO WA_OBJBIN SEPARATED BY C_TAB.
CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
APPEND WA_OBJBIN TO IT_OBJBIN.
ENDLOOP.
DESCRIBE TABLE IT_OBJBIN LINES V_LINES_BIN. " no of lines for excel data
" pack the data as RAW
CLEAR WA_IT_OBJPACK-TRANSF_BIN. "Obj. to be transported not in binary form
WA_IT_OBJPACK-HEAD_START = 1. "Start line of object header in transport packet
WA_IT_OBJPACK-HEAD_NUM = 0. "Number of lines of an object header in object packet
WA_IT_OBJPACK-BODY_START = 1. "Start line of object contents in an object packet
WA_IT_OBJPACK-BODY_NUM = MESSAGE_LINES. "Number of lines of the mail body
WA_IT_OBJPACK-DOC_TYPE = 'RAW'.
APPEND WA_IT_OBJPACK TO IT_OBJPACK.
" pack the data as excel
WA_IT_OBJPACK-TRANSF_BIN = 'X'.
WA_IT_OBJPACK-HEAD_START = 1.
WA_IT_OBJPACK-HEAD_NUM = 1.
WA_IT_OBJPACK-BODY_START = 1.
WA_IT_OBJPACK-BODY_NUM = V_LINES_BIN. "no of lines of it_orders to give no of unprocessed orders
WA_IT_OBJPACK-DOC_TYPE = 'XLS'. " -> excel fomat
WA_IT_OBJPACK-OBJ_NAME = 'EXCEL ATTACHMENT'.
" attachment name
IF NOT P_BOARD IS INITIAL.
CONCATENATE P_BOARD '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
ELSE.
CONCATENATE 'LIST' '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
ENDIF.
WA_IT_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
APPEND WA_IT_OBJPACK TO IT_OBJPACK.
" creating email id
DATA: STR1 TYPE STRING,
STR2 TYPE STRING,
STR3 TYPE STRING,
ITAB TYPE TABLE OF STRING.
DATA : WA_I LIKE LINE OF ITAB.
SPLIT P_EMAIL AT ',' INTO: TABLE ITAB.
e-mail receivers.
CLEAR WA_IT_RECLIST.
LOOP AT ITAB INTO WA_I.
WA_IT_RECLIST-RECEIVER = WA_I.
WA_IT_RECLIST-RECEIVER = V_MAILADDR.
WA_IT_RECLIST-EXPRESS = 'X'.
WA_IT_RECLIST-REC_TYPE = 'U'. "-> Internet address
APPEND WA_IT_RECLIST TO IT_RECLIST.
CLEAR WA_IT_RECLIST.
ENDLOOP.
" sending mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
PACKING_LIST = IT_OBJPACK
OBJECT_HEADER =
CONTENTS_BIN = IT_OBJBIN
CONTENTS_TXT = IMESSAGE
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS = IT_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
COMMIT WORK.
IF SY-SUBRC = 0.
MESSAGE I001 WITH 'Routing is Created for Board' P_BOARD 'and Mail send on e-mail id :' P_EMAIL.
ENDIF. -
My question is related to the Sales Data.xlsx template that comes with Excel 2013
IN this workbook is a sheet named Sales Data. It has, 3 shapes. One each for each of the tab sheets in the workbook. When I click on the 'Sales Report' shape it selects the sales report tab. When you do this the shape changes color and the 'Sales Data' shape
also changes color.
However I'm unable to figure out how the colors are changing.
I don't see any macros in the workbook/worksheet. Nor do I see any code for worksheet events. I don't see any modules in VBA either. I think what is happening is that there are 2 shapes. When you click on one, the one shape goes to the background and the
other one comes to the foreground.
I'm no sure how it's doing that.
Can someone look at this template, Sales Data.xlsx that comes with Excel and explain how this functionality works?
Thank You
Keith Aul
Keith AulThe shapes are exactly as I suspected, each of 3 sheets has 3 'navigation' shapes. The shape with the same name as the sheet has no hyperlink and is coloured differently to indicate it refers to the active sheet. The other two have hyperlinks linked to respective
sheets. 3x3 shapes, 9 in total, none of them ever change colour!
It's logical though not necessary to name each shape same as the sheet it links to, but they'd work just as well with their original default names.
For aesthetics, the shapes that refer to own sheet have a horizontal line on top, actually two shapes as a group.
If still confused copy each set of 3 shapes to a 4th sheet, or open two new windows so you can see all three sheets at the same time. -
Working with Excel spreadsheet embedded in access table
Hello!
I have Access DB which contain Excel spreadsheet objects embedded in table. To work with DB I use ADO-Tool based on ActiveX. Data passed to my program from GetRows method as 2D array of variants. As I understand I should convert variant to object refnum and then use this refnum with property and invoke nodes to get data from spreadsheet. How to select data type for VariantToData to work with Excel spreadseet?Hi,
Isn't it the same that using Index Array function? I believe that problem is in conversion of variant to refnum. For example, if I change refnum data type to string in Variant To Data, no error appears, and I've got some text data (see the attachment).
Attachments:
Temp.zip 25 KB -
Hyperion Essbase QAT Menu with Excel 2007
I just upgraded to Hyperion Essbase 11.1.1.3 and I recently upgraded to Excel 2007. Moving to XL2007 made the Essbase add-in two levels deep in the ribbon so I wanted to move this to the Quick Access Toolbar (QAT). I found a great tool to develop QAT menus authored by [url http://www.rondebruin.nl/qat.htm]Ron Debruin.
I took his code and customized it to work with the Hyperion commands. Picture of menu here: http://i.imgur.com/X7zFS.jpg
Everything worked great for a few month for both myself and about 75 coworkers but once we upgraded to Essbase 11.1.1.3 from 7, the menu macros stopped working for almost everyone except for myself and a few others.
I set this macro in the xlstart folders so that it opens with excel. The QAT menu still appears for everyone, but when selecting any of the menu items to run, nothing runs.
Example: When running
Sub MyMacro21()
Call EssMenuVConnect
End Subfrom the custom QAT menu, nothing happens. What should occur is a popup login for Hyperion. I've even tried to run the code outside of the QAT menu and it does not work so this leads me to believe something is wrong with my Hyperion code. Now mind you, this work fine on my machine.
I'm unable to determine the cause for the macro to not work. Any help or troubleshooting pointers would be appreciated.
Here is the code that I'm using.
Thanks in advance for any help.
-Risk
<font color="blue">First Module (Hyperion Code and subs for the QAT menu)</font>
Option Explicit
Option Private Module
Declare Function EssMenuVRetrieve Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVKeepOnly Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVZoomIn Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVZoomOut Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVPivot Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVWizard Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVQueryDesigner Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVFlashBack Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVOptions Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVMemberSelection Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVCurrencyReport Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVCascade Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVRetrieveLock Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVLock Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVUnlock Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVSend Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVCalculation Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVConnect Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVDisconnect Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVDatalessNav Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVLinkedObjects Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVRemoveOnly Lib "ESSEXCLN.XLL" () As Long
Declare Function EssMenuVLaunchTableau Lib "ESSEXCLN.XLL" () As Long
' The following prototype declares the VBA-specific functions
Declare Function EssVGetHctxFromSheet Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant) As Long
Declare Function EssVGetMemberInfo Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal mbrName As Variant, ByVal action As Variant, ByVal aliases As Variant) As Variant
Declare Function EssVFreeMemberInfo Lib "ESSEXCLN.XLL" (ByRef memInfo As Variant) As Long
Declare Function EssVFreeDataPoint Lib "ESSEXCLN.XLL" (ByRef Info As Variant) As Long
' The following constants are suitable as actions
' for the EssVGetMemberInfo function
Const EssChildLevel = 1
Const EssDescendentLevel = 2
Const EssBottomLevel = 3
Const EssSiblingLevel = 4
Const EssSameLevel = 5
Const EssSameGenerationLevel = 6
Const EssCalculationLevel = 7
Const EssParentLevel = 8
Const EssDimensionLevel = 9
' The following prototypes declare the Visual Basic
' Extended Spreadsheet macro-equivalent functions
Declare Function EssVCalculate Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal calcScript As Variant, ByVal synchronous As Variant) As Long
Declare Function EssVCancelCalc Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant) As Long
Declare Function EssVCascade Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal selection As Variant, ByVal path As Variant, ByVal prefix As Variant, ByVal suffix As Variant, ByVal level As Variant, ByVal openFile As Variant, ByVal copyFormats As Variant, ByVal overwrite As Variant, ByVal listFile As Variant) As Long
Declare Function EssVCell Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ParamArray memberList() As Variant) As Variant
Declare Function EssVConnect Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal userName As Variant, ByVal password As Variant, ByVal server As Variant, ByVal application As Variant, ByVal database As Variant) As Long
Declare Function EssVDisconnect Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant) As Long
Declare Function EssVFlashBack Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant) As Long
Declare Function EssVGetCurrency Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant) As Variant
Declare Function EssVGetDataPoint Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal cell As Variant, ByVal range As Variant, ByVal aliases As Variant) As Variant
Declare Function EssVGetGlobalOption Lib "ESSEXCLN.XLL" (ByVal item As Long) As Variant
Declare Function EssVGetSheetOption Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal item As Variant) As Variant
Declare Function EssVKeepOnly Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal selection As Variant) As Long
Declare Function EssVRemoveOnly Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal selection As Variant) As Long
Declare Function EssVPivot Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal startPoint As Variant, ByVal endPoint As Variant) As Long
Declare Function EssVRetrieve Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal lockFlag As Variant) As Long
Declare Function EssVSendData Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant) As Long
Declare Function EssVSetCurrency Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal currencyIdentifier As Variant) As Long
Declare Function EssVSetGlobalOption Lib "ESSEXCLN.XLL" (ByVal item As Long, ByVal globalOption As Variant) As Long
Declare Function EssVSetSheetOption Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal item As Variant, ByVal sheetOption As Variant) As Long
Declare Function EssVUnlock Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant) As Long
Declare Function EssVZoomIn Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal selection As Variant, ByVal level As Variant, ByVal across As Variant) As Long
Declare Function EssVZoomOut Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal selection As Variant) As Long
Declare Function EssVSetMenu Lib "ESSEXCLN.XLL" (ByVal setMenu As Boolean) As Long
Declare Function EssVGetStyle Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal styleType As Variant, ByVal dimName As Variant, ByVal item As Long) As Variant
Declare Function EssVSetStyle Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal styleType As Variant, ByVal dimName As Variant, ByVal item As Long, ByVal newValue As Variant) As Long
Declare Function EssVLoginSetPassword Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal newPassword As Variant, ByVal oldPassword As Variant, ByVal server As Variant, ByVal userName As Variant) As Long
Declare Function EssVSetSKUMouse Lib "ESSEXCLN.XLL" (ByVal fSKUWithMouse As Variant) As Long
Sub MyMacro1()
Call EssMenuVRetrieve
End Sub
Sub MyMacro2()
Call EssMenuVKeepOnly
End Sub
Sub MyMacro3()
Call EssMenuVRemoveOnly
End Sub
Sub MyMacro4()
Call EssMenuVZoomIn
End Sub
Sub MyMacro5()
Call EssMenuVZoomOut
End Sub
Sub MyMacro7()
Call EssMenuVDatalessNav
End Sub
Sub MyMacro9()
Call EssMenuVLinkedObjects
End Sub
Sub MyMacro12()
Call EssMenuVFlashBack
End Sub
Sub MyMacro13()
Call EssMenuVOptions
End Sub
Sub MyMacro14()
Call EssMenuVMemberSelection
End Sub
Sub MyMacro15()
Call EssMenuVCurrencyReport
End Sub
Sub MyMacro17()
Call EssMenuVLock
End Sub
Sub MyMacro18()
Call EssMenuVUnlock
End Sub
Sub MyMacro19()
Call EssMenuVSend
End Sub
Sub MyMacro20()
Call EssMenuVCalculation
End Sub
Sub MyMacro21()
Call EssMenuVConnect
End Sub
Sub MyMacro22()
Call EssMenuVDisconnect
End Sub
Sub MyMacro23()
Call SHRetrieveRetain
End Sub
Sub MyMacro24()
Call WBRetrieveRetain
End Sub
Sub MyMacro25()
Call SHRetrieveSuppress
End Sub
Sub MyMacro26()
Call WBRetrieveSuppress
End Sub<font color="blue">Second Module (this is Ron Debruin's QAT code)</font>
Option Explicit
Option Private Module
'TIP:
'After you click on "Edit Menu" in the menu you can change the button image.
'Right click on the QAT and choose Customize Quick Access Toolbar.
'In the “Choose commands from” dropdown choose Macros and in the
'Customize Quick Access Toolbar dropdown choose "For My Add-in.xlam".
'Select the RDBDisplayPopUp macro and press the Modify button to change the icon.
Sub WBCreatePopUp()
Dim MenuSheet As Worksheet
Dim MenuItem As Object
Dim SubMenuItem As CommandBarButton
Dim Row As Integer
Dim MenuLevel, NextLevel, MacroName, Caption, Divider, FaceId
' Location for menu data
Set MenuSheet = ThisWorkbook.Sheets("MenuSheet")
' Make sure the menus aren't duplicated
Call WBRemovePopUp
' Initialize the row counter
Row = 5
' Add the menu, menu items and submenu items using
' data stored on MenuSheet
' First we create a PopUp menu with the name of the value in B2
With application.CommandBars.Add(ThisWorkbook.Sheets("MenuSheet"). _
range("B2").Value, msoBarPopup, False, True)
Do Until IsEmpty(MenuSheet.Cells(Row, 1))
With MenuSheet
MenuLevel = .Cells(Row, 1)
Caption = .Cells(Row, 2)
MacroName = .Cells(Row, 3)
Divider = .Cells(Row, 4)
FaceId = .Cells(Row, 5)
NextLevel = .Cells(Row + 1, 1)
End With
Select Case MenuLevel
Case 2 ' A Menu Item
If NextLevel = 3 Then
Set MenuItem = .Controls.Add(Type:=msoControlPopup)
Else
Set MenuItem = .Controls.Add(Type:=msoControlButton)
MenuItem.OnAction = ThisWorkbook.Name & "!" & MacroName
End If
MenuItem.Caption = Caption
If FaceId <> "" Then MenuItem.FaceId = FaceId
If Divider Then MenuItem.BeginGroup = True
Case 3 ' A SubMenu Item
Set SubMenuItem = MenuItem.Controls.Add(Type:=msoControlButton)
SubMenuItem.Caption = Caption
SubMenuItem.OnAction = ThisWorkbook.Name & "!" & MacroName
If FaceId <> "" Then SubMenuItem.FaceId = FaceId
If Divider Then SubMenuItem.BeginGroup = True
End Select
Row = Row + 1
Loop
End With
End Sub
Sub RDBDisplayPopUp()
On Error Resume Next
application.CommandBars(ThisWorkbook.Sheets("MenuSheet").range("B2").Value).ShowPopup
On Error GoTo 0
End Sub
Sub EditMenu()
ThisWorkbook.IsAddin = False
End Sub
Sub WBRemovePopUp()
On Error Resume Next
application.CommandBars(ThisWorkbook.Sheets("MenuSheet").range("B2").Value).Delete
On Error GoTo 0
End Sub<font color="blue">Third Module (some custom Essbase comands to toggle between "retain formula options" and "suppress zero options")</font>
Option Explicit
Sub WBRetrieveRetain()
Dim sh As Worksheet, HidShts As New Collection 'to handle hidden sheets
For Each sh In ActiveWorkbook.Worksheets
If Not sh.Visible Then
HidShts.Add sh
sh.Visible = xlSheetVisible
End If
Next sh
For Each sh In Worksheets
Sheets(sh.Name).Activate
'Turn On Retain and Turns off Suppress and double clicks
If EssVGetSheetOption(Empty, 6) = True Or _
EssVGetSheetOption(Empty, 7) = True Then
Call EssVSetSheetOption(Empty, 6, False)
Call EssVSetSheetOption(Empty, 7, False)
End If
If EssVGetGlobalOption(1) = True Or _
EssVGetGlobalOption(2) = True Then
Call EssVSetGlobalOption(1, False)
Call EssVSetGlobalOption(2, False)
End If
Call EssVSetSheetOption(Empty, 11, True)
Call EssVSetSheetOption(Empty, 21, True)
Call EssVSetSheetOption(Empty, 22, True)
Next
For Each sh In HidShts
sh.Visible = xlSheetHidden
Next sh
End Sub
Sub SHRetrieveRetain()
'Turn On Retain and Turns off Suppress and double clicks
If EssVGetSheetOption(Empty, 6) = True Or _
EssVGetSheetOption(Empty, 7) = True Then
Call EssVSetSheetOption(Empty, 6, False)
Call EssVSetSheetOption(Empty, 7, False)
End If
If EssVGetGlobalOption(1) = True Or _
EssVGetGlobalOption(2) = True Then
Call EssVSetGlobalOption(1, False)
Call EssVSetGlobalOption(2, False)
End If
Call EssVSetSheetOption(Empty, 11, True)
Call EssVSetSheetOption(Empty, 21, True)
Call EssVSetSheetOption(Empty, 22, True)
End Sub
Sub SHRetrieveSuppress()
'Turn Off Retain and Turns on Suppress
If EssVGetSheetOption(Empty, 11) = True Or _
EssVGetSheetOption(Empty, 21) = True Or _
EssVGetSheetOption(Empty, 22) = True Then
Call EssVSetSheetOption(Empty, 11, False)
Call EssVSetSheetOption(Empty, 21, False)
Call EssVSetSheetOption(Empty, 22, False)
End If
Call EssVSetSheetOption(Empty, 6, True)
Call EssVSetSheetOption(Empty, 7, True)
End Sub
Sub WBRetrieveSuppress()
Dim sh As Worksheet, HidShts As New Collection 'to handle hidden sheets
For Each sh In ActiveWorkbook.Worksheets
If Not sh.Visible Then
HidShts.Add sh
sh.Visible = xlSheetVisible
End If
Next sh
For Each sh In Worksheets
Sheets(sh.Name).Activate
'Turn Off Retain and Turns on Suppress
If EssVGetSheetOption(Empty, 11) = True Or _
EssVGetSheetOption(Empty, 21) = True Or _
EssVGetSheetOption(Empty, 22) = True Then
Call EssVSetSheetOption(Empty, 11, False)
Call EssVSetSheetOption(Empty, 21, False)
Call EssVSetSheetOption(Empty, 22, False)
End If
Call EssVSetSheetOption(Empty, 6, True)
Call EssVSetSheetOption(Empty, 7, True)
Next
For Each sh In HidShts
sh.Visible = xlSheetHidden
Next sh
End Sub<font color="blue">Excel Object Code</font>
Option Explicit
Private Sub CommandButton1_Click()
Call WBCreatePopUp
MsgBox "Click on the button in the QAT to see if your menu is correct.", vbOKOnly, "Favorite Macro Menu"
End Sub
Private Sub CommandButton2_Click()
Call WBCreatePopUp
range("A1").Select
ThisWorkbook.IsAddin = True
ThisWorkbook.Save
End Sub
Private Sub CommandButton3_Click()
ThisWorkbook.IsAddin = True
ThisWorkbook.Saved = True
End Sub
Option Explicit
Private Sub Workbook_Open()
Call WBCreatePopUp
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call WBRemovePopUp
End SubHi Mathieu,
As per support matrix documentation, Essbase 7.1.3 is not supported with Excel 2007.
You may have to upgrade to client version 7.1.6.7 which supports Excel 2007.
Thanks,
Raja
Maybe you are looking for
-
How do i add a voice over to imovie
How do i add a voice over to an imovie project?
-
Every time I try to start my Mac's time Machine receive above message and it seems no possible to reopen/start properly the application. What is error OSS 2?
-
Sufficient stock but MRP create planned order and purchase requisition .
Hi Expert, After MRP run planned order and purchase requisition created . but the problem is for child material sufficient is there but still PR and plnd order is created . MRP type PD, LOT size EX,Strategy group 10, for testing purpose I made safety
-
How many external Firewire drives can I share at once?
I have several external hard drives connected to my server. I appears that I can only share 4 of them at a time. I work in a high volume photography environment and store about 2TB every three months. I need to be able to share multiple external hard
-
Powerbook dead? Sleeping? Playing games with me? Please help!
Please advise me about what to do with my 15" aluminum G4 1.25 GHz Powerbook. Often it won't start at all, and if it does, soon it freezes solid (screen still up, but no response to the trackpad or the keyboard) and I have to force it to quit or remo