Skip to Content
author's profile photo Former Member
Former Member

Display a context attribute as message manager pX input

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2011 at 04:29 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.