How to display icons in a Table Control






Output :
 


How to Achieve Above Output :
Create Table Control with wizard by Using Below declared Internal Table ( I_STATUS )



Click On Simulate Revised CTC Field  and maintain the properties defined:



Code :
Declaration :
Types : begin of ty_status            ,
        btrtl  
type pa0001-btrtl      ,
        btext  
type t001p-btext       ,    " PSA Description
        simu   
type icons-text        ,    "
        fina   
type icons-text        ,    "
        post   
type icons-text        ,    "
        
end of  ty_status             ,

        
begin of ty_papsa             ,
        werks  
type t001p-werks       ,
        btrtl  
type t001p-btrtl       ,
        
end of   ty_papsa             .
data i_papsa   type standard table of ty_papsa  ,
       wa_papsa 
like line of i_papsa             ,
       i_status  
type standard table of ty_status,
       wa_status 
like line of i_status        .


Logic : ( Write Logic in PAI ) @ Enter Event


 if lv_werks is not initial.
        
refresh :i_papsa[],i_status[],i_cstat[].
"  To get the Active Plants
select werks btrtl from t001p_delimit into table i_papsa 
                                    where werks lv_werks
                                      
and endda '99991231'.   

*& To get Status for Company Code entered on Screen:
*& R-Revised Simulate , F-Final Simulate , P- Post Finalized

select from z00hrt0177 into table i_cstat where werks lv_werks.

if i_cstat[] is not initial.
 sort  i_cstat[] by werks btrtl.
 delete adjacent duplicates from i_cstat[] comparing btrtl.
endif.
if i_papsa[] is not initial.
loop at i_papsa into wa_papsa.
wa_status
-btrtl wa_papsa-btrtl.
perform btrtl_text.
icon_name  icon_system_okay.
icon_name1 
icon_system_cancel.
clear :wa_cstat.
read table i_cstat into wa_cstat with key werks lv_werks
                                          btrtl 
wa_status-btrtl.
  
if wa_cstat is not initial.
  
if wa_cstat-zindi 'R'.

  perform icon_display using icon_name  changing wa_status-simu.
    perform icon_display using icon_name1 changing wa_status-fina.
  
perform icon_display using icon_name1 changing wa_status-post.
  
elseif wa_cstat-zindi 'F'.
  
perform icon_display using icon_name  changing wa_status-simu.
  
perform icon_display using icon_name  changing wa_status-fina.
  
perform icon_display using icon_name1 changing wa_status-post.

  elseif wa_cstat-zindi 'P'.
  
perform icon_display using icon_name  changing wa_status-simu.
  perform icon_display using icon_name  changing wa_status-fina.
  
perform icon_display using icon_name  changing wa_status-post.
  
endif.

else.
 perform icon_display using icon_name1 changing wa_status-simu.
 
perform icon_display using icon_name1 changing wa_status-fina.
 
perform icon_display using icon_name1 changing wa_status-post.
endif.

append wa_status to i_status.
clear:wa_papsa,wa_status.
 endloop.
 endif.
endif.
*&======================
*&      Form  PSA Text  * 
*&======================
form btrtl_text .
  
call function 'HRWPC_RFC_BTRTL_TEXT_GET'
    
exporting
      werks      
wa_papsa-werks          " PA
      btrtl      
wa_papsa-btrtl          " PSA
    
importing
      btrtl_text 
wa_status-btext.         " PSA Text
endform.                    " BTRTL_TEXT
*&======================
*&      Form  ICON_DISPLAY  * 
*&======================
form icon_display  using    p_name
                   
changing p_status.

  
call function 'ICON_CREATE'
    
exporting
      name       
p_name
*     TEXT       = ' '
*     INFO       = ' '
*     ADD_STDINF = 'X'
    
importing
      result     
p_status.

endform.                    " ICON_DISPLAY
 






Comments

Popular posts from this blog

SAP ABAP-Internal Table Operations and Example Program

HR ABAP Interview Questions and Answers

BDC (Batch Data Communication) - SAP ABAP