cancel
Showing results for 
Search instead for 
Did you mean: 

Display a context attribute as message manager pX input

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

1. Try to type cast the variable to the desired type.

2. I guess no other option, but to rearrange the generated code every time.

Regards,

Vinay