How to use field 'HIER_ID' to determine price in S/O?
I want to use field 'HIER_ID'(hierarchy) to determine price in S/O but I don't know what value I should maintain in pricing master data.
It should be 'HIER_ID' = 01 or 02 or 10 or else?????
I don't know.
HI,
U have to create a new condition table in the tcone V/03, there u can take the required field . then assign it to ur acess sequence.
now maintain condition record for that.
u wl get the price in s/o
cheers
Similar Messages
-
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. -
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 -
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,
Our consultant wants to use field exit as a way to validate a certain field in a screen for tcode MB1B.
I tried to follow the steps below to create a field exit but it seems that I'm missing a step or two because it doesn't work.
1. Run program RSMODPRF in se38.
2. Enter the data element and the number of field exit
3. create and activate the function module
After this I run tcode MB1B but it seems that it did not pass through the field exit.
Do I need an extra step to make the field exit work? And how do I assign a field exit to a certain screen?
Hope to hear from you guys soon.
Thanks!Hi Jackie,
1.Enter the tcode SE38
2.In the ABAP Editor enter the program name RSMODPRF
3.Execute
4.Then you will get a screen with Data Element and Number of Field Exit
Here enter the Data Element(for example MATNR for material no.) and
enter 0 to 9 or A to Z in the second field(I am taking 0 in my example)
5. Execute
6.Then you will be navigated to the Function Builder screen(se37) with FM name FIELD_EXIT_MATNR_0
The FM name contains the Data Element(MATNR) and No. of Field Exit (0) (in this case)
7.Then click on CREATE.
8.Give the Fun. Grp name and SAVE
9.It will take youn to the Source code wherein ypu have to write the code asb per your requirement
For Example:
FUNCTION FIELD_EXIT_MATNR.
IF INPUT BETWEEN 125 AND 150.
MESSAGE E000(ZMM) WITH "Material not allowed".
ENDIF.
ENDFUNCTION.
10.Then if you try to enter the values in MM01 for Material no.,this effect comes into picture
If you enter Material no between 125 and 150 you will get "Material not allowed".
Follow the above procedure with your requirements(data element,screen name)
And to assign a screen name and program to a Field Exit:
In the 'Field Exits for Data elements' screen, in the application tool bar you can assign the Program name and Screen no. by clicking Assign Prog. /Screen.
You will get the above screen by
1. goto tcode CMOD
2. Enter PRFB in the command prompt and press ENTER
Another procedure for implementing the Field Exit:
One more way to do this is goto tcode CMOD.
Enter PRFB in the command prompt and press ENTER
In the screen select the menu Field exit --> Create and follow the same procedure as above.
Please see the below links hich might be useful
http://www.****************/Tutorials/ExitsBADIs/MK01/FieldExit.htm
****Reward points if found useful
Regards,
Naresh -
How to use field "responsible Cost center" in Report Painter
Hi
I create report painter by using standard LIbrary and want to use field "Responsible Cost Center" as a parameter in order to display report in hierachy.But the standard Library "6O1" doesn't provide this field .
So I try to create new library by copy the standard "6O1" and using the structure "CCSS".But it doesn't show this "Responsible Cost Center" Field as a parameter .
Please give me an advice step by step the way to get this field as parameter in report painter
regards
ChompleonHi,
I have a similar requirement. I have followed OSS note 358251 as an example to add the 'Responsible Cost Center', however it doesn't display in the report even after I choose the field for display. The steps I have followed are -
1) Added the field ZZ_KOSTV in the include structure CI_CC1S.
2) Using transaction GRCT, table CCSS, I added a characteristic KOSTV with Def field OBJNR, and filler routinue EZZ_FILL_KOSTV. I then wrote code in this routinue to populate the value KOSTV from AUFK table in the include program FK21REZZ. In debug mode, I can see correct values are populated in this field.
3) I created a copy of an existing report in the library 6O1, changed it and in the Total line, added the field Responsible Cost Center to the Selected Characteristics. When I save, regenerate and execute the report, the value for Responsible Cost Center doesn't get displayed though the displayed orders have a value populated in this field and when I debug I can see the value is passed ut correctly form the filler routinue to the field KOSTV.
Please help and let me know what I need to do to be able to see this field in the output result.
Regards,
Neha -
How to use field symbol in select
Hi,
CONCATENATE 'WTG0' LV_MON INTO LV_FNAME.
ASSIGN (LV_FNAME) TO <FS>.
SELECT SINGLE <FS> FROM COSP INTO LV_SAPRST
WHERE OBJNR = LV_OBJ AND GJAHR = LV_YEAR AND WRTTP = '4' AND KSTAR = GT_INOUT-SAKNR
Error message : Unknown column name "<FS>" . field list. . field list. field list.
actually , if i use if command, i can do, but i want to use simple code by fieldsymbol.
is it possible in select command?
Thanks in advance
BenjaminHi
Hope it will help you.
reward if help.
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.
Related
ASSIGN, DATA
Additional help
Declaring Field Symbols -
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 validators, like an EmailValidator, in a Flash Catalyst project?
After making a contact form in Flash Catalyst, I added an EmailValidator in Flash Builder.
Unfortunately, the validation error message is not visible: only the outline of the message box and the red outline around the input field.
Does someone has some tips or suggestions how to make the error text visible?
details:
1. code snippets:
in de <fx:Declarations> section:
<mx:EmailValidator id="emailValidator"
source="{emailInput}" property="text"
triggerEvent=""
requiredFieldError="Email address must be entered"
missingAtSignError="add @-sign, please" />
2. screenshot of 'empty' error message:
(rectangle on the right in the image should display an error message)
Thanks for any help,
Peter van der PostThe issue is that Flash Catalyst uses the Wireframe Theme. Validators display in this fashion under that theme. What you need to do, once you are done with the project, take it back into Flash Builder, and change the Theme. This can be done under Project > Properties > Flex Theme > Spark
Hope this helps.
Chris -
HOW TO USE field value in repeat_fram formate trigger
i have a field on report layout. i want to use its value in formate trigger to filter the record in which that field value is zero.
field is number type, getting stock of item. i want if stock of item is zero than it should not display, for this i use formate trigger of repeating frame.
Thanks yashyash_08031983 wrote:
i have a field on report layout. i want to use its value in formate trigger to filter the record in which that field value is zero.
field is number type, getting stock of item. i want if stock of item is zero than it should not display, for this i use formate trigger of repeating frame.Hello, yash
Format trigger is for change the formation of value. Like change the font, make it bold,italic, changes it's colour . Not for filtering.
If you want to restrict your report not to show Zero(0) value of stock , you have to done it at SQL query. Like, if stock is a database filed you may write
select .........,....
from table
where stock >0Hope this helps.
If someone response is helpful or correct, please mark it accordingly. -
How to use FIELD-SYMBOLS with TYPE ANY?
Hi!
I need to write a function which gets an import string parameter containing a field name like MATNR. In this function I have to "map" this string to a real variable so that I can access the field which is represented by the string. I tried it like this but it does not work:
FUNCTION ZTEST1.
""Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(I_MARA) TYPE MARA
DATA: FIELD_NAME(30) VALUE 'I_MARA'.
FIELD-SYMBOLS : <FS_ANY> TYPE ANY.
Assign (FIELD_NAME) to <FS_ANY>.
Does not work (I guess because of 'type any')
WRITE: <FS_ANY>-MATNR.
ENDFUNCTION.
How can I solve this problem?
Thanks,
KonradThis code is far from perfection...But at least it could help you to find the right track -;)
REPORT ydummy_atg.
DATA: w_mara TYPE STANDARD TABLE OF mara.
START-OF-SELECTION.
SELECT *
INTO TABLE w_mara
FROM mara.
PERFORM test TABLES w_mara.
*& Form test
FORM test TABLES t_mara.
DATA: field_name(30) VALUE 'T_MARA',
new_line TYPE REF TO data,
flag TYPE c,
w_tabix TYPE sy-tabix.
FIELD-SYMBOLS : <fs_any> TYPE ANY,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
ASSIGN (field_name) TO <fs_any>.
CREATE DATA new_line LIKE LINE OF t_mara.
ASSIGN new_line->* TO <l_line>.
LOOP AT t_mara.
MOVE t_mara TO <l_line>.
ASSIGN COMPONENT 2 OF STRUCTURE <l_line> TO <l_field>.
<l_field> = <l_line>.
WRITE:/ <l_field>.
ENDLOOP.
ENDFORM. " test
Greetings,
Blag. -
How to use AVG function to determine difference.
Hi, I have a basic table where there is an invoice price. I can do the AVG function to find out what the average is, but I need to be able to subtract the difference from each value in the column and submit it as a query. I was wondering if anyone had any advice how I'd do that.
Thanks,
Justinwrote:user_7000025
Here is the table in question and the specific instructions:
Write the query that will show the invoice number, the average invoice amount, and the difference between the average invoice amount and the actual invoice amount.
INV_NUM CUST_NUM INV_DATE INV_AMOUNT
8000 1000 23-MAR-04 236
8001 1001 23-MAR-04 313
8002 1001 30-MAR-04 528
8003 1000 12-APR-04 195
8004 1000 23-APR-04 619test@XE> --
test@XE> -- Write the query that will show the invoice number, the average invoice amount, and
test@XE> -- the difference between the average invoice amount and the actual invoice amount.
test@XE> --
test@XE>
test@XE> --
test@XE> with t as (
2 select 8000 inv_num, 1000 cust_num, to_date('23-MAR-04','DD-MON-RR') inv_date, 236 inv_amount from dual union all
3 select 8001, 1001, to_date('23-MAR-04','DD-MON-RR'), 313 from dual union all
4 select 8002, 1001, to_date('30-MAR-04','DD-MON-RR'), 528 from dual union all
5 select 8003, 1000, to_date('12-APR-04','DD-MON-RR'), 195 from dual union all
6 select 8004, 1000, to_date('23-APR-04','DD-MON-RR'), 619 from dual)
7 --
8 select inv_num,
9 cust_num,
10 inv_date,
11 inv_amount,
12 avg(inv_amount) over () as avg_inv_amt,
13 avg(inv_amount) over () - inv_amount as avg_actual_diff
14 from t;
INV_NUM CUST_NUM INV_DATE INV_AMOUNT AVG_INV_AMT AVG_ACTUAL_DIFF
8000 1000 23-MAR-04 236 378.2 142.2
8001 1001 23-MAR-04 313 378.2 65.2
8002 1001 30-MAR-04 528 378.2 -149.8
8003 1000 12-APR-04 195 378.2 183.2
8004 1000 23-APR-04 619 378.2 -240.8
5 rows selected.
test@XE>
test@XE>
isotope
Update: Good to know the solution worked. You may want to mark the question answered and award points.
Edited by: isotope on Mar 14, 2009 10:50 PM -
How to use fields (which are from includes in marc) in selectqry where cond
Hi,
I want to select the data from marc which contains includes.....i want to use that include field
in selection list and in where condition, basing on that i want to retrieve data.
can u give examples reply..........
Thanks and Regards,
M PrasannaTYPES: BEGIN OF ty_marc,
matnr TYPE marc-matnr,
werks TYPE marc-werks,
pstat TYPE marc-pstat,
lvorm TYPE marc-lvorm,
bwtty TYPE marc-bwtty,
xchar TYPE marc-xchar,
mmsta TYPE marc-mmsta,
mmstd TYPE marc-mmstd,
maabc TYPE marc-maabc,
kzkri TYPE marc-kzkri,
ekgrp TYPE marc-ekgrp,
ausme TYPE marc-ausme,
dispr TYPE marc-dispr,
dismm TYPE marc-dismm,
END OF ty_marc.
DATA: gt_marc TYPE TABLE OF ty_marc.
SELECT matnr
werks
pstat
lvorm
bwtty
xchar
mmsta
mmstd
maabc
kzkri
ekgrp
ausme
dispr
dismm
FROM marc
INTO TABLE gt_marc
WHERE pstat = 'EDLQBG'.
IF sy-subrc = 0.
WRITE: / 'done'.
ELSE.
WRITE: / 'error'.
ENDIF. -
How to use field symbols in dynamic select query
I have a requirement to take the table name from selection screen and get data from that table
SELECT * FROM (P_TBLNM)
INTO TABLE <ITAB>
WHERE <condition>.
I have declared field symbol as type any table , but i am getting dump saying fieldsymbol is not getting assigned .
Any pointers , please help.Hi laxmi,
for your second question, try this one:
DATA : ref_table_des TYPE REF TO cl_abap_structdescr,
<itab> TYPE STANDARD TABLE,
<wtab> TYPE ANY,
dref TYPE REF TO DATA.
DATA: <knumh>.
ref_table_des ?= cl_abap_typedescr=>describe_by_name( P_TBLNM ).
create data dref type handle ref_table_des.
assign dref->* to <wtab>.
create data dref like standard table of <wtab>.
assign dref->* to <itab>.
SELECT * FROM (P_TBLNM)
INTO TABLE <itab>
WHERE <condition>.
LOOP AT <itab> ASSIGNING <wtab>.
assign component 'KNUMH' of structure <wtab> to <knumh>.
SELECT * FROM KONP
APPENDING TABLE GI_KONP
WHERE KNUMH = <knumh>.
ENDLOOP.
Regards,
Richard
Edited by: richard santos on Nov 17, 2009 8:16 AM
Maybe you are looking for
-
Creation of multiple orders under one main order
Dear Ajay , Sir, I want to create a main AUC order suppose as 10004, How to create Sub-AUC orders under the Main AUC (10004) as below, order:100041: Bldg. and construction exp order:100042:Mfg. machineries cost order:100043:Galvinizing machinery c
-
Emails from websites are not being delivered
If I send an email from another personal account to my mac/icloud email address, it is delivered. And I am still getting some unsolicited emails from vendor websites. But if I am on a website (for example a utility company site) and it says it will
-
Applications won't launch in Yosemite OS X
After installing Yosemite OS X some applications such as Photoshop CS6, Firefox won't launch. The icons of the applications keep bounching in the dock and after a while it will stop bounching with the message "Application Not Responding". Seems like
-
Hi. I oftenly use internet banking services which produce .csv reports for the transactions i make. After downloading these reports i try to open them in numbers (and excel) but the encoding for Greek is messed up. Opening the same file with excel on
-
We are unable to process HL7 V2 messages after applying BizTalk 2010 CU 6 in a development environment when we have a BAM tracking profile deployed that references the BTAHL7 messaging payload schemas. The messages process with no issue if we remove