Skip to Content
avatar image
Former Member

Comparison of TWO Fieldsymbol records.

Hi Experts,

I have two different field symbol records.both of them having multiple rows of records.But two fields are similar to both. Now i want to compare this two field symbol records and append the same to normal internal table.

Anyone guide me.

In normal internal table we are simply making read table and moving the workarea values to new internal table. But in Field symbol howtodo this.

Regards
Anandhan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Dec 31, 2014 at 09:18 AM

    Hi Anandhan,

    Find the below code to read the Information from two different FS.

    Field-symbol : <val1> type any,

         <val2> type any.

    Suppose you have two diff. work area for your two FS internal tables, like <wa1> & <wa2>.

    to read the column from internal table.

    loop at <fs_tab1> assign <wa1>.

         assign component 'FIELD_NAME' of structure <wa1> to <val1>.

         "here <val1> will contains the value of the given FIELD_NAME.

         loop at <fs_tab1> assing <wa2>.

               assign component 'FIELD_NAME'   of structure <wa2> to <val2>.

                "here <val2> will contains the value of the same FIELD of diff internal table.

                if <val1> eq <val2>.    

                        here you can write your logic

                 endif.

         endloop.

    endloop.

    Regards.

    Praveer.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 31, 2014 at 09:25 AM

    The structure are different, but few fields are common. Guide me

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Anandhan,

      The logic I have shared you is for all type of structure.

      You have to Declare the FS work-area and the rest of the logic will be same to read the information for same field, which is exist in both structure.

      data: <it1> type standard table of structure1,

                <it2> type standard table of strucutre2.

                <wa1> type structure1,

                <wa2> type strucure2,

                <val1>    type any,

                 <val2> type any.

      Loop at <it1> assign <wa1>.

           assign component 'FIELD_NAME' of structure <wa1> to <val1>.

           if <val1> is assigned.

                loop at <it2> assign <wa2>.

                     assign component 'SAME_FIELD_NAME' of structure <wa2> to <val2>.

                     if <val2> is assigned.

                          if <val1> eq <val2>.

                               write your rest of logic.

                          endif.

                     endif.

                endloop.

           endif.

      endloop.

      Regards.

      Praveer.

  • Dec 31, 2014 at 09:48 AM

    Hi,

    Share u r code here.

    Regards,
    Rajesh K

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 01, 2015 at 03:22 PM

    Hello,

    I made the code, but while looping the field symbol and assinging into structure, its looping only one roww of record. But in the fieldsymbol having 47 entries. what mistake i did?

    LOOP AT <fs_address> ASSIGNING <ls_address>.

    endloop.

    Anyone please guide.

    Regards

    Anandhan

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Anandahan,

      LOOP AT <fs_address> ASSIGNING <ls_address>.

           

           Loop at (Your Fields Table ) into WS (Work are for Fields table ).

               

                 assign component 'FIELD_NAME' of structure <wa1> to <val1>.

                 if <val1> is assigned.

                loop at <it2> assign <wa2>.

                     assign component 'SAME_FIELD_NAME' of structure <wa2> to <val2>.

                     if <val2> is assigned.

                          if <val1> eq <val2>.

                               write your rest of logic.

                          endif.

                     endif.

                endloop.

              endif.

           endloop.

      endloop.


      Regards.

      Praveer.