Field symbolsc code

I have the following difficulties in the following code:-
REPORT demo_field_symbols_stat_ASSIGN .
FIELD-SYMBOLS: <f1> TYPE ANY, <f2> TYPE i.
DATA: text(20)  TYPE c VALUE 'Hello, how are you?',
      num       TYPE i VALUE 5,
      BEGIN OF line1,
        col1 TYPE f VALUE '1.1e+10',
        col2 TYPE i VALUE '1234',
      END OF line1,
      line2 LIKE line1.
ASSIGN text TO <f1>.
ASSIGN num TO  <f2>.
DESCRIBE FIELD <f1> LENGTH <f2>.
WRITE: / <f1>, 'has length', num.
ASSIGN line1 TO <f1>.
ASSIGN line2-col2 TO <f2>.
MOVE <f1> TO line2.
ASSIGN 'LINE2-COL2 =' TO <f1>.
WRITE: / <f1>, <f2>.
The list output is:
Hello, how are you?  has length         20
LINE-COL2 =      1,234
The example declares two field symbols <f1> and <f2>. <f2> may only have fields of type I since it has been typed accordingly. <f1> and <f2> both point to different fields during the program.
q1]]               How does the "2" types of statements differentiates
i]ASSIGN <V> TO <FS>.     Where <v > refers to any variable & <fs> to any field     symbols
ii] MOVE <fs> TO <V>.
q2]]           How does the "NUM" variable's presence affect the output in the write statement----what I mean by the question  is what would have haooened if we had written <F2> instead of NUM ; min the following statements:-
ASSIGN text TO <f1>.
ASSIGN num TO  <f2>.
DESCRIBE FIELD <f1> LENGTH <f2>.
WRITE: / <f1>, 'has length', num

Hi
Go through the documnetation and correct it
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
Reward points if useful
Regards
Anji

