Checking of internal tables
hi all,
I have two internal tables and I want to check whether the data present in both the
internal tables is same or not.
how to do that.
Thanks,
Satish.
if itab1[] = itab2[].
~Suresh
Similar Messages
-
How to check two internal table fields
Hi all,
I need to check two internal table fields are equal or not means which statement i can use.
Not internal table ,table contents i need to check i.e
it1-pernr = it2-pernr.
like this
if i put loop it'll check one table field for one loop.
if i put two loop means some fields reflecting 2 in it1 then it'll pring 4 times like that.i want to print whatever in internal table only .
pernr(0001) two times there in it1 means
it1-pernr = it2-pernr then
it's printing
0001
0001
0001
0001
like this but actually in it1 only two records.
Anybody know solution.tell me.
Thanks
Regards,
NandhaHi,
code for your view
data : begin of it1 occurs 0,
z_pernr like pa9012-pernr,
z_fac_c like pa9012-zz_fac_c,
end of it1.
data : it2 like Zsc1 occurs 0 with header line,
It1 data
pernr FAC C
0001 5555
0001 5555
0002 4444
0003 3333
0006 8888
It2 data
pernr FAC C
0001 5555
0001 5555
0005 6666
0003 3333
output(My code)
loop at it2 .
loop at it1 where pernr = it2-pernr.
write:/01 it1-1pernr,
10 it1-z_fac_c.
endloop.
endloop.
out put i need.
0001 5555
0001 5555
0002 4444
0003 3333
Thanks,
Nandha -
Extended Program check for internal table
TYPES:BEGIN OF TY_FINAL,
VBELN TYPE VBAP-VBELN,
VBELV TYPE VBAP-VBELV,
POSNV TYPE VBAP-POSNV,
WERKS TYPE VBAP-WERKS,
ZZ_MODEL_NO TYPE VBAP-ZZ_MODEL_NO,
VKORG TYPE VBAK-VKORG,
TEXT(70) TYPE C,
END OF TY_FINAL.
Declaration of Variables *
DATA: IT_VBAK TYPE STANDARD TABLE OF TY_VBAK ,
IT_VBAP TYPE STANDARD TABLE OF TY_VBAP ,
IT_FINAL TYPE STANDARD TABLE OF TY_FINAL WITH HEADER LINE.
DATA: W_VBAK TYPE TY_VBAK ,
W_VBAP TYPE TY_VBAP ,
W_FINAL TYPE TY_FINAL ,
W_LAYOUT TYPE SLIS_LAYOUT_ALV ,
W_VARIANT_SAVE TYPE C ,
W_REPID TYPE SY-REPID .
In the above code i have declared IT_FINAL TYPE STANDARD TABLE OF TY_FINAL WITH HEADER LINE. in extended program check iam getting error as( Tables with headers are no longer supported in the OO context.
can any one plz suggest me to avoid this error.
Thanks in Advance.
Moderator message - Duplicate post locked
Edited by: Rob Burbank on May 19, 2009 9:12 AMHi,
DATA: IT_VBAK TYPE STANDARD TABLE OF TY_VBAK ,
IT_VBAP TYPE STANDARD TABLE OF TY_VBAP ,
" If you declare the internal table with header line in OO context it wll give you error. As OO wil not
" support the header line concept. Declare Internal table without header line and create the work area
" for the internal table
IT_FINAL TYPE STANDARD TABLE OF TY_FINAL. " WITH HEADER LINE.
DATA: W_VBAK TYPE TY_VBAK ,
W_VBAP TYPE TY_VBAP ,
W_FINAL TYPE TY_FINAL , " Use this work area
W_LAYOUT TYPE SLIS_LAYOUT_ALV ,
W_VARIANT_SAVE TYPE C ,
W_REPID TYPE SY-REPID -
How to check if internal table exists in dynamical called subroutine ?
Hi,
in a dynamically called subroutine i'm using a internal table, but in some calls this table is not exist.
How can i check in the code whether the internal table exist or not ?
regards,
HansIn Horst Keller's blog /people/horst.keller/blog/2005/05/27/abap-geek-10--everything-functions-150-but-how my issue is talked about :
All other parameters are handled in a way as they were declared as global data objects in the top include of the function group, that can be used only during the execution of the function module: They are visible throughout the function group but you can access them only while the function module is active. If you access such a parameter and the respective function module is not executed, you get the runtime error GETWA_NOT_ASSIGNED (Why? Well, technically thos guys are represented via field symbols which are valid only during the runtime of the function module).
The code is in SD pricing. Sometimes the code is called from function module PRICING_BUILD_XKOMV or PRICING_SUBSCREEN_PBO where TKOMV is defined as globalized parameter.
And sometimes it is called from function module PRCING_CHECK where TKOMV is NOT defined as parameter.
In the call of last function the dump occures on the ASSIGN statement :
data: ls_tkomv like line of tkomv,
lv_tablename(30) type c value 'TKOMV[]'.
field-symbols: <lfs> type any table.
assign (lv_tablename) to <lfs>.
if <lfs> is assigned.
Any suggestions to solve the issue ?
regards,
Hans -
Check an internal table is initial or not..
Hello experts,
I need to check whether an internal table is initial or not in AMDP.....
Lets say i have an internal table IT_TAB[].
I need a statement similar to IT_TAB[] IS NOT INITIAL (in ABAP)
I already tried with COUNT(*), but it returns me an internal table with a column name COUNT with the total number of entries and found it not useful.
Thanks in Advance,
RameshWell do it by below way.
DECLARE LV_LINE VARCHAR(3);
SELECT COUNT(*) INTO LV_LINE FROM :IT_TAB;
Regards,
Amol -
Where I can check the internal table memory that have the system?
Hi
I have some jobs that cancel with this error: No storage space available for extending an internal table.
Where I can check the amount of space memory that have the system and if I can resolve this problem if I put a commit work or something like that?
The dump stop when I make a import:
IMPORT TIMES DHIST3 SUM3 FROM DATABASE MONI(DB) ID MONIKEY.
Thanks for the help!hi,
goto:
sm04 - goto- memory
A.
Message was edited by:
Andreas Mann -
hi all,
I have to check an internal table data(it_tab)
It holds records like
A B C D E F
325 1 1 512 0 0010
325 1 1 548 36 0010
325 1 1 554 42 0010
325 2 2 512 0 0011
325 2 2 548 36 0011
325 2 2 554 42 0011
325 3 3 512 0 0012
325 3 3 554 42 0012
800 3 1 512 0 0011
800 3 1 530 18 0011
800 4 2 512 0 0012
800 4 2 532 20 0012
800 4 2 533 21 0012
800 4 2 538 26 0012
800 4 2 556 44 0012
800 5 3 512 0 0013
800 5 3 532 20 0013
800 5 3 538 26 0013
800 5 3 556 44 0013
I have to check whether the number generated in D is increasing one by one
for eg D : 512, 513, 514,...
Here it is not in the sequence
So i need to check whther it is in sequence if not so i should delete the record
Could you suggest the way to check the in_tab?
Regards
senthilHi,
Try the follwoing:
You just need to use AT NEW control break after the loop statement.
DATA: Var1(5) TYPE n.
DATA: Var2(5) TYPE n.
DATA: Count(5) TYPE n.
DATA: it_tab2 type table of it_tab.
clear: count.
LOOP at it_tab.
AT NEW a
Clear: count, Var1, Var2.
Count = Count + 1.
IF Count >= 2.
var2 = it_tab-D.
If var2 = var1 + 1.
append it_tab to it_tab2.
endif.
endif.
var1 = it_tab-D.
ENDAT
Endloop.
Reward points if helpful answer.
Ashvender -
Data is not coming in internal table
Hello Abapers,
Data is not coming in my internal table.
Plz tell me where I m wrong
SELECTION-SCREEN BEGIN OF BLOCK blk.
PARAMETERS: compcode LIKE vbrk-bukrs OBLIGATORY.
PARAMETERS: billtype LIKE vbrk-fkart OBLIGATORY.
SELECT-OPTIONS: billdate FOR vbrk-fkdat OBLIGATORY.
PARAMETERS : acgrpc LIKE vbrk-ktgrd OBLIGATORY.
PARAMETERS: acgrpm LIKE vbrp-ktgrm OBLIGATORY.
PARAMETERS: taxcode LIKE konv-mwsk1 OBLIGATORY.
SELECT-OPTIONS: plant FOR vbrp-werks .
SELECT-OPTIONS: bussarea FOR vbrp-gsber .
SELECTION-SCREEN END OF BLOCK blk.
START-OF-SELECTION.
SELECT avbeln afkart aknumv afkdat abelnr aktgrd abukrs axblnr
amwsbk bgsber bwerks bktgrm
FROM ( vbrk AS a INNER JOIN vbrp AS b ON
avbeln EQ bvbeln )
INTO CORRESPONDING FIELDS OF TABLE vbrk_vbrp
WHERE ( a~fkart EQ billtype ) AND
( a~fkdat IN billdate ) AND
( a~ktgrd EQ acgrpc ) AND
( a~bukrs EQ compcode ) AND
( b~gsber EQ bussarea ) and
( b~werks EQ plant ) AND
( b~ktgrm EQ acgrpm ) .
RaviHi,
write ur query this way :
SELECT avbeln afkart aknumv afkdat abelnr aktgrd abukrs axblnr amwsbk bgsber bwerks bktgrm
FROM ( vbrk AS a INNER JOIN vbrp AS b ON
avbeln EQ bvbeln )
INTO CORRESPONDING FIELDS OF TABLE vbrk_vbrp
WHERE ( a~fkart EQ billtype ) AND
( a~fkdat IN billdate ) AND
( a~ktgrd EQ acgrpc ) AND
( a~bukrs EQ compcode ) AND
( b~gsber IN bussarea ) and
( b~werks IN plant ) AND
( b~ktgrm EQ acgrpm ) .
even plz check then internal table ' vbrk_vbrp ' if they have all the fields of select query and even the order is same as select , since you are using ' into corresponding fields of table ' clause in select statement.
hope this helps.
thanx,
dhanashri.
Edited by: Dhanashri Pawar on Aug 26, 2008 6:14 AM -
Ti identify discrepancies in internal table data
Hi all,
I do have data in internal table like this...
PODTD Instl Instl.type Premise ContractAccount
100 I1 ELED P1 C1
100 I2 ELES P1 C1
101 I3 ELED P2 C2
102 I4 ELES P2 C2.
I want to delete the records if PODTD are same for the same contract account.
only want to display different PODTD exist for the same contract in the report.
How can i do this check in internal tables? Please give me yours valuable guidance>......
Thanks.<b></b>Hi,
Okay..Got it..Check this ..
Declare a temporary internal table with the same structure as your internal table that has the data..
DATA: ITAB_TEMP LIKE ITAB OCCURS 0 WITH HEADER LINE.
ITAB_TEMP[] = ITAB[].
DATA: V_TABIX TYPE SYTABIX.
LOOP AT ITAB_TEMP.
CLEAR: V_TABIX.
LOOP AT ITAB WHERE PODTD = ITAB_TEMP-PODTD
AND CONTRACT_ACCOUNT =
ITAB_TEMP-CONTRACT_ACCOUNT.
V_TABIX = V_TABIX + 1.
ENDLOOP.
IF V_TABIX > 1.
DELETE ITAB WHERE PODTD = ITAB_TEMP-PODTD
AND CONTRACT_ACCOUNT =
ITAB_TEMP-CONTRACT_ACCOUNT.
ENDIF.
ENDLOOP.
ITAB internal table will have the final values..
Hope this works..
Thanks,
Naren -
ABAP MM: In ME21N which internal table holds Actual Price (Including Taxes)
Using tcode ME21N, while creating new PO, which internal table holds Actual price (Including Taxes) of whole PO (not by item) , assuming PO is not saved.
In the program, I want to capture the total cost of whole PO including taxes as soon as user enter the items. So that I can make some processing according to the total amount of PO.
Thanks,Check the internal table lt_mepoaccounts field netpr.
-
How to collect similar record from the internal table
I need to collect exact matched records from 1 internal table to another internal table by searching 5 fields. I need to have records which are exactly matched for 5 fields. i have written a code wich is mention below it gave me only similar records but not 100% matched record.. would you like to help me. any correction, suggetion,. Will be great help to me.
To get exact match of 5 records, do as follows.
Check whether internal table gives only one record or not after READ statement.If internal table gives more than one entry for READ then the results will be improper.
I think there is no need of READ statement on same internal table within LOOP. I commented the same in code.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
*lv_tabix = sy-tabix.
*read table i_bp_p index lv_tabix into wa_i_bp_p.read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endloop.
sort i_bp_p100 by partner.
loop at i_bp_p100.
write : /10 i_bp_p100-partner,
20 i_bp_p100-title,
30 i_bp_p100-initials,
40 i_bp_p100-name_last,
53 i_bp_p100-idnumber,
70 i_bp_p100-idtype,
85 i_bp_p100-rbcode,
95 i_bp_p100-f50code.
endloop.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
lv_tabix = sy-tabix.
read table i_bp_p index lv_tabix into wa_i_bp_p.
if sy-subrc = 0.
read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endif.
endloop. -
How to check if all values from a dataset has come to an internal table
How to check if all values from a dataset has come to an internal table ?
Hi,
After OPEN DATASET statement check if sy-subrc = 0 if its success then proceed with split statement and save the dataset values into a internal table and while debugging the internal table you will find that whether all values get into internal table.
Checking sy-subrc after OPEN DATASET statement is must to fill up the values in the internal table.
For e.g.
OPEN DATASET p_inpfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
WRITE :/ 'No such input file' .
EXIT.
ELSE.
READ DATASET p_inpfile INTO loc_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
CLEAR loc2.
*Spliting fields in the file-
REPLACE ALL OCCURRENCES OF '#' IN wa_string WITH ' '.
SPLIT wa_string AT const INTO loc2-pernr
loc2-werks
loc2-persk
loc2-vdsk1.
Hope you get some idea.
Thanks,
Sakthi C -
I need to add check whether 21 fields of a internal table are empty or not.
Hello,
I need to add check whether 21 fields of a internal table are empty or not.How can we write a code for the same wand what would be the correct syntax for it.
I tried entering all the fields in the IF loop with AND condition but its giving syntax error.Perhaps this is because the lenght of the IF condition would be more than the allowed one.Hi,
After the select quiery.
If not itab is initial.
Message 'Table is not empty' type 'I'.
Endif.
Regards,
Jagadish. -
Capturing check box value into internal table
Hi all,
I am displaying the output including check box through following internal table.
The checkbox is displayed before every record.
<b>LOOP AT it_qals.
WRITE:/ it_qals-t_val AS CHECKBOX,
5 it_qals-werk,
12 it_qals-prueflos,
30 it_qals-matnr,
50 it_qals-charg,
62 it_qals-lagortchrg.
hide: it_qals .
ENDLOOP.</b>
I selected some of the records through check the checkboxes. when i click the <b>PUSHBUTTON TRANSFER</b>, those selected records only should transfer. i don't know how to modify the internal table with latest checkbox values. Initially checkbox values are blank.
Is there any solution except Function Module.
i would appreciate an earlier reply.
Regards
PrabhuHello,
Create one more table and transfer your entries into new table.
I have attached my code for you.
Regards,
Naimesh
REPORT ZTEST_NP NO STANDARD PAGE HEADING.
TABLES: MARA, MAKT.
DATA: BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
SEL,
END OF IT_MARA.
DATA: IT_MARA1 LIKE IT_MARA OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SET PF-STATUS 'ZTEST'.
PERFORM GET_DATA.
PERFORM WRITE_DATA.
TOP-OF-PAGE.
PERFORM HEADER.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'SELECT'.
PERFORM GET_DATA_SELECTED.
PERFORM WRITE_DATA_SELE.
WHEN 'SELALL'.
PERFORM SELECT_ALL.
SY-LSIND = 0.
PERFORM HEADER.
PERFORM WRITE_DATA.
WHEN 'DESEL'.
PERFORM DESELECT_ALL.
SY-LSIND = 0.
PERFORM HEADER.
PERFORM WRITE_DATA.
ENDCASE.
*& Form GET_DATA
FORM GET_DATA.
SELECT MATNR
INTO TABLE IT_MARA
FROM MARA
WHERE MATNR LIKE 'IN10020%'.
LOOP AT IT_MARA.
SELECT SINGLE MAKTX
INTO IT_MARA-MAKTX
FROM MAKT
WHERE MATNR = IT_MARA-MATNR
AND SPRAS = SY-LANGU.
MODIFY IT_MARA.
CLEAR IT_MARA.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form WRITE_DATA
FORM WRITE_DATA.
ULINE /(50).
LOOP AT IT_MARA.
WRITE: / '|' NO-GAP, IT_MARA-SEL AS CHECKBOX NO-GAP,
'|' NO-GAP, (10) IT_MARA-MATNR NO-GAP,
'|' NO-GAP, (35) IT_MARA-MAKTX NO-GAP,
'|' NO-GAP.
ENDLOOP.
ULINE /(50).
ENDFORM. " WRITE_DATA
*& Form HEADER
FORM HEADER.
ULINE /(50).
WRITE: / '|' NO-GAP, (1) ' ' NO-GAP,
'|' NO-GAP, (10) 'Material' NO-GAP,
'|' NO-GAP, (35) 'Description' NO-GAP,
'|' NO-GAP.
ENDFORM. " HEADER
*& Form GET_DATA_SELECTED
FORM GET_DATA_SELECTED.
DATA: L_CNT TYPE I.
DO.
L_CNT = L_CNT + 1.
READ LINE L_CNT FIELD VALUE IT_MARA-MATNR INTO IT_MARA1-MATNR
IT_MARA-MAKTX INTO IT_MARA1-MAKTX
IT_MARA-SEL INTO IT_MARA1-SEL.
IF SY-SUBRC = 0.
IF IT_MARA1-SEL = 'X'.
APPEND IT_MARA1.
CLEAR IT_MARA1.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " GET_DATA_SELECTED
*& Form WRITE_DATA_SELE
FORM WRITE_DATA_SELE.
PERFORM HEADER.
ULINE /(50).
LOOP AT IT_MARA1.
WRITE: / '|' NO-GAP, IT_MARA1-SEL AS CHECKBOX,
'|' NO-GAP, (10) IT_MARA1-MATNR NO-GAP,
'|' NO-GAP, (35) IT_MARA1-MAKTX NO-GAP,
'|' NO-GAP.
ENDLOOP.
ULINE /(50).
ENDFORM. " WRITE_DATA_SELE
*& Form SELECT_ALL
FORM SELECT_ALL.
LOOP AT IT_MARA.
IT_MARA-SEL = 'X'.
MODIFY IT_MARA.
CLEAR IT_MARA.
ENDLOOP.
ENDFORM. " SELECT_ALL
*& Form DESELECT_ALL
FORM DESELECT_ALL.
LOOP AT IT_MARA.
IT_MARA-SEL = ' '.
MODIFY IT_MARA.
CLEAR IT_MARA.
ENDLOOP.
ENDFORM. " DESELECT_ALL -
Check the range of values of an internal table with the statement IN
Hi,
I'd like to know how to check if the current contents of a field are in the set described by an internal table.
I know I have to use the statement <b>IN</b>, but I don't know exactly how to define the internal table. In my case, I have a single field (<i>tipo_doc</i>) in my internal table which stores 4 different values: C, I, K, L.
I want to use the statement <b>IN</b> as shown next:
SELECT * FROM VBFA APPENDING CORRESPONDING FIELDS OF TABLE it_flujo_docs WHERE ( VBELN = it_total_fact-vbeln )
AND ( VBTYP_V <b>IN</b> itab).
Then I'd like to know how the internal table <i>itab</i> should be defined. It should be something like this I think, but it doesn't work:
DATA: BEGIN OF itab OCCURS 0,
tipo_doc LIKE zpedidos-tipo_doc,
tipo_doc-sign = 'I',
tipo_doc-option = 'EQ',
tipo_doc-low = C,
tipo_doc-high = L,
END OF it_tipo_doc_ped.
I'd appreciate if someone could tell me the proper way to define it.
Thanks in advance,
GerardHi,
Please follow this.
RANGES R_VBTYP FOR VBFA-VBTYP_V.
R_VBTYP-SIGN = 'I'.
R_VBTYP-OPTION = 'EQ'.
R_VBTYP-LOW = 'C'.
CLEAR R_VBTYP-HIGH.
APPEND R_VBTYP.
Do the same for value 'I', 'K' and 'L'.
Now in the SELECT statement replace the following
VBTYP_V IN itab
with
VBTYP_V IN R_VBTYP.
Thanks
Vinod
Maybe you are looking for
-
Essbase error:You do not have sufficient access to perform a lock on this..
Hi all, I tried to retrieve the members in the spreadsheet addin client and I am getting the error as follows: Essbase error: You do not have sufficient access to perform a lock on this database. But Iam trying to do only a retrieve operation. Essbas
-
Adding gsber in selection screen of report painter
To gurus, I have a small requirement, I have to get business area (GSBER) in selection screen of report. I have developed the report using report painter FGI1 --FAGLFLEXT which is having gsber field. In selection screen it self i want this GSBER F
-
Will FCX run on a Macbook Air?
-
Gcc and gdb integration in Sun Developer 11
Is it possible (and how easy) to integrate gcc and gdb into Sun Developer Studio 11. Also, if yes, would one be able to use any of the visual debugging functionality (setting breakpoints etc..) in the Studio.
-
Slow imc COM (ActiveX)-libraries inside LabView
Hi I'm using the imc COM (ActiveX)-libraries inside labview. The key command is the "automation open" block from LabView and selecting the desired ActiveX class. Here his the definition of one of this function: Function DChannel.GetDataDouble( StartI