2009 Jul 16 6:37 PM
Hi,
Can you please let me know is there any way to solve below issue.
I have 2 strutures - lets say X_VBAK and Y_VBAK. Lets assume both has same data expect 2 or 3 fields different.
Is there any easy commond or class find out which fields are different.
******Poorna*******
Hi,
Can you please let me know is there any way to solve below issue.
I have 2 strutures - lets say X_VBAK and Y_VBAK. Lets assume both has same data expect 2 or 3 fields different.
Is there any easy commond or class find out which fields are different.
******Poorna*******
2009 Jul 16 7:11 PM
You may look into Marcin Pciak reply in the following thread
a®
2009 Jul 17 7:48 AM
Hi,
I did not find function or method which is adequate to your requirement (SE84 functions/methods in BC*).
(Do not expect too much from SAP development.)
With some work you may do it on oyur own. I give you a nice function here and you may complete. I assume, you are familiar with pointers.
REPORT test.
TYPES:
BEGIN OF my_type,
hugo LIKE mara-matnr,
emil LIKE marc-werks,
END OF my_type.
DATA:
struc TYPE my_type,
l_fields_table TYPE lvc_t_rfcfields.
CALL FUNCTION 'Z_GET_INFO_UNKNOWN_STRUC'
EXPORTING
struc = struc
TABLES
l_fields_table = l_fields_table.
BREAK-POINT.
FUNCTION Z_GET_INFO_UNKNOWN_STRUC.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(STRUC) TYPE ANY
*" TABLES
*" L_FIELDS_TABLE TYPE LVC_T_RFCFIELDS
*"----------------------------------------------------------------------
DATA:
l_oref_structure TYPE REF TO cl_abap_structdescr.
l_oref_structure ?= cl_abap_typedescr=>describe_by_data( struc ).
DATA l_tabname TYPE dd02l-tabname.
DATA l_component TYPE abap_compdescr.
DATA l_field TYPE rfc_fields.
DATA l_offset TYPE i.
SEARCH l_oref_structure->absolute_name FOR '\TYPE='.
IF sy-subrc = 0.
sy-fdpos = sy-fdpos + STRLEN( '\TYPE=' ) .
l_tabname = l_oref_structure->absolute_name+sy-fdpos.
ELSE.
l_tabname = 'UNKNOWN'.
ENDIF.
CLEAR l_offset.
l_field-tabname = l_tabname.
LOOP AT l_oref_structure->components INTO l_component.
MOVE-CORRESPONDING l_component TO l_field.
l_field-fieldname = l_component-name.
l_field-exid = l_component-type_kind.
l_field-intlength = l_component-length.
l_field-position = sy-tabix.
l_field-offset = l_offset.
l_offset = l_offset + l_field-intlength.
APPEND l_field TO l_fields_table.
ENDLOOP.
ENDFUNCTION.
Do you post your result function or method here? That would be fine.
Thanks and regards
Walter Habich
2009 Jul 21 7:26 AM
Hi,
Thanks for the reply.
I did it in the following way - it is very simple and crispy.
1. Got all the fields from DD03l table for VBAK.
2. Concatenate 'A_VBAK'-DD03L-fieldname into l_field1.
3. Concatenate 'B_VBAK'-DD03L-fieldname into l_field2.
4. assing (l_feild1) -> <fs_field1> and assign (l_field2) -> <fs_field2>.
5. if <fs_field1> ne <fs_field2>.
catch field DD03l-fieldname.
endif.
Reply back to me if i confuse u guys.
Thanks
******Poorna*******
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |