Internal table Read statement
Hi,
AM using Read statement to read internal table as below.
Read itab into wa with key x = y.
if sy-subrc eq 0.
do some thing.
endif.
However the work area wa is not useful to me in my program. when am doing extended check it is issueing warning saying wa is not used. HOW TO CLOSE THIS WARNING.
Regards,
AAkash
just before read statement do
CLEAR WA.
This should remove the error.
Cheers
VJ
Similar Messages
-
Regarding internal table read.
Hi,
i want to read internal table and compare the one variable existing with in from date and to date.
the psudo code is like this
READ TABLE L_TABEMPLOYEE INTO L_WAEMPLOYEE WITH KEY EMPLOYEE = SOURCE_FIELDS_RULE-PERNR
ULTIMO BETWEEN L_WAEMPLOYEE-DATEFROM AND L_WAEMPLOYEE-DATETO.
but this statement gives error.
how to code for the same requirement.
regards,
swami.Hi,
Recode like this.It will definitely work
LOOP AT L_TABEMPLOYEE INTO L_WAEMPLOYEE
WHERE EMPLOYEE = SOURCE_FIELDS_RULE-PERNR
AND ULTIMO > L_WAEMPLOYEE-DATEFROM
AND ULTIMO < L_WAEMPLOYEE-DATETO.
<Write what you want to do here >
ENDLOOP.
Please reward if useful
Thanks Arjun
Edited by: Arjun Puthuruthy on Mar 26, 2008 10:52 AM -
Internal table -Select statement -2nd plant is not being filled
Hi,
Second field for plant WERKD is not getting filled in this table.I am using into corresponding fields of table ITAB statement.
I need both plants and in single select statement.
Any ideas?
DATA: BEGIN OF T_STOF OCCURS 0,
VBELN LIKE LIPS-VBELN,
ERNAM LIKE LIPS-ERNAM,
WERKS LIKE LIPS-WERKS,
NTGEW LIKE LIPS-NTGEW,
GEWEI LIKE LIPS-GEWEI,
EBELN LIKE EKKO-EBELN,
WERKD LIKE EKPO-WERKS,
LGORT LIKE EKPO-LGORT,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
AEDAT LIKE EKPO-AEDAT,
KNUMV LIKE EKKO-KNUMV,
END OF T_STOF.
SELECT LIKPVBELN LIKPERNAM LIPSWERKS LIPSNTGEW LIPS~GEWEI
EKKOEBELN EKPOWERKS EKPOLGORT EKPOEBELP EKPOMATNR EKPOTXZ01 EKPOAEDAT EKKOKNUMV
INTO CORRESPONDING FIELDS OF TABLE T_STOF
FROM LIKP
INNER JOIN LIPS
ON LIKPVBELN EQ LIPSVBELN
INNER JOIN EKKO
ON LIPSVGBEL EQ EKKOEBELN
INNER JOIN EKPO
ON EKKOEBELN EQ EKPOEBELN
WHERE LIKP~VBELN IN S_VBELN
AND LIKP~ERNAM IN S_ERNAM
AND LIPS~WERKS IN S_WERKS
AND EKKO~EBELN IN S_EBELN
AND EKPO~WERKS IN S_WERKD
AND EKPO~LGORT IN S_LGORT
AND EKPO~MATNR IN S_MATNR
AND EKPO~AEDAT IN S_AEDAT
AND BSART = 'UB'.
Or am i doing in wrong?
Regards
PraveenHi,
If you use INTO CORRESPONDING then the fieldname in the internal table has to match the selecting field name..
To avoid this you can use INTO TABLE...
SELECT LIKPVBELN LIKPERNAM LIPSWERKS LIPSNTGEW LIPS~GEWEI
EKKOEBELN EKPOWERKS EKPOLGORT EKPOEBELP EKPOMATNR EKPOTXZ01 EKPOAEDAT EKKOKNUMV
<b>INTO TABLE T_STOF</b>
Thanks,
Naren -
Internal Table : occurs statement
What is the meaning of using "occurs" statement in Internal Table. What does it imply?
DATA: BEGIN OF ITAB OCCURS 10,
END OF ITAB.
What difference it will make if suppose I use "OCCURS 0" or "OCCURS 10" ?Hi yogesh for more clearification
difference b/w occurs 0 & occurs n
The number <N> indicate how many lines has to have the table in initialization time: i.e. when the program is loaded in memory, the space for the table depends on the initialization numbers of the records.
AT run time if the table needs more space, this'll automatically be enhanced.
But If you know your table can have a certain numbers of records, you can indicate it in the defination, what'll improve the performance:
all the space the table needs is taken at the beginin, so it doesn't need to enhance the space at run time.
When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each are then allocated.
You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The space occupied, depending on the line width, is 16 <= <n> <= 100.
It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for deep-structured internal tables where the inner table only has a few entries (less than 5, for example).
To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB."
and it is better to use occus 0 inplace of occurs n because of above specified reasons
while it is not recommended to use occurs for internal table declaration and it has become obselete
reward if helpful -
Reg : internal table & Perform statement
hi all
i have 3 internal tables ,
* in first internal table i have mark-1 ,*
* in 2nd internal table i have mark-2 ,*
* using "PERFORM" i have to add mark 1 & mark 2*
* and i need to display the total in 3rd internal table.*
* how to do by using "PERFORM" .*
Kindly clarify.
with kind regards
velRaghupathy is right you just have to write:
porgram code......
perform sum_of_tables tables itab1
itab2
itab3.
program code....
definition of form:
form_sum_of_tables tables itab1
itab2
itab3.
definiton type of witab1, witab2, witab3.
loop itab1 into witab1.
loop itab2 into witab2.
witab3-total = witab1-mark1 plus witab2-mark2.
append witab3 to itab3.
endloop.
endloop.
endform.
It will return itab3 which is sum of itab1 and itab2. -
Hi Guys,
I have one internal table, I need to loop the table and READ the same table with in the loop.
My requirement is like this:
In the internal table KUNNR VKORG and VTWEG, if three fields values are same for more then one record, i need to append those records into another internal table.
Could any one help me.
Thanks,
GourisankarHi,
Loop at itab1 into wa_tab1.
Read table itab1 into wa_tab2 with key kunnr = wa_tab1-kunnr
vkorg = wa_tab1-vkorg
vtweg = wa_tab1-vtweg
field4 NE wa_tab1-field4 .
If sy-subrc = 0.
Append wa_tab2 to itab2.
endif.
Endloop.
Important: Here field4 should be a unique key in ur internal table.
Regards,
Prem -
How to read the method and put that code in 1 internal table
Hi,
Actually in the normal ABAP, if we want to read the report, then we will write read report statement.
If we want to read method then this statement will not work.
So, to read the method and put that code in 1 internal table , which statement we need to write?
Regards,
RadhikaHi Naimesh,
Thanks for your reply.
As, i am not aware of ABAP Objects i am having some issues:
Actually that is working for some methods in some classes.
Here 1 issue is there:
In se24 1 method is there in 1 class.
Even by using that FM in SE37 i am able to get the program name by giving class and method name,
but while using that FM in the program i am not able to get that program name.
so, i am unable to read the source code of the program?
1 example here:
Class name is CL_GUI_FRONTEND_SERVICES.
in this class, methods like FILE_EXIST , FILE_GET_SIZE, etc are there.
By giving the class name and method name i am able to get the program name also,
but while using that FM in the program i am not able to get that program name.
so, i am unable to read the source code of the program?
Here is my code:
REPORT Z16059_SCAN_METHOD.
DATA: BEGIN OF I_PROGRAM OCCURS 0,
LINE(256) TYPE C,
END OF I_PROGRAM.
DATA METHOD TYPE PROGRAM.
DATA: BEGIN OF I_STRUCTURE,
CLS_NAME(30) TYPE C,
METH_NAME(61) TYPE C,
END OF I_STRUCTURE.
I_STRUCTURE-CLS_NAME = 'CL_GUI_FRONTEND_SERVICES'.
I_STRUCTURE-METH_NAME = 'CL_GUI_FRONTEND_SERVICES-FILE_EXIST'.
CALL FUNCTION 'SEO_METHOD_GET_INCLUDE_BY_NAME'
EXPORTING
MTDKEY = I_STRUCTURE
IMPORTING
PROGNAME = METHOD
EXCEPTIONS
INTERNALMETHOD_NOT_EXISTING = 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.
READ REPORT METHOD INTO I_PROGRAM.
Please help me out in this regard.
Thanks & Regards,
Radhika -
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. -
Performance Issue When Read from Internal Table
In my form, I have 6 windows which contain all the header information, which are kept in my gt_header internal table. Since all windows required data from the same internal table, reading the internal table at Initialization for once or, creating the LOOP at each window, which one will be a better choice in terms of performance?
Hi,
you cannot create 6 windows under loop.You can only have loop under a window only.
So create a big window which covers whole area of 6 windows.Create templete under that and write only one loo with text in all those boxes of that templete.
Regards,
Rock. -
Using internal tables in BI 7 Start routines
Hi All
I tried searching for using internal tables in a start routine in BI 7 could not find the right pointers.
This is what I am trying to do is the following:
In a DSO ZSD_O01 I have a sales order and sales order item number and this DSO also contains the Contract number and the contract Item number.
The DSO structure is as follows:
/BIC/AZSD_O0100
DOC_NUMBER
ITEM
CONTRACT
CITEMNUM
I want to read the data in this DSO into a internal table. But the key fields in this DSO is DOC_NUMBER and ITEM so I want to read this data into a internal table only for the first data package into the internal table. Thereafter I want to lookup into the internal table given the doc_number and ITEM to find the CONTRACT and CITEMNUM.
Can any of you kindly show me how to :
- Read data from a DSO into a internal table
- Read the internal table for the first data package
- How do I make the access in the internal table fast when my lookup in the internal table is not on the
DSO key columns but on a different key column
Appreciate your help
Thanks
KarenHi Karen ,
It will be helpful if you tell your requirement as the approach you suggested is not looks convincing .May be their is some easy way and we can suggest you better approach
-how to check for source_package = 1
You need to hard code it .
We decide package size at DTP level so you can declare a global variable .let say you have 50000 size of your package then use global variable as counter and read only when record_count is <= 50000 .
-how to declare the internal table so the values in it exists between different data packages
Declare a global table and select data into it .A global table retain data across the packages .
- The key on which I need to lookup in the internal table is not the key fields as in the DSO
Its ok .Let say you are doing lookup on A B and C field of DSO1 and the values may duplicate in your source .then you just need to read the internal table having data from DSO2 with key field A B C .
Better if you set them as semantic keys at DTP level so that all duplicate entries of A B C will appear in same package .
global Declarations
In your start routine you will have this following code :
TYPES:
tyt_SC_1 TYPE STANDARD TABLE OF tys_SC_1
WITH NON-UNIQUE DEFAULT KEY.
$$ begin of global - insert your declaration only below this line -
... insert your code here
$$ end of global - insert your declaration only before this line -
One question
Why you want to populate values for 1 source package only not for all ?This will be helpful to understand your requirement and may be we can fulfill it in some other manner .
Regards,
Jaya Tiwari -
Issue with uploading XML file from application server into internal table
i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module SMUM_XML_PARSE and the error message is "line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?
TYPES: BEGIN OF T_XML,
raw(2000) TYPE C,
END OF T_XML.
DATA:GW_XML_TAB TYPE T_XML.
DATA: GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
DATA:GI_STR TYPE STRING.
data: GV_XML_STRING TYPE XSTRING.
DATA: GI_XML_DATA TYPE TABLE OF SMUM_XMLTB INITIAL SIZE 0.
data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'File does not exist' TYPE 'E'.
ELSE.
DO.
* Transfer the contents from the file to the work area of the internal table
READ DATASET LV_FILE1 INTO GW_XML_TAB.
IF SY-SUBRC EQ 0.
CONDENSE GW_XML_TAB.
* Append the contents of the work area to the internal table
APPEND GW_XML_TAB TO GI_XML_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
* Close the file after reading the data
CLOSE DATASET LV_FILE1.
IF NOT GI_XML_TAB IS INITIAL.
CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
ENDIF.
* The function module is used to convert string to xstring
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = GI_STR
IMPORTING
BUFFER = GV_XML_STRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE 'Error in the XML file' TYPE 'E'.
ENDIF.
ENDIF.
IF GV_SUBRC = 0.
* Convert XML to internal table
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = GV_XML_STRING
TABLES
XML_TABLE = GI_XML_DATA
RETURN = GI_RETURN.
ENDIF.
READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ 0.
MESSAGE 'Error converting the input XML file' TYPE 'E'.
ELSE.
DELETE GI_XML_DATA WHERE TYPE <> 'V'.
REFRESH GI_RETURN.
ENDIF.Could you please tel me why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
Becuase there will be lot of XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?> ??????
Is there any other way we can do with out removing the lines? -
How to do a SELECT from different tables into an internal table?
How to do a SELECT from different tables into an internal table?
I want to select data from MARA, MARC and ZPERSON and populate my ITAB_FINAL
REPORT zinternal_table.
TABLES:
mara,
marc,
zperson.
TYPES:
BEGIN OF str_table1,
v_name LIKE zperson-zname,
v_matnr LIKE marc-matnr,
v_emarc LIKE marc-emarc,
v_werks_d LIKE marc-werks_d,
v_dstat LIKE marc-dstat,
END OF str_table,
i_table1 TYPE STANDARD TABLE OF str_table1.
DATA:
BEGIN OF str_table2,
v_mandt LIKE mara-mandt,
v_ernam LIKE mara-ernam,
v_laeda LIKE mara-laeda,
END OF str_table2,
itab_final LIKE STANDARD TABLE OF str_table2.first find the link between mara , marc and zperson , if u have link to 3 tables then u can jus write a join and populate the table u want ( thats final table with all the fields).
u defenitely have alink between mara and marc so join them and retrieve all data into one internal table.
then for all the entries in that internal table retrieve data from zperson into another internal table.
then loop at one internal table
read another internal table where key equals in both the tables.
finally assign fileds if sy-subrc = 0.
gs_finaltable-matnr = gs_table-matnr
etc...
and finally append gs_finaltable to gt_finaltable.
there u go ur final table has all the data u want.
regards
Edited by: BrightSide on Apr 2, 2009 3:49 PM -
Hi Experts,
Row
Column
Value
1
0001
Prem(First Name )
1
0002
Raj(Middle name )
1
0003
Kaushik(Last name
2
0001
Naresh
I have the above data in excel file and my internal table like as follows
Data : begin of it_itab occurs 0,
Row type c,
Column type string,
Value type string,
End of it_itab.
Now I want to upload the excel file to my internal table
filed wise i.e in my intenal table row
shold have row values from excel same as
for column and value also
Can anyone suggest me fix this issue?
Best Regards,
Ramjee MYou may use this function to put data in internal table.
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file *xcel file name
i_begin_col = p_scol *start column
i_begin_row = p_srow *start row
i_end_col = p_ecol *end col
i_end_row = p_erow *end row
TABLES
intern = it_tab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
Use this function to put data in internal table. -
How can I get the name of an internal table in a textfield?
Hi,
I have defined an internal table in a program. Now I need the name of thist table (<u>NOT</u> the components!!!) in a textfield.
Example for Data-Definitions in my Program:
data: begin of it_tab occurs 0,
feld1 like icon-id,
feld2 like icon-name,
end of it_tab.
data: tabname(30) type c.
How can I transfer the name "IT_TAB" into the field tabname?
Thanks in andvance!No, it has to by 'dynamic'. I don't want to transfer it hard, because it should work for any internal table name.
The requirement is: There are many function modules that have an input field TABLENAME. I have to give the tablename in the Form 'IT_TAB'.
But I look for a possibiltity not to write:
tabname = 'IT_TAB'.
For DDIC-Tables its not a problem, but I dont know a way for internal tables. -
Update all alv (grid) displayed records to internal table
Hi all,
i want to update the records into the internal table which are changed by the user in the edit field.
after he select save button.
i have to save the ALV grid displayed records in the internal table.
hw can i do this ?ALV with EDIT and SAVE functionality
Code:REPORT z_demo_alv_jg.*******************************************************************
TYPE-POOLS *
TYPE-POOLS: slis. *******************************************************************
INTERNAL TABLES/WORK AREAS/VARIABLES *
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.*******************************************************************
FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.*******************************************************************
SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.*******************************************************************
START-OF-SELECTION *
START-OF-SELECTION.* Storing table name
p_table = tabname.* Create internal table dynamically with the stucture of table name
entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'. LEAVE TO LIST-PROCESSING.
ENDIF.
Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>. SORT i_fieldcat BY col_pos.* Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS. REFRESH <dyn_tab_temp>.* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc <> 0. ENDIF.&----
*& Form SET_PF_STATUS
Setting custom PF-Status
-->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'Z_STANDARD'.ENDFORM. "SET_PF_STATUS&----
*& Form user_command
Handling custom function codes
-->R_UCOMM Function code value
-->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>. CASE r_ucomm.* When a record is selected
WHEN '&IC1'.* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex. IF sy-subrc = 0.* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.* Make all the fields input enabled except key fields
w_field-input = 'X'. MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL. ENDIF.* Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc = 0.* Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.* If the record is changed then track its index no.
and populate it in an internal table for future
action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF. ENDIF.* When save button is pressed
WHEN 'SAVE'.* Sort the index table
SORT i_index.* Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index. LOOP AT i_index.* Find out the changes in the internal table
and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF. ENDLOOP.* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3. IF sy-subrc = 0.* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>. REFRESH <dyn_tab_temp>.* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table. ENDIF.
ENDCASE. rs_selfield-refresh = 'X'.ENDFORM. "user_command
Maybe you are looking for
-
Burning downloaded movie to DVD
Is it possible to burn a movie i have downloaded from itunes onto a DVD?
-
Create GR using BBP_PD_CONF_CREATE
Hi Experts I have a requirement in which I have to automatically create GR from PO. For this I have created an FM. In this FM I first call BBP_CF_ASSIGNMENT and then map the header structure(without the dummy guid as it gives error in the BBP_PD_CONF
-
HELP - bpelc - problems with the element correlation !!! - NullPointerExcep
Hello ! I have a big problem to create a jar-file with bpelc, when I use correlations. bpelc produce the failure: java.lang.NullPointerException at com.collaxa.cube.ws.wsdl.ext.bpws.PropertyAliasSerializer.unmarshall( PropertyAliasSerializer.java:124
-
Bad Parameter - Extract pages Acrobat XI
Had to purchase Acrobat XI on new computer. DO NOT LIKE IT AT ALL!!!!! Loved Acrobat 9 format and it was very user friendly. Not the case at all for Acrobat XI. Wasting time trying to perform editing and now can't extract pages from file. How do
-
Publish projects as HTML5 files
This question was posted in response to the following article: http://help.adobe.com/en_US/captivate/cp/using/WS16484b78be4e1542-74219321367c91074e-8000. html