Read the internal table with key
Hi friends,
decleration of internal table is :
TYPES : BEGIN OF ty_qmel,
qmart TYPE qmel-qmart,
qmnum TYPE qmel-qmnum,
qmtxt TYPE qmel-qmtxt,
strmn TYPE qmel-strmn,
ltrmn TYPE qmel-ltrmn,
objnr TYPE qmel-objnr,
qmdat TYPE qmel-qmdat,
END OF ty_qmel.
i have written the query as follows .
SELECT qmart qmnum qmtxt strmn ltrmn FROM qmel
INTO CORRESPONDING FIELDS OF TABLE i_qmel
FOR ALL ENTRIES IN i_qmel
WHERE qmart EQ i_qmel-qmart.
I am getting the data into 1_qmel.
Let me know how to read this table with key...?
Thanks in advance...
Hi,
Refer this code.
*& Form SUB_COLLECT_DATA
text
FORM sub_collect_data.
*--Local variables
DATA : lv_count(3) TYPE c.
IF NOT it_fpltc[] IS INITIAL.
LOOP AT it_fpltc INTO wa_fpltc.
lv_count = wa_fpltc-fpltr+3(3).
wa_final-ccnum = wa_fpltc-ccnum.
wa_final-rfzei = lv_count.
CLEAR : wa_vbrk.
READ TABLE it_vbrk INTO wa_vbrk WITH KEY rplnr = wa_fpltc-fplnr
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_final-vbeln = wa_vbrk-vbeln.
wa_final-bukrs = wa_vbrk-bukrs.
ENDIF.
APPEND wa_final TO it_final.
CLEAR : wa_vbrk,
wa_fpltc,
lv_count.
ENDLOOP.
Regards,
PRashant
Similar Messages
-
Read internal table with key not equal to
Hi,
How can I read internal table with key not equal to some other field.
Basically in read statement we can read only fields equal to others fields.Hi,
Test the following Code you can Use Loop at for this But not Read Table
DATA: BEGIN OF it_test OCCURS 10,
f1(4),
f2 TYPE i,
f3(2),
END OF it_test.
DATA: it_test2 LIKE STANDARD TABLE OF it_test WITH HEADER LINE.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'B'.
APPEND it_test TO it_test.
it_test-f1 = '2000'.
it_test-f2 = 10.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'B'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 40.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
LOOP AT it_test INTO it_test WHERE f3 NE 'A'.
WRITE: / it_test-f1, it_test-f2, it_test-f3.
ENDLOOP.
Kind Regards,
Faisal -
How to read an internal table with more than one (2 or 3) key field(s).
how to read an internal table with more than one (2 or 3) key field(s). in ecc 6.0 version
hi ,
check this..
report.
tables: marc,mard.
data: begin of itab occurs 0,
matnr like marc-matnr,
werks like marc-werks,
pstat like marc-pstat,
end of itab.
data: begin of itab1 occurs 0,
matnr like mard-matnr,
werks like mard-werks,
lgort like mard-lgort,
end of itab1.
parameters:p_matnr like marc-matnr.
select matnr
werks
pstat
from marc
into table itab
where matnr = p_matnr.
sort itab by matnr werks.
select matnr
werks
lgort
from mard
into table itab1
for all entries in itab
where matnr = itab-matnr
and werks = itab-werks.
sort itab1 by matnr werks.
loop at itab.
read table itab1 with key matnr = itab-matnr
werks = itab-werks.
endloop.
regards,
venkat. -
Downloading the internal table with header to FTP folder
Hi All,
I have one requirement in downloading the internal table details with the fixed header line to FTP folder. The header line having the fixed text of 425 characters length.
Note: We are not suppose to use WS_DOWNLOAD and GUI_DOWNLOAD function modules.
Thanks in advance for your reply.
Regards
Kamini.Hi,
I can download the internal table details successfully to FTP folder using the FTP function modules like(FTP_CONNECT, FTP_COMMAND , FTP_R/3_TO_SERVER and FTP_DISCONNECT). Here my problem is I am unable to download the internation table with some header text.
You can see the format (example) of file to be download.
Here I can successfully download the below details without the header. But I am unable to download with header line. Could you please suggest me.
seq_no|record_action|trans_date|sku|description|
1|N|2008-01-03 07:52:31|TTASA5025CBO
2|N|2008-01-03 10:28:33|411014
3|N|2008-01-03 10:01:03|TTASA6030CBO
4|N|2008-01-03 10:01:15|TTASA6630CBO
5|N|2008-01-03 10:01:25|TTASA7035CBO
6|N|2008-01-08 16:57:39|TT6G
Regards
Kamini. -
Declare the internal table with only one 10 character field and use
Hi,
I want to declare the internal table with only one 10 character field and use.
JayaHi,
Go ahead. U can declare IT with only one field
Example:
data: begin of zcustlist occurs 1000,
custmer(10) type c,
end of zcustlist.
Narendra Reddy.
Edited by: Narendra Reddy C on Aug 8, 2008 11:39 AM -
Collect in an internal table with keys plant and material
Hi ,
I have an output internal table with material , plant and var quantitites .
I would like to use Collect statement and sum the quantities but do it by plant and material .
How do I specify that i want to do it on plant or material ?
Thanks !hi here is an example like urs..
DATA: BEGIN OF seats,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
seatsocc TYPE sflight-seatsocc,
END OF seats.
DATA seats_tab LIKE HASHED TABLE OF seats
WITH UNIQUE KEY carrid connid.
SELECT carrid connid seatsocc
FROM sflight
INTO seats.
COLLECT seats INTO seats_tab.
ENDSELECT.
check for help..
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
regards,
venkat -
Validate the data in the internal table with the date in selection screen
Hi all,
I want to validate the data in the internal table and get only the records with the input date in the selection screen.
The date is in the select options and please let me know how to get the records only if it satisfies the input date in the selection screen.
Regards,
ShalemFor Ex.
SELECT-OPTIONS: S_DATE FOR VBAK-VDATU
If you want to read one INTERNAL TABLE record
READ TABLE it_tab(internal table name) WHERE vdatu(date field name in the internal table) = s_date
If you want to move more then one
LOOP AT it_tab WHERE vdatu = s_date.
Take the field values in another table and append it. then end loop.
you will get the records which only have the date in select option..
If you want detail code give me internal table name and select option name i will write you the code.
regards
Yuvaram -
Function Module in VL10G containing the Internal Table with All SO & PO
Hi,
I have a situation where I need to get all the Sales Orders and POs for the given Shipping Point and Planned GI Date from my custom Report without writing SELECT queries. Now, can somebody give me a Function Module and the Internal Table Name where the actual data with Sales Orders and POs is stored?
Thanks,
Venkat.Hi,
I have a situation where I need to get all the Sales Orders and POs for the given Shipping Point and Planned GI Date from my custom Report without writing SELECT queries. Now, can somebody give me a Function Module and the Internal Table Name where the actual data with Sales Orders and POs is stored?
Thanks,
Venkat. -
Pass the internal table with different structures to the class module
Hi ,
I have created a class method to fill up the data in XML format. the method can be called from various programs with internal table with different structures. I want to pass it as dynamic How can I do that.
I tried to declare that as type any.
but not working.
regards,
MadhuriHi,
You could work with data reference.
Use GET REFERENCE OF itab INTO data_ref for passing the internal table to your method, and dereference it within the method with ASSIGN statement...
DATA: lr_data TYPE REF TO data.
GET REFERENCE OF itab INTO lr_data.
CALL METHOD meth EXPORTING pr_data = lr_data.
METHOD meth.
FIELD-SYMBOLS <fs> TYPE ANY TABLE
ASSIGN pr_data->* TO <fs>.
ENDMETHOD.
Kr,
Manu. -
How to fetch the data to the internal table with out using mandt
Hi all,
Iam giving my code please observer... and give me the reasonable solution.
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT mandt
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
By removing MANDT from select query, it is going to dump.
ex:
SELECT
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
> Now it is going to dump ( here i removed the mandt field ).
Please give me a solution to fetch the data by removing mandt in select statement, with out chaning the internal table structure.
Thanks,
Ravihi Ravi,
i also had to avoid move-corresponding and the following is what i did...its extra work and goes around but it will
do the needed work..............
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT *
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
the above gets you all the fields ...but if you still want to narrow it down to just two fields
*****Declaring structure with 2 fields
data:begin of fs_data.
data:werks type z_mar-werks,
lifnr type z_mar-lifnr ,
data:end of fs_data.
*******internal table of above
data:int_data like fs_data occurs 0 with headerline.
*****moving the only 2 required fields
loop at t_mar.
t_mar-werks = int_data-werks.
t_mar-lifnr = int_data-lifnr.
append int_data.
endloop.
Hope you found it useful...
Regards
Bx -
How to Read the internal table for the data download from the spool
HI all,
I have one issue regarding the spool ,we are getting the correct output as per requirement of user but when we send the same to the user in pdf format they did notget the same.
they are telling that the due date is missing from the pdf.
Please advice me how to track the internal table for the spool data converted intopdf in a readable format.
the FM used for the above task is :
call function 'CONVERT_OTFSPOOLJOB_2_PDF'
Please reply if any one worked on the same.
Thanks in advance.
Gaurav,Hi Wang,
Please let me know how you solved your question.
Points will be rewarded.
Thanks,
Arun. -
Dynamically fill the internal table with new fileds
Hi Friends,
I have the internal table like
Data:begin of i_data occurs 0,
a(60),
b(60),
c(60),
d(60),
e(60),
end of i_data.
I need to fill the internal table dynamically like
Data:begin of i_data occurs 0,
a(60),
b(60),
c(60),
c1(60), "new filed dynamically
c2(60), "new field dynamically
d(60),
e(60),
end of i_data.
Please suggest me how to do this.
Regards,
Sunny.
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 1:55 PMYou can not add new fields to a statically defined internal table, instead you must create the entrie internal table at runtime.
Search this forum for Dynamic Internal tables, you will get a lot of example programs.
Regards,
Rich Heilman -
Reg - Reading internal table with multiple record in a single field
Dear Guru's,
i want to read a internal table with field having mutilple entries like
read table READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
But it says comma without preceding colon (after READ?).
please guide me.....
thanks & Regards,
Balaji.Sya this is inside the loop.
plz check....
loop at lt_t2 into lt_t2_wa.
READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
endloop.
thanks & Regards,
Balaji.S -
Regarding the internal table data by using read table it_mard into wa_mard
hi,
i am reading the internal table it_mard with key matnr .
my code is like this.
*loop at it_final into wa_final.*
*wa_second-matnr = wa_final-matnr.*
wa_second-bwart = wa_final-bwart.
wa_second-bwtar = wa_final-bwtar.
*read table it_mard into wa_mard with key matnr = wa_final-matnr*
*binary search.*
*if sy-subrc = 0.*
*wa_second-labst = wa_mard-labst.*
*endif.*
*append wa_second to it_second.*
clear :wa_final.
*endloop.*
final internal table haveing duplicate values because this table it_final having movement types
so that i am not using delete statement .
is there any logic for handling the duplicate values inside the loop statement
by using read table statement.
could u plz explain clearly \[removed by moderator\]
Edited by: Jan Stallkamp on Jul 11, 2008 2:11 PMthis is my code could u plz explain regarding duplicate material number .
LOOP AT IT_MSEG INTO WA_MSEG.
WA_FINAL-MBLNR = WA_MSEG-MBLNR.
WA_FINAL-MATNR = WA_MSEG-MATNR.
WA_FINAL-BWART = WA_MSEG-BWART.
WA_FINAL-BWTAR = WA_MSEG-BWTAR.
WA_FINAL-MENGE = WA_MSEG-MENGE.
WA_FINAL-SOBKZ = WA_MSEG-SOBKZ.
COLLECT WA_FINAL INTO IT_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
LOOP AT IT_FINAL INTO WA_FINAL.
READ TABLE IT_MARD INTO WA_MARD WITH KEY MATNR = WA_FINAL-MATNR
BINARY SEARCH.
this is reading the duplicate records i need to control duplicate records here .
the labst value is repeating the number of times because of the meterial number duplication
how can i restrict plz explain
IF SY-SUBRC = 0.
WA_FINAL-LABST = WA_MARD-LABST.
ENDIF.
READ TABLE IT_MKPF INTO WA_MKPF WITH KEY MBLNR = WA_FINAL-MBLNR
BINARY SEARCH.
IF SY-SUBRC = 0.
WA_FINAL-BUDAT = WA_MKPF-BUDAT.
ENDIF.
MODIFY IT_FINAL FROM WA_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
LOOP AT IT_FINAL INTO WA_FINAL.
WA_SECOND-BWTAR = WA_FINAL-BWTAR.
IF WA_FINAL-BWART = '101' OR WA_FINAL-BWART = '501' OR WA_FINAL-BWART = '561'.
WA_SECOND-MENGE11 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '201'.
WA_SECOND-MENGE12 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '541' AND WA_FINAL-SOBKZ = 'O' .
WA_SECOND-MENGE13 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '601'.
WA_SECOND-MENGE14 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '543'.
WA_SECOND-MENGE15 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '702'.
WA_SECOND-MENGE16 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '313'.
WA_SECOND-MENGE17 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '315'.
WA_SECOND-MENGE18 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '122' OR WA_FINAL-BWART = '161'.
WA_SECOND-MENGE19 = WA_FINAL-MENGE.
ENDIF.
COLLECT WA_SECOND INTO IT_SECOND.
CLEAR WA_SECOND.
ENDLOOP. -
How can i read the field name in the internal table
Hi friends
i want to read the internal table filed name.
my requirement is like this:
data: begin of t_header occurs 0,
extno(12),
priotiy(5),
ecnumber(10).
end of t_header.
loop at t_header.
if the field name is priority i want to write some other
logic here.....
endloop.
Please tell me how can i do this.data: wf_fld_cat type slis_t_fieldcat_alv .
data: wf_repid like sy-repid .
data: int_tab_name type slis_tabname .
move: sy-repid to wf_repid ,
'INT_OUTPUT' to int_tab_name .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = wf_repid
i_internal_tabname = int_tab_name
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = wf_repid
i_bypassing_buffer = 'X'
I_BUFFER_ACTIVE =
changing
ct_fieldcat = wf_fld_cat[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
wf_fld_cat[] will hold the itab definition.
Regards
Raja
Maybe you are looking for
-
I started up my macbook pro 2 years ago using someone else's apple id. I just recently updated my software to OS X Yosemite and now I can't open iPhoto & iMovie. It says I have to download the latest version. How can I download it using my own apple
-
I'm having a problem with adding Titles. Everytime I click on the Titles button iMovie freezes. I cannot add titles at all. Transitions, Video FX etc. work great, but for some reason every time I try to add a title, iMovie will freeze. I have plenty
-
Whenever I drag a clip from the clips pane onto the scrubbing board, it loses its audio. When playing the clip in the clips pane it sounds fine, but it is frustratingly silent when I actually add it to my movie. I'm on imovie 4. When exported, there'
-
Hi, We bought 3 brand new X230 with Windows8 Preinstalled, we needed to downgrade the system to windows 7. The problem is that these Notebooks comes with no DVD reader even in the Docking Station......I installed Windows 7 cause we needed to built t
-
Hi All, We are Using SQ01 query to Generate On report, But the Problem is when iam Trying to Retrive Large amount of data, Few Commercial Contracts are not printing on the query out put, But if i execute to retrive small amount of Data That time ia