Similar Messages

  • Performing filter for field Tax Code (MWSKZ) in the Purchase Order

    Hello Experts,
    We have to perform a filter for field Tax Code in the purchase order (ME21N / ME22N / ME23N). We've tried to use SH SH_T007A and SSH_T007A with search help exit (e.g. F4_TAXCODE_USER_EXIT) but it is not working. The ABAP programmer has performed a debug and the standard does not check any line code in this function (the ABAP programmer has set a breakpoint into function F4_TAXCODE_USER_EXIT after assigning it for mentioned search helps)... it sounds like this program / search help is not called by standard program of ME2* transactions...
    I've tried to look for some other object and other function called FI_F4_MWSKZ has been found... I've set a breakpoint there and when I open the search help for field tax code into transaction ME21N it works... but as I could see this function FI_F4_MWSKZ is a standard one which we can not change...
    Have you ever had the same problem?
    We are currently in the SAP 4.6C version. I've found lots of OSS notes but only valid for 6.0.
    Maybe someone can help me on that.
    Best regards,
    Nilmar

    hi,
    goto gs01 transaction,give some name to ur step.
    give the table name and field name.
    then u can create a specific value set for that field.
    save.
    now u can use this set to define conditions for ur fields in obbh transaction.

  • Problem: Not able to change Signature field reason code Dynamically using signatureSetSeedValue

    Problem: Not able to change Signature Settings Dynamically.  
    What I want: Need to change the Signature Field Reason code Dynamically upon selecting Radio Button.
    Here is My Code:  
    var mydoc = xfa.resolveNode("FormData.P3_443.signature[2].ePadSignatureField3");
    mydoc.signatureSetSeedValue(
    reasons: ["Advisor"],
    flags: 8
    Error Message:
    TypeError: mydoc.signatureSetSeedValue is not a function
    9:XFA:FormData[0]:P3_443[0]:signature[2]:ePadSignatureField3[0]:validate'
       Source Code: Acrobat Code for Signature.
       // Obtain the signature field object:
    var f = this.getField("mySigFieldName");
    f.signatureSetSeedValue(
    { reasons: ["This is a reason", "This is a better reason"],
    flags: 8

    Problem: Not able to change Signature Settings Dynamically.  
    What I want: Need to change the Signature Field Reason code Dynamically upon selecting Radio Button.
    Here is My Code:  
    var mydoc = xfa.resolveNode("FormData.P3_443.signature[2].ePadSignatureField3");
    mydoc.signatureSetSeedValue(
    reasons: ["Advisor"],
    flags: 8
    Error Message:
    TypeError: mydoc.signatureSetSeedValue is not a function
    9:XFA:FormData[0]:P3_443[0]:signature[2]:ePadSignatureField3[0]:validate'
       Source Code: Acrobat Code for Signature.
       // Obtain the signature field object:
    var f = this.getField("mySigFieldName");
    f.signatureSetSeedValue(
    { reasons: ["This is a reason", "This is a better reason"],
    flags: 8

  • Additional field post code 2 in search in webui

    Hi,
    I am new to crm webui.I need to add the additional field post code to search this field is not available in the context node but is a standard feature.Please tell me step by step.
    P.S points will be awarded.

    The good news is that the field is in the underlying search function module used by Business Partner Search.
    All you need to do is the following:
    Add the field
    POST_CODE2 data element AD_PSTCD2 to the structure CRMST_HEADER_SEARCH_BUIL.
    This should magically make the element available for search and you will only need to configure your screen to have the element bound beyond the context node config.
    I believe this should work, based on looking at the code used for the BP search.
    Good luck,
    Stephen

  • Inactive field Company code in production

    Hello all,
    in the production system and in transaction PPOME I can change the value in field Company code (folder Account assignment) for the parent org. unit. If I select an org. unit which hangs from the parent, then the field is inactive and I cannot change the value. This is the same story for any other org. unit in deeper levels. This does not happen in development and test system.
    I guess that this is a customizing topic but where exactly can I make the field Active ??
    Thanks.

    Please check the following switches in table T77S0
    PPOM  INHIC
    PPOM  INHIH
    PPOM  INHS
    Regards
    Ravikumar

  • Making the field "company code" mandatory

    Hi SAP experts,
    is it possible to make the field : company code, a mandatory one in the initial screen of XD01 transaction (create customer)? How?
    Best regards,
    Bahia.

    Hi Bahia
    How are you? Why no posts for a long time?
    Making COMPANY CODE as a mandatory entry i think it is not possible with customization
    This means you cant achieve this thro OBD2 or OB20 or OVT0
    It is because SAP has given the provision of creating CMR only with general data and sales area data
    With these two levels SD people can do most of their processes  (t codeVD01)
    Similarly SAP has given the provision of creating CMR only with general data and company code data
    With these two levels FI people can do most of their processes( like that FI people also has t code to create CMR only with general data and company code)
    These provisions where it  is applied practically,, i dont know?
    But thro development i think you can make each and any CMR you prepare it should be only with XD01 and that too in that Company code has to be made mandatory
    Check with your technical team
    Regards
    Raja

  • Change field "company code " in  WBS

    Hello ,everyone:
         How can i change the field "company code " in WBS  after   distribution budget .    Although i've reversed  the budget,the field value can't be changed.
    Regards in advance.
    Orange

    Dear
    First u have to remove all budget from WBS then run OPSX for that WBS.
    Now u will able to change Co. Code.
    It has been tested & found ok pls. do it.
    Regards,
    Vishal Kr. Sharma

  • Error in set an Z field by code.

    Hi;
    I enhance the method on_save of save of account, because i need create a validate method to execute before on_save, but in the validate method i need to set a Z field by code. When I exit of validate method, this field is filled, but when i execute the standard code of on_save (because i call the standard code) the field exit empty.
    Any suggestions?
    Regards.

    Hi,
    Once you set value to the field, modify the core and the cal the save method. Insert the below code after you set value to the
    field,
    Data: lr_core type ref to cl_crm_bol_entity.
    lr_core = cl_crm_bol_core=>get_instance( ).
    lr_core->modify( ).
    Regards,
    Arun

  • Field Reason Code

    Dear FI Gurus,
    We need to use a field at vendor line items for information purposes only.
    We saw that the field "Reason Code" is not in use in our system. This field would be suitable for us because we can do mass changes to it through FBL1N.
    What would be the implications if we use it?
    How should we customize it in order to be used only for information purposes?
    Thank you in advance!

    Hi
    .Reason Code is the Code which identify the Reason for difference in the payments which might be more or less. This is used as reporting tool.

  • Substitutions field Tax Code MWSKZ in Line Item

    I need to do substitution for field Tax Code MWSKZ at line item when doing FI posting. However, I cannot find this subtitution field in OBBH Boolean class 009.
    How can I solve this? Is there any BADI or user exit that serve the same purpose?
    It's kind of urgent as I tried to find the solution for few days but I couldn't get any.
    Edited by: Irene Sam on Sep 24, 2008 3:07 PM

    hi,
    goto gs01 transaction,give some name to ur step.
    give the table name and field name.
    then u can create a specific value set for that field.
    save.
    now u can use this set to define conditions for ur fields in obbh transaction.

  • How to handle "Validation failed for the field - Tax code" issue?

    We had mass uplaod the order that create on Mar with tax code effective date on Apr. Now we would like return on this order  and getting error of "Validation failed for the field - Tax code". How to handle this issue?

    Hi
    You will have to check if the Tax_Code of RMA being received is the same as the one in the related sales order.
    If not you will need to use the same tax_code.
    Refer below document : Doc ID 1584338.1

  • How to get label text  for the Input Field in code

    Hi,
    I have created Two UI elements InputField  and Label.  I set the property 'labelFor' of the UI element Label to 'InputField'.
    This is my requirement .  I am having the Id of InputField in the code . I want to get the value of 'text' of  the UI element Label.
    Please suggest how to proceed.
    Points will be rewarded for helpful answers.
    Best Wishes
    Idhaya R

    Not sure why you really need this, but you could do something like
    IWDInputField field = (IWDInputField) view.getElement("inputFieldID");
    IWDLabel fieldLabel = null;
    for (Iterator children = field.getContainer().iterateChildren(); children.hasNext(); )
      IWDUIElement child = (IWDUIElement) children.next();
      if (child instanceof IWDLabel)
        IWDLabel  label = (IWDLabel) child;
        if ( field.getId().equals(label.getLabelFor())
          fieldLabel = label;
          break;
    Armin

  • MASS MAINTENANCE FOR MATERIAL-RELATED EXCISE DUTIES FIELDS - T CODE

    Dear Experts,
    Is there any separate t code available to  MASS MAINTENANCE FOR MATERIAL-RELATED EXCISE DUTIES FIELDS ?
    I got this POINT from ECC 6.0 features in Solution browser.
    Please help me on this.
    MASS MAINTENANCE FOR MATERIAL-RELATED EXCISE DUTIES FIELDS:
    Functionality Enhancements
    Provides a specific transaction for mass maintenance of material related excise duties fields
    Business Benefits
    Mass maintenance can now be performed in one step for material-relevant excise duties fields, instead of maintaining the excise duties fields in each material master record separately.
    Regards
    Soundar.G

    Dear Ravi,
    I have already created LSMW for this in Material master and J1ID.
    But i have checked in ECC 6.0 feature, there they are mentioning New t code is available for MASS maintenance of excise duty fields.
    Regards
    Soundar.G

  • Table name for field Task code text

    Hi guys,
                   I need to work on a report.could you please help me to find the table name for the filed Task code text in the tab customer corrective actions in QM01/02/03.I needto fetch  the text for the corresponding Task code.

    Hi,
    I think you are searching for -
    QPCD-KURZTEXT      or       QPCD-LTEXTV
    For text field fetch - go to table - QPCT
    If not give me more clear idea !!!!
    Edited by: ashleshabhagatshelke on Jun 9, 2010 8:16 AM

  • Additional field(company code) in purchase order screen layout

    Hi All experts,
    I have a requirement to set the company code in Purchase order as display field during PO creation or change.
    I have checked in IMG under screen layout for purchase order but  there is no company code field available.
    How can I add the additional field into the screen layout.
    Any inout will be highly appreciated.
    Thank you in advance
    Lost.

    Hi Chee Wan Ng,
    <b>Where</b> exactly you want to set the Company Code field in the Purchase order? Actually this field is already available under <b>Org.data</b> tab in the Purchase Order Creation transaction (ME21N), so you may not require to set the Company Code again.
    Which version of SAP R/3 you are using?
    Hope this helps you, if not, then give us more details to help you better.
    Good luck.

Maybe you are looking for

  • Acrobat Help | Edit images or objects in a PDF

    This question was posted in response to the following article: http://helpx.adobe.com/acrobat/using/edit-images-or-objects-pdf.html

  • Check+Printing+Sequence

    I am looking for some guidance on Check Printing Sequence.  Our specific problem is that we want checks over $50K to print first in our check run because these checks require signatures, but we are unsure of how to get this to work other than having

  • Data source 0PROJECT_ATTR  enhancement....

    I have to enhance two data sources with 3 fields. 0WBS_ELEMT_ATTR 0PROJECT_ATTR When I am enhancing the extract structure , I am adding the field in the "Component"  but I dont know what component type I have to give ? Can some body let me know about

  • Can't install Adobe 8.0 Professional

    I have been trying to install Acrobat Adobe 8.0 Professional. I first get an error that Adobe 7.0 is still installed. I have un-installed Adobe 7.0 Professional. I have also cleaned out the registry for anything pointing to the folder for Adobe 7.0.

  • PC Crash with Labview 7 and windows 2000

    Problem: the PC does reboot without any prompt when a LV 7 vi is running; the reboot seems to occur randomly (no time dependent); sometimes instead of rebooting, the PC switches to the blue screen with the following message: Stop: 0x0000001E (0xC0000