cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an additional column to a web dynpro table without upsetting the context?

former_member195355
Participant
0 Kudos

Hiya,

I have a  Z table that I have used as a basis for creating the context in my web Dynpro.

The context is then used as the binding for a Web Dynpro table.

I now would like to add an additional column to the table - to hopefully display a pretty icon, if another column contains a tick in a checkbox.

I thought I'd simply add an additional attribute to the context and then bind that as a column to the table...

However because I have bound the context to a Z table (see above) I can't add any more attributes to the context:

I need to keep the context bound to the Z table as that is how quantities, currencies and the positions of decimals are determined.

Is there any way I can add an additonal column to by table?

Thanks in advance for any ideas.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You either don't have to create additional fields in Ztable or create a new structure. For the context node, simply delete the dictionary structure; in your case, ZVENDOR. delete the ZVENDOR in context node properties and press enter. Then you can add extra attributes in the context node and your existing attributes still point to the dictionary structure ( for ex: EBELN would still point to ZVENDOR-EBELN)

Regards,

Kiran

former_member195355
Participant
0 Kudos

Hi Kiran,

Thanks for the reply but I need the data dictionary reference in order to make currency and quantity decimal places appear correctly.

former_member184578
Active Contributor
0 Kudos

Hi,

That's what I mention. Your attributes would still point to the Dictionary structure fields even after removing the dictionary structure.

For the context node, just remove the ZVENDOR in dictionary structure ( and press enter or you can click on the dictionary icon and remove the reference to dictionary structure ). And even after removing the ZVENDOR, your attributes would still point to the dictionary  structure fields ( you can check by clicking on any attribute) so that the currency and quantity decimals would retain.

Hope this helps u,

Regards,

Kiran

former_member195355
Participant
0 Kudos

Thanks for the reply Kiran and I'm sorry if I wasn't making myself clear.

I understand that the references to the data dictionary will remain but I also need the corresponding unit and currency fields and this link is only maintained if the data dictionary is maintained in the context. Otherwise I get a value of 10,000.000 when I should see 10,000 because the link to Unit (MEINS), in the data dictionary, is lost.

Thanks again for taking the time to reply.

former_member184578
Active Contributor
0 Kudos

Hi,

In the context node( after removing dictionary structure), what is the type of attribute MEINS point to ( I hope its ZVENDOR-MEINS )!

If not, I guess, while creating the context node, you didn't gave the Dictionary structure?

While creating context node, give the dictionary structure to create attributes from dictionary structure fields, then remove the dictionary structure in the context node, which allows you to add attributes in the context node.

Revert back for further clarifications.

Regards,

Kiran

Answers (2)

Answers (2)

former_member222068
Active Participant
0 Kudos

Hi Robert,

In the properties of the node 'RFQ_REPLY', remove the dictionary structure. Once if you remove the structure, you will be allowed to add attributes to the node.

Thanks & Regards,

Sankar Gelivi

ramakrishnappa
Active Contributor
0 Kudos

Hi Robert,

Simple approach:

You can add new fields into ZTABLE, and then add the attributes to the context node from the ZTABLE.

let me know if any further assistance required.

Hope this helps you.

Regards,

Rama

former_member195355
Participant
0 Kudos

Hi Rama,

Thanks for the reply, that's initially what I thought to do but unfortunately I 'm not allowed to amend the Z table.

Is there anything else you can think of?

Thanks again.

ramakrishnappa
Active Contributor
0 Kudos

Okay,

I suggest you the following

  • Create a new structure ZST_VENDOR and include your ZVENDOR into structure add new fields
  • Use the new structure to update the context node instead of ZVENDOR

Hope this would be simple.

If you want to go for dynamic programming, its quite tricky.

Regards,

Rama

former_member195355
Participant
0 Kudos

Hi Rama,

Thanks for the reply.

It's good to know that it's not a straightforward thing to do...

How about we approach it another way:

Basically in the table there is a column which has a boolean value i.e. X or ''.

This is read from the database and and I have set the column as type checkbox.

When a row has a checkbox that is ticked is there an easy way to display an icon when the checkbox is ticked?

ramakrishnappa
Active Contributor
0 Kudos

Hi Robert,

The simple way of resolving your issue is as below


  • Create an attribute "SOURCE" in context node
  • Add a column as "ICON_COL" into table
  • Add a IMAGE cell editor "ICON_VAL" and bind the property "ImageSource" to context attribute "SOURCE"
  • For check box, create an action "CHEK", and add to the event "OnToggle"
  • Write the below code in event handler method "ONACTIONCHECK"

METHOD onactioncheck .

  DATA lv_read_only TYPE wdy_boolean.

  DATA lv_icon_source TYPE string.

  DATA lo_element TYPE REF TO if_wd_context_element.

  lo_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).

  lo_element->get_attribute(

    EXPORTING

      name  = 'FUNC_REVIEW'

    IMPORTING

      value =    lv_read_only " DATA

  ).

  IF lv_read_only EQ abap_true.

    lv_icon_source = '~Icon/Add'.

  ELSE.

    lv_icon_source = '~Icon/Remove'.

  ENDIF.

  lo_element->set_attribute(

    EXPORTING

      value =  lv_icon_source

      name  =  'SOURCE'

  ).

ENDMETHOD.

Hope this helps you.

Regards,

Rama

former_member195355
Participant
0 Kudos

Hi Rama,

That's a good idea but again it requires the 'source' attribute added to the context and becasue the context is linked the the Z table, form the data dictionary, then we can't add it.

Thanks for trying. I'm sure the users won't mind if they can't have this functionality.

All the best!

ramakrishnappa
Active Contributor
0 Kudos

Okay Robert, If you can convince the users, its well and good.

In case, if you are allowed to append a field to Ztable, you can still consider this approach.

Good luck

Regards,

Rama