Visual basic code for essbase
Hi there
does anyone know what the VB code is for using essbase retrieve in Excel?
I am recording a macro in Excel, but it will not recognize either the retrieve or send functions
thanks
to clarify what John is saying,In excel, if you go to Essbase help, there is a section on the Essbase toolkit. It has examples of all of the Essbase functions. What you want is a menu equivelent function.
In order to get them to work, you have to remember to copy declare statement into the the module(not into the subroutine.
To do a menu retreive what you want is EssMenuVRetrieve
Declare Function EssMenuVRetrieve Lib "ESSEXCLN.XLL"() As Long
Sub MRetrieve()
X=EssMenuVRetrieve()
End Sub
Similar Messages
-
Visual Basic code genration for calling BAPI_SALESORDER_SIMULATE
Hi gurus,
Someone asked me how to generate the visual basic code for calling BAPI_SALESORDER_SIMULATE via RFC. I thought this function was available in SE37 but I can't find it...
Can someone help me ?
Thank you
Jean-Michel** プログラムID       : ZBAPI_SALESORDER_CREATE *
** プログラム名称      : Upload Sales Order Creation *
** 処理概要         : *
** 作成者           : Karthik.P *
** 作成日           : 2006/08/10 *
REPORT ZBAPI_SALESORDER_CREATE LINE-SIZE 132 MESSAGE-ID ZMMBAPI .
Internal table definition *
****<<<<<Communication Fields: Sales and Distribution Document Header>>>>>>>>
DATA: GT_ORDER_HEADER_IN LIKE BAPISDHD1,
*******<<<Checkbox Fields for Sales and Distribution Document Header>>>>>>>>>
GT_ORDER_HEADER_INX LIKE BAPISDHD1X,
*****<<<<<Return Parameter>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GT_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE, " Return Messages
*********<<<Communication Fields: Sales and Distribution Document Item<>>>>>
GT_ORDER_ITEMS_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE, " Item Data
*********<<<Communication Fields: Sales and Distribution Document Item>>>>>>>
GT_ORDER_ITEMS_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE, "Item Data Checkbox
*********<<<Communication Fields: Sales and Distribution Document Item>>>>>>>
GT_SALESDOCUMENT LIKE BAPIVBELN-VBELN , "Number of Generated Document
*********<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
GT_ORDER_PARTNERS LIKE BAPIPARNR OCCURS 0 WITH HEADER LINE, "Document Partner
********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
GT_ORDER_SCHEDULES_IN LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE, "Schedule Line Data
****<<<<<<<<Checkbox List for Maintaining Sales Document Schedule Line>>>>>>>>
GT_ORDER_SCHEDULES_INX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE, " Checkbox Schedule Line Data
*******Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_IN LIKE BAPICOND OCCURS 0 WITH HEADER LINE,
******Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_INX LIKE BAPICONDX OCCURS 0 WITH HEADER LINE.
Data definition *
DATA: BEGIN OF GT_FT_SALES OCCURS 0,
DOC_TYPE(4) , "Sales Document Type
SALES_ORG(4) , "Sales Organization
DISTR_CHAN(2) , "Distribution Channel
DIVISION(2) , "DIVISION(2)
SALES_DIST(6) , "Sales district
INCOTERMS1(3) , "Incoterms (part 1)
INCOTERMS2(28) , "Incoterms (part 2)
PMNTTRMS(4) , "Terms of payment key
PRICE_DATE(8) , "Date for pricing and exchange rate
PURCH_NO_C(35) , "Customer purchase order number
PURCH_NO_S(35) , "Ship-to Party's Purchase Order Number
EXCHG_RATE(8) , "Directly quoted exchange rate for pricing and statistics
CURRENCY(5) , "SD document currency
MATERIAL(18), "MATERIAL
TARGET_QTY(13) , "Target quantity in sales units
ITEM_CATEG(4) , "Sales document item category
MATL_GROUP(8) , "Material Group
PURCH_NO_C1(35), "Customer purchase order number
SALES_DIST1(6) , "Sales district
INCOTERMS11(3) , "Incoterms (part 1)
INCOTERMS21(28), "Incoterms (part 2)
PMNTTRMS1(4) , "Terms of payment key
EXCHG_RATE1(8) , "Directly quoted exchange rate for pricing and statistics
PRICE_DATE1(8) , "Date for pricing and exchange rate
TRG_QTY_NO(5) , "Factor for converting sales units to base units (target qty)
DIVISION1(2) , "DIVISION1
SALQTYNUM(5) , "Numerator (factor) for conversion of sales quantity into SKU
GROSS_WGHT(3) , "Gross Weight of the Item
NET_WEIGHT(15) , "Net Weight of the Item
UNTOF_WGHT(3) ,"Weight Unit
PARTN_ROLE(2) ,"Partner function
PARTN_NUMB(10) ,"Customer Number 1
********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
ITM_NUMBER(6) ,"Item number of the SD document
REQ_QTY(8) , "Schedule line date
DLV_DATE(8) , "Schedule line date
MS_DATE(8) , "Material availability date
LOAD_DATE(8) , "Loading time (local time with reference to a shipping point)
GI_DATE(8), "Time of goods issue (local DATE, with reference to a plant)
TP_DATE(8) , "Transportation planning -time (local w/ref. to shipping pnt)
ITM_NUMBER2(6) , "Condition item number
END OF GT_FT_SALES,
MSG(240) TYPE C, " Return Message
E_REC(8) TYPE C, " Error Records Counter
REC_NO(8) TYPE C, " Records Number Indicator
S_REC(8) TYPE C, " Successful Records Counter
T_REC(8) TYPE C. " Total Records Counter
selection block for EXCEL UPLOAD FILE>>>>>>>>>>>>>>>>>>>>>>>>
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
PARAMETERS FILE TYPE IBIPPARMS-PATH OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
*<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .>>>>>>>>>>>>
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = FILE.
**<<<<<<<<<<<<<<<<<START-OF-SELECTION.>>>>>>>>>>>>>>>>>>>>>>>>>>>
START-OF-SELECTION.
CALL FUNCTION 'WS_UPLOAD' "#EC *
EXPORTING
FILENAME = FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = GT_FT_SALES
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11.
IF SY-SUBRC <> 0 .
MESSAGE E000.
ENDIF.
SKIP 3.
FORMAT COLOR COL_HEADING INVERSE ON.
WRITE 40 TEXT-001.
FORMAT COLOR COL_HEADING INVERSE OFF.
SKIP 1.
FORMAT COLOR COL_NEGATIVE INVERSE ON.
WRITE :/ TEXT-002, 13 SY-MANDT , 104 TEXT-003, 111 SY-UNAME,
/ TEXT-004, 13 SY-DATUM , 104 TEXT-005, 111 SY-UZEIT.
FORMAT COLOR COL_NEGATIVE INVERSE OFF.
SKIP 3.
LOOP AT GT_FT_SALES.
PERFORM SLALE_UPLOAD_DATA.
ENDLOOP.
T_REC = E_REC + S_REC.
SKIP 3.
FORMAT COLOR COL_TOTAL INVERSE ON.
WRITE: /38 TEXT-007, T_REC.
FORMAT COLOR COL_TOTAL INVERSE OFF.
FORMAT COLOR COL_NEGATIVE INVERSE ON.
WRITE: /38 TEXT-008, E_REC.
FORMAT COLOR COL_NEGATIVE INVERSE OFF.
FORMAT COLOR COL_TOTAL INVERSE ON.
WRITE: /38 TEXT-009, S_REC.
FORMAT COLOR COL_TOTAL INVERSE OFF.
*& Form SLALE_UPLOAD_DATA
text
--> p1 text
<-- p2 text
FORM SLALE_UPLOAD_DATA .
*******<<<<<<<<<<Communication Fields: Sales and Distribution Document Header>>>>>>
GT_ORDER_HEADER_IN-DOC_TYPE = 'TA'.
GT_ORDER_HEADER_IN-SALES_ORG = GT_FT_SALES-SALES_ORG . "'0001'
GT_ORDER_HEADER_IN-DISTR_CHAN = GT_FT_SALES-DISTR_CHAN. "'01'
GT_ORDER_HEADER_IN-DIVISION = GT_FT_SALES-DIVISION. " '01'
GT_ORDER_HEADER_IN-SALES_DIST = GT_FT_SALES-SALES_DIST ."'000001'
GT_ORDER_HEADER_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1. "'CFR'
GT_ORDER_HEADER_IN-INCOTERMS2 = GT_FT_SALES-INCOTERMS2 . "'HAMBURG'
GT_ORDER_HEADER_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS . "'0001'
GT_ORDER_HEADER_IN-PRICE_DATE = GT_FT_SALES-PRICE_DATE ."'20060818'
GT_ORDER_HEADER_IN-PURCH_NO_C = '32'.
GT_ORDER_HEADER_IN-PURCH_NO_S = '32'.
GT_ORDER_HEADER_IN-EXCHG_RATE = GT_FT_SALES-EXCHG_RATE ."'1.00000'
GT_ORDER_HEADER_IN-CURRENCY = GT_FT_SALES-CURRENCY . " 'EUR'
********<<<Checkbox Fields for Sales and Distribution Document Header>>>>>>>>>
GT_ORDER_HEADER_INX-DOC_TYPE = 'X'.
GT_ORDER_HEADER_INX-SALES_ORG = 'X'.
GT_ORDER_HEADER_INX-DISTR_CHAN = 'X'.
GT_ORDER_HEADER_INX-DIVISION = 'X'.
GT_ORDER_HEADER_INX-SALES_DIST = 'X'.
GT_ORDER_HEADER_INX-INCOTERMS1 = 'X'.
GT_ORDER_HEADER_INX-INCOTERMS2 = 'X'.
GT_ORDER_HEADER_INX-PMNTTRMS = 'X'.
GT_ORDER_HEADER_INX-PRICE_DATE = 'X'.
GT_ORDER_HEADER_INX-PURCH_NO_C = 'X'.
GT_ORDER_HEADER_INX-PURCH_NO_S = 'X'.
GT_ORDER_HEADER_INX-EXCHG_RATE = 'X'.
GT_ORDER_HEADER_INX-CURRENCY = 'X'.
*****<<<<<<Communication Fields: Sales and Distribution Document Item>>>
GT_ORDER_ITEMS_IN-ITM_NUMBER = '000010'.
GT_ORDER_ITEMS_IN-MATERIAL = GT_FT_SALES-MATERIAL .
GT_ORDER_ITEMS_IN-PO_ITM_NO = '32'.
GT_ORDER_ITEMS_IN-CUST_MAT22 = 'AGNI-IV'.
GT_ORDER_ITEMS_IN-BILL_DATE = '20060808'.
GT_ORDER_ITEMS_IN-PLANT = '0001'.
*GT_ORDER_ITEMS_IN-STORE_LOC = '0001'.
GT_ORDER_ITEMS_IN-TARGET_QTY = GT_FT_SALES-TARGET_QTY . "'1000'
GT_ORDER_ITEMS_IN-ITEM_CATEG = GT_FT_SALES-ITEM_CATEG . "'TAN'
GT_ORDER_ITEMS_IN-MATL_GROUP = GT_FT_SALES-MATL_GROUP . "'01'
GT_ORDER_ITEMS_IN-PURCH_NO_C = GT_FT_SALES-PURCH_NO_C . "'32'
GT_ORDER_ITEMS_IN-SALES_DIST = GT_FT_SALES-SALES_DIST . "'000001'
GT_ORDER_ITEMS_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1 . "'CFR'
GT_ORDER_ITEMS_IN-INCOTERMS2 = GT_FT_SALES-INCOTERMS2 . "'HAMBURG'
GT_ORDER_ITEMS_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS . "'0001'.
GT_ORDER_ITEMS_IN-EXCHG_RATE = GT_FT_SALES-EXCHG_RATE . "'1.00000'
GT_ORDER_ITEMS_IN-PRICE_DATE = GT_FT_SALES-PRICE_DATE . "'20060808'
*GT_ORDER_ITEMS_IN-SALES_UNIT = 'DZ'.
GT_ORDER_ITEMS_IN-TRG_QTY_NO = GT_FT_SALES-TRG_QTY_NO . "'23'
GT_ORDER_ITEMS_IN-DIVISION = GT_FT_SALES-DIVISION . "'01'
GT_ORDER_ITEMS_IN-SALQTYNUM = GT_FT_SALES-SALQTYNUM . "'32'
GT_ORDER_ITEMS_IN-GROSS_WGHT = GT_FT_SALES-GROSS_WGHT. " ' 25272000'
GT_ORDER_ITEMS_IN-NET_WEIGHT = GT_FT_SALES-NET_WEIGHT. "'24464000'
GT_ORDER_ITEMS_IN-UNTOF_WGHT = GT_FT_SALES-UNTOF_WGHT . " 'KG'
*GT_ORDER_ITEMS_IN-CURRENCY = 'EUR'.
APPEND GT_ORDER_ITEMS_IN.
****<<<<<<Communication Fields: Sales and Distribution Document Item>>>
GT_ORDER_ITEMS_INX-ITM_NUMBER = '000010'.
GT_ORDER_ITEMS_INX-MATERIAL = 'X'.
*GT_ORDER_ITEMS_INX-PO_ITM_NO = 'X'.
GT_ORDER_ITEMS_INX-CUST_MAT22 = 'X'.
GT_ORDER_ITEMS_INX-BILL_DATE = 'X'.
GT_ORDER_ITEMS_INX-PLANT = 'X'.
*GT_ORDER_ITEMS_INX-STORE_LOC = 'X'.
GT_ORDER_ITEMS_INX-TARGET_QTY = 'X'.
GT_ORDER_ITEMS_INX-ITEM_CATEG = 'X'.
GT_ORDER_ITEMS_INX-MATL_GROUP = 'X'.
GT_ORDER_ITEMS_INX-PURCH_NO_C = 'X'.
GT_ORDER_ITEMS_INX-SALES_DIST = 'X'.
GT_ORDER_ITEMS_INX-INCOTERMS1 = 'X'.
GT_ORDER_ITEMS_INX-INCOTERMS2 = 'X'.
GT_ORDER_ITEMS_INX-PMNTTRMS = 'X'.
GT_ORDER_ITEMS_INX-EXCHG_RATE = 'X'.
GT_ORDER_ITEMS_INX-PRICE_DATE = 'X'.
*GT_ORDER_ITEMS_INX-SALES_UNIT = 'X'.
GT_ORDER_ITEMS_INX-TRG_QTY_NO = 'X'.
GT_ORDER_ITEMS_INX-DIVISION = 'X'.
GT_ORDER_ITEMS_INX-SALQTYNUM = 'X'.
GT_ORDER_ITEMS_INX-GROSS_WGHT = 'X'.
GT_ORDER_ITEMS_INX-NET_WEIGHT = 'X'.
GT_ORDER_ITEMS_INX-UNTOF_WGHT = 'X'.
*GT_ORDER_ITEMS_IN-CURRENCY = 'x'.
APPEND GT_ORDER_ITEMS_INX.
*****<<<<<<Communications Fields: SD Document Partner: WWW
GT_ORDER_PARTNERS-PARTN_ROLE = 'WE'.
GT_ORDER_PARTNERS-PARTN_NUMB = '0000000057'.
***GT_ORDER_PARTNERS-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER . " '000010'.
APPEND GT_ORDER_PARTNERS.
*********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
GT_ORDER_SCHEDULES_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER." '000010'
GT_ORDER_SCHEDULES_IN-REQ_QTY = GT_FT_SALES-REQ_QTY . "'234'
GT_ORDER_SCHEDULES_IN-DLV_DATE = GT_FT_SALES-DLV_DATE ." '20060824'.
GT_ORDER_SCHEDULES_IN-MS_DATE = GT_FT_SALES-MS_DATE . "'20060808'
GT_ORDER_SCHEDULES_IN-LOAD_DATE = GT_FT_SALES-LOAD_DATE. " '20060822'
GT_ORDER_SCHEDULES_IN-GI_DATE = GT_FT_SALES-GI_DATE . " '20060823'
GT_ORDER_SCHEDULES_IN-TP_DATE = GT_FT_SALES-TP_DATE . "'20060821'
APPEND gt_ORDER_SCHEDULES_IN.
*********<<<<Communications Fields: SD Document Partner: WWW FLAG>>>>>>>>>>>>>>>>>>
GT_ORDER_SCHEDULES_INX-ITM_NUMBER = '000010'.
GT_ORDER_SCHEDULES_INX-REQ_QTY = 'X'.
GT_ORDER_SCHEDULES_INX-DLV_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-MS_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-LOAD_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-GI_DATE = 'X'.
GT_ORDER_SCHEDULES_INX-DLV_DATE = 'X'.
APPEND gt_ORDER_SCHEDULES_INX.
********Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER ." '000010'
APPEND GT_ORDER_CONDITIONS_IN.
***Communication Fields for Maintaining Conditions in the Order
GT_ORDER_CONDITIONS_INX-ITM_NUMBER = '000010'.
APPEND GT_ORDER_CONDITIONS_INX.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
ORDER_HEADER_IN = GT_ORDER_HEADER_IN
ORDER_HEADER_INX = GT_ORDER_HEADER_INX
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = GT_SALESDOCUMENT
TABLES
RETURN = GT_RETURN
ORDER_ITEMS_IN = GT_ORDER_ITEMS_IN
ORDER_ITEMS_INX = GT_ORDER_ITEMS_INX
ORDER_PARTNERS = GT_ORDER_PARTNERS
ORDER_SCHEDULES_IN = GT_ORDER_SCHEDULES_IN
ORDER_SCHEDULES_INX = GT_ORDER_SCHEDULES_INX
ORDER_CONDITIONS_IN = GT_ORDER_CONDITIONS_IN
ORDER_CONDITIONS_INX = GT_ORDER_CONDITIONS_INX
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
IF GT_RETURN-TYPE EQ 'E' .
E_REC = E_REC + 1.
READ TABLE GT_RETURN WITH KEY ID = 'V1'.
FORMAT COLOR COL_NEGATIVE INVERSE ON.
REC_NO = E_REC + S_REC.
CONCATENATE TEXT-006 REC_NO ':'
GT_RETURN-MESSAGE INTO MSG SEPARATED BY SPACE .
CONDENSE MSG.
WRITE: / MSG.
FORMAT COLOR COL_NEGATIVE INVERSE OFF.
ELSEIF GT_RETURN-TYPE EQ 'S'.
S_REC = S_REC + 1.
FORMAT COLOR COL_POSITIVE INVERSE ON.
MSG = GT_RETURN-MESSAGE.
CONDENSE MSG.
WRITE: / MSG .
FORMAT COLOR COL_POSITIVE INVERSE OFF.
PERFORM COMMIT_MM.
ENDIF.
CLEAR: GT_RETURN[], MSG.
ENDFORM. " SLALE_UPLOAD_DATA
*& Form COMMIT_MM
text
--> p1 text
<-- p2 text
FORM COMMIT_MM .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = GT_RETURN.
clear: GT_ORDER_ITEMS_IN[],GT_ORDER_CONDITIONS_IN[].
ENDFORM. " COMMIT_MM -
Request for some Visual Basic code?
Hello not sure if I'm posting in the correct area but I have a request for some Visual Basic Code.
I use a particular document in word quite often to fill out forms for my job. However I would like something that allows me to open a new instance of the same document while closing the current AFTER I print it without any extra mouse clicks, or if after
I print the document the forms are cleared and I can start over.
P.S. I would take the time to learn how to do it myself but I currently reside in South Korea and work for the USAF so I don't have much time.Hi,
I suggest you post the request to Word for Developers forum since it needs support for coding:
http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=worddev
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Melon Chen
TechNet Community Support -
I want to know how to set the password encrytacion a database. Accdb from Visual Basic 2010 for a report. Rpl
You have to connect via ODBC, then use code along the lines of what is described here:
http://scn.sap.com/thread/3526924
by me on March 28 and Jan on March 29.
Also see KBA: 1686419 - SAP Crystal Reports designer does not recognize Access *.accdb file
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter -
Can a CIN be written for Visual Basic code
I've read about C code and CIN usage and seen references to other
languages such as Visual Basic (Visual Studio- don't have NET yet).
Is the only way to create a dll?Don't confuse a CIN (Code Interface Node) with the Call Library Function Node in which you interface to a dll. A CIN is a c language function only. The Call Library Function Node can be used for any dll in which the parameters and calling conventions are something LabVIEW can handle. You can create these dll's which c, C++, VB, Delphi, etc. The pdf document "Using External Code in LabVIEW" that is part of the shipping documentation explains the differences between the two. You can also find app notes and example code here that might help.
-
Hello!
I want to use visual basic to build a htm which can control labview throght datasocket, i set the switch
as " Swithc until release " in visual basic, the code is
Private Sub CWButton1_Click()
CWDataSocket1.Data = CWButton1.Value
End Sub
but the led of labview can't light on.
is the code problem?
thanks!The problem is most likely because you have the code in the Click() event handler. The click event in VB is a left mouse down AND mouse up over the controls. If you are wanting it to send out the value when you press and hold the button down, change the event handler to the ValueChanged event.
Best Regards,
Chris Matthews
National Instruments -
How to Change Crystal Report database name from visual basic code?
Hi all,
I have created a Crystal Report (CR) with .NET VB. I also have developd some UDTs for that pusrpose and everything is OK.
However I cannot use the same CR in another Company which has the same UDTs. I have not found how Connect to Company (in other words change the DB the report reads).
Any Idea?
Thanks,
Vangelis
Edited by: Vangelis Kanellopoulos on Jul 19, 2008 6:07 PM
Edited by: Vangelis Kanellopoulos on Jul 20, 2008 10:27 AM
Edited by: Vangelis Kanellopoulos on Jul 20, 2008 10:28 AMHi Vangelis,
Here's a simple VB class that has functions for setting the login details for the report and passing parameters.
Option Strict Off
Option Explicit On
Public Class CrystalFunctions
Enum ParamType As Integer
Int
Text
End Enum
Public Shared Sub SetCrystalLogin(ByVal sUser As String, ByVal sPassword As String, ByVal sServer As String, ByVal sCompanyDB As String, _
ByRef oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)
Dim oDB As CrystalDecisions.CrystalReports.Engine.Database = oRpt.Database
Dim oTables As CrystalDecisions.CrystalReports.Engine.Tables = oDB.Tables
Dim oLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim oConnectInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo()
oConnectInfo.DatabaseName = sCompanyDB
oConnectInfo.ServerName = sServer
oConnectInfo.UserID = sUser
oConnectInfo.Password = sPassword
' Set the logon credentials for all tables
For Each oTable As CrystalDecisions.CrystalReports.Engine.Table In oTables
oLogonInfo = oTable.LogOnInfo
oLogonInfo.ConnectionInfo = oConnectInfo
oTable.ApplyLogOnInfo(oLogonInfo)
Next
' Check for subreports
Dim oSections As CrystalDecisions.CrystalReports.Engine.Sections
Dim oSection As CrystalDecisions.CrystalReports.Engine.Section
Dim oRptObjs As CrystalDecisions.CrystalReports.Engine.ReportObjects
Dim oRptObj As CrystalDecisions.CrystalReports.Engine.ReportObject
Dim oSubRptObj As CrystalDecisions.CrystalReports.Engine.SubreportObject
Dim oSubRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
oSections = oRpt.ReportDefinition.Sections
For Each oSection In oSections
oRptObjs = oSection.ReportObjects
For Each oRptObj In oRptObjs
If oRptObj.Kind = CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then
' This is a subreport so set the logon credentials for this report's tables
oSubRptObj = CType(oRptObj, CrystalDecisions.CrystalReports.Engine.SubreportObject)
' Open the subreport
oSubRpt = oSubRptObj.OpenSubreport(oSubRptObj.SubreportName)
oDB = oSubRpt.Database
oTables = oDB.Tables
For Each oTable As CrystalDecisions.CrystalReports.Engine.Table In oTables
oLogonInfo = oTable.LogOnInfo
oLogonInfo.ConnectionInfo = oConnectInfo
oTable.ApplyLogOnInfo(oLogonInfo)
Next
End If
Next
Next
End Sub
Public Shared Sub SetCrystalParams(ByVal sFieldName As String, ByVal iDataType As ParamType, ByVal sVal As String, ByRef oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)
Dim oFieldDefs As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
Dim oFieldDef As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
Dim oParamVals As CrystalDecisions.Shared.ParameterValues
Dim oDiscreteVal As CrystalDecisions.Shared.ParameterDiscreteValue
oFieldDefs = oRpt.DataDefinition.ParameterFields
oFieldDef = oFieldDefs(sFieldName)
oParamVals = oFieldDef.CurrentValues
oParamVals.Clear()
oDiscreteVal = New CrystalDecisions.Shared.ParameterDiscreteValue()
Select Case iDataType
Case ParamType.Int
oDiscreteVal.Value = System.Convert.ToInt32(sVal)
Case ParamType.Text
oDiscreteVal.Value = sVal
End Select
oParamVals.Add(oDiscreteVal)
oFieldDef.ApplyCurrentValues(oParamVals)
End Sub
End Class
And here's how you would use them:
' Create an instance of the Crystal report
_rptCrystal = New CrystalDecisions.CrystalReports.Engine.ReportDocument()
_rptCrystal.Load(_oSBO.AddonPath + "\Reports\MyReport.rpt")
' Call SetCrystalLogin to see the logon information for all report tables
CrystalFunctions.SetCrystalLogin(sUser, sPassword, _oSBO.SboCompany.Server, _oSBO.SboCompany.CompanyDB, _rptCrystal)
' Set my report parameter value
CrystalFunctions.SetCrystalParams("MyParam", CrystalFunctions.ParamType.Int, 999, _rptCrystal)
' Print the report straight to the printer
_rptCrystal.PrintToPrinter(1, False, 0, 0)
The other way to approach this solution would be to base your Crystal report on a .NET dataset rather than a database connection. However, as you've already written your report, the code above is going to be simpler to implement.
Kind Regards,
Owen -
I have an ol QBasic code im working with and one of the lines in the code is: public Declare Function Init_DA_Brds% Lib "nidaq32.dll" (BYVAL slot%, SEG brdcode%).....i changed some of the line to be used in VB 6.0....any idea of what the SEG is?
Parameters look like AddressOf = a far pointer to some data/function.
"hcolas" wrote in message
news:[email protected]..
> I have an ol QBasic code im working with and one of the lines in the
> code is: public Declare Function Init_DA_Brds% Lib "nidaq32.dll"
> (BYVAL slot%, SEG brdcode%).....i changed some of the line to be used
> in VB 6.0....any idea of what the SEG is? -
Office for Mac 2011 - Visual Basic
I'm wondering if anyone has suggestions for a good place to get Visual Basic tutorials for Office 2011. I have zero experience in Visual Basic, and limited experience with formulas, tables, lists, and Pivot Tables, so the tutorials should be beginner-friendly.
What I'm looking to use it for is automatically generating spreadsheets with four or five tabs using one outside data feed (.csv uploading) and five or six formulas of my own design.
I've been using lynda.com to learn some technologies and their tutorials are very easy to understand and thorough. Unfortunately, they don't have anything specific about Visual Basic.
Any guidance from the extremely helpful Apple community would be appreciated. Thanks in advance!I was aware of both the help menu and the help forums. I had gone through the tutorial you linked to previously (got there from Excel help) but it had a Word table generation tutorial, so it wasn't exactly what I was looking for.
I recognize the increased effectiveness and decreased clutter of putting questions in the right place, but I wasn't exactly asking a help menu type question. I mentioned a location of tutorials that I'd found helpful for other topics and that many people are familiar with, hoping to find a similarly structured tutorial for this topic.
In my opinion, it's at least equally irrelevant to suggest a location that is not directly related to the question as it is to ask a question about a software made by another company. And way more condescending.
@Dimaxum: I, too, am familiar with this up and coming technology of internet perusal called google. -
Visual Basic RFC SAP no-unicode. Latin2 Caracteres are converted in '#'
Hi,
I are inserting data in Z SAP tables from a Visual Basic Script.
I are doing a RFC call.
The problem is that the data type text aren´t iserting correct when its are Latin2 caracteres.
Example:
Text in Visual Basic: "Prevozni strou0161ki-železniu0161ki"
But when theRFC function inserts the data in SAP, SAP shows "Prevozni stro#ki-#elezni#ki".
Could somebody help me??
thanks in adavanced,
JaviThanks for your answer.
But i din´t solve the problem.
I changed the encoding to UTF-16 and ISO-8859-5 but the caracteres are inserting bad yet :(.
I'm debugging the visual basic code and I can see that the text is correct in Visual Basic, but after it is incorrect in SAP.
Too, I'm inserting the value directly in visual basic sourcecode:
T_BAPI_P.Value(index, "TXZ01") = "Prevozni strou0161ki-železniu0161ki NOVO"
But the result is the same.
SAP shows "Prevozni stro#ki-#elezni#ki NOVO".
I have seen that in the transaction SM59 you can specify if the RFC conexion will be UNICODE.
The SAP system that i am working isn´t unicode, then it can not the tag to especificate this in SM59.
Could it be the problem that the SAP system isn´t unicode??
sorry, for my English's low level.
Thanks in advanaced for all yousr answer!
Javi -
How to compare two PDFs using Visual Basic
Hi,
We have created one Visual Basic exe for comparing two PDFs.We are using AcroExch.App and AcroExch.avDoc
for creating adobe application object. And we are using MenuItemExecute "DigSig:ToolsDiff" for comparing the PDFs. This piece of code is working fine with Adobe 4.0 and it is comparing the PDFs and showing the mismatches.
But the same piece of code is not working with Adobe 8.0 Professional. Is there any similar command to MenuItemExecute "DigSig:ToolsDiff" in Adobe 8.0 to find out the mismatches or any alternate approaches that i can try to make the existing code works properly to see the mismatches between two PDFs.
Thanks in advance,
RajuThe only APIs for comparing PDFs are part of the plugin APIs, and not exposed to COM/IAC. You would need to write a custom plugin that called the APIs directly and then expose your plugin for use via VB.
Leonard -
Labview vs visual basic vs visual C
Hi,
I am hoping to get advice about LabVIEW vs Visual Basic/C for developing education software. I have programmed in LabVIEW for test and measurement applications.
I have also programmed a couple of short programs in C, but have never programmed in Visual C or Visual basic. I want to develop software for educational purposes for
students with special needs such as spelling and reading comprehension programs. These programs would involve a lot of displaying text, graphics and
sounds to the students and measuring student inputs via text or clicks on buttons to determine whether they need additional help from the computer to learn the lessons.
I was was wondering if anyone has the knowledge to advise using LabVIEW vs Visual C vs Visual Basicfor such programming tasks?
I am guessing that Visual C and Visual Basic may have more flexibility in displaying text, graphics, sounds etc. since this is mostly what they used for. On the other hand,
I am famliar with the ease of coding in LabVIEW for test/measurement applications but wondering if there might be limitations or difficulties in programming with LabVIEW
for a more general purpose windows application such as the education software I am planning. I would have to learn Visual C or Visual Basic, but if those environments
would be easier or better in the long run, then I will be better starting off with one of them then getting down the road with labVIEW and changing directions. Any advice will
be welcomed. Thanks!
Dave AdamsHi Adam,
I suspect I will get a lot of crap from the LabVIEW community here for saying this, but if you have the time to learn VB .NET, I think you will find that it makes things much easier in the long run for applications that involve a lot of user interface design. In my experience, I have found that there is little that cannot be done in LabVIEW - it is more a matter of elegance. Software like you are describing is best implemented using an event-driven approach. VB .NET (as well as the older versions of VB, and C#) make this type of design pattern extremely easy to implement. With the .NET framework libraries available to you, virtually any type of user interface control that you would need is available to use and the documentation provided on MSDN blows LabVIEW documentation out of the water.
One caveat: if you expect to be running this software on other platforms other than Windows, .NET may not be the right choice. (There are .NET runtimes available on some other platforms (like Mono for Linux), but you would wind up needing to modify a lot of the user-interface code and a lot of the framework features in general are in beta.)
Also, the express version of Visual Studio is free and there are really no limitations to the express edition that would matter for writing a simple Windows application like you are describing. Note that a fairly convincing argument can be made for why Visual Studio is THE best IDE on the market right now.
On the other hand, using a tool you are familiar with has its benefits. Nevertheless, I have never met a software engineer that could not learn VB .NET, who could somehow still write decent LabVIEW code. LabVIEW is easier to use only for people without a software background - and those are the same people who really shouldn't be writing software (as evidenced by the hundreds of pitiful LabVIEW VIs that I'm exposed to on a daily basis).
Anyway, I hope this helps,
Rob -
How do I get visual basic 2010 on my macbook pro?
How do I get visual basic 2010 on my macbook pro?
The Mac version is called Real Studio
That is not the same as Visual Basic. It is similar, but not the same. Unless something has changed in the last few years, it will not execute or create Visual Basic code. That may or may not be important to the OP, depending on whether he actually needs VB or just a product that is similar, but is an important point he needs to be aware of. -
ActiveX privileges different in Labview than Visual Basic
Trying to make some ActiveX calls to a 3rd party app with LV 7.1. I am able to access many methods and properties, but one of the methods I call gives me a "insufficient user privileges" error from the app. Realizing y'all know nothing about what causes that error in the app, my question really is "If I write the exact same set of calls in Visual Basic, I don't get the error, why not?" What does LV do differently at that level? I have looked at the Dcom configuration manager and have set security to none on all apps, but again, since VB has no problem, it is unlikely that it would help, and sure enough, it did not. You may say, "ask the developers ", but none of then know how LV implements it's ActiveX so they say it is Labview's fault and of course NI will say it's an incomplete implementation of ActiveX. Any ideas?
thanksHi ET,
The behavior of your LabVIEW application is quite interesting since any
true copy of the ActiveX script from another programming language into
LabVIEW has always given the same results as with the text based
program. However, one thing that could be the difference it the
conversion of data types, especially when the Variant data type is
involved. To further troubleshoot what is going on, please submit a
simple example that shows the issue. I would prefer if you could submit
the Visual Basic code and the equivalent LabVIEW VI, thanks.
- Philip Courtois, Thinkbot Solutions -
Problems with visual basic and acrobat X
Hello,
In visual basic (excel), I had written a program in visual basic (excel) to open a pdf file on the local server.
Before I updated to acrobat pro X, I had acrobat pro 8 on my pc.
With the 8 I didn't had any problems to open the pdf-file.
Now with the X version, it only opens the start window of acrobat x pro.
Did they changed something in Xversion?
Does anyone has an idea to solve this problem?
Below you can find my visual basic code.
Thanks in advanced !!
Sylvie
Code:
Sub OpenPDF(bestand As String)
Dim retval
Dim sAdobeReader As String
sAdobeReader = Chr(34) & "C:\Program Files\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe" & Chr(34)
'sAdobeReader = "C:\Program Files\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe"
retval = Shell(sAdobeReader & Chr(34) & bestand & Chr(34), 0)
End Sub
Private Sub SelectedPDF()
OpenPDF ("N:\11276.pdf")
End SubThis is really a user forum, I think you need a developer forum... maybe SDK?
http://forums.adobe.com/community/acrobat
Maybe you are looking for
-
System Preferences quits every time I try to open .mac!!
Every time I click on .mac in System Preferences, the program thinks and then shuts down. I have not successfully entered that menu for many months. Everything else works fine and I just updated my OS. I'm trying to make sure everything is syncing
-
Tag issue when upgrading from PSE 7 to 11
I've upgraded from PSE 7 to 11 and the tags for people, while there, do not appear in the "people" section fo PSE11. Any suggestions on how to get them all to show?
-
Photoshop CC only detects Intel GPU instead of AMD Radeon (Win8)
Hi, I am running a pc with Win 8 and Intel i7-3630QM CPU. On my system I am running 2 Video Cards, both Intel HD Graphics 4000 and AMD Radeon HD 7670M. I set my switchable cards to high performance when using photoshop.exe, but when I check in PS Pre
-
Spotify iOS App for iPhone 4 - So slow!
Hi, I'm running iOS 7.0.4 (latest) with Spotify 0.9.1 (latest)... With the previous 0.8 version the app was working fine but now is terrible.. Clearly they didnt even test it on an iPhone 4 because it wouldn pass any quality test..
-
How to do a reverb effect on vocal recordings ?
Hi all experts, Sorry I am only a beginner, what I did was TRACK > NEW BASIC TRACK. I test & record some vocal. But my voice is horrible. What are the steps to do a reverb effect on the recorded voice ? Thanks