Append to internal table
Dear All!
Please can you check what is wrong on appending
of internal table III_YMMM_TBL74.
It's going to be overwriting always.
All what I want to do is populating
III_YMMM_TBL74 while is condition
if sy-subrc = 0 AND linp > 1.
is complied
*CODE
TYPES: BEGIN OF YMMM,
MATNR LIKE YMMM_TBL74-MATNR,
VORG_NR LIKE YMMM_TBL74-VORG_NR,
LIFNR LIKE YMMM_TBL74-LIFNR,
NAME1 LIKE YMMM_TBL74-NAME1,
UNGUEL_AB LIKE YMMM_TBL74-UNGUEL_AB,
GUEL_AB LIKE YMMM_TBL74-GUEL_AB,
GUEL_BI LIKE YMMM_TBL74-GUEL_BI,
END OF YMMM.
data I_YMMM_TBL74 type YMMM occurs 0 with header line.
data II_YMMM_TBL74 type YMMM occurs 0 with header line.
data III_YMMM_TBL74 type YMMM occurs 0 with header line.
select * from YMMM_TBL74
INTO CORRESPONDING FIELDS OF table I_YMMM_TBL74.
sort I_YMMM_TBL74 by matnr.
DELETE ADJACENT DUPLICATES FROM I_YMMM_TBL74 COMPARING matnr.
data: linp type i,
fin type i,
rin type i.
LOOP AT I_YMMM_TBL74.
select * from YMMM_TBL74
INTO CORRESPONDING FIELDS OF table II_YMMM_TBL74
WHERE MATNR = I_YMMM_TBL74-MATNR .
DESCRIBE TABLE II_YMMM_TBL74 lines linp .
DESCRIBE TABLE I_YMMM_TBL74 lines fin .
if sy-subrc = 0 AND linp > 1.
III_YMMM_TBL74[] = II_YMMM_TBL74[].
append III_YMMM_TBL74[].
endif.
ENDLOOP.
write:/ ''.
Hi,
Since you have already moved using the = statement with the body operator..You don't have use APPEND again..Just comment the append ..
III_YMMM_TBL74[] = II_YMMM_TBL74[].
*<b>append III_YMMM_TBL74[].</b>
Thanks,
Naren
Similar Messages
-
Effect of appending standard internal table to hashed one ?
hi,
in my main program i have an internal table called NAST which is hashed. i call a function module which returns an internal table called xNAST, whose records i append to NAST. since i dealt with TABLES tab of FM, i had to receive this xNAST of type standard table (and not hashed).
i appended the lines of xNAST to NAST using INSERT statement.
Now at one point, i have a statement,
READ TABLE *nast INTO *xxx WITH KEY mmm = '100'.
so when i inserted the records into NAST from xNAST, they r automatically hashed, right ? and this statement will work without any issues ?
thksHello,
WITH KEY
For hashed tables, the hash algorithm is used if the specified search key includes the table key. Otherwise the search is linear. The addition BINARY SEARCH is not permitted for hashed tables.
Alternative
WITH TABLE KEY
Effect:
Each component of the table key must listed either directly as comp_name1 comp_name2 ..., or as a bracketed character-type data object name1 name2 ..., which contains the name of the component when the statement is executed (before release 6.10 in upper case). If name contains spaces only, this component specification is ignored when the statement is executed. A data object must be assigned to each component, which is compatible with or can be converted to the data type of the component. The first found line of the table is read, for which the values in the columns of the table key match the values in the assigned data objects dobj1 dobj2 .... If necessary, the content of dobj1 dobj2 ... is converted to the data type of the component before the comparison.
The different table types are accessed as follows:
standard tables are searched using a linear search.
sorted tables are searched using a binary search.
For hashed tables, the hash algorithm is used.
Regards. -
hello friends,
I have two internal tables of different structure.
i have filled those two internal tables using join statements.
But one field is common in both the tables, when i try to append both tables into another new internal table.
i cant get the value for the 2nd tables field.
EX.
vbeln is common in vbuk, vbup, vbap, vbak, likp, lips.
but its sale order number in vbak, vbap.
delivery document in likp,lips.
vbup has both sales order and delivery in the vbeln field.
so, i made a join to between vbak, vbup and lips to see the goods movement status in vbup.
for that the vbeln should be delievery number.
and in other table, i have added vbup and vbak and vbep to get the delievery status.
for that the vbeln should be sale order no.
when i append both the tables into the third internal table that has the structure of both internal tables.
i could not get the vbeln of the second table(sale order no) in the third table.
help me guys.
rewards for helpful solutions.hello,
types:
begin of str,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
end of str.
types:
begin of st1,
lfstk like vbuk-vbeln,
end of st1.
types:
begin of st2,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
lfstk like vbuk-lfstk,
end of st2.
selection-screen: s_order for vbak-vbeln,
s_div for vbak-vtweg.
data: it type table of st with header line,
it1 type table of st1 with header line,
it2 type table of st2 with header line.
select vbeln vkorg vtweg from vbak into table it
where vbeln in s_order and
vkorg in s_div.
select lfstk from vbuk into table it1 for all entries in it
where vbeln = it-vbeln.
it2[] = it[].
append it1-lfstk into it2[].
or
move-corresponding it1 to it2.
" when i execute this code with a grid or list display, i m not able to get the values or entries for the 2nd table it1.
the it2 has the lfstk cloumn blank in the final display.
help me for a remedy.
rewards for useful suggestion. -
HI BW Experts,
MONITOR.
MONITOR-msgno = '005'.
MONITOR-msgid = 'SDBW'.
MONITOR-msgty = c_msgty_e
Above programme in 3.5 version no errors has came while wrote in routine,
That error was coming in 7.0 version .Please give me advise,how to do it? That error message like "MONITOR" is a table without a header line and therefore has no component called "MSGNO".
Regards
Ramana Reddy.I am not 100% certain about your requirement but the below logic/code to help you.
itab -->has the data for multiple ship account.
loop at itab.
move itab-shipacc to itab1-shipacc.
append itab1.
move itab-shipacc to itab2-shipacc.
append itab2.
move itab-shipacc to itab3-shipacc.
move itab-qty to itab3-qty.
collect itab3.
endloop.
In the above code, itab1 and itab2 would have records for multiple shipacc while itab3 would have only one record for each shipacc and you can collect the other values. Make sure to define itab3 with shipacc as the first field and a quantity/value(pack numeric field) as the second.
Regards
Anurag -
Maximun no of data stored in a internal table
Hello experts,
I need two things,
Maximum no of data can be stored to an internal table, as per my knowledge it probably max 2 GB, and the number of records
depends on the table line type also.
Can anyone give any tentaive maximum no ?
again i need to store them in application server,what is the maximum no of records which can be downloaded to application server.
I guess in both cases (max data append to internal table and stored in application server) 50 lakhs 5 million should work.
Actually we will have to run the job anf it will contain huge data, so we can noy just check by changing no of limit.
It will be helpful for us if it can be exceeded more than 50 lakhs 5 million also.
If anyone can give some idea, it will really help us a lot.
Edited by: Thomas Zloch on Mar 7, 2012You can get a good overview over the available memory in transaction RZ10, choose your instance profile, then "basic maintenance" and "memory management". Read the F1 help of the various parameters and consult your system administrator, as already suggested, also regarding available disk space on the application server, which should be much more, on average.
If you deal with large volumes of data, use block processing for filling your internal tables and writing to the app server, clear all tables before processing the next block, then you should stay well below your memory limits.
Thomas -
To create a deep structure for dynamic internal table.
Hello
My ALV has fields which are defined dynamically during execution.
so, i did it in the following way,
Declared Field symbolds, DREF and fieldcatalog as,
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
<fs_dyntable>.
DATA: dref_dyntab TYPE REF TO data,
dref_dynwa TYPE REF TO data.
DATA: ts_fieldcatalog TYPE lvc_t_fcat.
DATA: wa_fieldcatalog TYPE lvc_s_fcat.
Updated Fieldcatalog dynamically as,
*function module to read segment structure
CALL FUNCTION 'SEGMENT_READ'
EXPORTING
segmenttyp = v_segment_name
TABLES
segmentstructure = ts_seg_structure
EXCEPTIONS
no_authority = 1
segment_not_existing = 2
OTHERS = 3.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN '1'.
MESSAGE e024.
STOP.
WHEN '2'.
MESSAGE e025 WITH v_segment_name.
STOP.
WHEN OTHERS.
MESSAGE e023.
ENDCASE.
ENDIF.
*FETCH FIELDS FROM STRUCTURE OF SEGMENT AND CREATE FIELDCATALOG FOR
EACH FIELD OF SEGMENT (DYNAMIC FIELD CATALOG)
LOOP AT ts_seg_structure INTO wa_seg_structure.
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = wa_seg_structure-fieldname.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-ref_table = wa_seg_structure-segtyp.
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
ENDLOOP.
and generated dynamic internal table using fieldcatalog as,
*--Method to get the structure of table using fieldcatalog.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ts_fieldcatalog
IMPORTING
*--Variable of type REF TO DATA.
ep_table = dref_dyntab.
IF sy-subrc <> 0.
MESSAGE e023.
ENDIF.
*--Dynamic internal tables required when show segments selected
IF p_selseg IS NOT INITIAL.
ASSIGN dref_dyntab->* TO <t_dyntable>.
*--Create dynamic work area and assign to FS
CREATE DATA dref_dynwa LIKE LINE OF <t_dyntable>.
ASSIGN dref_dynwa->* TO <fs_dyntable>.
And then i populated this <t_dyntable> which is being passed as data-table to method
CL_GUI_ALV_GRID => SET_TABLE_FOR_FIRST_DISPLAY
for ALV grid Display along with above used filedcatalog ts_fieldcatalog.
Things are fine till here, but now i have the requirement to edit selected rows of the ALV display..
As you might be aware, we need a field
TS_STYLEROW TYPE lvc_t_styl, (i.e, a field of type 'h' and we can say as an internal table inside an internal table or else as a deep structure)
in the output internal table <t_dyntable> to meet our requirement.
My issue is about declaring one such field of type 'h' in this dynamically created internal table ''<t_dyntable>".
I tried in the following way by adding one such field to fieldcatalog :
*Field for Styling
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = 'TS_STYLEROW'.
wa_fieldcatalog-tabname = 'TS_STYLE'.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-no_out = 'X'.
wa_fieldcatalog-inttype = 'h'. " I even mentioned this
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
But this is creating a field of type 'C' in the table <t_dyntable> instead of what i was expecting
Guyz and respected,
Please advice me with the solution or ur ideas....
Note : The overall requirement is create a deep structure for dynamically generated internal table.
Your help is highly appreciated and unforgettable..!!!!!!!hi,
Dynamic append
Dynamic internal table
Dynamic internal table
dynamic columns in ALV
Variant for dynamic selection
thanks -
Accessing Global Internal Table in Field Routine Level
I am working on a transformation. I have created a Global Internal Table with the structure of my Source Target + extra fields not in my source target. In the start routine of the transformation I am first copying all corresponding fields from SOURCE_PACKAGE to internal table and then finally doing a lot of manipulations and modifying and appending the internal table with data now ready for populating to target.
I want to populate the target fields at field routine level by the data present in the Global internal table. Can you please tell me how to code here. If data was being read by SOURCE_PACKAGE, I would have read the value of SOURCE_FIELDS - (Value). But incase of value to be read from Global Internal Table, can I refer to the internal table work area directly. Thanks.
Global Internal Table - G_ITAB
Work Area - WA_G_ITAB
Is the below correct ?
Result = WA_G_ITAB-(Field Name).Let me understand this with an example as I am still not clear. Suppose I am loading to a DSO having 17 Key Fields say K1, K2, K3.........K17.
And if the 3.5x logic is
DATA : L1 LIKE COMM_STRUCTURE-amt.
CLEAR L1 .
IF COMM_STRUCTURE-CHK = '222'
OR COMM_STRUCTURE-CHK = '333' .
L1 = COMM_STRUCTURE-amt .
ENDIF.
RESULT = L1 .
Can you tell me the code of the above in BI7 at field level routine now. Please note I need to take data from G_ITAB internal table and that the DSO has 17 key fields? -
Hello,
in my program i can't fill and send contents of my internal table. my code looks like this:
TABLES:
MKPF,
MSEG.
TYPES: BEGIN OF ST_2,
F_1 LIKE MKPF-MANDT, " For MKPF~MANDT,
F_2 LIKE MKPF-MBLNR, " For MKPF~MBLNR,
etc
F_18 LIKE MSEG-ZEILE, " For MSEG~ZEILE,
F_19 LIKE MSEG-LINE_ID, " For MSEG~LINE_ID,
etc
END OF ST_2.
DATA: it_1 TYPE TABLE OF ST_2,
wa_it LIKE LINE OF it_1.
FORM get_data.
SELECT
MKPF~MANDT
MKPF~MBLNR
*etc
MSEG~ZEILE
MSEG~LINE_ID
*etc
INTO wa_it
FROM
MKPF AS MKPF
INNER JOIN
MSEG AS MSEG
ON MKPFMANDT = MSEGMANDT AND
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
WHERE
MKPF~CPUDT >= '20060301' AND
MSEG~BUKRS = 'M' AND
MSEG~BWART IN ('601', '602').
ENDSELECT.
so, where should i put:
INSERT wa_it INTO TABLE it_1.
CLEAR wa_it.
to append my internal table with data?
please help me!!!!Hi,
i`ve made the necessary changes to your code :
SELECT MKPFMANDT MKPFMBLNR MSEGZEILE MSEGLINE_ID
INTO wa_it FROM MKPF AS MKPF INNER JOIN MSEG AS MSEG
ON MKPFMANDT = MSEGMANDT AND
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
WHERE
MKPF~CPUDT >= '20060301' AND
MSEG~BUKRS = 'M' AND
MSEG~BWART IN ('601', '602').
<b>
append wa_it to it_it.
clear wa_it.
</b>
ENDSELECT.
reward points if helpful.
Regards -
Hi Experts,
I Have An issue while Appending into Internal table.
This is an outbound interface in which I have 7 different types of records. I am appending all the work area to an internal table with size 500 char. the problem is that the last field is blank in some records the spaces are trucated. I need those space at the end as that file will be encrypted and send.
Thanks in advance.
VijayHi Madhan,
Try below tricky code to get spaces.
DATA: BEGIN OF t_space OCCURS 0, " Data table
name(10) TYPE c,
dept(10) TYPE c,
last_fld(480) TYPE c, " Last field in data table, which you have to check
END OF t_space,
wa_space LIKE LINE OF t_space.
DATA: str_space TYPE string.
DATA: BEGIN OF t_final OCCURS 0, " Final table
text(500) TYPE c, " Single field with length 500 characters
END OF t_final,
wa_final LIKE LINE OF t_final.
"Below is tricky way to get ASCII value for space.
" Press ALT key and hold it and now press 255 in Numeric Keypad and now release ALT key.
"This is ASCII value for space
CONSTANTS: ascii_space VALUE ' '. " Give this space as mentioned in above line
wa_space-name = 'A'. wa_space-dept = 'IT'.
APPEND wa_space TO t_space.
wa_space-name = 'B'. wa_space-dept = 'CSE'.
APPEND wa_space TO t_space.
wa_space-name = 'C'. wa_space-dept = 'EEE'.
APPEND wa_space TO t_space.
wa_space-name = 'D'. wa_space-dept = 'ECE'.
APPEND wa_space TO t_space.
IF NOT t_space[] IS INITIAL.
DO 480 TIMES. " 480 times because it is length of the last_fld(480) in data table. Change it according to length of your last field
CONCATENATE str_space ascii_space INTO str_space.
ENDDO.
ENDIF.
LOOP AT t_space INTO wa_space.
CONCATENATE wa_space-name wa_space-dept INTO wa_final. "Concatenate all data fields into final workarea except final field
IF wa_space-last_fld IS INITIAL. " Check whether final field is empty
CONCATENATE wa_final str_space INTO wa_final. " Concatenate spaces at end of final work area
ENDIF.
APPEND wa_final TO t_final. " Append to Final table
ENDLOOP.
Hope you understand friend. -
How to append row in internal table for perticular condition
Hi,
I have 4 records in my internal table and i want to append row
after second row when condition will match.
please guide me.
thanks in advancs
regards
SNDhi,
using key word INDEX u can insert a record in aspecified position as
if internal table is with header line.
INSERT <internaltable> index SY_INDEX [or index no if u know where to insert]
with out header line.
INSERT <internaltable> FROM <workarea> index SY_INDEX [or index no if u know where to insert]
if condition is true.
insert itab index 2.
endif.
if helpful reward some points.
with regards,
Suresh.A -
How to append records between two internal tables
hi all,
im trying to append from an internal table to another internal table with same structure. i tried the following but it overwrites previous contents of i_dest:
move i_src to i_dest
thanks,
sidhey u try to move it record by record
<b>itab2 = itab.
append itab2.</b>
This should work I guess
just check the code below, if u want to move the whole itab into itab2 then use <b>itab2[] = itab.</b>
<b>loop at it_pgm.
read table itab with key obj_name = it_pgm-pgm_name.
if sy-subrc = 0.
itab_final-obj_name = itab-obj_name.
itab_final-func_spec = itab-func_spec.
itab_final-func_area = itab-func_area.
itab_final-dev_class = itab-dev_class.
append itab_final.
else.
itab_alt-pgm_name = it_pgm-pgm_name.
append itab_alt.
endif.</b>
please reward points if found helpful -
i m calling one FM inside the loop, this FM will return data in internal table. for each loop count i want to save this data to same other internal table, how to do that?
i want to append the one internal tables data to another internal table how to do that?
ThanksHi Lucky,
Refer this code :
LOOP AT I_TAB1.
CALL FUNCTION <FUNCTION NAME>
EXPORTING
IMPORTING
TABLES = I_TAB2.
APEEND LINES OF I_TAB2 to I_TAB3.
REFRESH I_TAB2.
ENDLOOP.
REWARD POINTS IF HELPFUL.
Regards,
Hemant -
Append a record to internal table
hello:
when i execute the code below,there is a runtime error." In die sortierte interne Tabelle (Typ SORTED_TABLE)
"PROGRAM=ZJOIN_INTER_TABLEDATA=T_ITAB1" sollte an
Position 1 eine Zeile eingefügt bzw. geändert werden.
Dadurch wurde die für die Tabelle durch ihren Schlüssel festgelegte
Sortierreihenfolge zerstört."
how can i resolve it?which one can tell me?Thanks very much
REPORT ZJOIN_INTER_TABLE.
DATA:BEGIN OF WA_ITAB,
COL1 TYPE I,
COL2(10) TYPE C,
END OF WA_ITAB.
DATA:T_ITAB1 LIKE SORTED TABLE OF WA_ITAB WITH NON-UNIQUE KEY COL1.
WA_ITAB-COL1 = 10.
WA_ITAB-COL2 = 'col2'.
APPEND WA_ITAB TO T_ITAB1.
WA_ITAB-COL1 = 9.
WA_ITAB-COL2 = 'col2'.
APPEND WA_ITAB TO T_ITAB1.hi
kindly go thro the lines.
syntax:
DATA itab {TYPE tabkind OF linetype|LIKE tabkind OF lineobj}
WITH [UNIQUE|NON-UNIQUE] keydef
[INITIAL SIZE n] [WITH HEADER LINE].
The system creates an internal table with table type tabkind. Since there is no generic field definition, you cannot use the table types ANY TABLE or SORTED TABLE.
The construction of the table lines is defined by linetype (if you are using a TYPE reference) or by the type of the referred object lineobj (if you are using a LIKE reference). If you specify the line type, you can also use REF TO to refer to a reference type.
The same rules apply to UNIQUE and NON-UNIQUE as apply to the TYPES definition. You may only omit this specification with standard tables.
If you do not specify an INITIAL SIZE, the system assumes a default value of INITIAL SIZE 0.
i think now u r clear... now yr code will work.
DATA:BEGIN OF WA_ITAB,
COL1 TYPE I,
COL2(10) TYPE C,
END OF WA_ITAB.
DATA:T_ITAB1 like TABLE OF WA_ITAB WITH NON-UNIQUE KEY COL1.
WA_ITAB-COL1 = 10.
WA_ITAB-COL2 = 'col2'.
APPEND WA_ITAB TO T_ITAB1.
WA_ITAB-COL1 = 9.
WA_ITAB-COL2 = 'col2'.
APPEND WA_ITAB TO T_ITAB1. -
Appending All the fields of one internal table to other
Hi,
while running a FM I get three internal tables, my requirement is that I am running this FM at item level if it is possible to append all the tables datas get as a result of this FM to other internal table having same structure.
I know it is possible while using loop, I need a solution with out using the loop
Regards
NausalMove Itab1[] to itab2[].
data: begin of itab occurs 0,
Maktx LIKE MAKT-MAKTX,
end of itab.
data: begin of itab1 occurs 0,
Maktx LIKE MAKT-MAKTX,
end of itab1.
select maktx from makt into table itab where maktx like 'M1%'.
move itab[] to itab1[].
loop at itab1.
write:/ itab1-maktx.
endloop. -
Append two structures in an internal table.
hi,
if i join two tables by innerjoining will it effect the performance?If such,how i can join these with better performance?can i get the data from different tables in a single internal table by appending different structures in this case?Please answer me.If inner Join has a performance issue the best thing u can do is...
Create 3 int tables. "This is to avoid 'INTO CORRESPONDING FIELDS' select query which will affect performance.
itab1 with the structure of table1
itab2 with the structure of table2
itab3 with the structure of table1 & table2
Select from 1st table into itab1.
if itab1 is not initial.
select from table 2 into itab2 for all entries in itab1 where field = itab1-field.
sort itab2 by field. "For binary search
loop itab1.
move-corresponding itab1 to itab3.
read itab2 with key field = itab1-field binary search.
move-corresponding itab2 to itab3.
append itab3.
endloop.
Regards
Sathar
Edited by: Sathar RA on Sep 8, 2008 9:10 AM
Maybe you are looking for
-
Laptop kernel error while updating Nokia Asha200 t...
My phone is Asha 200. The Nokia suite version is 3.8.30. Laptop is Windows8. I start the Nokia suite on laptop and then connect the phone via USB. The phone gets recognized and there is the software update also available. I start the update process.
-
Tcode to see Prev Maint order in PP
Hi, PP WC is used in Eq Master. Prev Maint order is created with sys condition as 0 as per scheduling 1.In which Tcode i've to see whether this WC is blocked for the period as per Maint order 2. In which Tcode i've to see Prev Maint order in PP Kindl
-
When will Nike + Ipod Kit be available in Denmark?
When will Nike + Ipod Kit be available in Denmark? Anyone know? Thanks
-
Symbian belle & Tamil font update for c6-00
Is this phone compat for update sym belle and tamil font Solved! Go to Solution.
-
Form content saved but no longer visible
I am having an issue similar to a previously reported issue with form content, but not the same. I have created a form in Acrobat 10. I filled it out in Acrobat 10. I saved from Acrobat 10 I have viewed it several times in Acrobat 10. I printed