Skip to Content
0
Former Member
Dec 07, 2011 at 09:15 AM

Display a context attribute as message manager pX input

42 Views

Hi,

I'm new to ABAP (former Java WDP developer) and I'm trying to pass a context attribute (type String) to the message manager.

This is the code snippet:

  DATA messaggio TYPE wd_this->element_view_settings-messaggio.

  DATA lo_nd_view_settings TYPE REF TO if_wd_context_node.
  DATA lo_el_view_settings TYPE REF TO if_wd_context_element.
  lo_nd_view_settings = wd_context->get_child_node( name = wd_this->wdctx_view_settings ).
  lo_el_view_settings = lo_nd_view_settings->get_element( ).

  lo_el_view_settings->get_attribute(
      EXPORTING name = 'MESSAGGIO'
      IMPORTING value = messaggio
  ).

  wd_this->msg_manager->report_t100_message(
      msgid = 'ZPM_TEST_ABAP_WDP_MS'
      msgno = '001'
      msgty = 'I'
      p1    = messaggio ).

It fails because 'messaggio' is not of the right type. Is there a way to make an implicit type conversion of some sort instead of creating another temporary variable.

On a side note, the problem I'm having with ABAP Object Oriented Programming in general is that the Code Wizard (the magic wand button) tends to output a lot of boilerplate code that makes things overtly long and confusing. If there is a way not to create new variables which I don't need would be an improvement.

Thanks,

Pietro