Skip to Content
author's profile photo Former Member
Former Member

ASSIGN Component ... (field symbol stuff)

Hi,

I want to validate certain fields (KNA1, BUKRS, KOART, FNAME) which are

entered by the user in the transaction XK01. They are being captured in a structure, lets say X_LFA1.

To validate this fields I am being asked to use field symbols using component assign.

Can someone tell me how do I do this ?

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2005 at 04:16 AM

    Tushar,

    Can you give more details what exactly you want to do?

    The usual way of assinging a field symbols is ...

    FIELD-SYMBOLS : <FS_ANY> TYPE ANY.

    ASSIGN COMPONENT KUNNR OF KNA1 (LOCAL STRUCT NAME) TO <FS_ANY>.

    Then do your operation on the field symbols.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Tushar,

      Its still not clear to me what exactly you are trying to do.

      Is it like you just want to see if those fields exist in the table or not? If yes, you can do like this.

      parameter : p_field -- field entered by the user

      data : wa_ztable like ztable.

      field-symbols : <fs_any> type any.

      Assign component p_field of structure wa_ztable to <fs_any>.

      if sy-subrc = 0.

      Success.

      endif.

      Regards,

      Ravi

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2005 at 04:18 AM

    Hi ,

    Using field symbols :

    FIELD-SYMBOLS <F> TYPE ANY.

    ASSIGN TABLE FIELD (NAME) TO <F>.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2005 at 04:32 AM

    hi , Tushar

    Maybe you should descript your requirement more clear.

    for the structure X_LFA1,

    if you know the field name of this structure in runtime, you can use ASSIGN NAME

    if you only know the field sequence of this structure in runtime, you can use ASSIGN INDEX.

    if you don't know anything about the structure in runtime, you should use some RTTI class to try to descript this structure fields at first.

    Hope it will be helpful

    thanks

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.