cancel
Showing results for 
Search instead for 
Did you mean: 

Business Graphic working but short dumping when 'No Data' is available

former_member386290
Participant
0 Kudos

Dear Experts,

I am trying to plot a graph (Bar chart) and it is working very well except when these is no data. In that instance instead of not displaying a data, it is giving short dump.

I am trying to plot a graph for a project from a list of the projects. In the Context, List of projects is a parent node while the cost data (used for drawing graph) is on child node. Both are with the cardinality of 0..n

When the project has cost data, graph is working beautifully but when the project does not have a cost data i get short dump.

Here is the what I get in Internet explorer.


The following error text was processed in the system UPG : Access via 'NULL' object reference not possible. 
The error occurred on the application server SAPSANDPIT_UPG_00 and in the work process 2 . 
The termination type was: RABAX_STATE 
The ABAP call stack was: 
Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/CBUSINESS_GRAPHICS======CP
Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C8STANDARD==============CP
Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C8STANDARD==============CP
Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C7STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program CL_WDR_VIEW_ADAPTER===========CP
Method: IF_WDR_NW7_DELTA_RENDERER~CALCULATE_DELTA_BLOCKS of program CL_WDR_VIEW_ADAPTER===========CP
Method: IF_WDR_NW7_DELTA_RENDERER~CALCULATE_DELTA_BLOCKS of program CL_WDR_WINDOW_CONTENT_ADAPTER=CP
Method: SET_CONTENT of program CL_WDR_NW7_INT_WIN_ADAPTER====CP
Method: SET_CONTENT of program CL_WDR_NW7_MAIN_WIN_ADAPTER===CP
Method: IF_WDR_CLIENT~SEND_RESPONSE of program CL_WDR_CLIENT_SSR_LS==========CP

And here is what is in ST22



Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED_NO 
Exception              CX_SY_REF_IS_INITIAL           

Error analysis                                                                     
    An exception occurred that is explained in detail below.                       
    The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not      
     caught in                                                                     
    procedure "IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT" "(METHOD)", nor was it     
     propagated by a RAISING clause.                                               
    Since the caller of the procedure could not have anticipated that the          
    exception would occur, the current program is terminated.                      
    The reason for the exception is:                                               
    You attempted to use a 'NULL' object reference (points to 'nothing')           
    access a component.                                                            
    An object reference must point to an object (an instance of a class)           
    before it can be used to access components.                                    
    Either the reference was never set or it was set to 'NULL' using the           
    CLEAR statement.                                                               

Problem is at following point


                                                                                mv_CHARTDATA = mv_DATA->create_simple_element( name = 'ChartData' parent = mv_DATA ). "#
*   >> END_UCA BUSINESS_GRAPHICS|BUSINESS_GRAPHICS|CHARTDATA                                                                                
*   >> Property: Get BUSINESS_GRAPHICS-SERIES_SOURCE                                        
    mv_SERIES_SOURCE =  get_bound_node( i_binding = wd_BUSINESS_GRAPHICS->bp_SERIES_SOURCE )
                                                                                *   >> Property: UCA BUSINESS_GRAPHICS-SERIES_ELEMENTS                                      
*   >> UCA BUSINESS_GRAPHICS|BUSINESS_GRAPHICS|SERIES_ELEMENTS                                                                                
mv_SERIES_ELEMENTS = mv_SERIES_SOURCE->get_elements( ).                                 
*   >> END_UCA BUSINESS_GRAPHICS|BUSINESS_GRAPHICS|SERIES_ELEMENTS                                                                                
*   >> Property: UCA BUSINESS_GRAPHICS-SERIES_SOURCE_PATH                                   
*   >> UCA BUSINESS_GRAPHICS|BUSINESS_GRAPHICS|SERIES_SOURCE_PATH                           


mv_SERIES_SOURCE IN in above code is initial when data does not exists for a project.

Thanks in advance for your help.

ABAPer

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

> In the Context, List of projects is a parent node while the cost data (used for drawing graph) is on child node. Both are with the cardinality of 0..n

I believe that the parent child relationship is the key to your problem. Even an empty child node won't exist for the cost data if there are no elements in the parent list of projects node. Without a node object in the child, the UI element dumps with a null reference.

Consider if you need the parent child relationship. If so, consider inserting a dummy initial entry in the parent node so at least the child node will be created (with no elements). Also consider hidding the chart if the context is initial. All of these should work around this situation.

former_member386290
Participant
0 Kudos

Hello Thomas,

Thank you for your reply.

I think I will hide the chart if context is initial. Consider the context structure as following:

PROJECT_TABLE -> COSTS (child of PROJECT_TABLE) ->COST_GRAPH (child of COSTS)

'BGR' is the name of the business graphic UIElement that is mapped to 'COST_GRAPH' child node.

(1) If context is initail, What is the Code to hide the chart?

(3) Where should it be put? in WDDOMODIFYVIEW method of the view?

Thanks

Regards,

ABAPer

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>(1) If context is initail, What is the Code to hide the chart?

In my opinion, but the chart in a separte view. Insert this view via a viewContainerUIElement. Bind a context attribute to the visible property of the viewContainerUIElement. Control the visiblity by setting the value of this bound context attribute. If the ViewContainerUIElement is not visible, then the inner view is not even attempted to be rendered (most efficient).

>(3) Where should it be put? in WDDOMODIFYVIEW method of the view?

I wouldn't recommend it in WDDOMODIFYVIEW. I would set visible to false in WDDOINIT and then only trigger visible to true in whatever method also populates the data of the context of the parent.

former_member386290
Participant
0 Kudos

Hi Thomas,

I have used an object of 'cl_wd_uielement_container' to read the refence of child UI elemnt (i.e. graphic UI Element) using GET_ELEMENT method and then used the SET_VISIBLE method to hide it (the chart) in WDDOMODIFYVIEW method and it is working fine now.

Thank you.

ABAPer

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It really isn't necessary nor is it suggest do access the control object directly in WDDOMODIFYVIEW. It is much better to bind the context attribute as I described.

Answers (1)

Answers (1)

former_member386290
Participant
0 Kudos

Forgot to add following info from ST22


Information on where terminated                                                               
    Termination occurred in the ABAP program "/1WDA/CBUSINESS_GRAPHICS======CP" -             
     in "IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT".                                            
    The main program was "SAPMHTTP ".                                                                                
In the source code you have the termination point in line 753                             
    of the (Include) program "/1WDA/CBUSINESS_GRAPHICS======CCIMP".                           
    The termination is caused because exception "CX_SY_REF_IS_INITIAL" occurred in            
    procedure "IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT" "(METHOD)", but it was                
     neither handled locally nor declared                                                     
    in the RAISING clause of its signature.                                                                                
The procedure is in program "/1WDA/CBUSINESS_GRAPHICS======CP "; its source               
     code begins in line                                                                      
    390 of the (Include program "/1WDA/CBUSINESS_GRAPHICS======CCIMP ".                       

Thanks

ABAPer