cancel
Showing results for 
Search instead for 
Did you mean: 

FPM IDR doesn't display amount fields

ged_hurst
Participant
0 Kudos

Hi everyone,

I've defined a dictionary structure named ZSRM_WD_PO_HEADER containing 2 fields:

- AMOUNT type BPREI reference field ZSRM_WD_PO_HEADER-WAERS

- WAERS type WAERS

The amount field is displayed correctly onto the screen but when I include it in the FPM IDR region it does not work:



  ls_item_ref-label_name = 'Amount:'.
  ls_item_ref-value_path = 'PO_HEADER.AMOUNT'.
  APPEND ls_item_ref TO lt_items_ref.

  ls_item_ref-label_name = 'Currency:'.
  ls_item_ref-value_path = 'PO_HEADER.WAERS'.
  APPEND ls_item_ref TO lt_items_ref.

   me->lo_idr->add_item_group_by_ref( EXPORTING
                                         io_root_node = lo_main_context
                                         it_items = lt_items_ref
                                         IMPORTING ev_key = lv_idr_key ).

In this case I get a dump: could not find WAERS attribute.

If I remove the amount from the IDR it all works okay and the amount is displayed onto the screen (but not in the IDR of course).

This sounds to me like a bug. Any ideas?

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Error message is clear that attribute "WAERS" is not available in PO_HEADER at the moment IDR is being called. Perhaps it is dynamically added to the context node later.

ged_hurst
Participant
0 Kudos

The message is clear enough to me as well but it is blatantly false.

WAERS has been assigned to the structure ZSRM_WD_PO_header at design time, in SE11 and it's available. Also, when the amount is displayed in ANY view of the WebDynpro Application it works all right, everything is formatted correctly.

However when the same field is added to the IDR it is not displayed. Why?

It looks like a bug with FPM to me. What do you think?

Or what am I doing wrong?

Former Member
0 Kudos

There may be a possibility that if you use context node which is based on the ZSRM_WD_PO_header and the WAERS field is not in the node as attribuut.

You have to analyse how the IDR gets it key-value pair. Debug it and see if anything missing there.

ged_hurst
Participant
0 Kudos

HI,

I tried to debug the standard coding:


   _get_all_attributes( ).
      read table me->attributes->* into attribute_info with table key name = name.

and the table

 me->attributes->* 

does contain 1 attribute only (AMOUNT) so it dumps raising a message for the field WAERS not being defined.

However this is not true. I built a context node from a dictionary structure in which 2 fields were defined: AMOUNT + WAERS

and AMOUNT refers to WAERS.

Also, the problem is raised in IDR only not in normal WebDynpro views.

Any clue?

Former Member
0 Kudos

if you have added 2 attributes to the structure and the context node does not have them then i would suggest to debug again and see how the attributes table is being build ? Some how it gets the AMOUNT attribute and not the WAERS attribute.

ged_hurst
Participant
0 Kudos

Hi,

you can try that yourself.

Create a simple FPM application (which implements IF_FPM_UI_BUILDING_BLOCK) with 1context node that links to a Dictionary structure called ZWD_TEST_01 made up of two fields:


AMOUNT type BPREI     reference table ZWD_TEST_01-WAERS
WAERS type WAERS

Then in the init method of the component copy and paste the following coding:


METHOD wddoinit .
  DATA:
      lt_items_ref TYPE if_fpm_idr=>t_items_ref,
      ls_item_ref  TYPE if_fpm_idr=>s_items_ref,
      lo_main_context TYPE REF TO if_wd_context,
      lo_exc       TYPE REF TO cx_fpm_idr,
      lv_text      TYPE string,
      iv_bottom    TYPE string,
      iv_top       TYPE string.
  DATA lo_fpm TYPE REF TO if_fpm.
  DATA lo_idr TYPE REF TO if_fpm_idr.


  DATA lo_nd_test TYPE REF TO if_wd_context_node.

  DATA lo_el_test TYPE REF TO if_wd_context_element.
  DATA ls_test TYPE wd_this->element_test.
  DATA lv_amount TYPE wd_this->element_test-amount.
  lo_nd_test = wd_context->get_child_node( name = wd_this->wdctx_test ).
  lo_el_test = lo_nd_test->get_element( ).
  lo_el_test->set_attribute(  name =  `AMOUNT`  value = '12' ).
  lo_el_test->set_attribute(  name =  `WAERS`  value = 'EUR' ).



  lo_fpm = cl_fpm_factory=>get_instance( ).
  lo_idr ?= lo_fpm->get_service( cl_fpm_service_manager=>gc_key_idr ).
  ls_item_ref-label_name = 'Currency:'.
  ls_item_ref-value_path = 'TEST.WAERS'.
  APPEND ls_item_ref TO lt_items_ref.

  ls_item_ref-label_name = 'Amount:'.
  ls_item_ref-value_path = 'TEST.AMOUNT'.
  APPEND ls_item_ref TO lt_items_ref.

  lo_main_context = wd_context->get_context( ).
  DATA lv_idr_key TYPE i.
  TRY.
      lo_idr->set_ticket( iv_top = iv_top iv_bottom = iv_bottom iv_top_tooltip = space  iv_bottom_tooltip = space ).

      lo_idr->add_item_group_by_ref( EXPORTING
                                         io_root_node = lo_main_context
                                         it_items = lt_items_ref
                                         IMPORTING ev_key = lv_idr_key ).
    CATCH cx_fpm_idr INTO lo_exc.
  ENDTRY.
ENDMETHOD.

Also create a view with 2 fields: Amount + Test, linked to the context attributes above in order to see that the fields work okay when added to the form.

Try and preview the application.

You will get an error: "Could not find attribute WAERS"....

Thank you for letting me know if you get the same.

Cheers

ged_hurst
Participant
0 Kudos

Does anybody know how to work this out?