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,
Gaurav
Hi 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
Similar Messages
-
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. -
How to send data from internal table to the shared folder in ABAP
Hi experts,
My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is "
xxx\y\z....".
I do not have any idea on how to send data from internal table to the shared folder path.
can anybody please help me out how to do this?
Thanks & Regards
Sireesha.Where that folder is located, its on presentation server i.e. desktop or application server.
If its on presentation server, use FM GUI_UPLOAD.
If its on application server, then use DATASET functions. Have a look at below link.
[File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
I hope it helps.
Thanks,
Vibha
Please mark all the useful answers -
Downloading data from internal table to xls file leading zeros are not disp
Hai abap gurus,
when i am downloading data from internal table to excle file. some field values in a column are with leading zeros and some others dont have leading zeros.but in the output it is showing without leading zeros. then how to get with exact values.
Ex:
<b>ECC Code.</b>
045234
88567
098456
but output is giving like this:
45234
88567
98456
how to get the actual values.....
plz help me in this matter.Dear Kiran,
Those field in the internal table having Leading Zeroes, make those fields' datatype as character.
Then use the function module to download the content of the internal table to the excel file.
Regards,
Abir
Don't forget to Reward Points * -
Reading data from BSEG table with Non-key fields in where clause
Hi All,
I have to read data from BSEG table based on WBS element field (PROJK). As I'm not passing key fields to WHERE clause system couldnt run the select statement. Since BSEG is a cluster table I cant even create secondary index on PROJK field.
Could you please tell me, how to improve its performance.
Regards
Jaker.SELECT bukrs
belnr
gjahr
shkzg
dmbtr
hkont
lifnr
matnr
werks
menge
meins
ebeln
FROM bseg
INTO TABLE it_bseg
PACKAGE SIZE 10
FOR ALL ENTRIES IN it_final
WHERE bukrs EQ it_final-bukrs
AND belnr EQ it_final-belnr
AND gjahr EQ it_final-gjahr
AND buzei EQ it_final-buzei
AND hkont EQ it_final-hkont
AND werks IN s_werks.
By using package and fetch from BSEG table. gathering all other information to a final internal table.This will reduce the hit to database.And also try to put that data in hashed internal table which is it_bseg....then definetly improve the performance.
<REMOVED BY MODERATOR>
Dara.
Edited by: Alvaro Tejada Galindo on Apr 21, 2008 12:47 PM -
Hash lookup or Binary search to fetch data from internal table
Hi All,
I want to know Which is faster, Hash lookup or Binary search to fetch data from internal tables?
Thanks,
Mahesh
Moderator Message: Duplicate post
Edited by: kishan P on Oct 14, 2010 4:22 PMtype mod* .the the sign would change to pattern.try and see.i checked.reward if works.
-
Reading Data from a Table With an Expert
Hi all - I'm trying to write an Expert in OWB that would read data from a table and create a new table based on that information. I have the table creation part down, but how can I read data from a table with an Expert? From what I've read, Experts only deal with metadata, and there is no mechanism in Experts to actually read data in the tables. Does OraTcl work in Experts? Has anyone ever came across this problem, and if so, how did you solve it? Thanks in advance for your time! - Don
Hi Don
Can also use Java and JDBC from within Tcl, see the routines in this file below, take modify or whatever;
http://blogs.oracle.com/warehousebuilder/ombora.tcl
source <dir>\ombora.tcl
set g_user scott
set g_upwd zzzzzz
set g_hostname localhost
set g_port 1521
set g_srvname ora111
oraconnect $g_user $g_upwd $g_hostname:$g_port:$g_srvname
oraselect "select * from emp" ""
As well as dumping the results to stdout (you probably want to comment that part out and change any other part you don't like), g_res is a ResultSet object you can use to do whatever.
Cheers
David -
Gui_download for transferring the data from internal table to excel sheet.
hi all,
i am using gui_download for transferring the data from internal table to excel sheet.
I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
Thanks in advance.Hi Venkata,
plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_filename = p_file
* I_APPL_KEEP = ' '
tables
i_tab_sap_data = t_mbew
* CHANGING
* I_TAB_CONVERTED_DATA =
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Hope this helps,
Erwan -
Read data from 2 tables.
Hello everyone,
I created a SQL database in phpMyAdmin. It contains 2 tables.
'Woninginformatie' and 'Makelaars'.
I use the next SQL query in my PHP file to read from the
database:
SELECT DISTINCT * FROM Woninginformatie
INNER JOIN Makelaars ON Woninginformatie.ID_mk =
Makelaars.ID_mk
WHERE Huiscode = $huiscode"
The query works correct and I get all the fields from both
tables. Anyway, in Flash I can only read out the information in the
table 'Woninginformatie'.
I use these kind of codes to read from the database:
eigendomssituatie =
gegevens.childNodes[0].childNodes[24].firstChild.nodeValue;
How can I also read data from the second table?you can't read data from the 2nd table because because you
have a table issue, php issue or you can read data from the table
but are having trouble getting those data into flash? are you using
echo to return data to flash? -
Download data from internal table to flat file.
I need to download the data from Internal table to Flat file. can any one suggest how to do it? i suppose WS_Download OR GUI_DOWNLOAD.
but if it is please guide me how to use this.
is thre any other F.M. please provide the information.
Thanks in advanceHi,
Try this,
* File download, uses older techniques but achieves a perfectly
* acceptable solution which also allows the user to append data to
* an existing file.
PARAMETERS: p_file like rlgrap-filename.
* Internal table to store export data
DATA: begin of it_excelfile occurs 0,
row(500) type c,
end of it_excelfile.
DATA: rc TYPE sy-ucomm,
ld_answer TYPE c.
CALL FUNCTION 'WS_QUERY'
EXPORTING
query = 'FE' "File Exist?
filename = p_file
IMPORTING
return = rc.
IF rc NE 0. "If File alread exists
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'File Already exists!!'
text_button_1 = 'Replace'
* ICON_BUTTON_1 = ' '
text_button_2 = 'New name'
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
IMPORTING
answer = ld_answer
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
* Option 1: Overwrite
IF ld_answer EQ '1'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = p_file "File Name
filetype = 'ASC'
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_excelfile "Data table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i003(zp) WITH
'There was an error during Excel file creation'(200).
exit. "Causes short dump if removed and excel document was open
ENDIF.
* Option 2: New name.
ELSEIF ld_answer EQ '2'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = p_file "File name
filetype = 'ASC' "File type
* col_select = 'X' "COL_SELECT
* col_selectmask = 'XXXXXXXXXXXXXXXXXXXXXXXXXX'
* "COL_SELECTMASK
filetype_no_show = 'X' "Show file type selection?
* IMPORTING
* act_filename = filename_dat
TABLES
data_tab = it_excelfile "Data table
* fieldnames =
EXCEPTIONS
file_open_error = 01
file_write_error = 02
invalid_filesize = 03
invalid_table_width = 04
invalid_type = 05
no_batch = 06
unknown_error = 07.
ENDIF.
ELSE. "File does not alread exist.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = p_file "File name
filetype = 'ASC' "File type
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_excelfile "Data table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i003(zp) WITH
'There was an error during Excel file creation'(200).
exit. "Causes short dump if removed and excel document was open
ENDIF.
ENDIF.
Regards,
Raghav -
Convert data from internal table to XML file.
Hi All,
I am selecting data from database into one internal table.
Now I want to convert data from internal table to xml file format and save in to my desktop. Please suggest me how I can achieve my requirement.
Kindly reply me ASAP.Use this FM. SAP_CONVERT_TO_XML_FORMAT
Check this link too -
Re: Data Export in XML format
XML files from ABAP programs -
Do I have to use lock when I am reading data from a table
Hi,
When i am reading data from a table , do I have to set a lock on that table .
Is it necessary for us to set the lock on a table when I am reading data from the table.
When I am updating the table , do I have to set a lock on the table ?
If yes, then what sort of lock-read lock,write lock or shared lock?
Regards,
Sushanth H.S.check it out,
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 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.
Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
1. enque_lockobject
1. deque_lockobject
before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
Reward if helpful -
How to read Data from ZL table
Can someone give me function module or sample code to read data from ZL table in B2 cluster
Edited by: Saurabh Desai on Jan 13, 2010 9:13 PMYou wanted to extract data, ZL table to precise, from B2 cluster, is that right?
For this the snipped I gave you can be used.
First you need an inlcude with appropriate declarations
INCLUDE rpc2b201. "-> here b2 structure, ZL table are declared
Now you provide key for the cluster which is what below does
b2-key-pernr = "ee number
b2-key-pabrj = "year to extract data for
b2-key-pabrp = "month to extract data for
b2-key-cltyp = 1.
Now all you need is to extract ZL table form B2 cluster
IMPORT zl "get ZL table
FROM DATABASE pcl2(b2) "from cluster B2
ID b2-key. "for this key
That's it. Now you have correct data in ZL table which you can process further.
Hope now it is clear.
Regards
Marcin -
Upload data from Internal table to text file with '~' separator
can anyone help me to download data from internal table to flat file with '' separator. GUI_DOWNLOAD is not working in my case ....like for '' separator
Here it is
REPORT zkb_test1.
TYPE-POOLS: truxs.
DATA: i_scarr TYPE TABLE OF scarr,
i_conv_data TYPE truxs_t_text_data.
SELECT * FROM scarr INTO TABLE i_scarr.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = '~'
TABLES
i_tab_sap_data = i_scarr
CHANGING
i_tab_converted_data = i_conv_data
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = 'C:\Test1.txt'
filetype = 'ASC'
CHANGING
data_tab = i_conv_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards
Kathirvel -
Hi,
I met a problem.
How to read data from cluster tables using:
b2-key-pernr = 20.
b2-key-pabrj = 2006.
b2-key-pabrp = 09.
b2-key-cltyp = '1'.
import saldo from database pcl2(b2) id b2-key.
the problem is that the sy-subrc is always 4, could anyone help me?
thank you very much!Hi,
Import and export to database is used in two programs and not in the same program.
<b>ZPROGRAM1.</b>
tables : indx.
Data : SALDO type i,
indxkey LIKE indx-srtfd VALUE 'ZAB1'.
indx-aedat = sy-datum.
indx-usera = sy-uname.
indx-pgmid = sy-repid.
EXPORT SALDO TO DATABASE indx(zc) ID indxkey.
In another program,
<b>ZPROGRAM2.</b>
tables : indx.
Data : SALDO type i,
indxkey LIKE indx-srtfd VALUE 'ZAB1'.
indx-aedat = sy-datum.
indx-usera = sy-uname.
indx-pgmid = sy-repid.
IMPORT SALDO FROM DATABASE indx(zc) ID indxkey.
Best regards,
Prashant
Maybe you are looking for
-
My husband and I share a macbook. We each have our own log-in and we each have our own itunes account. How can we use home sharing?
-
Could not find main class - Java virtual machine launcher error
Hi, I tried executing the following cmd, below is the following error: <<command i executed>> C:\Program Files\Java\jre1.5.0_09\bin>java -classpath "C:\Program Files\Java\jre1.5.0_09\lib\javaws.jar" com.sun.javaws.Main https://<IPddr>:8443/sample.jnl
-
I have an iMac, OS 10.7.2, Airport Extreme router, and an HP Officejet Pro 8000 Wireless. I recently replaced my router with an Airport Extreme. My printer setup CD is for OS 10.4 or 10.5. I'm trying to setup the 8000 wirelessly but without much l
-
2008 imac ejects CDs after 10 secs plays dvds ok,running OS X 10.8.2
2008 iMac w built in disc player Ejects CD after 10 secs cannot load to Itunes library. Plays DVDs fine.
-
Hello, i wanna update a column in a table (make it null). but the table is very big, and if i write something like update my_table set column_name=nullit takes very much time (probably hours) How can i optimize that? Any workaround for this to reduce