Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Warning Error in Program - When assigning one field to another

nitin_gupta
Associate
Associate
0 Kudos
166

Hi All,

I have a report program in ECC 6.0:

data: gv_valuepart(960) type c,

wa_bapi_te_wbs_element type bapi_te_wbs_element.

wa_bapi_te_wbs_element = gv_valuepart.

Here in structure bapi_te_wbs_element, I have the include CI_PRPS.

In third line of my code above in assignment operation(=) I am getting the following Warning Message:

The assignment or the comparison might not be allowed after a structure enhancement.

This frequently occurring case is referred to as "container programming". A structure is inserted into a longer character type single field. If this structure can be flatly enhanced, it is very likely that an enhancement will result in non-character-type components being inserted into the field and this would cause a syntax error.

Troubleshooting: This warning is triggered because the data type can be flatly enhanced. In SE11, you can assign this data type a lower enhancement category than "can be flatly enhanced".

For further information on possible structure enhancements with regard to checks in Unicode programs, see Handling Structure Enhancements

I am not able to resolve this Warning.

I feel this warning is somehow related to the new Enhancement Category concept introduced from ECC 5.0

Anybody know how this warning can be removed?

Thanks,

Nitin

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos
72

Hello Nitin

The explanation for this warning is the new "Fragment View" of structures under Unicode:

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/79/c55464b3dc11d5993800508b6b8b11/content.htm">Unicode Fragment View</a>

This warning will most likely always be triggered when you assign (=) an unstructured "Char container" to a structured variable.

You could perhaps get rid of this warning using the following coding:


*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_UC_FRAGMENT_VIEW
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_uc_fragment_view.


DATA:
  gv_valuepart(960) TYPE c,
  wa_bapi_te_wbs_element TYPE bapi_te_wbs_element.





START-OF-SELECTION.

**  wa_bapi_te_wbs_element = gv_valuepart.

  CALL METHOD cl_abap_container_utilities=>read_container_c
    EXPORTING
      im_container           = gv_valuepart
    IMPORTING
      ex_value               = wa_bapi_te_wbs_element
    EXCEPTIONS
      illegal_parameter_type = 1
      OTHERS                 = 2.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


END-OF-SELECTION.

Regards

Uwe

2 REPLIES 2

uwe_schieferstein
Active Contributor
0 Kudos
73

Hello Nitin

The explanation for this warning is the new "Fragment View" of structures under Unicode:

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/79/c55464b3dc11d5993800508b6b8b11/content.htm">Unicode Fragment View</a>

This warning will most likely always be triggered when you assign (=) an unstructured "Char container" to a structured variable.

You could perhaps get rid of this warning using the following coding:


*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_UC_FRAGMENT_VIEW
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_uc_fragment_view.


DATA:
  gv_valuepart(960) TYPE c,
  wa_bapi_te_wbs_element TYPE bapi_te_wbs_element.





START-OF-SELECTION.

**  wa_bapi_te_wbs_element = gv_valuepart.

  CALL METHOD cl_abap_container_utilities=>read_container_c
    EXPORTING
      im_container           = gv_valuepart
    IMPORTING
      ex_value               = wa_bapi_te_wbs_element
    EXCEPTIONS
      illegal_parameter_type = 1
      OTHERS                 = 2.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


END-OF-SELECTION.

Regards

Uwe

0 Kudos
72

Hi Uwe,

Many Thanks!

The solution worked out perfectly.

Regards,

Nitin