Fetching data from a table and displaying it on the text box
Hi,
I have created a dialog program in which created a container(text box) to enter data upto 1000 characters.
Iam capturing the data and storing it in a custom table. In PBO I want to fetch data from my custom table (if data is already present :1000 characters data) and display it on screen.
Please let me know how do i do it?
hii Pavani,
declare this two sttements in Screen
MODULE STATUS_DATA.
MODULE SELECT_DATA.
In PBO, Under SELECT_DATA write Select query like:
(considering the DB field to be text and Screen Field to be SC_TEXT)
select text from <DB Table> into SC_TEXT where <condition>.
*note if u r selecting more than one field than write fields in ( ),eg. (f1....f2) )
Plz let me know for any further queries.
Regards,
Apoorv
Similar Messages
-
How do I retrieve all data from a table and display it on a text area?
I want to retrieve all the data from one of my MS Access data table and display them all in a text area. how do i go among doing this?
In my car table i have the fields lined up like this..
license,color,doors and year_made
I have an Object class called CAR that will contain methods to set the data from these fields when it gets retrieved.
here's what i go so far.....
statement = getDBConnection().createStatement();
rs = statement.executeQuery("select * from car");
boolean moreRS = rs.next();
if(moreRS)
car.setLicense(rs.getLong(1));
car.setColor(rs.getString(2));
car.setDoors(rs.getString(3));
car.setYearMade(rs.getString(4));
//but this will only get me one car. How do I get more car data?
HELP!!Vector cars = new Vector();
while (rs.next()) {
String license = rs.getLong(1);
String color = rs.getLong(2);
String doors = rs.getLong(3);
String year = rs.getLong(4);
myTextArea.append(license+"\t"+color+"\t"+doors+"\t"+year+"\n");
Car car = new Car();
car.setLicense(license);
car.setColor(color);
car.setDoors(doors);
car.setYearMade(year);
cars.add(car);
}t=tab
n=newline
Vector: http://java.sun.com/j2se/1.4.1/docs/api/java/util/Vector.html -
Pull data from SQL Table and display it in mail
I have a requirement to pull the data from SQL table and send it in email. Currently I am sending the hard coded info in email but is it possible to pull some data from SQL Table and than format it and send it across in the same email?
Can you guide me with steps on this.
NeilThere are several ways to do this. First is to populate a file in a data flow and then send that as an attachment in the send mail task.
As far as including the results in the email body this becomes a bit trickier. To use a variable you would need to use an SSIS variable type of
Object, this is similar to a collection in .NET. The problem once the object is populated is that it isn't like a readable result set, but again more like an array or a collection. There is no native method to take the object variable and
specify .ToString() or cast its results as text. You would need to iterate through each row and append it to another variable of type string, this could be done with a script task or ForEach container.
Also you mentioned formatting the results. What type of formatting were you looking for. A limitation of the SMTP send mail task is that the message body doesn't support HTML so if you were looking at creating a table within the mail body you
would have to use a script task or a custom component
David Dye My Blog -
Fetch data from one table and insert into two tables in desired format
I have similar to the following data in a table and it is not normalized. The groupID is being used to group two records of similar nature.
DECLARE @OldDoc TABLE (oldDocID INT, groupID INT, deptID INT)
INSERT INTO @OldDoc (oldDocID, groupID) VALUES (1, NULL, 111),(2,NULL,111),(3,1,111),(4,NULL,333),(5,1,222),(6,NULL,333),(7,2,222),(8,2,333),(9,NULL,111),(10,3,222),(11,NULL,333),(12,3,444)
I need to process the data from the above table (@OldDoc) and write into two new tables (@NewDoc and @NewDocGroup) as follows.
oldDocID should be stored as newDocID when inserting to @NewDoc table. Only records with groupID NULL and one record (first one) per group should be considered (For example, oldDocID 5 is not considered as 3 and 5 belong to the same groupID 1) for insertion.
DECLARE @NewDoc TABLE (newDocID INT)
INSERT INTO @NewDoc (newDocID) VALUES (1),(2),(3),(4),(6),(7),(9),(10),(11)
All records from @OldDoc should be considered for insertion into @NewDocGroup table. OldDocID is inserted as NewDocID and deptID is as-is. Instead of groupID, the ID of the first record in the
group should be considered as parentNewDocID (For example, 3 is considered as parentNewDocID for newDocID 5 as 3 and 5 belong to the same groupID in @OldDoc table) for the newDocID.
DECLARE @NewDocGroup (newDocID INT, parentNewDocID INT, deptID INT)
INSERT INTO @NewDocGroup (newDocID, parentNewDocID, deptID) VALUES (1,1,111),(2,2,111),(3,3,111),(4,4,333),(5,3,222),(6,6,333),(7,7,222),(8,7,333),(9,9,111),(10,10,222),(11,11,333),(12,10,444)
How do I accomplish the above using SQL ? Thanks for the help.>> I have similar to the following data in a table and it is not normalized. The group_id is being used to group two records [sic] of similar nature. <<
Rows are not records. Tables have to have a key by definition. You do not do math with identifiers, so they should not be numeric. Let's ignore that error for now. In short, you are posting garbage. If you had followed Forum Netiquette, would you have posted
this?
CREATE TABLE Old_Documents
(old_doc_id INTEGER NOT NULL PRIMARY KEY,
group_id INTEGER,
dept_nbr INTEGER NOT NULL
REFERENCES Departments (dept_nbr));
INSERT INTO Old_Documents(old_doc_id, group_id, dept_nbr)
VALUES (1, NULL, 111),
(2, NULL, 111),
(3, 1, 111),
(4, NULL, 333),
(5, 1, 222),
(6, NULL, 333),
(7, 2, 222),
(8, 2, 333),
(9, NULL, 111),
(10, 3, 222),
(11, NULL, 333),
(12, 3, 444);
>> I need to process the data from the above table (Old_Documents) and write into two new tables (New_Documents and New_Documents_Groups) as follows. <<
Just like punch cards and mag tape data processing! Being old and being new are a status, not another kind of entity. But that is how mag tapes work. And you even use the verb "fetch" from tape files. This design flaw is called attribute splitting.
Do you have a Male_Personnel and Female_Personnel table? NO! It is just Personnel!
>> old_doc_id should be stored as new_doc_id when inserting to New_Documents table. Only records [sic] with group_id NULL and one record [sic] (first [sic; no ordering in a table] one) per group should be considered (For example, old_doc_id 5 is not considered
as 3 and 5 belong to the same group_id =1) for insertion. <<
Think about your punch card mindset. Why did you physically materialize that redundant New_Documents table? Let me answer that: this is how you work with punch cards! In SQL we use a VIEW:
CREATE VIEW New_Documents (new_doc_id)
AS
SELECT old_doc_id
FROM Old_Documents;
>> All records [sic] from Old_Documents should be considered for insertion into New_Documents_Groups table. The old_doc_id is inserted as new_doc_id and dept_nbr is as-is. Instead of group_id, the ID [sic: which identifier??] of the first [sic: tables
have no ordering like a deck of punch cards] record [sic] in the group should be considered as parent_new_doc_id (For example, 3 is considered as parent_new_doc_id for new_doc_id 5 as 3 and 5 belong to the same group_id in Old_Documents table) for the new_doc_id.
<<
Why not use 5 as the parent? My guess is that you are trying to form equivalence classes. See:
https://www.simple-talk.com/content/print.aspx?article=2020
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Craete a simple abap object to select data from a table and display
Hi,
I know the concept of abap objects but i never worked on it,
can any one give me simple example of how to create an abap object to display data from mara table.also please send me documents or info regd ABAP OBJECTS.
I want to write a simple report in terms of abap object
Regards,
Sowjanyahi,
Here is hte sample program in se38.
REPORT ZFGLI00003
*-- Include for data declarations and performs
include ZFGLI00003_f01.
*--Include for Classes and their Implementation
include ZFGLI00003_cl.
* selection-screen *
*-- Selection Values : Block1
selection-screen begin of block b1 with frame title text-001.
*-- Ledger
parameters: p_rldnr like zzprodnt-rldnr default 'NP'.
*-- Fiscal year
parameters: p_ryear like zzprodnt-ryear.
*-- Period(month)
parameters: p_rpmax like zzprodnt-rpmax.
selection-screen end of block b1.
*-- Selection Values : Block2
selection-screen begin of block b2 with frame title text-002.
*-- Company ID's
select-options : s_glcomp for ZZPRODNT-ROBUKRS .
*-- Profit Center
select-options : s_prctr for ZZPRODNT-RPRCTR .
*-- Product Assignment
select-options : s_prasn for ZZPRODNT-RZZWWZ01 .
*-- Corporate Brand
select-options : s_crpbd for ZZPRODNT-RZZWWZ05 .
selection-screen end of block b2.
*-- Selection Values : Block3 Download Options
selection-screen begin of block b3 with frame title text-003.
parameters : p_local radiobutton group 1,
p_unix radiobutton group 1,
p_path like rlgrap-filename obligatory
default 'C:P20Z_Formatted.txt'(009).
selection-screen end of block b3.
* At Selection-Selection on value-request for file path *
at selection-screen on value-request for p_path.
if p_unix <> 'X'.
*-- Getting F4 help for output file
perform get_filename changing p_path.
else.
message i999(zi) with
'Sorry !! Function not available for UNIX file.'(i01).
endif.
*-- At selection screen validations
at selection-screen on p_path.
if p_unix <> 'X'.
*-- Validate local file
if p_path+1(2) <> ':'.
message e999(zi) with 'Invalid file path'(006).
endif.
else.
*-- Validate unix file
if p_path+0(1) <> '/'.
message e999(zi) with 'Invalid file path'(006).
endif.
endif.
* Initialization *
initialization.
*-- Initialize the period
perform init_period changing p_rpmax p_ryear.
* start-of-selection *
start-of-selection.
data : o_tm1_intf type ref to lcl_tm1_intf.
create object o_tm1_intf.
*-- Extract the data from ZZPRODNT
call method o_tm1_intf->get_data exporting e_rldnr = p_rldnr
e_ryear = p_ryear
e_rpmax = p_rpmax
e_glcomp = s_glcomp[]
e_prctr = s_prctr[]
e_prasn = s_prasn[]
e_crpbd = s_crpbd[]
importing i_subrc = v_subrc.
* INCLUDE ZFGLI00003_CL *
* CLASS lcl_tm1_intf IMPLEMENTATION
class lcl_tm1_intf definition.
public section.
*-- Data Declaration
data : lv_date type sy-datum, "Date
lv_time type sy-uzeit, "Time
lv_count type i, "Count for total records
lv_acsline type zfgl014-acsline,"ACS line code
lv_amt_curr type zzprodnt-kslvt, "current month amount
lv_amt_ytd type zzprodnt-kslvt, "YTD Amount
lv_check, "check if any record is
"downloaded
lv_msg(100), "message
lv_count_s(5) , "Count for total(char)
lv_amt_curr_s(23), "Current month amount(char)
lv_amt_ytd_s(23), "YTD Amount(char)
lv_ksl_pd(17), "KSLxx
lv_period(2) type n. "month(period)
*-- Types Declaration
types : ty_rldnr type zzprodnt-rldnr, "Type for Ledger
ty_ryear type zzprodnt-ryear, "Type for Fiscal Year
ty_rpmax type zzprodnt-rpmax, "Type for Period
ty_glcomp type range of char4, "Type for company selection
ty_prctr type range of char10, "Type for profit center sel
ty_prasn type range of char6, "Type for prod assignmt sel
ty_crpbd type range of char4, "Type for Corp Brand sel
begin of ty_file, "Type for File
line(150),
end of ty_file,
begin of ty_ZZPRODNT, "Type-ledger summary table
company type OBUKR, "Company
gl_acct type RACCT, "GL Account
cst_ctr type KOSTL, "Cost Center
prt_ctr type PRCTR, "Profit Center
rfarea type FKBER, "Functional Area
wbs_ele type PS_POSID, "WBS Element
prd_*** type RKEG_WWZ01, "Product Assignment
corp_bd type RKEG_WWZ05, "Corporate Brand
ksl01 type KSLXX9, "Total of transactions - 01
ksl02 type KSLXX9, "Total of transactions - 02
ksl03 type KSLXX9, "Total of transactions - 03
ksl04 type KSLXX9, "Total of transactions - 04
ksl05 type KSLXX9, "Total of transactions - 05
ksl06 type KSLXX9, "Total of transactions - 06
ksl07 type KSLXX9, "Total of transactions - 07
ksl08 type KSLXX9, "Total of transactions - 08
ksl09 type KSLXX9, "Total of transactions - 09
ksl10 type KSLXX9, "Total of transactions - 10
ksl11 type KSLXX9, "Total of transactions - 11
ksl12 type KSLXX9, "Total of transactions - 12
ksl13 type KSLXX9, "Total of transactions - 13
ksl14 type KSLXX9, "Total of transactions - 14
ksl15 type KSLXX9, "Total of transactions - 15
ksl16 type KSLXX9, "Total of transactions - 16
end of ty_ZZPRODNT.
*-- Structure Declaration
* Structure for final file
data : x_file type ty_file,
* Structure for Product Ledger Summary table
x_ZZPRODNT type ty_ZZPRODNT,
* Structure for Functional Area to ACS line mapping
x_zfgl014 type zfgl014.
*-- Internal Table Declaration
* Table for records of Product Ledger Summary table
data : it_ZZPRODNT type table of ty_ZZPRODNT,
* Table for final file
it_file type table of ty_file,
* Table for Functional Area to ACS line mapping
it_zfgl014 type table of zfgl014.
*-- Method Declaration.
methods : get_data importing e_rldnr type ty_rldnr
e_ryear type ty_ryear
e_rpmax type ty_rpmax
e_glcomp type ty_glcomp
e_prctr type ty_prctr
e_prasn type ty_prasn
e_crpbd type ty_crpbd
exporting i_subrc type sy-subrc.
endclass. "lcl_tm1_intf DEFINITION
* CLASS lcl_tm1_intf IMPLEMENTATION
class lcl_tm1_intf implementation.
*-- Method get_data selects the North American Product Ledger Summary
* table data and then maps the Functional Area to ACS line to get
* the ACS line code
method get_data.
*-- Local Variable
DATA: L_ZZPRODNT TYPE TY_ZZPRODNT.
*-- Get the data from North American Product Ledger Summary table
select robukrs
racct
rcntr
rprctr
rfarea
rzzwbs_el
rzzwwz01
rzzwwz05
ksl01
ksl02
ksl03
ksl04
ksl05
ksl06
ksl07
ksl08
ksl09
ksl10
ksl11
ksl12
ksl13
ksl14
ksl15
ksl16
from zzprodnt
into table it_ZZPRODNT
where rldnr = e_rldnr
and ryear = e_ryear
and rpmax = e_rpmax
and ROBUKRS in e_glcomp
and RPRCTR in e_prctr
and RZZWWZ01 in e_prasn
and RZZWWZ05 in e_crpbd.
if sy-subrc = 0.
loop at it_ZZPRODNT into l_zzprodnt.
condense l_ZZPRODNT-rfarea no-gaps.
if l_ZZPRODNT-rfarea is initial.
delete it_ZZPRODNT.
endif.
endloop.
*-- Get the Functional Area to ACS line code mapping data
select *
from zfgl014
into table it_zfgl014
for all entries in it_ZZPRODNT
where fkber = it_ZZPRODNT-rfarea .
if sy-subrc = 0.
endif.
endif.
i_subrc = sy-subrc.
endmethod. "get_data
endclass. "lcl_tm1_intf IMPLEMENTATION
* INCLUDE ZFGLI00003_F01 *
* Table
tables : zzprodnt.
* Data Declaration
data : v_subrc type sy-subrc.
*& Form get_filename
* Description : This subroutine is used for F4 Prompting
form get_filename changing p_path like rlgrap-filename.
*-- Local variables
data : lv_file like ibipparms-path, "Local file for upload/download
lv_repid like syst-cprog, "ABAP program, caller in external
"procedures
lv_dynnr type syst-dynnr. "Current screen No
lv_repid = syst-cprog.
lv_dynnr = syst-dynnr.
*-- Function module used for F4 help
call function 'F4_FILENAME'
exporting
program_name = lv_repid
dynpro_number = lv_dynnr
importing
file_name = lv_file.
move lv_file to p_path.
endform. " get_filename
*& Form init_period
FORM init_period changing p_rpmax p_ryear.
if sy-datum+4(2) = 01.
p_rpmax = 12.
p_ryear = sy-datum+0(4) - 1.
else.
p_rpmax = sy-datum+4(2) - 1.
p_ryear = sy-datum+0(4).
endif.
ENDFORM. " init_period
Hope this helps.
Regards,
Richa -
Fetch data from two tables and insert into one table
I have similar to the following data in two tables (@Plant, @PlantDirector) and need to consolidate into one table (@PlantNew) as follows.
DECLARE @Plant TABLE (PlantID INT, PlantName VARCHAR(100))
INSERT INTO @Plant (PlantID, PlantName) VALUES (1, 'Name One'),(2, 'Name Two'),(3, 'Name Three'),(4, 'Name Four'),(5, 'Name Five'),(6, 'Name Six')
Director data for the Plants exist in the following table. Assistant value 1 means Assistant Director and 0 means Director.
Data exists only for subset of plants and a Plant may have one or both roles.
DECLARE @PlantDirector TABLE (PlantID INT, PlantDirectorID INT, Assistant bit)
INSERT INTO @PlantDirector (PlantID, PlantDirectorID, Assistant) VALUES (2, 111, 1),(2, 222, 0),(4, 333, 0),(6,444,1)
The above data needs to be inserted into one table (@PlantNew) as follows:
PlantID in @Plant table is IDENTITY value and needs to be inserted as-is into this table.
PlantDirExists will get a value of 1 if at least one record exists in @PlantDirector table for a PlantID. PlantAssistantDirID and PlantDirID should be set to the corresponding PlantDirID or NULL appropriately depending on the data.
DECLARE @PlantNew TABLE (PlantID INT, PlantName VARCHAR(100), PlantDirExists bit, PlantAssistantDirID INT, PlantDirID INT)
INSERT INTO @PlantNew (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID)
VALUES (1, 'Name One', 0, NULL, NULL),(2, 'Name Two', 1, 111, 222),(3, 'Name Three', 0, NULL, NULL),(4, 'Name Four', 1, NULL, 333),(5, 'Name Five', 0, NULL, NULL),(6, 'Name Six',1, 444, NULL)
How do I achieve the above using SQL ? Thanks.like this
INSERT @PlantNew (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID)
SELECT p.PlantID,
p.PlantName,
CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
PlantAssistantDirID,
PlantDirID
FROM @Plant p
LEFT JOIN (SELECT PlantID,
MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
@PlantDirector
GROUP BY PlantID)pd
ON pd.PlantID = p.PlantID
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
You're missing a FROM
insert into @PlantNew
SELECT p.PlantID,
p.PlantName,
CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
PlantAssistantDirID,
PlantDirID
FROM @Plant p
LEFT JOIN (SELECT PlantID,
MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
from @PlantDirector
GROUP BY PlantID)pd
ON pd.PlantID = p.PlantID -
Fetch data from different tables print them is assigned places
Hi Friends,
I have designed one SMART-Form (Receipt).
I need to fetch data from different tables and the data must be print in assigned places. Please help me how to achieve this requirement. Thanks for your help.
Best regards,
Manju.
Edited by: Alvaro Tejada Galindo on Feb 12, 2008 10:20 AMU're right.
When it creates a smartform it needs to decide when the main data have to be extracted:
- or in driver program
- or in smartforms
The difference can be in the performance, because the program can select the data only once, the smartforms needs to extract them everytime it's called.
I prefer to use a complex structure for the smartform interface as so all data I need are in only one structure, the problem is the complex structure is harder to be managed.
Max -
How to Fetch Data From Standard Table MARA and Display using BOPF ?
Hello All,
In BOPF creation of Quey to a node fetches data from the Data Base Table attached to that Node,
But in my requirement I have to fetch data Present in a Standard table and Display it in the FPM List Using FBI.
** Can we Fetch the data From Standard Table and fill the Node in BOPF, Is this possible as the standard Table do not contain KEY field which BOPF uses for Data Fetching ?
Kindly share your Idea's .
Thanks in Adv.Hi Dhivya,
Thanks For your Response.
In my Requirement I want to make ROOT Node as Transient Node.
When I create a Sub Node to a Root Node, I am able to get this option to make this sub node as a Transient Node .
By selecting 'Standard<-->Extended' option in the Menu item 'GoTo' I am able to get this Transient Node check box field for the Sub Nodes.
I want to make a ROOT Node as a Transient Node.
(Which Version you are using, and which transaction you are using to create BO . we are using BOBX Transaction, Version Ehp 6 )
Kindly Guide me .
Thanks,
Kranthi Kumar. -
Select query taking too much time to fetch data from pool table a005
Dear all,
I am using 2 pool table a005 and a006 in my program. I am using select query to fetch data from these table. i.e. example is mentioned below.
select * from a005 into table t_a005 for all entries in it_itab
where vkorg in s_vkorg
and matnr in s_matnr
and aplp in s_aplp
and kmunh = it_itab-kmunh.
here i can't create index also as tables are pool table...If there is any solutions , than please help me for same..
Thanks ,it would be helpful to know what other fields are in the internal table you are using for the FOR ALL ENTRIES.
In general, you should code the order of your fields in the select in the same order as they appear in the database. If you do not have the top key field, then the entire database is read. If it's large then it's going to take a lot of time. The more key fields from the beginning of the structure that you can supply at faster the retrieval.
Regards,
Brent -
Generic datasource by function module to fetch data from multiple tables?
I'm writing a function module to fetch price, for generic datasource.
At first, extract test is OK. But InfoPackage never stop when loading data to PSA in BW.
And I find the example codes:
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
WHERE CARRID IN L_R_CARRID AND
CONNID IN L_R_CONNID.
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR S_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF.
There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
Now I fetch data from multiple tables, I don't think I can use Cursor.
Then How can I handle this?
Thanks a lot.Thanks
IF IT_999[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
* A~DATBI >= SY-DATUM AND
LOEVM_KO = ''.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_997[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A997 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_997
WHERE
* A~KNUMH = IT_997-KNUMH AND
A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_996[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A996 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_996
WHERE
* A~KNUMH = IT_996-KNUMH AND
A~KSCHL = 'ZPRB' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
SELECT MATNR "u7269u6599u53F7u7801
MEINH "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
UMREZ "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
UMREN "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
FROM MARM
INTO CORRESPONDING FIELDS OF TABLE IT_MARM
FOR ALL ENTRIES IN TP_DATA
WHERE MATNR = TP_DATA-MATNR AND MEINH = TP_DATA-KMEIN.
LOOP AT TP_DATA.
IF TP_DATA-KPEIN NE 0.
TP_DATA-KBETR = TP_DATA-KBETR / TP_DATA-KPEIN.
TP_DATA-KHETR = TP_DATA-KHETR / TP_DATA-KPEIN.
ENDIF.
IF TP_DATA-KSCHL = 'ZPRA'.
* TP_DATA-MEINH = 'ZI'.
* TP_DATA-KSCHL = 'B4'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRB'.
* TP_DATA-KSCHL = 'L0'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPR3'.
* TP_DATA-KSCHL = 'B2'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ENDIF.
TP_DATA-MEINH = '01'.
MODIFY TP_DATA.
E_T_DATA-MATNR = TP_DATA-MATNR.
E_T_DATA-KSCHL = TP_DATA-KSCHL.
E_T_DATA-KHETR = TP_DATA-KHETR.
E_T_DATA-KBETR = TP_DATA-KBETR.
E_T_DATA-KMEIN = TP_DATA-KMEIN.
E_T_DATA-DATAB = TP_DATA-DATAB.
E_T_DATA-DATBI = TP_DATA-DATBI.
APPEND E_T_DATA.
CLEAR WA_MARM1.
CLEAR WA_MARM2.
ENDLOOP.
Edited by: Shen Peng on Oct 20, 2010 10:09 AM -
SELECT is taking lot of time to fetch data from cluster table BSET
<Modified the subject line>
Hi experts,
I want to fetch data of some fields from bset table but it is taking a lot of time as the table is cluster table.
Can you please suggest me any other process to fetch data from cluster table. I am using native sql to fetch data.
Regards,
SURYA
Edited by: Suhas Saha on Jun 29, 2011 1:51 PMHi Subhas,
As per your suggestion I am now using normal SQL statement to select data from BSET but it is still taking much time.
My SQL statement is :
SELECT BELNR
GJAHR
BUZEI
MWSKZ
HWBAS
KSCHL
KNUMH FROM BSET INTO CORRESPONDING FIELDS OF TABLE IT_BSET
FOR ALL ENTRIES IN IT_BKPF
WHERE BELNR = IT_BKPF-BELNR
AND BUKRS = IT_BKPF-BUKRS.
<Added code tags>
Can you suggest me anymore?
Regards,
SURYA
Edited by: Suhas Saha on Jun 29, 2011 4:16 PM -
How to use for all entires clause while fetching data from archived tables
How to use for all entires clause while fetching data from archived tables using the FM
/PBS/SELECT_INTO_TABLE' .
I need to fetch data from an Archived table for all the entries in an internal table.
Kindly provide some inputs for the same.
thanks n Regards
RameshHi Ramesh,
I have a query regarding accessing archived data through PBS.
I have archived SAP FI data ( Object FI_DOCUMNT) using SAP standard process through TCODE : SARA.
Now please tell me can I acees this archived data through the PBS add on FM : '/PBS/SELECT_INTO_TABLE'.
Do I need to do something else to access data archived through SAP standard process ot not ? If yes, then please tell me as I am not able to get the data using the above FM.
The call to the above FM is as follows :
CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
EXPORTING
archiv = 'CFI'
OPTION = ''
tabname = 'BKPF'
SCHL1_NAME = 'BELNR'
SCHL1_VON = belnr-low
SCHL1_BIS = belnr-low
SCHL2_NAME = 'GJAHR'
SCHL2_VON = GJAHR-LOW
SCHL2_BIS = GJAHR-LOW
SCHL3_NAME = 'BUKRS'
SCHL3_VON = bukrs-low
SCHL3_BIS = bukrs-low
SCHL4_NAME =
SCHL4_VON =
SCHL4_BIS =
CLR_ITAB = 'X'
MAX_ZAHL =
tables
i_tabelle = t_bkpf
SCHL1_IN =
SCHL2_IN =
SCHL3_IN =
SCHL4_IN =
EXCEPTIONS
EOF = 1
OTHERS = 2
OTHERS = 3
It gives me the following error :
Index for table not supported ! BKPF BELNR.
Please help ASAP.
Thnaks and Regards
Gurpreet Singh -
How can we improve the performance while fetching data from RESB table.
Hi All,
Can any bosy suggest me the right way to improve the performance while fetching data from RESB table. Below is the select statement.
SELECT aufnr posnr roms1 roanz
INTO (itab-aufnr, itab-pposnr, itab-roms1, itab-roanz)
FROM resb
WHERE kdauf = p_vbeln
AND ablad = itab-sposnr+2.
Here I am using 'KDAUF' & 'ABLAD' in condition. Can we use secondary index for improving the performance in this case.
Regards,
HimanshuHi ,
Declare intenal table with only those four fields.
and try the beloe code....
SELECT aufnr posnr roms1 roanz
INTO table itab
FROM resb
WHERE kdauf = p_vbeln
AND ablad = itab-sposnr+2.
yes, you can also use secondary index for improving the performance in this case.
Regards,
Anand .
Reward if it is useful.... -
Hey guys how to fetch data from db table using subroutine
hi guys,
I am fetching data from db table "mcha". now in the follwing code i get it in "HSDAT1_DATE."
now when i read out_tab with key "HSDAT1". it wont come in out_tab-value.plz tell me what is wrong whether some key condition in out_tab or any thing else.
and what should i write in changing && in script.
thanks in advance
FORM DATE_MGF TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
tables :MCHA ,QALS.
DATA : WERKS1 LIKE QALS-WERK.
DATA : HSDAT1 LIKE MCHA-HSDAT.
DATA : DATE(2),
MONTH(2),
YEAR(4).
DATA : HSDAT1_DATE(10).
READ TABLE IN_TAB WITH KEY 'QALS-WERK'.
LOOP AT IN_TAB.
IF SY-TABIX EQ 1.
WERKS1 = IN_TAB-VALUE.
IF WERKS1 NE SPACE.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
SELECT SINGLE HSDAT INTO HSDAT1
FROM MCHA
WHERE WERKS = WERKS1.
DATE = HSDAT1+6(2).
MONTH = HSDAT1+4(2).
YEAR = HSDAT1+0(4).
CONCATENATE DATE '.' MONTH '.' YEAR INTO HSDAT1_DATE.
READ TABLE OUT_TAB WITH KEY 'HSDAT1' .
IF SY-SUBRC = 0.
OUT_TAB-VALUE = HSDAT1.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.Hi,
Let me understanf clearly what you want.
initally mine out_tab is blank
According to you, your table out_tab is blank. And you need to add out_tab-value = HSDAT1_date.
READ TABLE OUT_TAB WITH KEY 'HSDAT1' .
IF SY-SUBRC = 0.
OUT_TAB-VALUE = HSDAT1.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
So, if your table is blank, then read statement will fail.
Please let me know if your table out_tab in blank when you are reading the table and if this table contains any field called HSDAT.
Basically i would like to know your internal table out_tab declaration.
Thanks,
Archana -
SQL Select Performance - Approached to fetch data from big table
Hi
I just wanted to know view on different approached to fetch data from a table which has 40 billion records and which joined to another table which has 1 million record.
e.g.
I have two tables TableA and TableB
TableA has 40 Billion records has 6 columns
TableA has partitions on Date
TableA has required indexes
TableB has 1 Milluion record and has 10 columns
Table A has indexes
Now I have written query like
select distinct TableA.column1,TableA.column2,TableB.columnA
FROM TableA join TableB
ON TableA.Column1=TableB.Column2
WHERE TableA.DateColumn between StartDate and EndDate
for a given date range it will fetch 5 billion of records which takes around 40 minutes.
I just wanted to know what all tuning approaches I can follow. What would be the best approach to make record retrieval faster in such a scenario.
Just wanted to know your vies/experience in such a scenarioSufficiently large array fetchsize
and,
possibly using parallel query,
pop into my mind.
I would be interested though in the business requirement that asks for you to write a program that gets 5 billion (!) rows out of the database...
Maybe you are looking for
-
How to find colums in CLOB variable and get this colums value to update col
Question How to find colums in CLOB variable and get this colums value to update colum of oracle database table How my work will go Step-1 - I am creating XML FIle which is based on code that we discused before- Its developing xml file with data in <
-
Goods receipt - Entry Door in WM
Hello, i work in 4.7 environment and we are implementing task and resource management. We have to map in our warehouse entry doors and staging area (bay) where the goods are temporarly stored before putaway. The doors must be assigned manually by t
-
Can I save an IMAQ image with overlayed tools and text/ROI graphics.
I am using LabVIEW 6.0.2/IMAQ 2.5 on WinNT. Thanks, Jeff
-
Password when waking from the screensaver stopped working.
I just found that my computer stopped asking for my password when waking from the screensaver or sleeping. I went back and double checked my system prefs and it was still checked to require a password. Any ideas? I also have noticed that after my com
-
After JSR-168 processAction there is no re-Render?
In the Edit/Config mode of my JSR-168 portlet I want to have a rather complex form. It's a table that the user would be able to edit, add, and remove rows from. I have a form that submits to the actionURL, and sucessfully calls the processAction meth