Select * from table into table field-symbol
Hello,
I am trying to do a dynamic select into a dynamically defined internal table (field-symbol), but it doesn't work like I expected.
if I try this code :
data : p_tabname type string value 'PA9006',
dref type ref to data .
FIELD-symbols: <struc> TYPE ANY.
CREATE DATA dref TYPE table of (p_tabname).
ASSIGN dref->* TO <struc>.
SELECT * INTO TABLE <struc> FROM (p_tabname) .
I get the following error :
<struc> is not an internal table.
Is there any way I can make this work?
Points will be assigned for each usefull answer.
Hi Dries
Just change your declaration of <struc> to as below it would work,
field-symbols : <struc> type standard table.
Reward points if useful.
~Ranganath
Similar Messages
-
I want to select data into a changeable struct so i used field-symbols but in select statement i got an error saying that "With an Open SQL select, the output area is too small"..i use ANY type in declaration of field-symbols.
What can i do correct this mistake?
SELECT * INTO TABLE FIELDS FROM T682Z WHERE KOZGF = 'ZPPT' AND KOLNR = T682I-KOLNR
ORDER BY ZAEHK.
CONCATENATE 'CNCCRMPR' T682I-KOTABNR INTO TN.
FIELD-SYMBOLS <FS> type any.
SELECT * FROM (TN) INTO <FS>
WHERE TIMESTAMP_TO >= time_stamp AND TIMESTAMP_FROM <= time_stamp.
ENDSELECT.Hi..
You can check this code to know how to use Field symbols in SELECt.
Try it....
DATA : REF_TAB TYPE REF TO DATA.
FIELD-SYMBOLS: <FTAB> TYPE TABLE.
DATA: L_TABNAME TYPE DD02L-TABNAME VALUE 'EKPO'.
CREATE DATA REF_TAB TYPE TABLE OF (L_TABNAME).
ASSIGN REF_TAB->* TO <FTAB>.
SELECT * FROM (L_TABNAME) INTO TABLE <FTAB>.
DESCRIBE TABLE <FTAB>.
WRITE:/ SY-TFILL.
REWARD IF HELPFUL. -
DB Trigger: select from and into current table
I'm running 8.0.5 and facing a table looking like MYTAB(RECID,RECLABEL,..., PARENTRECID, PARENTRECLABEL) where:
. RECID = current record UID (say: employee number)
. RECLABEL = current record label (say: employee name)
. PARENTRECID = RECID of another record in table MYTAB (say: employee ID of the manager of the current employee)
. PARENTRECLABEL = must be made to hold automatically the contents of RECLABEL in the parent record (say: the name of the manager of the current employee)
I know an easy way to get this info would be to use a view like CREATE VIEW MYVIEW AS SELECT A.RECID, A.RECLABEL, A.PARENTRECID, B.RECLABEL "PARENTRECLABEL" FROM MYTAB A, MYTAB B WHERE A.PARENTRECID=B.RECID but for various reasons I would really love to denormalize that info into column PARENTRECLABEL using a database trigger.
Obviously, table MYTAB itself cannot be selected from during the execution of the dB trigger: mutating table error !
I tried:
. to select from a view defined as "SELECT * FROM MYTAB" as suggested in another thread, but this trick didn't seem to be sufficient to lure Oracle (it still says I'm trying to select from a mutating table !)
. to use a package within which a PL/SQL table variable is filled with the list of affected RECID on a FOR EACH ROW basis, and to issue updates in a after statement (thus: not AFTER EACH ROW) AFTER UPDATE trigger - but it's too late already and those updates are apparently not taken into account by the database.
Any other suggestions?
Thx - DidierHere's the code, if the formatting in unpreserved please do let me I'll mail the same.
The Package
CREATE OR REPLACE PACKAGE save_table_package
AS
TYPE saved_test2_type
IS TABLE OF test2%ROWTYPE
INDEX BY BINARY_INTEGER;
saved_test2 saved_test2_type;
saved_test2_num NUMBER:= 1;
PROCEDURE save_test2_row(i_id NUMBER
,i_ename VARCHAR2
,i_mgr_id NUMBER
,i_mgr_ename VARCHAR2
PROCEDURE clear_rows;
END save_table_package;
show err
CREATE OR REPLACE PACKAGE BODY save_table_package AS
PROCEDURE save_test2_row(i_id NUMBER
,i_ename VARCHAR2
,i_mgr_id NUMBER
,i_mgr_ename VARCHAR2
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Enter pkg.save_test2_row:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
save_table_package.saved_test2(saved_test2_num).id := i_id;
save_table_package.saved_test2(saved_test2_num).ename := i_ename;
save_table_package.saved_test2(saved_test2_num).mgr_id := i_mgr_id;
save_table_package.saved_test2(saved_test2_num).mgr_ename := i_mgr_ename;
DBMS_OUTPUT.PUT_LINE('Saved Details Of Row ###:' | |
TO_CHAR(save_table_package.saved_test2_num,'099999') | |'('| |
TO_CHAR(save_table_package.saved_test2(saved_test2_num).id,'099') | |','| |
save_table_package.saved_test2(saved_test2_num).ename | |','| |
save_table_package.saved_test2(saved_test2_num).mgr_id | |','| |
save_table_package.saved_test2(saved_test2_num).mgr_ename | |')'
save_table_package.saved_test2_num := save_table_package.saved_test2_num + 1;
DBMS_OUTPUT.PUT_LINE('Leave pkg.save_test2_row:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
END save_test2_row;
PROCEDURE clear_rows IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Enter pkg.clear_rows :'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
save_table_package.saved_test2_num := 1;
DBMS_OUTPUT.PUT_LINE(' Leave pkg.clear_rows :'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
END clear_rows;
END save_table_package;
show err
The Triggers
CREATE OR REPLACE TRIGGER trig_bfr_iup_test2_fer
BEFORE INSERT OR UPDATE OF mgr_id ON test2 FOR EACH ROW
DECLARE
BEGIN
DBMS_OUTPUT.PUT_LINE('Enter before insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
save_table_package.save_test2_row(:new.id
,:new.ename
,:new.mgr_id
,:new.mgr_ename);
DBMS_OUTPUT.PUT_LINE('Leave before insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
END;
show err
CREATE OR REPLACE TRIGGER trig_aft_iup_test2_stm
AFTER INSERT OR UPDATE OF mgr_id ON test2
DECLARE
BEGIN
DBMS_OUTPUT.PUT_LINE('Enter after insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
FOR i IN 1 .. save_table_package.saved_test2_num - 1
LOOP
UPDATE test2 eme
SET mgr_ename = (SELECT mgr.ename
FROM test2 mgr
WHERE mgr.id = eme.mgr_id)
WHERE eme.id = save_table_package.saved_test2(i).id
DBMS_OUTPUT.PUT_LINE('MGR_ENAME Set Row#:'| |TO_CHAR(i,'099999'));
END LOOP;
save_table_package.clear_rows;
DBMS_OUTPUT.PUT_LINE('Leave after insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
END;
show err
null -
How to assign tasks in Approval Workflow to a set of users selected from a Lookup table
Hi all,
I am new to Project Server and I am using Project Server 2013 On premises deployement. Please help me on how to achieve the below scenario:
I have a requirement where, the initial PDP will have 2 fields (Reviewers and Approvers), wherein the engineer himself will select who the reviewer and approver from the Lookup tables.
Now I have to start task process with these selected people for approval.
Say for example , engineer has selected Alice and Bob as 2 reviewers, then
In the workflow I have :
Start Task process with
Project Data: Reviewers (which is giving error as
[System.ArgumentException: AssignedTo at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager
bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) ]
Then I tried logging the value of Project Data: Reviewers, It logged the value as Alice, Bob (which looks pretty good),
Then I tried assigning only 1 person as Reviewer, then also I get the same error.
So can anybody please tell me where I went wrong. Is it not possible to fetch the data from the values selected as Project Data from the Lookup tables ? If not then what is the workaround I can use to achieve this ?
Thanks,
ShankyHi Paul,
Yes I am using SP designer for Workflows. And yes, You were right, there was a mismatch in the names of AD account and the Lookup table, now with 1 person selected from the lookup table it is assigning the task properly. However with multiple selection,
it is failing.
As Robert mentioned, the fetched value is a text as "Alice, Bob", which makes 2 usernames as a single text. So when I try to assign a task to this group, which returns value as "Alice, Bob", workflow fails to find such AD user, as it
is an invalid value.
So is there any way I can seperate this out to form 2 different username ? I checked for string extraction function in th Workflow, but nothing helped me for this scenario.
Any input will be helpful.
Thanks,
Shanky -
Hi Guys,
I was just hoping to get your opinion on something.
I have a procedure in Production that is taking longer and longer to finish and sticks on one certain section of code.
The code is an INSERT into the main dimension table.
This same procedure runs fine on TEST and the section of code completes an awful lot quicker.
The traffic on Production is a lot heavier and there have been applications developed by people other than myself which SELECT from this dimension table. I'm assuming, based on the fact the code in Test and Production are identical, that this increased traffic could be eating up the bandwith and slowing the jobs.
So, I was thinking - if I create Views and let the other applications hit the views as opposed to the main table, will this help speed it up. I did this before on a Teradata platform using a 'dirty read' which worked quite well but Oracle doesn't seem to offer this option.
What do you guys think? Could this work or do I need to take a different approach.
Thank You.GerardMcL wrote:
I meant ordinary views.
I was wondering if there was a way of putting some locking code in or asking for a dirty read that would speed up the SELECT from the table?There is no such thing as a dirty read with Oracle -- Teradata, SQL Server, Sybase, IBM, etc., have different locking architectures where reads can block write and writes can block reads, and that is not an issue with Oracle.
If there's a query performance problem, which is what that will be if the SELECTs are slow, then if you could follow the following links, that will help diagnosis immensely:
[How to Post A Tuning Request|http://forums.oracle.com/forums/thread.jspa?threadID=863295&tstart=0]
And:
[When your Query takes too long|http://forums.oracle.com/forums/thread.jspa?messageID=1812597#1812597]
There is such as thing as stale reads, against Materialized Views, which are views that actually materialize and store the results of a query, and which then can subsequently be queried. -
How to insert the select query result into table?
How to insert the select query result into table?
SELECT top 20 creation_time
,last_execution_time
,total_physical_reads
,total_logical_reads
,total_logical_writes
, execution_count
, total_worker_time
, total_elapsed_time
, total_elapsed_time / execution_count avg_elapsed_time
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
ORDER BY total_elapsed_time / execution_count DESC;
Thanks,
Tirumala1. SELECT INTO
Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
Use AdventureWorks2008R2;
Go
---Insert data using SELECT INTO
SELECT AddressLine1, City
INTO BothellAddresses
FROM Person.Address
where City = 'Bothell';
GO
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
2. INSERT INTO SELECT
Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
another table.
Use AdventureWorks2008R2;
Go
---Create Table
CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
---Insert into above table using SELECT
INSERT INTO BothellAddresses(AddressLine1, City)
SELECT AddressLine1, City
FROM Person.Address
where City = 'Bothell';
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
Regards,
Vishal Patel
Blog: http://vspatel.co.uk
Site: http://lehrity.com -
Selecting from 2 different tables
is this possible?
i just want to select from two different tables in one select statement and they have the same WHERE clauseSELECT
a.pkggrp,
a.pkgtype,
a.area,
a.process,
a.ww,
count(a.ww) as LOTSGATED,
sum(a.samplesize) as SUMSAMPLESIZE,
sum(a.total_defects) as SUMTOTALDEFECTS,
sum(case a.auditresult when 'pass' then 1 else 0 end) COUNTPASS,
sum(case a.auditresult when 'fail' then 1 else 0 end) COUNTFAIL,
case sum(case a.auditresult when 'fail' then 1 else 0 end)
when 0 then 0
else round(sum(case a.auditresult when 'fail' then 1 else 0 end) / count(a.ww) * 100,2)
end LRR,
case sum(case a.auditresult when 'fail' then 1 else 0 end)
when 0 then 0
else round(sum(case a.auditresult when 'fail' then 1 else 0 end) / sum(a.samplesize) * 1000000,0)
end PPM,
count(c.itrnum)
FROM
t_prodproc_monitoring a, t_itr c
WHERE
a.ww=c.ww
and a.ww between 1 and 50
and c.ww between 1 and 50
GROUP BY
a.pkggrp,
a.pkgtype,
a.area,
a.process,
a.ww
ORDER BY
a.pkggrp,
a.pkgtype,
a.area,
a.process,
a.ww ascthis gave me a
"c". "ww": invalid identifier -
SELECTing from a large table vs small table
I posted a question few months back about teh comparison between INSERTing to a large table vs small table ( fewer number of rows ), in terms of time taken.
The general consensus seemed to be that it would be teh same, except for teh time taken to update the index ( which will be negligible ).
1. But now, following teh same logic, I m confused why SELECTINg from a large table should be more time taking ("expensive" ) than SELECTing from a small table.
( SELECTing using an index )
My understanding of how Oracle works internally is this :
It will first locate the ROWID from teh B-Tree that stores the index.
( This operation is O(log N ) based on B-Tree )
ROWID essentially contains teh file pointer offset of teh location of the data in teh disk.
And Oracle simply reads teh data from teh location it deduced from ROWID.
But then the only variable I see is searching teh B-Tree, which should take O(log N ) time for comparison ( N - number of rows )
Am I correct above.
2. Also I read that tables are partitioned for performance reasons. I read about various partiotion mechanisms. But cannot figure out how it can result in performance improvement.
Can somebody please helpuser597961 wrote:
I posted a question few months back about teh comparison between INSERTing to a large table vs small table ( fewer number of rows ), in terms of time taken.
The general consensus seemed to be that it would be teh same, except for teh time taken to update the index ( which will be negligible ).
1. But now, following teh same logic, I m confused why SELECTINg from a large table should be more time taking ("expensive" ) than SELECTing from a small table.
( SELECTing using an index )
My understanding of how Oracle works internally is this :
It will first locate the ROWID from teh B-Tree that stores the index.
( This operation is O(log N ) based on B-Tree )
ROWID essentially contains teh file pointer offset of teh location of the data in teh disk.
And Oracle simply reads teh data from teh location it deduced from ROWID.
But then the only variable I see is searching teh B-Tree, which should take O(log N ) time for comparison ( N - number of rows )
Am I correct above.
2. Also I read that tables are partitioned for performance reasons. I read about various partiotion mechanisms. But cannot figure out how it can result in performance improvement.
Can somebody please helpIt's not going to be that simple. Before your first step (locate ROWID from index), it will first evaluate various access plans - potentially thousands of them - and choose the one that it thinks will be best. This evaluation will be based on the number of rows it anticipates having to retrieve, whether or not all of the requested data can be retrived from the index alone (without even going to the data segment), etc. etc etc. For each consideration it makes, you start with "all else being equal". Then figure there will be dozens, if not hundreds or thousands of these "all else being equal". Then once the plan is selected and the rubber meets the road, we have to contend with the fact "all else is hardly ever equal". -
No value is select from user define table
Hi ALL,
i am using B1if , i am sending data B1 to isr , i am using user define table but problem no value is select from user define table .
my table ID is @SSRPOD
<payload operation="">
<ns0:MT_POD_B1_System xmlns:ns0="http://xxxx.com/SC/B1/Dlvr/CustDlvr/ExtPrfOfDlvr">
<POD>
<Header>
<SalesOrderNumber>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_SalOrdNo" />
</SalesOrderNumber>
<ArrivalDate>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_TaxDate" />
</ArrivalDate>
<Detail>
<DOLineQuantity>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_Quantity" />
</DOLineQuantity>
<UOM>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_Unitmsr" />
</UOM>
</Detail>
</Header>
</POD>
</ns0:MT_POD_B1_System>
</payload>
I have set following things.
Inbound Channel
scenirio step identifier :z.xxxx
Inbound Channel(IPO):INB_B1_EVNT_ASYN_EVT
InboundType:Asynchronous
Process Trigger:B1Event
Identification Method: B1Event
Identification Parameter:n.a
Identifier:?????
Identifier Namespace:??????
can anyone help me?
Edited by: Sinha_Sinha on Feb 3, 2012 7:47 AMFound an authorization object was missing, that enabled the case types to show but hitting the GO button brought a page that can not be viewed in IE. on to the next hurdle..........
-
New JNDI name created for each drag and drop of database table into table
Hi All,
I'm using Netbeans 5.5 with Visual Web Pack with Mysql as backend. Whenever I drag and drop a database table into table component it creates new JNDI (data source) name for each table. I want to use single JNDI name for all tables. If I change the JNDI name to default name then the design disappears and shows error . Is there any option to set the JNDI name unique for all tables?
Thanks in advance.Hi again,
Well I've tried using the MouseListener / MouseMotionListener approach but it doesn't quite seem to work, although it does get the events correctly. I think the reason is that it doesn't interact correctly with the Java DnD machinery which is something that V.V hinted at. It's something that I may need to look into if / when I have more time available.
I have to say though that I haven't had any problems with scrollbars - we're making fairly heavy use of large tables and if you drag over a table with a scroll bar and move to the top or bottom then it scrolls as you would expect and allows you to drop the data where you like. For this situation I've used pretty much the same approach as for the toy example above except that I've implemented separate source and destination TransferHandlers (the source table is read-only, and it really doesn't make sense to allow people to drag from the destination table so I've essentially split the functionality of the example handler down the middle).
I'm not actually particularly in favour of messing too much with the mechanics of DnD, more because of lack of time than anything else. Guess I'll just have to put up with this for the moment. Doesn't help that DnD is so poorly documented by Sun.
Thanks for all your help.
Bart -
How to convert select-options table into single field internal table
Hi,
My requirement is to convert select-options table into single internal table which has one field.
e.g. select-options: s_matnr for mara-matnr.
select-options table can have options 'BT',"EQ", "NE", "GE", "GT", "LE", "LT", "CP" etc. select-options table
have Sign:I ,Option:BT, Low: 1, High.10.The new internal table records should be 1,2,3,4,5,6,7,8,9,10.
Please suggest any function module available for this scenario in SAP.
Thanks,
Somi.
Edited by: somi reddy satti on Sep 15, 2009 3:18 PMHi Sowmya,
Here is the answer if I understand well of your question.
Data: begin of gt_mon OCCURS 0,
mon(2) TYPE n,
end of gt_mon.
Data: begin of gt_year OCCURS 0,
year(4) TYPE n,
end of gt_year.
Select-options: s_period FOR ptdw_pws_db-kmonth NO-EXTENSION
DEFAULT sy-datum(6)
TO sy-datum(6).
For example according to above statement period is 201110 is 201201.
Period field does n't exists in SAP for selection. If your selection is on date based on period which is given on the selection-screen then you need to convert the period to date by concatenating ( or using FM to convert )01 at the end of each period . You need to declare one range table for date to select the data from table.
loop at s_period.
gr_date-sign = s_period-sign.
gr_date-option = s_period-option.
COncatenate s_period-low
'01'
into gr_date-high.
COncatenate s_period-high
'01'
into gr_date-low
append gr_date.
ENDloop.
Thanks,
Satheesh -
Populate data into the dynamic table ie using field symbols
Dear All,
I need to convert the XML data into internal table. I did this using the guidelines in the forum. Using all those i can get my data
in the format of
Cname Cvalue
id 1
name XX
id 2
name YY
But i need the values in the format of int_tab like,
ID Name
1 XX
2 YY
I used the below code to create the dynamic table strucure.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <itab>.
* Create dynamic work area and assign to FS
create data dy_line like line of <itab>.
assign dy_line->* to <wa>.
So now my strucure will be like ID Name.
I strucked in the place of populating the data into this like 1,XX,2,YY into the dynamic table.
If you come across with this scenario, can anyone suggest me on this.
Regards,
Anita Vizhi Arasi BHi Anita,
Try to understand below given code. It works same as you want. But I used Function module not any method.
TYPES: BEGIN OF ty_xml,
raw(255) TYPE x,
END OF ty_xml.
DATA: lv_file_name TYPE rlgrap-filename,
lit_hdr TYPE TABLE OF ty_hdr,
ls_hdr TYPE ty_hdr,
lv_file TYPE string,
wa_xml TYPE ty_xml,
lit_xml TYPE STANDARD TABLE OF ty_xml,
lv_filename TYPE string ,
ls_xmldata TYPE xstring ,
lit_result TYPE STANDARD TABLE OF smum_xmltb,
ls_result TYPE smum_xmltb,
lit_return TYPE STANDARD TABLE OF bapiret2,
lv_size TYPE i,
lv_count TYPE i.
CONSTANTS: line_size TYPE i VALUE 255.
REFRESH lit_hdr.
*~ File selected from Local System
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
CHANGING
file_name = lv_file_name
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
lv_file = lv_file_name.
*~ Upload for Data Provider
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file
filetype = 'BIN'
has_field_separator = ' '
header_length = 0
IMPORTING
filelength = lv_size
TABLES
data_tab = lit_xml
EXCEPTIONS
OTHERS = 1.
*~ Convert from Binary to String
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_size
IMPORTING
buffer = ls_xmldata
TABLES
binary_tab = lit_xml
EXCEPTIONS
failed = 1
OTHERS = 2.
*~ Parse XML docment into a table structure
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
xml_input = ls_xmldata " Buffered data
TABLES
xml_table = lit_result " final internal table which contain records
return = lit_return.
LOOP AT lit_result INTO ls_result.
IF ls_result-hier = '3'.
IF ls_result-type = 'V'.
CASE ls_result-cname.
WHEN 'intno'. "Internal Number
ls_hdr-intno = ls_result-cvalue.
WHEN 'acode'. "Article Code
ls_hdr-matnr = ls_result-cvalue.
WHEN 'adesc'. "Article Description
ls_hdr-maktx = ls_result-cvalue.
WHEN 'idesc'. "Item Description
ls_hdr-itmds = ls_result-cvalue.
WHEN 'sdesc'. "Standard Description
ls_hdr-stdds = ls_result-cvalue.
WHEN 'at'. "Article Type
ls_hdr-mtart = ls_result-cvalue.
WHEN 'mc'. "Merchandise Category
ls_hdr-matkl = ls_result-cvalue.
WHEN 'cp'. "Characteristic Profile
ls_hdr-charp = ls_result-cvalue.
CONDENSE ls_hdr-charp.
WHEN 'c1'.
ls_hdr-col01 = ls_result-cvalue.
WHEN 'c2'.
ls_hdr-col02 = ls_result-cvalue.
WHEN 'c3'.
ls_hdr-col03 = ls_result-cvalue.
WHEN 'c4'.
ls_hdr-col04 = ls_result-cvalue.
WHEN 'c5'.
ls_hdr-col05 = ls_result-cvalue.
WHEN 'c6'.
ls_hdr-col06 = ls_result-cvalue.
WHEN 'tc'. "Tax Classification
ls_hdr-taklv = ls_result-cvalue.
WHEN 's'. "Season
ls_hdr-saiso = ls_result-cvalue.
WHEN 'sy'. "Season Year
ls_hdr-saisj = ls_result-cvalue.
WHEN 'fg'. "Fashion Grade
ls_hdr-fashg = ls_result-cvalue.
WHEN 'rm'. "Reference Material
ls_hdr-rfmat = ls_result-cvalue.
WHEN 'fcv'. "Free Character Value
ls_hdr-frecv = ls_result-cvalue.
WHEN 'uom'. "Unit of Measure
ls_hdr-uom = ls_result-cvalue.
WHEN 'pou'. "PO Unit
ls_hdr-pount = ls_result-cvalue.
WHEN 'v'. "Vendor
ls_hdr-lifnr = ls_result-cvalue.
WHEN 'b'. "Vendor
ls_hdr-brand = ls_result-cvalue.
WHEN 'pg'. "Purchasing Group
ls_hdr-wekgr = ls_result-cvalue.
WHEN 'rv'. "Regular Vendor
ls_hdr-rlifn = ls_result-cvalue.
WHEN 'pp'. "Pricing Profile
ls_hdr-sprof = ls_result-cvalue.
WHEN 'sp'. "Sales Price
ls_hdr-spric = ls_result-cvalue.
WHEN 'm'. "Margin
ls_hdr-margn = ls_result-cvalue.
WHEN 'c'. "Calculate
ls_hdr-pcalc = ls_result-cvalue.
WHEN 'purp'. "Purchase Price
ls_hdr-ppric = ls_result-cvalue.
WHEN 'a'. "Assortment
ls_hdr-asort = ls_result-cvalue.
WHEN 'bm'. "Batch Management
ls_hdr-batch = ls_result-cvalue.
WHEN 'mrl'. "Min. Remaining Life
ls_hdr-minrl = ls_result-cvalue.
WHEN 'aag'. "Account Assignment Group
ls_hdr-acass = ls_result-cvalue.
WHEN 'vc'. "Valuation Class
ls_hdr-valcl = ls_result-cvalue.
WHEN 'eancat'. "EAN Category
ls_hdr-eanct = ls_result-cvalue.
WHEN 'ean11'.
ls_hdr-ean11 = ls_result-cvalue.
ENDCASE.
AT END OF hier.
APPEND ls_hdr TO lit_hdr.
ENDAT.
ENDIF.
ENDIF.
ENDLOOP.
APPEND LINES OF lit_hdr TO git_hdr.
DELETE git_hdr WHERE maktx IS INITIAL "Article Description
AND mtart IS INITIAL "Article Type
AND matkl IS INITIAL "Merchandise Category
AND charp IS INITIAL "Characteristic Profile
AND taklv IS INITIAL "Tax Classification
AND uom IS INITIAL "Unit of Measure
AND pount IS INITIAL "PO Unit
AND lifnr IS INITIAL "Vendor
AND brand IS INITIAL "Brand
AND wekgr IS INITIAL "Purchasing Group
AND ppric IS INITIAL "Purchasing Price
AND spric IS INITIAL "Sales Price
AND acass IS INITIAL "A/c Assign. Grp.
AND valcl IS INITIAL "Valuation Class
AND saiso IS INITIAL "Season
AND saisj IS INITIAL. "Season Year
IF git_hdr[] IS NOT INITIAL.
CLEAR: lv_count.
LOOP AT git_hdr INTO ls_hdr.
lv_count = lv_count + 1.
ls_hdr-intno = lv_count.
MODIFY git_hdr FROM ls_hdr TRANSPORTING intno.
CLEAR: ls_hdr.
ENDLOOP.
ENDIF.
Code written is part of my program. Try to understand it. I hope it will help you out.
Regards,
Narendra -
Giving Error When Selecting From a Custom Table
There is a custom report 'Z*' which archives data.
In this report, while selecting data(needs to be archived) from a custom table 'Z*_T', giving runtime error in Production Server.
The select statement is written below :
*data izX like z_t occurs 1000 with header line._
*select * from z*t into table i_zX.*_
How can I change the select statement so that it will work properly?Sas..
From your example code it appears you are trying to use a wild card for both your dbtable and the internal table.
To do this, you will lilkely need to use a Field Symbol for the target internal table and your FROM will need to be a varible
FROM (dbtabname)
The ABAP Helps gives this example for the Select Table
DATA TABNAME(10).
DATA: BEGIN OF WA,
ID LIKE SCUSTOM-ID,
NAME LIKE SCUSTOM-NAME,
REST(134),
END OF WA.
TABNAME = 'SCUSTOM'.
SELECT * INTO WA FROM (TABNAME).
WRITE: / WA-ID, WA-NAME.
ENDSELECT. -
Select from a dictionary table - "timings" problem ?
Hi all experts,
a simple question: in my code on an SRM machine I create a purchase order using some calls to these FM:
-1- BBP_PD_PO_CREATE;
-2- BBP_PD_PO_SAVE;
-3- eventually, a call to BBP_PD_PO_UPDATE.
-4- COMMIT WORK AND WAIT.
This sequence is used to create a purchase order in my report, but then I have to update directly in tbe BBP_PDIGP table a single field in a row that has just been added with the sequence:
CLEAR wa_del_item.
LOOP at t_item INTO wa_del_item WHERE FINAL_ENTRY = 'X'.
SELECT SINGLE * FROM BBP_PDIGP
INTO WA_BBP_PDIGP
WHERE GUID = wa_del_item-guid.
IF sy-subrc = 0.
WA_BBP_PDIGP-FINAL_ENTRY = 'X'.
MODIFY BBP_PDIGP FROM WA_BBP_PDIGP.
ENDIF.
ENDLOOP.
Here is the problem. If I run the report and check in debug the SELECT result, it always returns a sy-subrc equal to 4. BUT if I wait a little bit more, then the SELECT finds correctly the entry.
Guess it's a problem due to "timings" in the update table process, how can I make it work? Actually, it should not be possibile to get a sysburc NE 0 , anyway cycling until the result is found appears to me as a "dirty" solution. Any idea?
Thanks in advanceHi Issa and thanks for your help,
tried as you told me but unfortunately, seems it doesn't work
I'm gonna move the SELECT snip at the end of the code, hoping it helps gaining enough time.. anyway, this non-deterministic solution scares me (what about, for example, a large PO that takes a lot of time to be processed?)... Any other idea? Is there any way to force a synch on a db table?
Thanks in advance. -
Unable To Select From SQL Server table with more than 42 columns
I have set up a link between a Microsoft SQL Server 2003 database and an Oracle 9i database using Heterogeneous Services (HSODBC). It's working well with most of the schema I'm selecting from except for 3 tables. I don't know why. The common denominator between all the tables is that they all have at least 42 columns each, two have 42 columns, one has 56, and the other one, 66. Two of the tables are empty, one has almost 100k records, one has has 170k records. So I don't think the size of the table matters.
Is there a limitation on the number of table columns you can select from through a dblink? Even the following statement errors out:
select 1
from "Table_With_42_Cols"@sqlserver_db
The error message I get is:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message [Generic Connectivity Using ODBC]
ORA-02063: preceding 2 lines from sqlserver_db
Any assistance would be greatly appreciated. Thanks!Not a very efficient and space friendly design to do name-value pairs like that.
Other methods to consider is splitting those 1500 parameters up into groupings of similar parameters, and then have a table per group.
Another option would be to use "vertical table partitioning" (as oppose to the more standard horizontal partitionining provided by the Oracle partition option) - this can be achieved (kind of) in Oracle using clusters.
Sooner or later this name-value design is going to bite you hard. It has 1500 rows where there should be only 1 row. It is not scalable.. and as you're discovering, it is unnatural to use. I would rather change that table and design sooner than later.
Maybe you are looking for
-
Gmail - Username and password do not match Options
I get this message every time I try to log into my Gmail account on my new iPod Touch, although the same username and password allow me to log in on my laptop. I know I'm using the correct username and password, but If I go to the relevant link via m
-
We are running multiple MSSQL Server databases ranging from 60gb to 550gb in DB sizes. However the machine that we are using are Core i7 CPUs instead of Xeon CPUs. Do you guys think there will be a difference or improvement if we shift to Xeon CPUs?
-
Issue with the activation of transfer rules
Hi, I am working with the datasource 0PRODUCT_TEXT, and I am trying to install transfer rules from BI Content and unable to get the active version. But the transfer rules are showing inactive and the error is as follows. Error generating program Mess
-
Flex & CF: unable to open...
Connecting flex to coldfusion cfc via a remote object. The error " unable to open '\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml' " appears. The file exist with its coldfusion-destination. I managed to connect flex to coldfusion on another com
-
Distributed environment Library
Gurus, I have a distributed environment. Two servers. While some of the things such as Oracle db, essbase server, etc are in one server, others such as planning application, HSS, etc are installed in the other server. Since I inherited the environmen