Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8852

Re: Compare two different WA.

$
0
0

I just made this report for you.....

 

 

REPORT ztest_gb1.

 

DATA: wa_1 TYPE t001,

       wa_2 TYPE t001.

 

DATA: rf_descr_ref TYPE REF TO cl_abap_typedescr.

 

FIELD-SYMBOLS: <fs1> TYPE any,

                <fs2> TYPE any.

 

START-OF-SELECTION.

 

   SELECT * FROM t001 INTO wa_1

   UP TO 1 ROWS.

   ENDSELECT.

 

   wa_2 = wa_1.

 

*forcefully changing variable to test

   wa_2-stceg = '1'.

 

   DO.

* Assign every field of this structure subsequently to the untyped

*fieldsymbol.

*    BREAK-POINT.

     ASSIGN COMPONENT sy-index OF STRUCTURE wa_1 TO <fs1>.

     IF sy-subrc NE 0.

       EXIT.

     ENDIF.

     ASSIGN COMPONENT sy-index OF STRUCTURE wa_2 TO <fs2>.

     IF sy-subrc NE 0.

       EXIT.

     ENDIF.

     IF <fs1> NE <fs2>.

 

*      mismatch found.

 

       CALL METHOD cl_abap_typedescr=>describe_by_data

         EXPORTING

           p_data      = <fs1>

         RECEIVING

           p_descr_ref = rf_descr_ref.

 

       WRITE: / sy-index, rf_descr_ref->type_kind,

       rf_descr_ref->absolute_name.

 

     ENDIF.

 

   ENDDO.


It should give an output like


 

 

 

        14  C

\TYPE=STCEG





Viewing all articles
Browse latest Browse all 8852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>