Procedure parameter of type returned by function
Hi there
I want to know if it's possible to pass a parameter to procedure of type returned by function
Something like that
pocedure test(x in varchar2
,y in my_function(param)
)
Definitely don't fullish yourself ;-)
AFAIK you cannot declare a variable based on the return type of a function.
Perhaps though you are looking for SUBTYPEs.
SQL> SET SERVEROUTPUT ON;
SQL> DECLARE
2 SUBTYPE subtype_name IS VARCHAR2 (30) NOT NULL;
3
4 PROCEDURE procedure_name (
5 parameter_name IN subtype_name)
6 IS
7 BEGIN
8 DBMS_OUTPUT.PUT_LINE (parameter_name);
9 END;
10
11 FUNCTION function_name (
12 parameter_name IN DATE)
13 RETURN subtype_name
14 IS
15 BEGIN
16 RETURN TO_CHAR (parameter_name, 'DAY');
17 END;
18
19 BEGIN
20 procedure_name (function_name (SYSDATE));
21 END;
22 /
THURSDAY
PL/SQL procedure successfully completed.
SQL>
Similar Messages
-
DATE type returned from function does not return the time component
Hi,
I'm dealing with a strange problem. I have a PL/SQL function (running on Oracle 8.1.4.7) which returns a DATE value. Like we all know the DATE datatype includes a date component and a time component.
The function I used for testing is like this:
FUNCTION ReturnDate return Date is
dReturn Date;
Begin
select sysdate into dReturn from dual;
return dReturn;
end ReturnDate;
When I call this function from .NET using ODP.NET the date value I get does not have the time component included only the day-month-year components.
This is a code-snippet that calls the function :
command.CommandText="Schema.ReturnDate";
command.CommandType=CommandType.StoredProcedure;
command.Parameters.Add("Return_Value",
OracleDbType.Date,0,ParameterDirection.ReturnValue);
command.ExecuteNonQuery();
I use the OracleDbType.Date type which I think is the most logical choice, because the type in the Database is after all DATE.
However this does not include the time componet. But if I change the OracleDbType.Date to OracleDbType.TimeStamp I get the time component. I'm not happy with this "hack" because I'm not sure what will happen when we upgrade our version of the Database to Oracle 9i which uses the new TimeStamp datatype.
Is this a bug that the OracleDbType.Date does not include the time component??How do you examine the output Date value?
If it is from the string, then the time components will
not show because the NLS_DATE format in the client
machine does not contain the time components.
In American, the Date format is 'DD-MON-RR' by default whereas, the TimeStamp format is 'DD-MON-RR HH.MI.SSXFF AM' by default.
Can you take a look at the time components from the OracleDate by accessing the time properties, eg. OracleDate.Hour, OracleDate.Minute..etc to see if the time values are there?
Thanks
Martha -
Question on the parameter type of DLL functions
Question on the parameter type of DLL functions
I am trying to develop an interface to control a laser with LV8.2 I am planing to use the VI “Call Library Function Node” to call the DLL and set the exact same parameters of functions in the DLL.
According to the DLL manual of the laser, there are six functions. One of the prototypes is: function getstatuspointer : pointer. I don't know how to set this parameter for the function. Is there anyone who can give some hints? Thanks!
BTW :The following is a description of the function:
This function returns a 32 bit pointer to the STATUS data structure (Tstatusrec). In the 32 bit DLL, every application is using its own copy of the data structure (local
memory). The data structure is a packed structure. "packed" means that the fields in the structure are not aligned on word or double-word boundaries.
Tstatusrec = packed record
size : word;
initstat : byte;
queuefill : byte;
anzapp16 : word; (not used)
anzapp32 : word;
anzdock16 : word; (not used)
anzdock32 : word;
dll16ver : tchararray; (not used)
dll32ver : tchararray;
excimerver : tchararray;
excimer : TExcimerStatus;
end;Hi Jack,
This is a good starting point when using Call Library Function node. Check out this Help Page
Van L
NI Applications Engineer -
Retrieving PL/SQL Table Type returned by stored procedure using Java.
Hi All,
I am facing an issue in a Stored Procedure (SP) which returns Table Type, the PL/SQL complex type.
Below mentioned is how my stored procedure looks like.
CREATE OR REPLACE package sp_test_pkg as
TYPE v_value_table_type is table of SW_VALID_CODE.swValue%Type
index by binary_integer;
v_swRMAStatus v_value_table_type;
procedure sp_test
(locale in int,
name in SW_CODE.swName%Type,
v_value_table out v_value_table_type,
batch_size in int,
out_batch_size in out int,
status out int);
end sp_test_lcode_code_pkg;
My java program to access this stored procedure is as given below:
import java.sql.*;
import oracle.jdbc.driver.*;
public class OracleTest {
public static void main(String args[]) {
Connection con = null;
OracleCallableStatement cstmt = null;
String url = "url";
String userName = "username";
String password = "password";
try
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection(url, userName, password);
cstmt = (OracleCallableStatement)con.prepareCall("begin " +
"sp_test_pkg.sp_test_pkg(?,?,?,?,?,?); end;");
cstmt.setInt(1, 1);
cstmt.setString(2, "Test");
cstmt.registerOutParameter(3, OracleTypes.ARRAY);
cstmt.setInt(4, 10);
cstmt.setInt(5, 1);
cstmt.registerOutParameter(5, Types.INTEGER);
cstmt.registerOutParameter(6, Types.INTEGER);
cstmt.execute();
} catch(Exception ex) {
ex.printStackTrace(System.err);
} finally {
if(cstmt != null) try{cstmt.close();}catch(Exception _ex){}
if(con != null) try{con.close();}catch(Exception _ex){}
When i execute this java program, i get the following error:
java.sql.SQLException: Parameter Type Conflict: sqlType=2003
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:187)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:229)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:245)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:389)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:452)
at OracleTest.main(OracleTest.java:49)
I am not sure where i am going wrong. I have never worked on such complex types before. I want to retrieve the complex table type returned by the stored procedure using my java source code.
Can anyone please help me out in resolving this issue?. This is very urgent.JDBC does not recognise types declared in PL/SQL. This is documented in the Dev Guide. [Find out more|http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraarr.htm#1057625].
The only work around would be to build a wrapper which calls your existing PL/SQL procedures and returns a SQL type instead. Obviously not knowing your precise scenario I have no idea how much work this entails for you. It may be worth building a code generator.
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
Pass TestStand error type directly into function parameter
Hi,
I am using TestStand 4 and Labwindows CVI 8.5.
I wonder if it is possible to pass Standard Step error type into CVI function parameters.
I think it would be more simple to pass one parameter instead of passing Error code, Error occurred state and Error message into function prototype.
I tried to use tsErrorDataType struct defined into tsutil.h into my function prototype.
In TestStand, I pass Step error type into function parameter but it does not work.
TestStand displays an error meaning parameters does not match function prototype.
Thank you for your help.Hi Tartempion,
In order to pass the TestStand Error Container as one parameter to a function in a CVI DLL, you must use a struct that is typedef'ed and create an .fp file that is included as a type library for the DLL. When you create a .fp file to add to a DLL, the DLL will not build unless all structs/enums are typedef'ed. Thus, I wouldn't advise using the tsutil.h because you would have to go through and typedef every single struct and enum in the header file.
Instead, you can simply create a typedef'ed struct in your projects header file and create an .fp file with the struct specified as a data type. Then in TestStand, when you call the function you would need to ensure that the parameter is of Category "C Struct", and type "Error". The attached zip file contains a CVI 8.5 project that demonstrates this along with a TestStand 4.0 sequence file that demonstrates how to pass the parameter to the function by reference. In case you run into trouble creating the .fp file please refer to the following KnowledgeBase. The instructions are for enums but easily correspond to structs as well:
TestStand and LabWindows/CVI Enumeration Data Types
Hope this helps!
Manooch H.
National Instruments
Attachments:
PassTSError.zip 19 KB -
Specify two conditions for button type: pl/sql function body return boolean
Hello,
Can anyone help me out with this issue.
I am using Oracle APEX 3.2 version.
I have page zero select list with submit items P0_ITEM1, P0_ITEM2, P0_ITEM3
and i also have a button on page zero. Now I want to make this button conditional
like only show the button only when all the three items are selected. For this I am having the below condition which is working perfectly fine.
Type: PL/SQL function returning boolean.
RETURN NVL(:P0_ITEM1,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM2,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM3,'%'||'null%') != '%'||'null%' ;Now I want to add one more condition to the button --
the condition is that, the buttton should be displayed only on the pages 1,2,3,4
so can anyone please help me out how do i change the code to include the additional condition.
thanks,
Orton
Edited by: orton607 on Jul 28, 2010 2:02 PMTry:
Type: PL/SQL function returning boolean.
RETURN NVL(:P0_ITEM1,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM2,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM3,'%'||'null%') != '%'||'null%' AND
:app_page_id in (1, 2, 3, 4);http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#sthref156 -
Stored Procedure parameter (@Carrier) used in report and can't be set via code
I have a report that has regular Crystal parameters that I am setting correctly via code. However, one report actually uses one of the database parameters from the stored procedure that the report was created from. It is the only report like this and I'm using the same code in an attempt to set it's value. Although no error is thown, if I look at the parameter value in the IDE it is set correctly, but the field on the report just shows up blank. I have changed the way the report is created. Previously, I used the report.export method to create the actual file via a stored procedure. Now, I'm running the stored procedure first and creating a datatable. This allows me to execute the SP only once to see if it has data, because only then do I want to create the actual report. I'm using the SetDataSource method to pass the datatable into Crystal and then using the report.export method to create the report with data. Everything seems to work, except this stored procedure parameter (@Carrier) is not actually being populated to display on the report.
Not sure what to look at. Any suggestions?
Thanks.crpe32.dll is version 13.0.5.891. This was developed in VS2012 and VB.NET. I'm using ADO.Net to connect to a MS SQL Server database.
MainReport.SetDataSource(DTbl)
bRC = PopulateAllSubReports(MainReport)
If Not bRC Then Throw New Exception("Received an error in PopulateAllSubReports.")
bRC = PopulateCrystalParameters(MainReport, SP)
If Not bRC Then Throw New Exception("Received an error in PopulateCrystalParameters.")
'Actually create the output file.
bRC = ExportData(MainReport)
Private Function PopulateCrystalParameters(myReportDocument As ReportDocument, SP As ReportStoredProcedureCrystal) As Boolean
Dim myParameterFieldDefinitions As ParameterFieldDefinitions = Nothing
Dim myParameterFieldDefinition As ParameterFieldDefinition = Nothing, ParamValue As String = ""
Dim bRC As Boolean, Param As SqlParameter = Nothing
Try
myParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterFields
'*********************Report Parameters***************************
For Each myParameterFieldDefinition In myParameterFieldDefinitions
myParameterFieldDefinition.CurrentValues.Clear()
Select Case myParameterFieldDefinition.ParameterFieldName.Trim.ToUpper
Case "@CARRIER"
If SP.DBParameters.ContainsKey("@CARRIER") Then
Param = SP.DBParameters("@CARRIER")
ParamValue = NullS(Param.Value).Trim
bRC = SetCurrentValueForParameterField(myParameterFieldDefinition, ParamValue)
If Not bRC Then Return False
End If
End Select
Next
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
End Try
End Function
Private Function SetCurrentValueForParameterField(myParameterFieldDefinition As ParameterFieldDefinition, submittedValue As Object) As Boolean
Dim currentParameterValues As ParameterValues = Nothing
Dim myParameterDiscreteValue As ParameterDiscreteValue = Nothing
Try
myParameterDiscreteValue = New ParameterDiscreteValue
myParameterDiscreteValue.Value = NullS(submittedValue).Trim
currentParameterValues = New ParameterValues
currentParameterValues.Add(myParameterDiscreteValue)
myParameterFieldDefinition.ApplyCurrentValues(currentParameterValues)
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
Finally
myParameterDiscreteValue = Nothing
currentParameterValues = Nothing
End Try
End Function
Private Function SetDBSourceForSubReport(mySubReport As ReportDocument) As Boolean
Dim myTables As Tables = Nothing, myTable As Table = Nothing, DTbl As DataTable, SP As StoredProcedure = Nothing
Try
myTables = mySubReport.Database.Tables
For Each myTable In myTables
Dim SPName As String = myTable.Location.Substring(0, myTable.Location.IndexOf(";"c))
SP = New StoredProcedure(ConnectionString, SPName, CommandType.StoredProcedure)
DTbl = SP.FillTable
mySubReport.SetDataSource(DTbl)
SP = Nothing
Next
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
Finally
If Not SP Is Nothing Then SP = Nothing
If Not myTable Is Nothing Then myTable = Nothing
If Not myTables Is Nothing Then myTables = Nothing
End Try
End Function
Private Function PopulateAllSubReports(myReportDocument As ReportDocument) As Boolean
Try
Dim mySections As Sections = myReportDocument.ReportDefinition.Sections
For Each mySection As Section In mySections
Dim myReportObjects As ReportObjects = mySection.ReportObjects
For Each myReportObject As ReportObject In myReportObjects
If myReportObject.Kind = ReportObjectKind.SubreportObject Then
Dim mySubreportObject As SubreportObject = CType(myReportObject, SubreportObject)
Dim subReportDocument As ReportDocument = mySubreportObject.OpenSubreport(mySubreportObject.SubreportName)
Dim bRC = SetDBSourceForSubReport(subReportDocument)
If Not bRC Then Return False
End If
Next
Next
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
End Try
End Function -
Execute oracle stored procedure from C# always returns null
Hi,
I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
Below are the SP, and the code used from .Net to call it, if that can help.
Oracle SP:
CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
v_status VARCHAR2(5) := NULL;
BEGIN
BEGIN
SELECT CHECK_NO_EXISTENCE(to_char(l_number))
INTO v_status
FROM DUAL;
EXCEPTION WHEN OTHERS THEN
v_status := NULL;
END;
DBMS_OUTPUT.PUT_LINE(v_status);
END CHECK_CONTRNO_EXISTENCE;
C# Code:
string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
OracleConnection conn = new OracleConnection(connStr);
OracleParameter param1 = new OracleParameter();
param1.ParameterName = "v_status";
param1.OracleType = OracleType.VarChar;
param1.Size = 5;
param1.Direction = ParameterDirection.Input;
OracleParameter param2 = new OracleParameter();
param2.ParameterName = "l_number";
param2.OracleType = OracleType.Number;
param2.Direction = ParameterDirection.Input;
param2.Value = 006550249;
OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddRange(oraParams);
conn.Open();
object result = cmd.ExecuteScalar();
conn.Close();Hi,
Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
See if this helps.
Cheers,
Greg
create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
is
retval varchar2(50);
begin
myoutvar := myinvar;
retval := 'the return value';
return retval;
end;
using System;
using System.Data;
using Oracle.DataAccess.Client;
public class odpfuncparams
public static void Main()
OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
con.Open();
OracleCommand cmd = new OracleCommand("myfunc", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
retval.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(retval);
OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
inval.Direction = ParameterDirection.Input;
inval.Value="hello world";
cmd.Parameters.Add(inval);
OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
outval.Direction = ParameterDirection.Output;
cmd.Parameters.Add(outval);
cmd.ExecuteNonQuery();
Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
con.Close();
} -
Dynamic parameter with 'type-ahead' capability
Hi,
How do I create a dynamic parameter that will return a drop down list of over 11,000 records in alphabetic order that I can then select the value I want by starting to type in the value. For example, in a list of cities of the world I want to select 'London' so I type in an 'L' and the list moves to the first city starting with an 'L', I then type an 'o' and the list goes to 'Lo' etc.
At the moment only 30 values appear in the drop-down list and I can only enter the first letter.
I want to use this value as the parent for a cascading parameter.
Thanks, ColinThe dynamic parameter does not have the functionality to 'type-ahead' and go to specific values in the list in that manner. The most you can do is go to values that start with a specific letter and scroll through them. This behavior is occurring by design.
By default, Crystal Reports will only return the first 1000 unique values for a dynamic parameter. This can be changed through a registry entry.
For information on changing the values retrieved for the dynamic parameter, you can refer to the following Business Objects Note.
- Go to this link
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_ossnotes&query=&adv=true
- Search for the Note: 1218588
When using a dynamic parameter, the limit will be a combination of all the values return at each level to reach the total number of records returned. Also the more records that you return to the dynamic parameter, the longer it will take to retrieve the data from the database. -
Problem with a procedure with a type table varchar2
Hey,
I can't seem to call my function with a custom type:
The function:
FUNCTION f_get_urls(v_table IN t_table)
RETURN VARCHAR2
IS
v_urls VARCHAR2(600);
BEGIN
FOR i IN 1..v_table.count LOOP
v_urls := CONCAT(v_urls,v_table(i));
END LOOP;
RETURN v_urls;
END f_get_urls;
t_table is declared in the package header:
TYPE t_table is table of VARCHAR2(100) index by binary_integer;
All goes well if i call the fucntion from within the package, but when i call it from an other package I get the next error:
Error(12,11): PLS-00306: wrong number or types of arguments in call to 'F_GET_URLS'
This is the procedure where i'm caling the fucntion:
PROCEDURE temp1
IS
TYPE t_table is table of VARCHAR2(100) index by binary_integer;
v_tab t_table;
v_temp VARCHAR2(100);
BEGIN
v_tab(1):='test';
v_tab(2):='test2';
v_temp:=pkg_print.f_get_urls(v_tab);
dbms_output.PUT_LINE(v_temp);
END temp1;
Any idea if i made an error or is this just not possible?
ThanksHey,
I can't seem to call my function with a custom type:
The function:
FUNCTION f_get_urls(v_table IN t_table)
RETURN VARCHAR2
v_urls VARCHAR2(600);
GIN
FOR i IN 1..v_table.count LOOP
v_urls := CONCAT(v_urls,v_table(i));
D LOOP;
RETURN v_urls;
END f_get_urls;
t_table is declared in the package header:
TYPE t_table is table of VARCHAR2(100) index by
binary_integer;
All goes well if i call the fucntion from within the
package, but when i call it from an other package I
get the next error:
Error(12,11): PLS-00306: wrong number or types of
arguments in call to 'F_GET_URLS'
This is the procedure where i'm caling the fucntion:
PROCEDURE temp1
IS
TYPE t_table is table of VARCHAR2(100) index by---Dont declare new collection
binary_integer;
> v_tab Yourpackagename.collectionname;
v_temp VARCHAR2(100);
EGIN
v_tab(1):='test';
v_tab(2):='test2';
v_temp:=pkg_print.f_get_urls(v_tab);
dbms_output.PUT_LINE(v_temp);
END temp1;
Any idea if i made an error or is this just not
possible?
ThanksTry it
PROCEDURE temp1
IS
-- TYPE t_table is table of VARCHAR2(100) index by---Dont declare new collection
-- binary_integer;
v_tab Yourpackagename.collectionname;
v_temp VARCHAR2(100);
BEGIN
v_tab(1):='test';
v_tab(2):='test2';
v_temp:=pkg_print.f_get_urls(v_tab);
dbms_output.PUT_LINE(v_temp);
END temp1;
colection types are not compatible even you created 2 diffrent types with the exact defination.
Please paste yours full code here....
Khurram
Whats that
v_temp:=pkg_print.f_get_urls(v_tab);
Message was edited by:
Khurram Siddiqui -
WRONG VALUE OF THE parameter file type(bdc-session method)
Hi experts,
when iam uploading vendor details,,,
it is giving above error.
chk the code once.....
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:/VENDOR1.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_UPLOAD.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SRR'
USER = SY-UNAME.Hi here iam sending the whole code once to you. just chk it once and same error(WRONG VALUE OF THE parameter file type) is coming after the changes.
if i use asc it is giving that no file exists.
Table Declaration
tables :rf02k, "Maintain vendor master record screen and work fields
lfa1, "Vendor Master(general)
lfbk, "Vendor Master (Bank Details)
lfb1, "Vendor Master (Company Code)
lfm1, "Vendor master record purchasing organization data
lfb5. "Vendor master (dunning data)
Data Declaration
data : begin of it_UPLOAD occurs 0,
LIFNR like rf02k-lifnr, "vendor no
BUKRS like rf02k-bukrs, "company code
EKorg like rf02k-ekorg, "purchasing org
KTOKK like rf02k-ktokk, "account group
anred like lfa1-anred, "initial
name1 like lfa1-name1, "name of vendor
sortl like lfa1-sortl, "search term
land1 like lfa1-land1, "country
akont like lfb1-akont, "reconcillation a/c.
fdgrv like lfb1-fdgrv, "planning group
zterm like lfb1-zterm, "terms of payment key
mahna like LFB5-MAHNA, "dunning procedure
waers like lfm1-waers, "Purchase order currency
END OF IT_UPLOAD.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
include bdcrecx1.
start-of-selection.
UPLOADING THE DATA TO IT_UPLOAD
call function 'GUI_UPLOAD'
exporting
filename = 'C:\DASRR\VENDOR1.TXT'
filetype = 'DAT'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT_UPLOAD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
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 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:/VENDOR1.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_UPLOAD.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SRR'
USER = SY-UNAME.
POPULATE INTERNAL TABL
LOOP AT IT_UPLOAD.
CLEAR IT_BDCDATA.
REFRESH IT_BDCDATA.
PERFORM POPULATE_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'XK01'
TABLES
DYNPROTAB = IT_BDCDATA.
ENDLOOP.
*& Form POPULATE_DATA
text
--> p1 text
<-- p2 text
FORM POPULATE_DATA .
PERFORM GETDATA USING 'X' 'SAPMF02K' '0100'.
perform getdata using ' ' RF02K-LIFNR 'IT_UPLOAD-LIFNR'.
perform getdata using ' ' RF02K-bukrs 'IT_UPLOAD-bukrs'.
perform getdata using ' ' RF02K-EKORG 'IT_UPLOAD-EKORG'.
perform getdata using ' ' RF02K-KTOKK 'IT_UPLOAD-KTOKK'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0110'.
perform getdata using ' ' LFA1-ANRED 'IT_UPLOAD-ANRED'.
perform getdata using ' ' LFA1-NAME1 'IT_UPLOAD-NAME1'.
perform getdata using ' ' LFA1-SORTL 'IT_UPLOAD-SORTL'.
perform getdata using ' ' LFA1-LAND1 'IT_UPLOAD-LAND1'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0210'.
perform getdata using ' ' LFB1-AKONT 'IT_UPLOAD-AKONT'.
perform getdata using ' ' LFB1-FDGRV 'IT_UPLOAD-FDGRV'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0215'.
perform getdata using ' ' LFB1-ZTERM 'IT_UPLOAD-ZTERM'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0220'.
perform getdata using ' ' LFB5-MAHNA 'IT_UPLOAD-MAHNA'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0310'.
perform getdata using ' ' LFM1-WAERS 'IT_UPLOAD-WAERS'.
ENDFORM. " POPULATE_DATA
*& Form GETDATA
text
-->P_0213 text
-->P_0214 text
-->P_0215 text
FORM GETDATA USING VALUE(P_0213)
VALUE(P_0214)
VALUE(P_0215).
IF P_0213 = 'X'.
IT_BDCDATA-PROGRAM = P_0213.
IT_BDCDATA-DYNPRO = P_0214.
IT_BDCDATA-DYNBEGIN = P_0215.
ELSE.
IT_BDCDATA-FNAM = P_0214.
IT_BDCDATA-FVAL = P_0215.
ENDIF.
****************any error in coding just chk it***************** -
I would like to pass a parameter of type PORTAL30.WWV_UTL_API_TYPES.VC_ARR into a procedure, but am getting an error when the form is trying to compile. I believe it is due to there not being a p_session.get_value_as_PORTAL30.WWV_UTL_API_TYPES.VC_ARR function delared anywhere, but I am not sure what I can do about this.
If anyone can tell me where I need to go from here I would appreciate it. Alternatively, if there is another method to pass up to 32676 characters into a procedure, I would greatly appreciate direction on that as well.
Thank you in advance.Loanshark, this forum is for Oracle Portal caching questions, try posting your question in the APEX forum.
Cheers,
Mick. -
SESSION METHOD( WRONG VALUE OF THE parameter file type)
Hi here iam sending the whole code once to you. just chk it once and same error(WRONG VALUE OF THE parameter file type) is coming after the changes.
if i use asc it is giving that no file exists.
Table Declaration
tables :rf02k, "Maintain vendor master record screen and work fields
lfa1, "Vendor Master(general)
lfbk, "Vendor Master (Bank Details)
lfb1, "Vendor Master (Company Code)
lfm1, "Vendor master record purchasing organization data
lfb5. "Vendor master (dunning data)
Data Declaration
data : begin of it_UPLOAD occurs 0,
LIFNR like rf02k-lifnr, "vendor no
BUKRS like rf02k-bukrs, "company code
EKorg like rf02k-ekorg, "purchasing org
KTOKK like rf02k-ktokk, "account group
anred like lfa1-anred, "initial
name1 like lfa1-name1, "name of vendor
sortl like lfa1-sortl, "search term
land1 like lfa1-land1, "country
akont like lfb1-akont, "reconcillation a/c.
fdgrv like lfb1-fdgrv, "planning group
zterm like lfb1-zterm, "terms of payment key
mahna like LFB5-MAHNA, "dunning procedure
waers like lfm1-waers, "Purchase order currency
END OF IT_UPLOAD.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
include bdcrecx1.
start-of-selection.
UPLOADING THE DATA TO IT_UPLOAD
call function 'GUI_UPLOAD'
exporting
filename = 'C:\DASRR\VENDOR1.TXT'
filetype = 'DAT'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT_UPLOAD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
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 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:/VENDOR1.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_UPLOAD.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SRR'
USER = SY-UNAME.
POPULATE INTERNAL TABL
LOOP AT IT_UPLOAD.
CLEAR IT_BDCDATA.
REFRESH IT_BDCDATA.
PERFORM POPULATE_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'XK01'
TABLES
DYNPROTAB = IT_BDCDATA.
ENDLOOP.
*& Form POPULATE_DATA
text
--> p1 text
<-- p2 text
FORM POPULATE_DATA .
PERFORM GETDATA USING 'X' 'SAPMF02K' '0100'.
perform getdata using ' ' RF02K-LIFNR 'IT_UPLOAD-LIFNR'.
perform getdata using ' ' RF02K-bukrs 'IT_UPLOAD-bukrs'.
perform getdata using ' ' RF02K-EKORG 'IT_UPLOAD-EKORG'.
perform getdata using ' ' RF02K-KTOKK 'IT_UPLOAD-KTOKK'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0110'.
perform getdata using ' ' LFA1-ANRED 'IT_UPLOAD-ANRED'.
perform getdata using ' ' LFA1-NAME1 'IT_UPLOAD-NAME1'.
perform getdata using ' ' LFA1-SORTL 'IT_UPLOAD-SORTL'.
perform getdata using ' ' LFA1-LAND1 'IT_UPLOAD-LAND1'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0210'.
perform getdata using ' ' LFB1-AKONT 'IT_UPLOAD-AKONT'.
perform getdata using ' ' LFB1-FDGRV 'IT_UPLOAD-FDGRV'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0215'.
perform getdata using ' ' LFB1-ZTERM 'IT_UPLOAD-ZTERM'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0220'.
perform getdata using ' ' LFB5-MAHNA 'IT_UPLOAD-MAHNA'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0310'.
perform getdata using ' ' LFM1-WAERS 'IT_UPLOAD-WAERS'.
ENDFORM. " POPULATE_DATA
*& Form GETDATA
text
-->P_0213 text
-->P_0214 text
-->P_0215 text
FORM GETDATA USING VALUE(P_0213)
VALUE(P_0214)
VALUE(P_0215).
IF P_0213 = 'X'.
IT_BDCDATA-PROGRAM = P_0213.
IT_BDCDATA-DYNPRO = P_0214.
IT_BDCDATA-DYNBEGIN = P_0215.
ELSE.
IT_BDCDATA-FNAM = P_0214.
IT_BDCDATA-FVAL = P_0215.
ENDIF.When u use GUI_UPLOAD, U can not assign file type as 'dat'. This must be either ASC or BIN.
Make sure ur flat file path should correct..
This well help u... -
How can I pass an empty array to a parameter of type PLSQLAssociativeArray
How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
Dim myArray() as String = new String() {}
Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
myPara = 0
myPara.Value = myArray
When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
I have tried to give it the DBNull.Value, but it doesn't work either.
Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
Thank you,How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
Dim myArray() as String = new String() {}
Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
myPara = 0
myPara.Value = myArray
When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
I have tried to give it the DBNull.Value, but it doesn't work either.
Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
Thank you, -
Not able to create a parameter of type STRING_TABLE in BOR
Hi All,
I want to send a table of type STRING_TABLE from webdynpro to workflow.
I have created this table of type STRING_TABLE in webdynpro as well as in workflow successfully.
But i am not able to create a parameter of type STRING_TABLE in BOR event as well as method.
It is giving me error as "Data type STRING_TABLE can not be used".
So how can i send my internal table value of STRING_TABLE type into workflow?
Regards,
AmarHi,
I agree Vinoth in certain aspects. It is not possibly the best idea to try to store a string table in workflow container. There are certain limitations in the container (255 characters) in certain situations and you might find yourself in problems in the future. So, consider converting the string data into some other format - OR you could also check if you can limit somehow the lenght in WDA (but of course then you will still have the same problem about the string table data type).
If you want to try to it, you should be able to create your own table type of string. I don't remember the details but there might be something "special" about the STRING_TABLE (only available in WDA or whatever), and that's why you are seeing the error. So, try to create your own table type that has string data type as an row. Then use that.
But as I said, you might see some problems. For example, if you try to read the container with SAP_WAPI_READ_CONTAINER, it will just return you the first 255 characters of each row, etc. There are ways to overcome these kind of problems, but just to let you know, they might not be that simple.
Regards,
Karri
Maybe you are looking for
-
Beta video tapes into iMovie: How?
I have been given the family task of converting old Beta video tapes (& a couple VHS) onto DVD. I have an old Beta VCR, not video camera. How do I get the Beat vido footage onto iMovie? eMac Mac OS X (10.3.9) iMovie 3.0.3
-
I'm very interested in buying an iPhone but have concerns about accumulating multiple pieces of computer equipment. It would be really nice if Apple would develop a sort of docking system for the iPhone where the iPhone could be plugged into a notebo
-
Weird external drive behavior with Time Machine....
I have a 500 GB WD My Essentials USB hard drive. I've been using on Lion for 6+ months. I have the drive in 2 partitions, 400 GB for Time Machine and 100 GB for storage. Everything has been working fine for 6+ months. As of yeterday when I plug i
-
Macbook Pro crashes instead of sleeping
My Macbook Pro 13" Late-2011 model with 2.4GHz is having a problem. This problem has occurred a few months earlier and it happened again. When I try to put my mac to sleep, or if it puts itself to sleep, instead of the sleep light fading in and out a
-
hi guys , I am trying to update a 3d graph dynamically, now its easy to plot the 3d graph when all the values are know . In my case ,check the vi, i have three axis distance wavelength and power. The wave lenght and distance are fixed that is i am ta