cancel
Showing results for 
Search instead for 
Did you mean: 

How to display dynamic status image in webdynpro table based on the condition

Former Member
0 Kudos

my z table i have record like this

STATUS     CUSTOMER REFNO     DATE.

     R          8354                            12:12:2012

     A          3485                             11:12:2011

R  - REJECTED

A  -  APPROVED

when i display same record in webdynpro table web browser

status column under that i want like this

R =

A =

STATUS     CUSTOMER REFNO     DATE

               8354                          12:12:2012

               3485                           11:12:2011

   

I did coding like this

method ONACTIONSUBMIT .

   DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
   lo_COMPONENTCONTROLLER wd_this->get_componentcontroller_ctr( ).

     lo_componentcontroller->execute_zzt_list_rfc(
     ).

endmethod.

METHOD execute_zzt_list_rfc .
* declarations for context navigation
   DATA lo_zzt_list_rfc TYPE REF TO if_wd_context_node.
   DATA lo_changing TYPE REF TO if_wd_context_node.
   DATA lo_t_statusdet TYPE REF TO if_wd_context_node.
   DATA lo_importing TYPE REF TO if_wd_context_node.
   DATA lo_element TYPE REF TO if_wd_context_element.
   DATA lt_elements TYPE wdr_context_element_set.
*  data : lo_IMG type ref to CL_WD_IMAGE.
*
*LO_IMG = cl_wd_IMAGE=>new_IMAGE( id = status SOURCE = 'ICON_BW_APD_TARGET' tooltip = sts_tltp ).
*
*lo_cont->add_child( the_child = lo_img ).

* declarations for parameters
   DATA lv_i_datefrm TYPE dats.

   DATA lv_i_dateto TYPE dats.

   DATA lv_i_sno TYPE zserial_no.

   DATA lv_i_status TYPE zstatus_1.

   DATA lt_c_t_statusdet TYPE if_componentcontroller=>elements_t_statusdet."ZZT_SD_CUS_STR_STATDET
   DATA wa_statusdet TYPE zzt_sd_cus_str_statdet.
   DATA wa_statusdet_tmp TYPE zzt_sd_cus_str_statdet.
   DATA lt_statusdet TYPE if_componentcontroller=>elements_t_statusdet.
   DATA ls_c_t_statusdet LIKE LINE OF lt_c_t_statusdet.
   DATA lt_c_t_statusdet_cp TYPE if_componentcontroller=>elements_t_statusdet.


* get all involved child nodes
   lo_zzt_list_rfc = wd_context->get_child_node( wd_this->wdctx_zzt_list_rfc ).
   lo_changing = lo_zzt_list_rfc->get_child_node( wd_this->wdctx_changing ).
   lo_t_statusdet = lo_changing->get_child_node( wd_this->wdctx_t_statusdet ).
   lo_importing = lo_zzt_list_rfc->get_child_node( wd_this->wdctx_importing ).

* get input from context
   lo_importing->get_attribute(
     EXPORTING
       name  = `I_DATEFRM`
     IMPORTING
       value = lv_i_datefrm ).
   lo_importing->get_attribute(
     EXPORTING
       name  = `I_DATETO`
     IMPORTING
       value = lv_i_dateto ).
   lo_importing->get_attribute(
     EXPORTING
       name  = `I_SNO`
     IMPORTING
       value = lv_i_sno ).
   lo_importing->get_attribute(
     EXPORTING
       name  = `I_STATUS`
     IMPORTING
       value = lv_i_status ).
   lt_elements = lo_t_statusdet->get_elements( ).
   LOOP AT lt_elements[] INTO lo_element.
     lo_element->get_static_attributes( IMPORTING static_attributes = ls_c_t_statusdet ).
     INSERT ls_c_t_statusdet INTO TABLE lt_c_t_statusdet[].
   ENDLOOP.

   lt_c_t_statusdet_cp = lt_c_t_statusdet[].
   CLEAR : lt_c_t_statusdet[].

* the invocation - errors are always fatal !!!
   CALL FUNCTION 'ZZT_LIST_RFC'
     EXPORTING
       i_sno       = lv_i_sno
       i_datefrm   = lv_i_datefrm
       i_dateto    = lv_i_dateto
       i_status    = lv_i_status
*      i_remarks = lv_remarks                           "   IMPORTING
                                    "      e_return =                        wd_this->e_return
     TABLES
       t_statusdet = lt_c_t_statusdet."      et_return =

LOOP AT lt_c_t_statusdet INTO ls_c_t_statusdet.
*   wa_statusdet_tmp = wa_statusdet.

     IF ls_c_t_statusdet-status = 'S'.
       ls_c_t_statusdet-status 'Icon/YellowLed'. "-> Write the correct image name
    elseif ls_c_t_statusdet-status = 'A'.
ls_c_t_statusdet-status 'Icon/GreenLed'.
    else.
ls_c_t_statusdet-status 'Icon/RedLed'.
     ENDIF.
   modify lt_c_t_statusdet from ls_c_t_statusdet.
  ENDLOOP.
ENDMETHOD.


Accepted Solutions (0)

Answers (2)

Answers (2)

former_member213957
Participant
0 Kudos

Hi Sakthi,

May be status field data element is string.so, u can never display any icons in the string type field in the table.If u want to display column as a icon statuses, status field should be a type of  "WDG_UR_WEB_ICON_ALIAS" . if it is not working then use "WDG_UR_WEB_ICON".

SO, my idea is create one more field status_display or attribute with above data element, simply remove present status column form your table but don't delete the context attribute.Maintain present status attribute as status description and change the name also.And write the logic based on the status description value map the required icon to the status field then your problem solved.

use best icons names for your requirement : WEBICON_RED/ GREEN

Regards,

Kishorekumar

Former Member
0 Kudos

I am not sure that my idea will works or not. If you are using an SALV component in your webdynpro application, then you can do it by changing your fieldcatalog property of that column "Status". Just get all the properties of salv by calling method get_columns( ) which will return the object ref of class "CL_SALV_COLUMNS".

Use the object to modify the property of the required column "status". Use the ICON property for the column.

Former Member
0 Kudos

Thanks Friend , but i am not using SALV.

i am using normal table within that table  want to display like this

z table maintenance i created one RFC by referring that rfc using service call method created root context componentcontroller nodes

my view

now displaying like

but i want respective icon in status column

Former Member
0 Kudos
Former Member
0 Kudos

you can do it by using TRISTATECHECKBOX  use below link for more detail about tristate

http://help.sap.com/saphelp_nw70ehp2/helpdata/en/49/6c75a8b8ad1ec8e10000000a42189b/content.htm

You can make use of the   TOGGLEBUTTON  with image source bind with context attribute

if helpful reward points