Loop Where The row type of the table must be statically definied
Hi Experts,
Actually i am working on dynamically generated the funtion module.
It has four input parametrs.. IT_TAB_REFERENCE - Table reference, IS_STR_REFERENCE is Structure Reference and
two more fields are input fields.. one contains employee reference and other is calmonth..
Getting row mismatch and please find the code below. error is at the loop statement.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IT_TAB_REFERENCE) TYPE REF TO DATA
*" REFERENCE(IS_STR_REFERENCE) TYPE REF TO DATA
*" REFERENCE(ID_SOURCEFIELD1) TYPE REF TO DATA
*" REFERENCE(ID_SOURCECALMONT1) TYPE REF TO DATA
*" EXPORTING
*" REFERENCE(LS_OUTTAB_REFERENCE) TYPE REF TO DATA
*" CHANGING
*" REFERENCE(CD_SOURCEFIELD1) TYPE REF TO DATA
*" REFERENCE(CD_SOURCEFIELD2) TYPE REF TO DATA
FIELD-SYMBOLS:<it_tab_reference> TYPE ANY TABLE,
<ls_str_reference> TYPE ANY.
FIELD-SYMBOLS: <id_sourcefield1> TYPE /bi0/oiemployee,
<id_sourcecalmont1> TYPE /bi0/oicalmonth.
DATA: ld_calday TYPE sy-datum.
CONSTANTS: lc_day TYPE char2 VALUE '01'.
ASSIGN it_tab_reference->* TO <it_tab_reference>.
ASSIGN is_str_reference->* TO <ls_str_reference>.
ASSIGN id_sourcefield1->* TO <id_sourcefield1>.
ASSIGN id_sourcecalmont1->* TO <id_sourcecalmont1>.
IF <it_tab_reference> IS ASSIGNED. " data in internal table?
*... Get the First Day Of the Month
CONCATENATE <id_sourcecalmont1> lc_day INTO ld_calday.
*... Calculate the Last Day Of the Month
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = ld_calday
IMPORTING
last_day_of_month = ld_calday
EXCEPTIONS
day_in_not_valid = 1
OTHERS = 2.
*... Get the Date to Salary Group using the employee and calday.
LOOP AT <it_tab_reference>
ASSIGNING <ls_str_reference>
WHERE /bic/emp_dspec = <id_sourcefield1> AND
datefrom LE ld_calday AND
dateto GE ld_calday.
ENDLOOP.
IF sy-subrc EQ 0.
GET REFERENCE OF <ls_tab_reference> INTO ls_outtab_reference.
ENDIF.
ENDIF. " it_zhrbi_th_emp_dspec[] IS NOT INITIAL
Thanks in advance,
Sunil
Hi,
As stated in the Help :
Dynamic specification of a component through bracketed character-type data objects is not possible.
Since it is possible through READ TABLE statement, I would advise changing your LOOP logic by a DO. READ TABLE ... ENDDO one. (not very pleasant but not much choice, isn't it?)
Best regards,
Guilllaume
Similar Messages
-
Hi All,
I have written the code, for greater than (GJAHR) 2007 and restricted company codes ( table name = ZGLCCODE).
Here I have written the following the code which is giving an error
In "LOOP ... WHERE ..." the line type of the table must be statically defin
ZGLCCODE Contains only restricted company codes.
Code is as follows
TABLES : ZGLCCODE.
DATA : LT_DATAPACKAGE TYPE TABLE OF DTFIGL_4.
DATA : LS_PACKAGE TYPE DTFIGL_4.
TYPES: BEGIN OF LS_TZGLCCODE,
ZBUKRS type BUKRS,
END OF LS_TZGLCCODE.
DATA : LT_ITZGLCCODE TYPE LS_TZGLCCODE OCCURS 0 WITH HEADER LINE.
DATA : LI_NUM TYPE I,
LC_ZGJAHR TYPE BSEG-GJAHR VALUE '2007'.
SELECT ZBUKRS INTO TABLE LT_ITZGLCCODE FROM ZGLCCODE.
Note: "C_T_DATA" dynamic structure = "DTFIGL_4" structure
*- Remove from the DataSource Company Code -
LOOP AT C_T_DATA INTO LS_PACKAGE WHERE GJAHR GE '2007'.
READ TABLE LT_ITZGLCCODE WITH KEY ZBUKRS = LS_PACKAGE-BUKRS.
IF SY-SUBRC <> 0.
APPEND LS_PACKAGE TO LT_DATAPACKAGE.
ENDIF.
CLEAR LS_PACKAGE.
ENDLOOP.
IF LT_DATAPACKAGE[] IS NOT INITIAL.
DESCRIBE TABLE LT_DATAPACKAGE LINES LI_NUM.
IF LI_NUM GT 0.
REFRESH C_T_DATA.
APPEND LINES OF LT_DATAPACKAGE TO C_T_DATA.
REFRESH LT_DATAPACKAGE.
FREE LT_DATAPACKAGE.
endif.
ELSE.
REFRESH C_T_DATA.
ENDIF.
Please give me your valuable suggestions.
Thanks
Ganesh Reddy.Hi Ganesh,
whatever you do, you can try like this:
1 - any code posted should be wrapped in \
then try something like this:
field-symbols:
<tabrec> type any,
<field> type any.
sort ITZGLCCODE by bukrs.
LOOP AT C_T_DATA ASSIGNING <tabrec>.
ASSIGN component 'GJAHR' of structure <tabrec> to <field>.
check <field> <= 2007.
ASSIGN component 'BUKRS' of structure <tabrec> to <field>.
READ TABLE LT_ITZGLCCODE WITH KEY ZBUKRS = <field>
BINARY SEARCH TRANSPORTING NO FIELDS. "speed up the volume.
IF SY-SUBRC 0.
MOVE-CORRESPONDING <tabrec> to LS_PACKAGE.
APPEND LS_PACKAGE TO LT_DATAPACKAGE.
ENDIF.
ENDLOOP.
Regards,
Clemens -
The row structure of the table BANFTAB is incorrect
Dear Experts,
I get right here the error message
The row structure of the table BANFTAB is incorrect
ZBANFN is a table type and has the line tab BANFN.
Can you pls tell me what is wrong here ?
FUNCTION Z_CHANGE_EBAKZ_FLAG.
*"*"Lokale Schnittstelle:
*" CHANGING
*" VALUE(BANFTAB) TYPE ZBANFN
data lt_eban type table of eban.
data ls_eban type eban.
SELECT * FROM eban into table lt_eban where BANFN IN BANFTAB AND EBAKZ EQ 'X'.
IF SY-SUBRC IS INITIAL.
LOOP AT lt_eban INTO ls_eban .
ls_eban-EBAKZ = ' '.
modify eban from ls_eban.
ENDLOOP.
ENDIF.
ENDFUNCTION.Hello,
You have to use a ranges table in this case.
FUNCTION Z_CHANGE_EBAKZ_FLAG.
*"*"Lokale Schnittstelle:
*" CHANGING
*" VALUE(BANFTAB) TYPE ZBANFN
data:lt_eban type table of eban.
data:ls_eban type eban.
data:
l_r_banfn type range of banfn,
l_wa_banfn like line of l_r_banfn,
l_wa_banftab like likne of BANFTAB.
loop at banftab into l_wa_banftab.
l_wa_banfn-sign = 'I'.
l_wa_banfn-option = 'EQ'.
l_wa_banfn-low = l_wa_banftab-banfn.
append l_wa_banfn into l_r_banfn.
clear l_wa_banfn.
endloop.
SELECT * FROM eban into table lt_eban
where
BANFN IN L_R_BANFN "BANFN IN BANFTAB
AND EBAKZ EQ 'X'.
IF SY-SUBRC IS INITIAL.
LOOP AT lt_eban INTO ls_eban .
ls_eban-EBAKZ = ' '.
modify eban from ls_eban.
ENDLOOP.
ENDIF.
ENDFUNCTION.
or you can use FOR ALL ENTRIES :
FUNCTION Z_CHANGE_EBAKZ_FLAG.
*"*"Lokale Schnittstelle:
*" CHANGING
*" VALUE(BANFTAB) TYPE ZBANFN
data lt_eban type table of eban.
data ls_eban type eban.
SELECT * FROM eban into table lt_eban
FOR ALL ENTRIES IN BANFTAB "--> Add this
where BANFN = BANFTAB-BANFN
AND EBAKZ EQ 'X'.
IF SY-SUBRC IS INITIAL.
LOOP AT lt_eban INTO ls_eban .
ls_eban-EBAKZ = ' '.
modify eban from ls_eban.
ENDLOOP.
ENDIF.
ENDFUNCTION.
Try this & let me know in case of any issues.
BR,
Suhas
Edited by: Suhas Saha on Feb 10, 2009 5:43 PM -
Procudure to count all the rows in a all tables in the schema
When I run the following store procedure to count all the rows in all the tables I crash my sql Plus editor:
CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT(OWNER IN varchar2)
IS
row_count number;
cursor get_tab is
select table_name, num_rows
from all_tables
where owner='MAXDEV';
begin
dbms_output.put_line('Checking Record Counts for schema maxdev ');
FOR get_tab_rec IN get_tab LOOP
BEGIN
EXECUTE IMMEDIATE 'select count(*) from '||get_tab_rec.table_name
INTO row_count;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Error counting rows for table '
||get_tab_rec.table_name);
END;
END LOOP;
END;
What am I doing wrong.
Thanks for any help TonyThe boss gave me 5 pages of tables and wants to know how many row there are in each table. There is a problem of one DB being out of sync with another.
But I have managed to work the problem though.
here is the working code:
CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT (
TableOwner IN varchar2)
IS
row_count number;
vTable varchar2(30);
v_sqlstmt varchar2(100);
cursor get_tab is
select table_name, num_rows
from all_tables
where owner = TableOwner;
begin
dbms_output.put_line('Checking Record Counts for schema maxdev ');
FOR get_tab_rec IN get_tab LOOP
vTable := get_tab_rec.table_name;
v_sqlstmt := 'SELECT count(*) from '||vTable;
EXECUTE IMMEDIATE v_sqlstmt into row_count;
dbms_output.put_line('Table '|| get_tab_rec.table_name || ' Row ' || row_count);
END LOOP;
END; -
How to display the rows dynamically in the table display in web dynpro abap
Hi experts,
There is a visible row count tab where you can give the no of rows to be displayed in the output table, but i want it to be done dynamically as the row count of my table may change dynamically at runtime.
And i want to know how to reduce the width of a column as my table display is taking the length as per the binded table specifications.Can anyone please help me out in this issue.
Thanks in advance,
Anita.Hi Anita
You can bind the visiblerowcount property to the a context attribute. and at runtime you can set the context attribute to the no of rows you want in your table,
Regards
Naresh -
Modify the Field Type of standard Table fields in a Query
Hello. I have a question.
Is there a way to "modify" the field type for standard table fields that are included in a Query?
I made a simple query out of a join of tables, but several fields have a lot of decimals, and I would like to present them in the query without any decimals, just as a regular "N" field.
I tried the possibility of creating extra local fields where all I do is transfer the value to the new "N" field, but I have many fields like this, so if there's a better way; I'd prefer that.
Maybe somewhere in the InfoSet there's a way to modify the type of the standard table fields?
Thank you.Hi,
This document may help you out.
[http://help.sap.com/saphelp_erp60_sp/helpdata/en/d2/cb4468455611d189710000e8322d00/frameset.htm|http://help.sap.com/saphelp_erp60_sp/helpdata/en/d2/cb4468455611d189710000e8322d00/frameset.htm]
Cheers, -
Create an internal table with the rows of another internal table.
Hi I want to know if posible to create an internal table structure with the rows of another internal table?
ex.
If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third.
Now I want that the structure of my internal table be: first, second, thirdHi,
If you do this way then what will be the difference between the two table anyway?? First internal table has the same structure irrespective of which row you select. and you are going to store the data from each row to the rows of the second internal table. In that case, the structure of the internal table is the same as first table. and it would have same rows.
Am I missing something here? or you want to declare the internal table with each field being the structure of the first table? In this case you'd have to do a dynamic declaration of data as the first table can have any no of rows then the second table would have any no of fields in the structure.
Now if you know that your first internal table is going to have a fixed no of rows eg 3 rows then it becomes simple. Do the following then
Data: begin of second_table occurs 0,
first type <first_table type>,
second type <first_table type>,
third type <first_table type>,
end of second_table.
Regards
Prasenjit -
How to computer the row size of a table
Hi
How can i compute the row size of a table. My general Idea is
create table emp(
empno number(4),
ename varchar2(10),
hire_date date,
update_yn timestamp);
the character set is UFT8
how can i compute the size of this table
thanksHi,
for Avg. row length see this
SQL> desc dba_tables
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
TABLE_NAME NOT NULL VARCHAR2(30)
TABLESPACE_NAME VARCHAR2(30)
CLUSTER_NAME VARCHAR2(30)
IOT_NAME VARCHAR2(30)
PCT_FREE NUMBER
PCT_USED NUMBER
INI_TRANS NUMBER
MAX_TRANS NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENTS NUMBER
MAX_EXTENTS NUMBER
PCT_INCREASE NUMBER
FREELISTS NUMBER
FREELIST_GROUPS NUMBER
LOGGING VARCHAR2(3)
BACKED_UP VARCHAR2(1)
NUM_ROWS NUMBER
BLOCKS NUMBER
EMPTY_BLOCKS NUMBER
AVG_SPACE NUMBER
CHAIN_CNT NUMBER
AVG_ROW_LEN NUMBER
AVG_SPACE_FREELIST_BLOCKS NUMBER
NUM_FREELIST_BLOCKS NUMBER
DEGREE VARCHAR2(10)
INSTANCES VARCHAR2(10)
CACHE VARCHAR2(5)
TABLE_LOCK VARCHAR2(8)
SAMPLE_SIZE NUMBER
LAST_ANALYZED DATE
PARTITIONED VARCHAR2(3)
IOT_TYPE VARCHAR2(12)
TEMPORARY VARCHAR2(1)
SECONDARY VARCHAR2(1)
NESTED VARCHAR2(3)
BUFFER_POOL VARCHAR2(7)
ROW_MOVEMENT VARCHAR2(8)
GLOBAL_STATS VARCHAR2(3)
USER_STATS VARCHAR2(3)
DURATION VARCHAR2(15)
SKIP_CORRUPT VARCHAR2(8)
MONITORING VARCHAR2(3)
CLUSTER_OWNER VARCHAR2(30)
DEPENDENCIES VARCHAR2(8)
SQL> Regards! -
How to increase the row height of the table in the smartform
Hi,
Can any one say,
How to increase the row height of the table in the smartform.
It is presently show the row width very small, i want to increase the row with of the table in the smartform.
Plase say how can we increase the row height in the smartform.Hi Ravi,
In Smartforms , Select the Table and you can adjust the cell hieghts in OUTPUT OPTIONs TAB.
Reward points if that Helps.
Manish -
How to change the data type in the table ESLL for the field USERF2_NUM ?
Hello Friends,
I have a requirement in which one of the change is to convert the data type of the field 'USERF2_NUM' in the table 'ESLL' from 'QUAN' to 'CHAR'.
How do i do it if i have an access to change it..........i think i should also check the impact of the change if done.
Kindly tell me as my requirement starts with this small change.
Regards,
Rajesh KumarThanks for the reply Sowmya.
I would like to know 2 things.
1. Is it ok to change the data type of the field 'USERF2_NUM ' which is in the table ESLL. from quan to char.
2. The table ESLL already has entries. if we change the data type from QUAN to CHAR what is the effect on the existing entries of the table .
Kindly reply me back.
Thanks & Regards,
Rajesh Kumar -
In the attached VI why does one loop coerce the data type while the other doesn't?
In the attached VI why does one loop coerce the data type while the other doesn't?
Solved!
Go to Solution.
Attachments:
AAA.vi 8 KBI'm guessing you created the Enum on the front panel. If you right-click it and create an indicator, it will match the type, and be an enum. LabVIEW represents enums as U16, but because the types aren't identical (for example, your enum has 3 values, but a U16 has 65,536 values), LabVIEW automatically coerces (or converts) the smaller (enum) representation into the larger (U16) value.
-
How to Find the Data Type of the Field In a Database Table
Hi Experts,
I'm currently working on a program which needs to find out the data type of the given field in a database table. In addition to accessing DD03L directly, is there any other workaround such as function module to help me achieve this? It would be helpful if a demo example could be provided.
Thanks a lot.Hi,
Use this..
DESCRIBE FIELD dobj TYPE typ.
write typ.
type will contain the data type of the object.
and check this thread also....
Re: How to get datatype of fields in dynamic structures
Cheers,
Simha.
Reward all the helpful answers.. -
How to get the row count of a Table DATA?
Hi,
In my Adobe form layout, I have a Table node which is bound to an internal table. Now at runtime, I want to determine the number of rows that the internal table has, i.e the row count of the DATA node of the Table. How will I be able to determine the no. of rows of the internal table at runtime using Javascript? I am not being able to find any suitable answer in this forum. Please suggest. Thanks in advance.Hi,
If you bind the interactive form table to the internal table and specify some properties, the table will vary its row size according to the number of data available in the internal table.
You have to wrap the table in a sub form, check 'allow page break with contents' and property 'flowed'.
the table will automatically increase its row size...
Is this the reason for which you wanted for the row count..?
If so, this will help you..
Regards.
Surya -
How to get the line type of a table type
Hi,
i want to indetify the line type of a table type dynamically in my program. how to do?
For example:
data: lv_ttype type type ROLLNAME value 'PRXCTRLTAB'.
how to identify line type of lv_ttype in the program.
Thanks,
johnney.Hello Johnney,
try like this...
types: begin of ty_itab,
matnr like mara-matnr,
werks like marc-werks,
maktx like makt-maktx,
end of g_t_itab.
data: g_t_itab type table of ty_itab.
data: <b>wa_itab like line of g_t_itab.</b> " This is line type... so called work area.
Reward If Helpful.
Regards
Sasidhar Reddy Matli. -
The area at the top of Tab bar where i would type in the webpage is gone, how do i get it back
the area at the top of Tab bar where i would type in the webpage is gone, how do i get it back?
MacBook Pro, Mac OS X (10.7.4) < your profile
If that is correct, updating your system software may help the Safari toolbar issue.
Click Software Update from your Apple menu OR open System Preferences > Software Update > Check Now
Restart your Mac after the updates are installed then try Safari.
If your software is actually up to date, from the Safari menu bar click Safari > Preferences then select the Extensions tab.
If you have any extensions installed, turn that OFF, quit and relaunch Safari to test.
If the address bar reappears, uninstall one extension at a time, quit and reluanch Safari to test until you find the one that's blocking the address bar.
Maybe you are looking for
-
Hi, I have already checked to see that I meet the requirements in the instructions (and answers on similar questions). I am using a CD direct from Apple of the software (a copy of a 10.6.4 CD). Yet the install CD says it can't be installed on my comp
-
Hello Sir, I want to create the wage type for advance loan.Can you please suggest me where i can create the wage type for advance loan.Please provide the configuration path for this. After the advance loan will be created it will be updated in offcyc
-
Tip: How to read "eBooks"
I would love to see either Apple or a third-party developer provide a decent eBook reader application, but until that happens there is a pretty good workaround: Email yourself the file and use the new Mail application to view it. I use Gmail, so sett
-
Why Data Pump tool cannot get in?
Why Data Pump tool cannot get in? [oracle@hostp ~]$ impdp Import: Release 10.2.0.1.0 - Production on Thursday, 18 September, 2008 22:30:05 Copyright (c) 2003, 2005, Oracle. All rights reserved. Username: system Password: UDI-00008: operation generate
-
Transferring music from flash drive
My old laptop died but luckily my hard drive was intact so I was able to transfer my itunes to a flash drive. Now that I have a new computer, how do i transfer music from flash drive to itunes on my new computer (windows)?