Reading Multiple Tables with VB
I'm attempting to retrieve records from multiple tables base on info returned from the previous call.
This code fails on the second call to " IF RFC_Read_TableTJ.Call = True"
also if I comment out "IF RFC_Read_TableTJ.Call = True" is creates the next text file with records from the previous table"
Why is this happening and how do I change tables?
thanks!
Dim RFC_ReadTableTJ, TblFields, TblData, TblOptions As Object
Dim I, J, K, IntCol As Integer
Dim IntRow, LastRow As Long
Dim StopTJ As Boolean
Dim StrTemp, OutLine, OutLine2, TempChar, DelimitFromXL As String
Dim strExport1, strExport2 As Object
Dim ObjFileSystemObject As Object
Dim MATNO(1 To 10) As String
' Dim R3 As SAPFunctions
'Create Server object and Setup the connection
Set R3 = CreateObject("SAP.Functions")
R3.Connection.ApplicationServer = SAPServerIP
R3.Connection.SystemNumber = SAPSystemNo
R3.Connection.System = SAPSystem
R3.Connection.client = SAPClient
R3.Connection.language = SAPLang
If R3.Connection.Logon(0, False) <> True Then
Exit Sub
End If
Set ObjFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set TblFields = Nothing
Set TblData = Nothing
Set TblOptions = Nothing
'Call RFC function RFC_READ_TABLE
Set RFC_Read_TableTJ = R3.Add("RFC_READ_TABLE")
Set strExport1 = RFC_Read_TableTJ.Exports("QUERY_TABLE")
Set strExport2 = RFC_Read_TableTJ.Exports("DELIMITER")
Set TblOptions = RFC_Read_TableTJ.Tables("OPTIONS")
Set TblData = RFC_Read_TableTJ.Tables("DATA")
Set TblFields = RFC_Read_TableTJ.Tables("FIELDS")
'MATERIAL DESCRIPTION***********************************************
'LOOK UP MATERIAL DESC TO GET MATERIAL NO
strExport1.Value = "MAKT"
DelimitFromXL = ","
strExport2.Value = Chr(165)
'Criteria
TblOptions.AppendRow
TblOptions(1, "TEXT") = "MAKTX LIKE '%A19118N1A%'"
'Fields to retrieve
TblFields.AppendRow
TblFields(1, "FIELDNAME") = "MANDT" 'Client
TblFields.AppendRow
TblFields(2, "FIELDNAME") = "MATNR" 'Material Number
TblFields.AppendRow
TblFields(3, "FIELDNAME") = "SPRAS" 'Language Key
TblFields.AppendRow
TblFields(4, "FIELDNAME") = "MAKTX" 'Material Description
TblFields.AppendRow
TblFields(5, "FIELDNAME") = "MAKTG" 'Material description in upper case for matchcodes
'Call RFC and write output
If RFC_Read_TableTJ.Call = True Then
If TblData.RowCount > 0 Then
'Write output to file
'MANDT , MATNR, SPRAS, MAKTX, MAKTG
Set OutFile = ObjFileSystemObject.CreateTextFile("c:\MAKT.txt", True)
OutFile.WriteLine "MANDT , MATNR, SPRAS, MAKTX, MAKTG" 'Header
For IntRow = 1 To TblData.RowCount
'Replace all instances of the delimeter that occur in the data with a ";"
OutLine = ""
For K = 1 To Len(TblData(IntRow, "WA"))
If Mid(TblData(IntRow, "WA"), K, 1) = DelimitFromXL Then
TempChar = ";"
Else
TempChar = Mid(TblData(IntRow, "WA"), K, 1)
End If
OutLine = OutLine & TempChar
Next K
'Put in delimeter
OutLine2 = ""
For K = 1 To Len(OutLine)
If Mid(OutLine, K, 1) = Chr(165) Then
TempChar = DelimitFromXL
Else
TempChar = Mid(OutLine, K, 1)
End If
OutLine2 = OutLine2 & TempChar
Next K
'Write to file
OutFile.WriteLine OutLine2
Next
'MsgBox "Completed Successfully"
Else
'MsgBox "No records returned"
End If
Else
' MsgBox "Error calling SAP RFC_READ_TABLE"
End If
''MAST Material to BOM Link*****************************************
hi John
you can create a join of those multiple tables in an internal table
and then u can view that on this single internal table....
like:-
example
SELECT c~carrname
p~connid
f~fldate
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( scarr AS c INNER JOIN spfli AS p
ON pcarrid = ccarrid
AND p~cityfrom = p_cityfr
AND p~cityto = p_cityto )
INNER JOIN sflight AS f ON fcarrid = pcarrid
AND fconnid = pconnid ).
LOOP AT itab INTO wa.
WRITE: / wa-fldate, wa-carrname, wa-connid.
ENDLOOP.
Similar Messages
-
Help to read a table with data source and convert time stamp
Hi Gurus,
I have a req and need to write a ABAP prog. As soon as i excute ABAP program it should ask me enter a data source name, then my ABAP prog has excute teh code, in ABAP code i have to read a table with this data source as key, sort time stamp from table and should display the data source and time stamp as output.
As follows:
Enter Data Source Name:
Then user enters : 2lis_11_vahdr
Then out put should be "Data source :" 10-15-2008.
The time stamp format in table is 20,050,126,031,520 (YYYYMMDDhhmmss). I have to display as 05-26-2005. Any help would be apprciated.
Thanks,
RamHi Jayanthi Babu Peruri,
I tried to extract YEAR, MONTH, DAY separately and using
EDIT MASK written it.
Definitely there will be some STANDARD CONVERSION ROUTINE will be there. But no idea about it.
DATA : V_TS TYPE TIMESTAMP,
V_TS_T TYPE CHAR16,
V_YYYY TYPE CHAR04,
V_MM TYPE CHAR02,
V_DD TYPE CHAR02.
START-OF-SELECTION.
GET TIME STAMP FIELD V_TS.
V_TS_T = V_TS.
CONDENSE V_TS_T.
V_YYYY = V_TS_T.
V_MM = V_TS_T+4(2).
V_DD = V_TS_T+6(2).
V_TS_T(2) = V_MM.
V_TS_T+2(2) = V_DD.
V_TS_T+4(4) = V_YYYY.
SKIP 10.
WRITE : /10 V_TS," USING EDIT MASK '____-__-________'.
/10 V_YYYY,
/10 V_MM,
/10 V_DD,
/10 V_TS_T USING EDIT MASK '__-__-__________'.
If you want DATE alone, just declare the length of V_TS_T as 10.
Regards,
R.Nagarajan.
We can - -
Read multiples files with same extension
how to read multiples files with same extension in java.
for ex : i would like to read all .DAT files from C drive using java.
How is it done- You create the filter
- You get the list of files
- You open and read each file.
For the first two above you look at java.io.File and listFiles(FileFilter filter).
For the third you find whatever input stream is appropriate from java.io.* -
Read internal table with key not equal to
Hi,
How can I read internal table with key not equal to some other field.
Basically in read statement we can read only fields equal to others fields.Hi,
Test the following Code you can Use Loop at for this But not Read Table
DATA: BEGIN OF it_test OCCURS 10,
f1(4),
f2 TYPE i,
f3(2),
END OF it_test.
DATA: it_test2 LIKE STANDARD TABLE OF it_test WITH HEADER LINE.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'B'.
APPEND it_test TO it_test.
it_test-f1 = '2000'.
it_test-f2 = 10.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'B'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 40.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
LOOP AT it_test INTO it_test WHERE f3 NE 'A'.
WRITE: / it_test-f1, it_test-f2, it_test-f3.
ENDLOOP.
Kind Regards,
Faisal -
Reg - Reading internal table with multiple record in a single field
Dear Guru's,
i want to read a internal table with field having mutilple entries like
read table READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
But it says comma without preceding colon (after READ?).
please guide me.....
thanks & Regards,
Balaji.Sya this is inside the loop.
plz check....
loop at lt_t2 into lt_t2_wa.
READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
endloop.
thanks & Regards,
Balaji.S -
Multiple tables with the possibility of multiple records in each table
Post Author: viper
CA Forum: .NET
Hi
I have been trying for a few days now to come up with a CR solution to displaying data from multiple tables. These tables, in some cases, have more then one record that needs to be displayed. This is basically what I am trying to do.....
I am developing a .net web application(vb) using vs2005 and an oracle 10g backend. There is a data entry part of the site that users will enter data related to a property. Other users will be able to search these records and have a list of records returned based on the search criteria. The user then can click on one of these records to view a pop up CR report containing all the data related to that one property. The PropID is passed to the pop up page and is used in the WHERE clause of my SQL statement to bring back only one property. This data can come from as many as 18 tables if all the fields have been entered for this property. I have tried many different solutions to get the data from multiple tables...and have had some that were close to what I need. The best one I have will display data from multiple tables but only one record per table.....which doesn't work in my case since some of the tables have more then one record per table.
Is there anybody that has had success in setting up similar reports?
Does anybody know how I could use the "Group Expert" to group by the tables in my application? I can only figure out how to group within a single table.
It would be great if I could group by table....then just display the record(s) in each table that had the same PropID. I am not sure if the pdf export would show all the data in that situation but it would be worth a try. If fact...maybe I could create a new table called MyTables and just add two colums like MyTableID and MyTableName. Then add all the table names to MyTables that I want to see in the report and add the associated MyTableID value to each table as a new column. I could then group by MyTableID and PropID. Just guessing here.
Any ideas would be appreciated.Post Author: quafto
CA Forum: .NET
Your query is not too clear so I'll do my best to answer it broadly.
You mentioned that you have a .NET web application where your users enter data on one screen and then may retrieve it on another. If the data is written in real time to a database then you can create a standard Crystal Report by adding multiple tables. The tables should be linked together using the primary and foreign keys in order to optimize the database query and give you a speedy report. Using unlinked tables is not recommended and requires the report engine to index the tables (it is quite slow).
You also mentioned you have a "PropID" to be used in a WHERE clause. This is a great place to use a parameter in your report. This parameter can then be used in your record selection formula inside Crystal Reports. The report engine will actually create the WHERE clause for you based on the parameter value. This is helpful because it allows you to simply concentrate on your code rather than keeping track of SQL queries.
Now, what Crystal does not do well with is uncertainty. When you design a report with X number of tables the report engine expects X number of tables to be available at processing time. You should not surprise the print engine with more or less tables because you could end up with processing errors or incorrect data. You may need to design multiple reports for specific circumstances.
Regarding the group expert question. I'm not sure how you would/could use the group expert to group a table? A table is a collection of fields and cannot be compared to another table without a complex algorithm. The group expert is used to group and sort records based on a field in the report. Have a look at the group expert section of the help file for more information.
Hopefully my comments have given you a few ideas. -
Multiplication Table with Two Nested For Loops
I am trying to code a multiplication table in which the user enters the number of rows between 2 and 10 and enters the number of columns from 2 to 10. This must be in nested for loop format somewhat like this:
rows has been assigned the input variable for rows and columns is the name for input value for columns
for (int i = 1; i <=rows; i++)
for (int j = 1; j <=columns; j++)
i * j
i can't figure out how to get it to print out in table format or if the calculation coding is correct. can anyone help me please?
it should look like this for rows is 4 and columns is 7
1 2 3 4 5 6 7
2 4 6 8 10 12 14
3 6 9 12 15 18 21
4 8 12 16 20 24 28
Edited by: hatecodingsomuch on Feb 22, 2009 8:15 PMhatecodingsomuch wrote:
I refuse to ask for help from people who are acting like they are all-knowing and unwilling to help someone, considering I am asking for help...to learn. Obviously I am not understanding java very well and I don't need to be ridiculed like this from members who are supposed to help "NEW TO JAVA" individuals. Get off your high horse or get off the website. I will never use this again.Good luck with that.
You do seem to be yet another "do my homework for me" type of flunkie. I predict you'll soon have an epiphany that software development really isn't for you.
I hope you know how to say "Do you want fries with that, sir?" better than the next guy so you can edge him out. -
Is it possible to update multiple tables with a dynamic form?
I have columns from two tables populating a dynamic form. I am trying to have the form update both tables on submit. I have tried both a linked transaction and a custom transaction but I am not making progress. Only the master table is being updated. Is it possible with ADDT to update two tables with a dynamic form?
I meant
SXMSMSTAT
SXMSSYERR
Thanks. -
Best way to implement oracle TEXT on multiple tables with regular updates
Hi,
I have the following situation:
5 tables where we want full text search on multiple columns.
Some of the tables have a master/detail relation. (1 to 1000, or more)
because of the number of transactions on these tables we can't have a lag in the sync time.
Currently I have create a dummy table just for the search with 2 columns: for the primary key to all the other tables and one for the update trigger.
I use the user_datastore with a procedure to join all the necessary columns resulting in a clob.
My question is regarding the update.
Of course I can create triggers to update the dummy field in the search table, but this will give lot of updates on that table with possible locking issues.
What would be the best approach to have this search functionality working?
I am open for any ideas!
Thanks,
EdwardOk, I will focus on building a solution on 12c.
right now I have used a USER_DATASTORE with a procedure to glue all the field together in one document.
This works fine for the search.
I have created a dummy table on which the index is created and also has an extra field which contains the key related to all the tables.
So, I have the following tables:
dummy_search
contracts
contract_ref
person_data
nac_data
and some other tables...
the current design is:
the index is on dummy_search.
When we update contracts table a trigger will update dummy_search.
same configuration for the other tables.
Now we see locking issues when having a lot of updates on these tables as the same time.
What is you advice for this situation?
Thanks,
Edward -
Question about reading generic tables with keys
Hello
I'm wondering if it's possible to read a generic table with key statement:
FIELD-SYMBOLS:
<lv_key> TYPE zconf_key,
<lt_data_bi> TYPE INDEX TABLE,
<lt_data_ai> TYPE INDEX TABLE,
<ls_data_bi> TYPE any,
<ls_data_ai> TYPE any.
* create data types
CREATE DATA lt_data_bi TYPE (ls_node-data_table_type).
ASSIGN lt_data_bi->* TO <lt_data_bi>.
CREATE DATA lt_data_ai TYPE (ls_node-data_table_type).
ASSIGN lt_data_ai->* TO <lt_data_ai>.
* do check
LOOP AT <lt_data_ai> ASSIGNING <ls_data_ai>.
ASSIGN COMPONENT 'KEY' OF STRUCTURE <ls_data_ai> TO <lv_key>.
READ TABLE <lt_data_bi> WITH KEY key = <lv_key>
ASSIGNING <ls_data_bi> BINARY SEARCH.
I receive the message: "The specified type has no structure and therefore no component called KEY" in the read statement above.
Does anyone has an idea what I can do here?
Regards,
MathiasMathias Glockner wrote:
> READ TABLE <lt_data_bi> WITH KEY key = <lv_key>
In your structure ls_data_bi there is no field called KEY . please check whether you have field KEY in structure
a®s -
Loading multiple tables with SQL Loader
Hi,
I want to load multiple tables from a single data file using SQL Loader.
Here's the basic idea of what I want. Let's say I have two tables, table =T1
and table T2:
SQL> desc T1;
COL1 VARCHAR2(20)
COL2 VARCHAR2(20)
SQL> desc T2;
COL1 VARCHAR2(20)
COL2 VARCHAR2(20)
COL3 VARCHAR2(20)
My data file, test.dat, looks like this:
AAA|KBA
BBR|BBCC|CCC
NNN|BBBN|NNA
I want to load the first record into T1, and the second and third record load into T2. How do I set up my control file to do that?
Thank!Tough Job
LOAD DATA
truncate
INTO table t1
when col3 = 'dummy'
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(col1,col2,col3 filler char nullif col3='dummy')
INTO table t2
when col3 != 'dummy'
FIELDS TERMINATED BY '|'
(col1,col2,col3 nullif col3='dummy')
This will load t2 tbl but not t1.
T1 Filler col3 is not accepting nullif. Its diff to compare columns have null using when condition. If i find something i will let you know.
Can you seperate records into 2 file. Will a UNIX command work for you which will seperate 2col and 3col record types for you. and then you can execute 2 controlfiles on it.
Thanks,
http://www.askyogesh.com -
Read-only table with a LOV on a VO's attribute
Hi,
I have a VO ('X') that is displayed as a read-only table. 'X' has an attribute called 'SubscriptionId'. The value of 'SubscriptionId' is a foreign key to another table called 'Subscription'. My 'Subscription' database table has a column named 'Description'.
Example:
'X' has an attribute 'SubscriptionId' = 14
DB table 'Subscription' has a row that looks like this:
14, "A subscription description" (where "A subscription description" is the 'Description' column)
I set up a LOV for 'SubscriptionId' on my VO 'X', so that it should show the value of 'Description' from 'Subscription' instead of the 'SubscriptionId'.
If I display my VO 'X' as a form, I can see my LOV (for 'Description').
However, when I display my VO ('X') as a read-only table, it isn't adhering to the LOV I defined on my VO, and is instead showing the 'SubscriptionId'.
What do I need to do differently on my table to show the 'Description' instead of the foreign key 'SubscriptionId'? I want it to be just an output text of the Description, not a choice list.
Thanks,
JoelHi
In simple way just set the ReadOnly property of choice list in the coloum = true
for example
<af:column sortProperty="EmpId" sortable="true"
headerText="#{bindings.DocTransactionView1.hints.EmpId.label}"
id="c2" align="center">
<af:selectOneChoice value="#{row.bindings.EmpId.inputValue}"
label="#{row.bindings.EmpId.label}"
required="#{bindings.DocTransactionView1.hints.EmpId.mandatory}"
shortDesc="#{bindings.DocTransactionView1.hints.EmpId.tooltip}"
id="soc4" readOnly="true">
<f:selectItems value="#{row.bindings.EmpId.items}" id="si3"/>
</af:selectOneChoice>
</af:column> -
Hi All,
I have a dynamic table in my LifeCycle form. Each table row contains a button that links to an external PDF file (using xfa.host.gotoURL). The links work fine in Acrobat 8 Pro, so far, so good... But when clicking the buttons in Reader 8, nothing happens. No error message or security warning, nothing...
I searched the web and some forums for this problem and by reading between the lines of some posts I came to guess that my LifeCycle form will not work in Adobe Reader unless I purchase the respective LifeCycle Extensions license... :-/
What exactly are my options now? Can I get the buttons to work in Adobe Reader somehow (using JS) without having to purchase the Reader Extensions? Or can I somehow recreate the dynamic table of the LifeCycle form using AcroForms in Acrobat 8 Pro to avoid the problem? If so, how do I add such a table using Acrobat's form tools...?
Thanks for your help,
MarcusNormal http://... URLs do indeed work, but relative URLs pointing to local files do not work with the Adobe Reader on my machine. I thought this might be due to a security restriction that can only be overcome by using the Reader Extensions...?
Is there any other way of linking to other PDFs on the local machine than the gotoURL method? I also tried launchApp(), but it didn't work either.
I currently use this statement to link to PDFs in a subfolder:
xfa.host.gotoURL("TrainingGuides/"
+ docName + ".pdf", 1); -
How to read multiple segments with same name in IDOC
I want to read segments in IDOC say e1edk02.I am using orders05 idoc.
BUT If I use the statement
CONSTANTS :
c_segnam1 type char19 value 'E1EDK02'.
read table idoc_data into wa_idocdata with key segnam = c_segnam1.
It will read only one segment.but we are populating 2 e1edk02 segments.LOOP AT IDOC_DATA
WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
CASE IDOC_DATA-SEGNAM.
WHEN 'E1EDK02'.
MOVE IDOC_DATA-SDATA TO E1EDK02.
reward if useful
check FM idoc_input_orders for reference -
Dynamic read from table with DBMS_SQL Block
Hi,
In the orcale8 Application developer's Guide is this example:
-- To select everything from this table and move it into four PL/SQL tables, you could use the following simple program:
c number;
d number;
n_tab dbms_sql.Number_Table;
d_tab1 dbms_sql.Date_Table;
v_tab dbms_sql.Varchar2_Table;
d_tab2 dbms_sql.Date_Table;
indx number := 10;
begin
c := dbms_sql.open_cursor;
dbms_sql.parse(c, 'select * from multi_tab order by 1', EXEC_sql.V7);
dbms_sql.define_array(c, 1, n_tab, 5, indx);
dbms_sql.define_array(c, 2, d_tab1, 5, indx);
dbms_sql.define_array(c, 3, v_tab, 5, indx);
dbms_sql.define_array(c, 4, d_tab2, 5, indx);
d := dbms_sql.execute(c);
loop
d := dbms_sql.fetch_rows(c);
dbms_sql.column_value(c, 1, n_tab);
dbms_sql.column_value(c, 2, d_tab1);
dbms_sql.column_value(c, 3, v_tab);
dbms_sql.column_value(c, 4, d_tab2);
exit when d != 5;
end loop;
dbms_sql.close_cursor(c);
Here the four tables can be used for anything at all. One usage might be to use BIND_ARRAY to move the rows to another table by using a query such as 'INSERT into SOME_T values(:a, :b, :c, :d);
exception when others then
if dbms_sql.is_open(c) then
dbms_sql.close_cursor(c);
end if;
raise;
at the second 'dbms_sql.define_array' comes an ORA-0600 error.
What's wrong ?Some solutions posted here : {message:id=9689485}
Maybe you are looking for
-
Hello Guru's My requirement is to get the total labour costs in BEx analyzer.So i need to create custom DS for that. But i am not sure about the FICO tables which are having the Labour info.. I'm having the GR10 report from R/3 sidepls look at the do
-
Problem in GR/IR cClearing A/c (VERY URGENT)
hi guru's good morning I ma facing a problem in GR/IR Clearing a/c i am not able to clear GR/IR Clearing (Automatic clearing in F.13) some of entries are cleared and some of entries are not getting cleared, can anybody advise me how to get it clear,
-
When syncing my iPhone to Microsoft Outloook all the full day appointments become two day - 2300hrs to 2300hrs next day. Sometimes this will include a nuber of a single day of 23 hours. Looked at solutions and all point to a clock issue or a daylight
-
Apple Mail Graphic Artifacts Bug?
For starters, I never encountered this issue with Lion. But when I open Mail 6.0 (most of the time), I receive odd graphical artifacts around the message (especially messages that have graphics (i.e. pictures) on the right. I took it to Apple and t
-
? Export and burn project in .avi format
How do you export a FCP project to disc so that it is just an .avi file. My video clip needs to be uploaded to a website and the site requires an .avi file. I tried emporting it as an .avi file from FCP but after I burned it in DVDSP it comes up as a