How to move field symbol internal table to internal table with header line?
Dear all,
hi...hereby i would like to ask how i can move field symbol internal table to a internal table?
as i know field symbol internal table is without header line..
so, may i know how to do this....to move field symbol internal table to internal table which consist of header line and field and record will same as field symbol internal table...in additional, my field symbol internal table is dynamic table mean everytime will have flexible columns..?
Please advise...
Thanks
Regard,
ToToRo.
Edited by: @ToToRo@ on Aug 20, 2009 6:16 AM
Hello,
Try this way:
If both the type of internal tables are same then you can directly assign dynamic internal table to static internal table.
itab = <itab>.
Suppose you have field symbol internal table <itab> which is different in structure from ITAB.
Now, you can create <wa> as follow:
FIELD-SYMBOLS <wa>.
DATA wa TYPE REF TO DATA.
CREATE DATA wa TYPE LINE OF <itab>.
ASSIGN wa->* to <wa>.
This way your work area is read.
Using [ASSIGN COMPONENT|http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/content.htm] syntax you can read required component of <wa>.
Finally you can use that value to load static internal table.
You can also refer to my thread on [Dynamic table|Re: Creating Dynamic table].
Hope this helps!
Thanks,
Augustin.
Edited by: Augustarian on Aug 20, 2009 10:06 AM
Similar Messages
-
Move Field symbol data to Internal table
Dear All,
Please suggest how to move field symbol data to internal table. The requirement is I have dynamic data in Field symbol which to move to table parameter of a function module.
Thanks in Advance
Rams.Dear All,
In need to pass tabular data i.e. multiple entries from field symbol to the table parameter of the custom function module.
Field symbol is declared as below:
FIELD-SYMBOLS: <FS_EXCEL_TAB> TYPE STANDARD TABLE,
<FS_TABLE_HEADER> .
DATA WA_PD LIKE PRICE_DOWNLOAD.
APPEND <FS_TABLE_HEADER> TO <FS_EXCEL_TAB>.
CLEAR <FS_TABLE_HEADER>.
WA_PD-VKORG = <FS_EXCEL_TAB>-VKORG.u201D Problem while using this statement
APPEND WA_PD TO PRICE_DOWNLOAD.
CLEAR WA_PD.
Field symbol <FS_EXCEL_TAB> is populated like this.
VKORG | KUNNR_SH | KUNNR_SP |
0015 | 102105 | 102105 |
Now I need to move this data to table in tables parameter of custom fucntion module.
Thanks in advance,
Rams -
How to use FIELD-SYMBOLS to declare a table
How to use FIELD-SYMBOLS to declare a table?
hi yong,
this will be very general:
FIELD-SYMBOLS : <gf_table> TYPE ANY TABLE.
or
to do like a specific table from your program
FIELD-SYMBOLS : <gf_table> TYPE itab.
itab is of course your internal table from your program.
ec -
How to use field symbols in program
how to use field symbols can any one explain with example please..
Regards,
venki...Hi
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
check the below links u will get the answers for your questions
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect
You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
<b>Reward points for useful Answers</b>
Regards
Anji -
can anyone tell me how to use field symbols. What effect it has on performance of a program?
what r its avantages?
iam working on a report where iam facing a lot of problems in performance issue. can anyone tell how field symbols are useful in this regard?
thanx to allCheck the below links
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Additions
1. ... STRUCTURE s DEFAULT wa
2. ... TYPE t
3. ... TYPE LINE OF t
4. ... LIKE s
5. ... LIKE LINE OF s
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN . All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT>.
TABLES SFLIGHT.
ASSIGN SFLIGHT-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... STRUCTURE s DEFAULT wa
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP/4 Dictionary ( s ). All fields of the structure can be addressed by name: <fs>-fieldname . The structured field symbol points initially to the work area wa specified after DEFAULT .
The work area wa must be at least as long as the structure s . If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Addition 2
... TYPE t
Addition 3
... TYPE LINE OF t
Addition 4
... LIKE s
Addition 5
... LIKE LINE OF s
Effect
You can use additions 2 to 5 to type field symbols in the same way as FORM parameters (see also Type assignment of subroutine parameters). ASSIGN performs the same type checks as with USING parameters of FORM s. -
Why does my internal table(with header line) ignore 4 of its fields?
Hi Gurus,
I am a newbie to ABAP how has spent far to much of my weekend time trying to solve the following problem;
when trying to insert data from table cdpos into my internal table, I only get the two object* fields, the other 3 are not even part of the internal table according to the debugger.
my select code is:
SELECT fname tabkey changenr objectclas objectid
FROM cdpos
INTO CORRESPONDING FIELDS OF i_cd_index
WHERE tabname = 'XXX'
AND fname = 'XXX'
AND chngind = 'U'
ENDSELECT.
IF sy-subrc <> 0.
ENDIF.
- If I use a wa like line of i_cd_index the other fields will show up.
- I have tried with including 'TABLE' in the INTO statement, same result.
Please help out, getting very frustrated here....
/MikeHi Magdic,
I have completely coded for but i have taken as parameters rather direct values (XXXX). Under stand the code and select statement you will get it. Program which i have shown is working fine.
Do one thing first go the table CDPOS take one entry of Objectid, Tabname, fname and chngind and then enter in the selection and find whether the values are fetched correctly or not.
To my knowledge there might be no data in your table.
Anyhow try the below code.
TABLES: CDPOS.
DATA: ITAB LIKE CDPOS OCCURS 0 WITH HEADER LINE.
parameters: p_CHGID like CDPOS-chngind,
p_TAB like CDPOS-TABNAME,
P_FNAM LIKE CDPOS-FNAME.
SELECT OBJECTID TABNAME FNAME CHNGIND FROM CDPOS INTO CORRESPONDING FIELDS OF ITAB WHERE OBJECTID = P_CHGID
AND TABNAME = P_TAB
AND FNAME = P_FNAM.
APPEND ITAB.
ENDSELECT.
WRITE: ITAB-OBJECTID, ITAB-TABNAME, ITAB-FNAME, ITAB-CHNGIND.
Cheers!!
Balu -
Very Urgent: how to define field symbols in class using se24 Points assured
hi all
I am new to abap oo programming. I am using se24 to build a class
where some methods have code which involves working with field sybmols but i am not able to figure out way for how to define field symbols in the attributes section.
I tried defining like : fld_sym type ref to dbtab-fld
but in the method implementation if i try to use it like assign fld to <fld_sym> there it says fld_sym is not defined as a field symbol.
So can anyone please guide me how to define field symbols in se24.
Also what should be the general steps while creating a class using se24.
Points assured
thanksHi
Global classes are like Global fun modules in which the Methods and code is already written and is mainly used for Reusability purpose.
Goto SE24 tcode and see the std global classes like
CL_ABAP_CHAR_UTILITIES
see the links
chk out the links below:
General Tutorial for OOPS
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
Have a look at these links for OO ABAP.
http://www.sapgenie.com/abap/OO/
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
SDN Series:
https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb [original link is broken]
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
Basic concepts of OOPS
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b17cf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
http://www.henrikfrank.dk/abapuk.html
http://www.erpgenie.com/abap/OO/
Reward oints if useful,
Aleem. -
How to use field-symbols in MODIFY ... TRANSPORTING and SORT
Hi,
I need to increase the performance of an abap report using the field-symbols. More exactly the code is the following.
TYPES:
BEGIN OF itab_structure.
INCLUDE STRUCTURE nameofstructure.
TYPES:
RECNO LIKE sy-tabix,
END OF itab_structure.
DATA:
itab TYPE STANDARD TABLE OF itab_structure
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
SORT itab ASCENDING BY f1.
LOOP AT itab WHERE f1 = '10'.
itab-fn= value-n.
MODIFY itab
TRANSPORTING fx fy fz ft
WHERE f1 = c1_filed AND
f2 = c2_field.
ENDLOOP.
I need your suggestions in this kind of conversion or solution.
SORT itab ASCENDING BY f1 (<-- I don't know if in this case the better performances should be obtained using field symbols and in which way)
FIELD-SYMBOLS: <fs_itab_line> TYPE LINE OF itab.
LOOP AT itab ASSIGNING <fs_itab_line> WHERE
<fs_itab_line>-f1 = '10'.
MODIFY itab
TRANSPORTING fx fy fz ft
WHERE f1 = c1_filed AND
f2 = c2_field.
(I don't know if in this case the better performances should be obtained using field symbols and in which way)
ENDLOOP.
I wish to implement the field symbols or the better performance in terms of execution time in all my abap code, where it is possible.
Any suggestion will be well appreciated.
Thanks in advance for your kind support.
Regards,
GiovanniDear All,
I have appeciated your suggestions and I can conclude these points in my case:
1) The "sort" statement is not optimized in a different way using filed-symbols
2) The loop with "where" condition on a standard table is performed using filed-symbols
But ... my last point to investigate is about the statement MODIFY table TRANSPORTING f1, f2 WHERE conditions.
More exactly, in my code the execution logic of the abap code expects a global modification of the same table at the end of every (primary) loop, using the MODYFY statement.
In other words in my code I can locate two loops on the same table in the following logic:
LOOP AT table1 WHERE f1 = '10'. (#1)
updates to table1
set c1_filed, c2_filed
LOOP AT table1. (#2)
IF f1 = c1_filed AND
f2 = c2_filed.
table1-fx = 'x'.
table1-fy = 'y'.
table1-fz = 'z'.
table1-ft = 't'.
ENDIF.
MODIFY table1.
ENDLOOP. (#2)
ENDLOOP. (#1)
In better way (maybe more fast in terms of execution time) to modify a set of lines (MODIFY...TRANSPORTING...WHERE):
LOOP AT table1 WHERE f1 = '10'.
table1-fx= 'x'.
table1-fy= 'y'.
table1-fz= 'z'.
table1-ft= 't'.
MODIFY itab
TRANSPORTING fx fy fz ft
WHERE f1 = c1_filed AND
f2 = c2_field.
ENDLOOP.
My aim is to use field-symbols everywhere possible for speeding up the execution of my code,by maintaining this logic.
My proposal should be the following but I need your kind opinion.
FIELD-SYMBOLS: <fs_#1_line> TYPE LINE OF table1.
FIELD-SYMBOLS: <fs_#2_line> TYPE LINE OF table1.
LOOP AT table1 WHERE f1 = '10' ASSIGNING <fs_#1_line>. (#1)
updates to table1
set c1_filed, c2_filed
LOOP AT table1 ASSIGNING <fs_#2_line>. (#2)
IF <fs_#2_line>-f1 = c1_filed AND
<fs_#2_line>-f2 = c2_filed.
<fs_#2_line>-fx = 'x'.
<fs_#2_line>-fy = 'y'.
<fs_#2_line>-fz = 'z'.
<fs_#2_line>-ft = 't'.
ENDIF.
ENDLOOP. (#2)
ENDLOOP. (#1)
Your kind support is very important for me.
Thanks in advance.
Regards,
Giovanni -
How to use Field-symbol with dynamic select query
Can anybody tell me, how to use field-symbols in the dynamic select query.
FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
1. ... typing
2. ... STRUCTURE struc DEFAULT dobj
The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
eg.
FIELD-SYMBOLS <fs> TYPE ANY.
DATA: BEGIN OF line,
string1(10) VALUE '0123456789',
string2(10) VALUE 'abcdefghij',
END OF line.
WRITE / line-string1+5.
ASSIGN line-string1+5(*) TO <fs>.
WRITE / <fs>.
output:
56789
56789
reward if helpful
anju -
Hi,How to add field to sap Liquidity calculation module tables?
Hi Experts,
How to add field to sap Liquidity calculation module tables?
and how to add a field to a particular transaction code using a customer exits.
please tell me in detail.
thanks inadvance,
Regards,
RekhaHi Pranab,
Please follow the below steps to create an extra field and write code for that field through Infoset.
1-->Change in Infoset
u2022Go to SQ02 , enter Infoset name and click on Change Button
u2022Go to Extras (F5) button displayed on application bar.
u2022In Extras tab, click on 'Create' icon to create additional field E_NAME1, give as type C (character) and give desired length and. Enter header description as 'ShipToName'
u2022Select this field i.e E_NAME1 in one of the field group of Infoset.
u2022Go to Code section (Shift+F8) of infoset, Select Record Processing Event and write your logic code (condition) in this code section:
if vbpa-adrnr = space.
E_NAME1 = kna1-name1.
else.
E_NAME1 = adrc-name1.
endif.
2-->Generate the Infoset.
3-->Change in Query
u2022Go to SQ01(in a new session), give your query name (by selecting your user group) and click on change button.
u2022Check the field group in which you have added E_NAME1 field, then check E_NAME1 from Fields screen
u2022Click on 'Basic List' button; give line (row no.) and sequence (column no.) for extra fields.
u2022Execute/Test the Query, you will get desired result.
Please let me know, if you need more information.
Regards,
Dinesh
Edited by: Dinesh Tiwari on Oct 29, 2009 7:13 AM -
Dynamicly creating an internal table with header line
Hi experts,
I am trying to do a read on an internal table using field symbols of type any table. To be able to read more than one row at once, I'd like to read it into another internal table (instead of just one line and instead of looping through them one by one).
So far the following line rendered an error that the target internal table doesn't have a header line
read table <fs_v_tab> WITH KEY (<fs_comp>) = <fs_param>-low INTO <fs_v_tab>.
(also attempted using "<fs_v_tab>->*" & "<fs_v_tab>[]" to be silly)
Based on the following article, I was wondering if it were possible to dynamicly create an internal table with header line.
[http://help-abap.blogspot.com/2008/09/dynamic-internal-table-creation.html|http://help-abap.blogspot.com/2008/09/dynamic-internal-table-creation.html]
Any help or tips on how to dynamicly filter an internal table field-symbol is greatly appreciated!Just read the online help:
This statement reads a row from internal table itab.
Or more exact:
This statement reads one row from internal table itab.
Therefore you can not read multiple lines into another table. The header line is needed to put the result in. And this is not what you intended, the result will be in the header line, not in the table itself.
If the row to be read is not uniquely specified, the first suitable row is read. In the case of index tables, this row has the lowest table index of all matching rows.
At least you have to do what you dont wanna do: looping. -
BADI cant use an internal table with header line
hi,
In BADI, we cant use an internal table with header line, and I am calling a function module which requires internal table as import parameter, now, the table I am passing is without a header line, So how to solve this problem ?You can use a type and then create an internal table of that type.
types :
begin of t_<example>
*field list
end of t_<example>
data :
gt_<table> type standard table of t_<example>
pass this to the FM -
Dynamic Creation of Internal table WITH HEADER LINE
Dear,
Please show me the way of creating Internal table WITH HEADER LINE dynamically..
Thanks,
Nirav<font color='blue'>Hi Parekh,
Have a look at the sample program for Dynamic internal table
This program has been developed to update any table data in the dictionary. We give table name and File name as Input fields.
<pre>
REPORT znpmmm0201.
*Types
TYPES:
BEGIN OF ty_file,
data(4096) TYPE c,
END OF ty_file.
*Type-pools
TYPE-POOLS:
truxs.
*Work areas
DATA:
wa_file TYPE ty_file.
*Internal tables
DATA:
it_file TYPE STANDARD TABLE OF ty_file,
it_data TYPE truxs_t_text_data.
DATA:
gv_dref TYPE REF TO data,
file_name TYPE string.
*FIELD-SYMBOLS
FIELD-SYMBOLS:
<gf_itab> TYPE STANDARD TABLE,
<wa> TYPE ANY.
*& Selection-screen
PARAMETERS:
p_table TYPE rsrd1-tbma_val,
p_file TYPE ibipparms-path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_for_p_file CHANGING file_name .
*& START-OF-SELECTION
START-OF-SELECTION.
CREATE DATA gv_dref TYPE TABLE OF (p_table).
ASSIGN gv_dref->* TO <gf_itab>.
PERFORM upload_data USING file_name.
MODIFY (p_table) FROM TABLE <gf_itab>.
*& Form UPLOAD_DATA
FORM upload_data USING file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file
filetype = 'ASC'
TABLES
data_tab = it_file.
APPEND LINES OF it_file TO it_data.
CLASS cl_abap_char_utilities DEFINITION LOAD.
DATA: l_field_seperator.
l_field_seperator = cl_abap_char_utilities=>horizontal_tab.
REPLACE ALL OCCURRENCES OF '|' IN TABLE it_data WITH l_field_seperator.
CALL FUNCTION 'TEXT_CONVERT_TEX_TO_SAP'
EXPORTING
i_field_seperator = l_field_seperator
i_tab_raw_data = it_data
TABLES
i_tab_converted_data = <gf_itab>.
ENDFORM. " UPLOAD_DATA
*& Form F4_FOR_p_file
FORM f4_for_p_file CHANGING file.
DATA:
l_field_name LIKE dynpread-fieldname VALUE 'P_FILE'.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = l_field_name
IMPORTING
file_name = p_file.
file = p_file.
ENDFORM. " F4_FOR_p_file </pre>
Thanks,
Venkat.O</font> -
Passing an internal table WITH HEADER LINE to abap object
Hi. In another thread, it was explained how to pass an internal table to an abap object method. Is it possible to pass an internal table that has a header line, and RETAIN the header line once the table has been passed?
My problem is, that I can pass the table, update it, but the read buffer is not populated when returning from the object's method. This is the result of being able to pass a STANDARD TABLE type, but not a STANDARD TABLE WITH HEADER LINE.
This means that I have to read the table into a work area instead of doing a READ TABLE LKNA1 within the method, which is what I need to do.
Thanks.Please check this sample program, notice that it is modifing the internal table and passing it back modified as well as passing the "work area" or "header line" back thru the exporting parameter.
report zrich_0001.
* CLASS lcl_app DEFINITION
class lcl_app definition.
public section.
types: t_t001 type table of t001.
class-data: it001 type table of t001.
class-data: xt001 like line of it001.
class-methods: change_table
exporting ex_wt001 type t001
changing im_t001 type t_t001.
endclass.
data: w_t001 type t001.
data: a_t001 type table of t001 with header line.
start-of-selection.
select * into table a_t001 from t001.
call method lcl_app=>change_table
importing
ex_wt001 = w_t001
changing
im_t001 = a_t001[] .
check sy-subrc = 0.
* CLASS lcl_app IMPLEMENTATION
class lcl_app implementation.
method change_table.
loop at im_t001 into xt001.
concatenate xt001-butxt 'Changed'
into xt001-butxt separated by space.
modify im_t001 from xt001.
endloop.
ex_wt001 = xt001.
endmethod.
endclass.
Regards,
Rich Heilman -
Getting error of Defining an internal table with header line, SELECT-OPTIO
Hi all,
i have a coding for my smart form,In this coding i have define an structure which being used,but when i execute it it give me
error of Defining an internal table with header line, SELECT-OPTIONS, and RANGES is not allowed within a structure.Even tough you can see that in my coding im not using SELECT-OPTION or RANGES,but can't understand why it gives me this error.
Following are the code:
DATA: BEGIN OF traptab OCCURS 50.
INCLUDE STRUCTURE mseg.
DATA: vgart LIKE mkpf-vgart,
blart LIKE mkpf-blart,
blaum LIKE mkpf-blaum,
bldat LIKE mkpf-bldat,
budat LIKE mkpf-budat,
cpudt LIKE mkpf-cpudt,
cputm LIKE mkpf-cputm,
aedat LIKE mkpf-aedat,
usnam LIKE mkpf-usnam,
tcode LIKE mkpf-tcode,
xblnr LIKE mkpf-xblnr,
bktxt LIKE mkpf-bktxt,
frath LIKE mkpf-frath,
frbnr LIKE mkpf-frbnr,
wever LIKE mkpf-wever,
END OF traptab.
Thanks & Regards,
sappk25thanks
Maybe you are looking for
-
MY OLD COMPUTER HAS THE CORRECT MUSIC INSTALLED IN ITUNES. I HAVE NOW INSTALLED THE CORRECT MUSIC ON MY IPOD-NANO I HAVE A 2ND COMPUTER WITH AN INCORRECT MUSIC LIST IN ITUNES. I NEED TO COPY THE CORRECT MUSIC TO COMPUTER 2 FROM MY IPOD WITHOUT LOOSIN
-
Blanks, spetial characters in column and table names
Is there any posibility, which i have overseen to change the sugested table and column names to something with mixed case, blanks, spetial characters, which often occurs in the MS World. It's uggly but 1000 times better then rewriting code, or changi
-
DAX CrossJoin between heavy facts
Dear Gurus, I am using SSAS Tabular and creating SSRS reports on top of it. My datasets are pure DAX code, no MDX. My issue is that I am unable to find out how to make my query fast when the dataset involves many facts. Currently I am using the follo
-
Solution Directory--Business process --Check in /Out option
Dear Friends, I am working in Solution directory (t.code: DSWP). I have created one maintenance project. In this maintenance project i have maintained the following business process. 1. Sale Order Processing 2. Production Order Processing. These t
-
No input with Blackmagic Decklink SDI 9.7.7 and Adobe Premiere
Hi there My BM Decklink is properly installed: I can grab Video with the BM Software. In Adobe Premiere there is no signal. The TC is ok and running. All Settings seems to be ok. I'm running a Windows7/64 Bit Thank for your help.