Wednesday, December 2, 2009

ALV Hyperlink for SD documents

 

To create a Hyperlink in the Link in the ALV for any SD Document following code can be used.

This Form name has to be included in the ALV call.

 

FORM user_command USING  in_ucomm LIKE sy-ucomm
                             in_selfield 
TYPE slis_selfield.
  
CONSTANTS : c_ucomm_select_line LIKE sy-ucomm VALUE '&IC1',
              char_x 
VALUE 'X'.

  
DATA: lfs_data1 LIKE it_out.
  
CLEAR : lfs_data1.
  
READ TABLE it_out INDEX in_selfield-tabindex
              
INTO lfs_data1.
  
IF p_sum IS NOT INITIAL.
    
READ TABLE it_sum INDEX in_selfield-tabindex
                
INTO lfs_data1-vbeln.
  
ENDIF.
*-----At USER ACTION carry out action
  
IF in_ucomm = c_ucomm_select_line.
    
IF in_selfield-sel_tab_field = 'IT_OUT-VBELN'
      
or in_selfield-sel_tab_field = 'IT_SUM-VBELN'.
      
IF NOT lfs_data1-vbeln IS  INITIAL.
        
CALL FUNCTION 'RV_CALL_DISPLAY_TRANSACTION'
          
EXPORTING
            vbeln = lfs_data1-vbeln.
      
ENDIF.
    
ELSEIF in_selfield-sel_tab_field = 'IT_OUT-VBELN_DO'.
*Delivery
      
IF NOT lfs_data1-vbeln_do IS  INITIAL.
        
CALL FUNCTION 'RV_CALL_DISPLAY_TRANSACTION'
          
EXPORTING
            vbeln = lfs_data1-vbeln_do.
      
ENDIF.
    
ELSEIF in_selfield-sel_tab_field = 'IT_OUT-VBELN_PO'.
* PO No

      
IF NOT lfs_data1-vbeln_po IS  INITIAL.
        
CALL FUNCTION 'RV_CALL_DISPLAY_TRANSACTION'
          
EXPORTING
            vbeln = lfs_data1-vbeln_po
            vbtyp = 
'V'.
      
ENDIF.

    
ELSEIF in_selfield-sel_tab_field = 'IT_OUT-BELNR'.
* IR No
      
IF NOT lfs_data1-belnr IS  INITIAL.
        
SET PARAMETER ID 'RBN' FIELD it_out-belnr.
        
CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
      
ENDIF.
    
ELSEIF in_selfield-sel_tab_field = 'IT_OUT-VBELN_GI'.
*Goods issue " MB03
      
IF NOT lfs_data1-vbeln_gi IS  INITIAL.
        
CALL FUNCTION 'RV_CALL_DISPLAY_TRANSACTION'
          
EXPORTING
            vbeln = lfs_data1-vbeln_gi
            vbtyp = 
'R'.
      
ENDIF.
    
ELSEIF in_selfield-sel_tab_field = 'IT_OUT-VBELN_RV'.
*Billing Document
      
IF NOT lfs_data1-vbeln_rv IS  INITIAL.
        
CALL FUNCTION 'RV_CALL_DISPLAY_TRANSACTION'
          
EXPORTING
            vbeln = lfs_data1-vbeln_rv.
      
ENDIF.
    
ENDIF.
  
ENDIF.
ENDFORM.                               " USR_COMM.





No comments: