Read definition of internal table
is it possible that you can read all fields of an internal table which are for example defined as an quan?
Hi,
when ever we write
loop at itab.
endloop .
means all the fields / columns comes to the header part of the internal table if it is declared with header line or we can read into workarea if it is notdeclared with header line.
Read table itab index 1
or
read table itab with key matnr = v_matnr
maktx = v_maktx
binary search.
if sy-subrc = 0 .
write itab-matnr.
endif.
the header part of the internal table will be stored in the header part whenever condition is satisfied.
all the types of fields can be read.there is no specific read stmt depending upon the field type.
but if you want to read only Quant field means you shoud know the field names.otherwise with field types we cant differenciate for reading.
Thanks
Parvathi
Similar Messages
-
Could not read definitions; no read definitions permission for table
We have a hand punch (time clock) that is maintained in Access. This is a 3rd party product, I believe I'm having a permissions problem but the vendor says we should be able to read the data as a guest account. I select the database push the >> arrow and on all but two tables I get:
Database Connector Error: DAO Error Code: 0xc26
Source: DAO.Fields
Description Could not read definitions; no read definitions permission for table or query 'AbsenseT'
(Table name changes with each table of course.)
After clicking through 30 some tables two of them are selected. I can browse them etc.
Vendor has pushed out of his court saying its a Crystal problem but I believe its a permission problem especially since I can access those 2 tables but I need someone to confirm that for me or just tell me I'm wrong thats OK too. Any help as to why this is happening would be appreciated.
Thanks,
RandyHi Randy,
I believe CR will log in as Admin for the top level but we don't support the second level of security. As you can see we only one one level of prompt.
ODBC may be a work around for you...
Thank you
Don -
READ CHECKBOX FROM INTERNAL TABLE
can anyone tell me how to read in an internal table whether checkbox are marked or not....
i m finding difficulty in identifiyng my checkboxes as marked or not....dynamically....
Thanks in Advance.......
KARTIKEYHi,
are u using ALV LIST or GRID?
Find the sample code.
TYPES:
BEGIN OF ty_output,
chk TYPE c,
number TYPE i,
name(20) TYPE c,
END OF ty_output.
DATA: gt_output TYPE STANDARD TABLE OF ty_output,
gs_output TYPE ty_output.
<<populate the internal table>>
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
I_STRUCTURE_NAME =
is_layout = wa_layout
it_fieldcat = it_fieldcatalog
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_output
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
*& Form USER_COMMAND
FORM user_command USING p_ucomm TYPE sy-ucomm
p_selfld TYPE slis_selfield.
CASE p_ucomm.
WHEN 'HELLO'.
loop at gt_output into gs_output where chk = 'X'.
< <ur code>>
endloop.
ENDCASE.
ENDFORM.
Note: HELLO is a button in the PF status,
Regards,
Niyaz -
Reading Data from Internal Table
Hi,
Can anyone please tell me how to read data from Internal Tables in the Event Handler without using the Select statement OnInitialization?
Thanks,
GauravHi Siddhartha,
Can you tell me the problem in my code. I tried to work on the way you suggested. Though I have not finished with the coding, I just wanted to know whether I am going in the direction or not.
I have declared the the structure in Type Defination as
TYPES: BEGIN OF TEST_STRUC,
BEGDA TYPE BEGDA,
ENDDA TYPE ENDDA,
END OF TEST_STRUC.
TYPES: TEST_TAB_TYPE TYPE TABLE OF TEST_STRUC.
In the Event Handler, I have added the following code on OnInputProcessing:
event handler for checking and processing user input and
for defining navigation
DATA TEST_INFO LIKE LINE OF TEST_TAB.
DATA: MYTAB6 TYPE TABLE OF PA0006,
MYTAB6_WA LIKE LINE OF MYTAB6.
REFRESH TEST_TAB.
CLEAR TEST_INFO.
MYTAB6_WA-BEGDA = REQUEST->GET_FORM_FIELD( STARTDATE ).
MYTAB6_WA-ENDDA = REQUEST->GET_FORM_FIELD( ENDDATE ).
IF EVENT->NAME EQ 'button'
AND EVENT->SERVER_EVENT EQ 'click'.
LOOP AT MYTAB6 INTO MYTAB6_WA.
TEST_INFO-BEGDA = MYTAB6_WA-BEGDA.
TEST_INFO-ENDDA = MYTAB6_WA-ENDDA.
ENDLOOP.
APPEND TEST_INFO TO TEST_TAB.
CLEAR TEST_INFO.
NAVIGATION->SET_PARAMETER( NAME = 'test_tab'
VALUE = 'begda' ).
NAVIGATION->SET_PARAMETER( NAME = 'test_tab'
VALUE = 'endda' ).
NAVIGATION->GOTO_PAGE( 'MyBSP2.htm').
ENDIF.
P.S. MyBSP2.htm is my next page.
Thanks,
Gaurav -
How to read from an internal table with multiple key fields.
Hi All!!
I want to read from an internal table having keys as k1,k2,k3.
How can I use read statement to read an entry having this as the key fields.
Thanks in adavance..
Prabhas Jhahi there
use:
sort itab by K1 K2 K3.
read table itab into wa with key K1 = value 1
K2 = value2
K3 = value 3
BINARY SEARCH.
where:
itab is ur internal table
wa is the work area with the same line type as the itab
cheers
shivika -
With in the internal table can I READ the same internal table for a record?
With in the internal table can I READ the same internal table?
For Suppose
LOOP AT itab.
can I do as below
READ TABLE itab with key bukrs = itab-bukrs
belnr = itab-belnr.
*and I have to compare
IF itab-shkzg = itab-shkzg_ia.
ENDIF.
ENDLOOP.Hi,
Yes..But use work area to differentiate..
EX.
DATA: WA LIKE ITAB.
DATA: WA_READ LIKE ITAB.
LOOP AT itab <b>INTO WA</b>.
can I do as below
READ TABLE itab <b>INTO WA_READ</b>
with key bukrs = itab-bukrs
belnr = itab-belnr.
*and I have to compare
IF <b>WA</b>-shkzg = <b>WA_READ</b>-shkzg_ia.
ENDIF.
ENDLOOP.
Please reward for helpful answers.
Thanks,
Naren -
Read statement in internal table.
PLease help me to figure out what a read statement does???
Please show me through examples how a read statements selects data from a table ,,,puts into internal table & finally we are able to read it through work area????
thanx... <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Mar 10, 2008 7:27 PMHey saswat ,
just wanted to give a simplified example of ur query , if not understood please ask
REPORT Z_PRGM_TRY_READ NO STANDARD PAGE HEADING.
TABLES : MARA , MARD.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
TYPES : BEGIN OF LT_MARA ,
MATNR LIKE MARA-MATNR ,
ERSDA LIKE MARA-ERSDA ,
MBRSH LIKE MARA-MBRSH ,
END OF LT_MARA .
DATA : TT_MARA TYPE STANDARD TABLE OF LT_MARA INITIAL SIZE 0 ,
WA_MARA TYPE LT_MARA .
TYPES : BEGIN OF LT_MARD ,
MATNR LIKE MARD-MATNR ,
WERKS LIKE MARD-WERKS ,
LGORT LIKE MARD-LGORT ,
PSTAT LIKE MARD-PSTAT ,
END OF LT_MARD.
DATA : TT_MARD TYPE STANDARD TABLE OF LT_MARD INITIAL SIZE 0 ,
WA_MARD TYPE LT_MARD.
TYPES : BEGIN OF LT_FINAL ,
MATNR LIKE MARA-MATNR ,
ERSDA LIKE MARA-ERSDA ,
MBRSH LIKE MARA-MBRSH ,
WERKS LIKE MARD-WERKS ,
LGORT LIKE MARD-LGORT ,
PSTAT LIKE MARD-PSTAT ,
END OF LT_FINAL .
DATA : TT_FINAL TYPE STANDARD TABLE OF LT_FINAL INITIAL SIZE 0 ,
WA_FINAL TYPE LT_FINAL .
SELECT MARA~MATNR
ERSDA
MBRSH
INTO CORRESPONDING FIELDS OF TABLE TT_MARA FROM MARA WHERE MARA~MATNR IN S_MATNR .
SELECT MARD~MATNR
WERKS
LGORT
PSTAT
INTO CORRESPONDING FIELDS OF TABLE TT_MARD FROM MARD
FOR ALL ENTRIES IN TT_MARA
WHERE MATNR = TT_MARA-MATNR.
LOOP AT TT_MARA INTO WA_MARA.
READ TABLE TT_MARD INTO WA_MARD WITH KEY MATNR = WA_MARA-MATNR .
IF SY-SUBRC = 0.
WA_FINAL-MATNR = WA_MARA-MATNR .
WA_FINAL-ERSDA = WA_MARA-ERSDA.
WA_FINAL-MBRSH = WA_MARA-MBRSH.
WA_FINAL-WERKS = WA_MARD-WERKS.
WA_FINAL-LGORT = WA_MARD-LGORT.
WA_FINAL-PSTAT = WA_MARD-PSTAT.
APPEND WA_FINAL TO TT_FINAL.
CLEAR WA_FINAL.
ENDIF.
ENDLOOP.
LOOP AT TT_FINAL INTO WA_FINAL.
WRITE : / WA_FINAL-MATNR , WA_FINAL-ERSDA , WA_FINAL-MBRSH , WA_FINAL-WERKS ,
WA_FINAL-LGORT , WA_FINAL-PSTAT.
ENDLOOP. -
Read from a internal table whose name is decided in runtime
Dear ABAPers
I've an internal table's name in a variable, the name is populated in runtime (user_command->ls_selfield-tabname). Now that using the name (in the variable) i need to read a row from that particular internal table (which is populated into the variable). How can i do that.
Regards
Prabumanoharanhi see the coding and do the changes accordingly...
report ztests .
DATA:
o_ref TYPE REF TO data.
FIELD-SYMBOLS:
<lt_table> TYPE STANDARD TABLE,
<fs> TYPE ANY,
<field> TYPE ANY,
<field1> TYPE ANY.
PARAMETERS:
p_tab TYPE tabname default 'MARA', " Table name (eg: MARA)
p_field(20) TYPE c default 'MATNR'. " Field name (eg: MATNR)
START-OF-SELECTION.
CREATE DATA o_ref TYPE TABLE OF (p_tab).
ASSIGN p_field TO <field1>.
ASSIGN o_ref->* TO <lt_table>.
SELECT *
INTO TABLE <lt_table>
FROM (p_tab).
LOOP AT <lt_table> ASSIGNING <fs>.
ASSIGN COMPONENT <field1> OF STRUCTURE <fs>
TO <field>.
IF sy-subrc = 0.
WRITE:/ <field>.
ENDIF.
ENDLOOP. -
Hi all,
I am using a transaction CJR2. At the end of this transaction I get a Log. I want to read this log into an internal table.
How will it works.
Please suggest.
Thanks
Sanket sethi.Hi
If that an Application log then based on object you can get the log in an Internal table.
BAL_log_display. -
How to read pdf to internal table
hi,
i have pdf file having reprot for multiple invoices ,one report per page per invoice.
i want to split this pdf into multiple pdf for each invoices.
please advice.
regards,
sheetal.HI Srivijaya
I have to upload details from PDF document saved into C drive into internal table.
While refering to the programme FP_PDF_TEST_03,it actually upload the details into excel sheet.
in this programme "PERFORM download_file USING l_data p_xml." is actually uploading the details(Stored in l_data) into XLS format through path p_xml.
What i need is to upload records into internal table .But the fromat of the l_data is in hexadecimal(Ex : 3C3F786D6C2076657273696F).
I cannot read these values and upload into internal table
Do you know any FM which convert Hexa into xml format or any thing else so that i can read the details into my internal table.
Or you have any other suggestions
Waiting for your reply -
I will use READ DATASET to read the file content, the content will be tab spearated, I would like to know how to read each field to interal table. Thanks!
Hi,
<li>Define horizontal tab.
DATA: hor_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
<li>Try like below for every record in the file.
OPEN DATASET ....
DO.
READ DATASET file INTO wa_content.
IF sy-subrc EQ 0.
SPLIT wa_content AT hor_tab INTO wa_data-field_01
wa_data-field_02
wa_data-field_03
wa_data-field_04.
APPEND wa_data TO it_data.
CLEAR wa_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET...
Regards,
Venkat.O -
Greeting everyone,
Could anyone guide me is there any wrong to my below code as Im not manage to display the errors report while execute it. eg: XXX not found. Thanks.
DATA: wa_file LIKE i_input1,
lv_pspnr LIKE i_input1-pspnr,
l_pspnr LIKE prps-pspnr.
LOOP AT i_input1 INTO wa_file.
CLEAR: i_pspnr,i_pbukr.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT'
EXPORTING
input = wa_file-pspnr
IMPORTING
output = i_pspnr.
IF sy-subrc EQ 0.
CLEAR iv_pspnr.
Check WBS element from upload file if exist in PRPS table
SELECT single pspnr
INTO iv_pspnr
FROM prps
WHERE pspnr = i_pspnr.
IF sy-subrc NE 0 AND iv_pspnr IS INITIAL.
WRITE :wa_file-pspnr, 'Not Found'.
endif.
ENDIF.
ENDLOOP.
Edited by: Sweetgarden 2007 on Mar 29, 2008 9:28 PMHi All,
I manage to solve myself by adding the exception part.
Thanks. -
Reading complex file in ABAP internal table.
I have a following XML file. and I want to read it in internal Table with deep structure.
<?xml version="1.0" encoding="utf-16" ?>
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
- <TAB>
- <item>
<CATALOGUEREQUESTIDID>5</CATALOGUEREQUESTIDID>
<MBRSH>Chemical Industry</MBRSH>
<MTART>Spare Parts</MTART>
<WERKS>Spare Parts Warehouse</WERKS>
<MAKTX>Lubricant,Oil Graphite></MAKTX>
<MEINS>Bottle</MEINS>
<MATKL>Spare parts - General</MATKL>
<BRGEW>10</BRGEW>
<GEWEI>G</GEWEI>
<NTGEW>9</NTGEW>
<VOLUM>1</VOLUM>
<VOLEH>L</VOLEH>
<EKGRP>Buyer 1</EKGRP>
<XCHPF>NO</XCHPF>
<EKWSL>-15, -10, -05</EKWSL>
<WEBAZ>2</WEBAZ>
<INSMK>NO</INSMK>
<KZKRI>NO</KZKRI>
<MFRPN>SHELL</MFRPN>
<MFRNR>WD-40</MFRNR>
- <DRGNUM>
<ZEINR>C-39166</ZEINR>
<ZEIAR>KKK</ZEIAR>
<ZEIVR>3</ZEIVR>
<BLATT>4</BLATT>
<AESZN>12</AESZN>
<ZEIFO>A3</ZEIFO>
<BLANZ>12</BLANZ>
</DRGNUM>
- <DRGNUM>
<ZEINR>C-39167</ZEINR>
<ZEIAR>KKK</ZEIAR>
<ZEIVR>3</ZEIVR>
<BLATT>4</BLATT>
<AESZN>12</AESZN>
<ZEIFO>A3</ZEIFO>
<BLANZ>12</BLANZ>
</DRGNUM>
- <DRGNUM>
<ZEINR>C-39168</ZEINR>
<ZEIAR>KKK</ZEIAR>
<ZEIVR>3</ZEIVR>
<BLATT>4</BLATT>
<AESZN>12</AESZN>
<ZEIFO>A3</ZEIFO>
<BLANZ>12</BLANZ>
</DRGNUM>
</item>
</TAB>
</asx:values>
</asx:abap>
+I for this I have created a internal table as; +
types : begin of DRGNUM,
ZEINR(10),
ZEIAR(5),
ZEIVR(5),
BLATT(5),
AESZN(5),
ZEIFO(5),
BLANZ(5),
end of DRGNUM.
data : begin of item occurs 0,
CATALOGUEREQUESTIDID,
MBRSH(20),
MTART(15),
WERKS(30),
MAKTX(40),
MEINS(10),
MATKL(30),
BRGEW(5),
GEWEI(2),
NTGEW(5),
VOLUM(5),
VOLEH(2),
EKGRP(10),
XCHPF(3),
EKWSL(15),
WEBAZ(2),
INSMK(2),
KZKRI(2),
MFRPN(5),
MFRNR(5).
data : DRGNUM type ZDRGNUM.
data: end of item.
*XML
call transformation ('ID')
source xml xmlupl
result tab = item[]
The problem is that for DRGNUM nodes in XML I can only manage to get last DRGNUM node data in the internal table.
How can I get all the 3 items for DRGNUM in the Internal table ?
Your help is appreciated.
Edited by: Hasan Bin Tariq on May 6, 2009 11:12 AMu need to create three files with 3 different data in DRGNUM.
i.e, in the 1st file give the 1st set of data for drgnum and
in the 2nd file, u will hve 2nd set of data for DRGNUM and the rest will data will be same without any change. simliarly do the 3rd file.
and try to get into the internal table now. -
Read info about files in specific folder into internal table
Hi Experts
I need to have last modified date and filename information read into an internal table. I need to read in the information of all files in a specific (UNIX) folder (I do not know the name of the single files).
I really hope someone can help.
Thanks a lot
Kind regards,
TorbenHi Guys
Thanks a lot for you input.
I managed to get my program to works as follows:
REPORT ZDELETE_ARCHIVING_FILES.
*Step 1: Get the list of files in the directory into internal table :
DATA: DLIST LIKE EPSFILI OCCURS 0 WITH HEADER LINE,
DPATH LIKE EPSF-EPSDIRNAM,
MDATE LIKE SY-DATUM,
MTIME LIKE SY-UZEIT.
DATA: BEGIN OF FATTR OCCURS 0,
FILE_NAME LIKE EPSF-EPSFILNAM,
FILE_SIZE LIKE EPSF-EPSFILSIZ,
FILE_OWNER LIKE EPSF-EPSFILOWN,
FILE_MODE LIKE EPSF-EPSFILMOD,
FILE_TYPE LIKE EPSF-EPSFILTYP,
FILE_MTIME(12),
END OF FATTR.
DATA: P_PATH(50) TYPE C.
CONCATENATE '/ARCHIVE/' sy-sysid '/archive' INTO P_PATH.
* WRITE: / P_PATH.
DPATH = P_PATH.
*Get files in folder - read into internal table DLIST
*if filenames are longer than 40 characters
*then use FM SUBST_GET_FILE_LIST.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
DIR_NAME = DPATH
TABLES
DIR_LIST = DLIST
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
NO_AUTHORIZATION = 4
READ_DIRECTORY_FAILED = 5
TOO_MANY_READ_ERRORS = 6
EMPTY_DIRECTORY_LIST = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
*Step 2: Read the file attributes into an internal table
*Read info about the files (attributes) into the internal table FATTR
*as we need info about the last time it was changed (MTIME)
LOOP AT DLIST.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
FILE_NAME = DLIST-NAME
DIR_NAME = DPATH
IMPORTING
FILE_SIZE = FATTR-FILE_SIZE
FILE_OWNER = FATTR-FILE_OWNER
FILE_MODE = FATTR-FILE_MODE
FILE_TYPE = FATTR-FILE_TYPE
FILE_MTIME = FATTR-FILE_MTIME
EXCEPTIONS
READ_DIRECTORY_FAILED = 1
READ_ATTRIBUTES_FAILED = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
FATTR-FILE_NAME = DLIST-NAME.
APPEND FATTR.
ENDIF.
ENDLOOP.
SORT FATTR BY FILE_NAME.
DATA: time(10), date LIKE sy-datum.
DATA: months TYPE i.
DATA: e_file TYPE string.
LOOP AT FATTR.
CLEAR: time, months, e_file.
IF FATTR-FILE_NAME(10) = 'archive_BW'.
*Convert the unix time into readable time
PERFORM p6_to_date_time_tz(rstr0400) USING FATTR-FILE_MTIME
time
date.
*Calculate the number of months between date (MTIME) and current day
*ex 31.03.2009 - 01.04.2009 = 1 month
*ex 01.02.2009 - 01.04.2009 = 2 month
CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_von = date
i_datum_bis = sy-datum
IMPORTING
e_monate = months.
CONCATENATE DPATH '/' FATTR-FILE_NAME INTO e_file.
* WRITE: / FATTR-FILE_NAME,
* FATTR-FILE_SIZE,
* date,
* time,
* sy-datum,
* months,
* e_file.
*Step 3: Delete files where months > 1
IF months > 1.
OPEN dataset e_file for output in text mode encoding default.
DELETE dataset e_file.
CLOSE dataset e_file.
ENDIF. "months > 1
ENDIF.
ENDLOOP.
ENDIF. -
Best way to read a CSV file into an internal table
Hi,
I have a comma seprated file, which I need to read into an internal table, and be able to look at particular values - basically looping round and populating BDC fields. Whats the easiest way of doing this?The easiest way would be to define a flat interal table.
Data: begin of itab occurs 0,
rec(1000) type c,
end of itab.
Then call the function module GUI_UPLOAD to get the data into your internal table from the file on the frontend. I assume that you know how to use this function module. You could also use the method GUI_UPLOAD of the class CL_GUI_FRONTEND_SERVICES.
For example, say you have a comman delimited file with materail number, plant, quantity in it.
4000001,0004,1.00
4000002,0006,2.00
Define another internal table to hold the data.
Data: begin of itab2 occurs 0,
matnr type mara-matnr
werks type marc-werks
quant(10) type c.
end of itab2.
Then loop at the internal table(ITAB) and use the split statement to split it up into the appropriate fields of the other interal table(ITAB2).
Loop at itab.
clear itab2.
split itab-rec at ',' into itab2-matnr
itab2-werks
itab2-quant.
append itab2.
endloop.
That's it.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
Maybe you are looking for
-
Want to type in my phone contacts with my computer (NOT tiny buttons on phone)
OK so I do not use Outlook or Yahoo or any of the like type services and even if I did, it would just be email addresses and not phone numbers. I need to input all my phone contacts (about 200) into my 8330. I cannot fathom how long it is going to
-
Where to find microsoft office app
where to find microsoft office App
-
HT1218 do you have to have a wireless router with the macbook air
do you have to have a wirelss router with the macbook air if you do not have internet in your home
-
Motion: controlling start/stop of animated still?
Very simple move on a still. I want to start on closeup, move out, pause at one point mid-frame, then move out further to full frame. I'm just using keyframes. I get my start very smooth (bezier) out to my 'pause' ... both the start and the stop at
-
Guinea Pigs Needed ;-)
Faced with web based reporting issues? Need to support multi-lingual site development. Sessions and URL rewritting spoiling your day? JSPFrame virtually eliminates Java in your JSP. A series of Tags (Dreamweaver extensio