URGENT!! Graphical representation of functions
Hello,
I am developing an application that calculates the fatigue life of a material. To do this I need to draw concurrent graphs of some equations.
The problems are the following:
- I need to have a cursor running along the lines (and possibly around the surface
- I need to fill the areas between the lines with a specific color
The above graphs need to change dynamically when the user changes the values through controls that are going to be provided in the GUI.
Can somebody help me because I am lost in various complex scientific visualization libraries.
Thanks in advance
I'm developing numerical simulation of a physical phenomena and needed similar features as you describe. To fill the closed area you can look into the Graphics class and check out the different version of the fill method. To have that cursor running you can use a separate thread. Let me know if you need fruther help.
Nikita
Similar Messages
-
Graphical representation of report
hi ..
How do we provide graphical representation of report output.Hi
1st example
report GRAPHICS_GUI_CE_DEMO.
global data
data: G_CE_CONTAINER type ref to CL_GUI_CUSTOM_CONTAINER.
data: G_CE_NEW_CONTAINER type ref to CL_GUI_CUSTOM_CONTAINER.
data: G_CE_VIEWER type ref to CL_GUI_CHART_ENGINE.
data: G_CE_VIEWER_NEW type ref to CL_GUI_CHART_ENGINE.
data: G_IXML type ref to IF_IXML.
data: G_IXML_SF type ref to IF_IXML_STREAM_FACTORY.
data: G_DESIGN_MODE type C.
data: G_VALUE_CHANGE type C.
data: G_SAVE_OKCODE like SY-UCOMM.
dynpro data
data: OKCODE like SY-UCOMM,
GT_SFLIGHT type table of SFLIGHT,
G_REPID like SY-REPID,
G_MAX type I value 100,
MYCONTAINER type SCRFNAME value 'NEW_CONTAINER',
reference to custom container: neccessary to bind ALV Control
CUSTOM_CONTAINER type ref to CL_GUI_CUSTOM_CONTAINER,
GRID1 type ref to CL_GUI_ALV_GRID.
'x_save' contains a flag to control which kind of a layout the user
can save (see below).
'gs_layout' identifies a layout. It must contain
at least the report-id.
§ 1.Declare a structure of type DISVARIANT to identify a layout
and a variable to define the saving options for users.
data: X_SAVE, "for Parameter I_SAVE
GS_LAYOUT type DISVARIANT. "for parameter IS_VARIANT
event handler
class LCL_CE_VIEWER_EH definition.
public section.
methods ON_CLICK for event CLICK of CL_GUI_CHART_ENGINE
importing
ELEMENT SERIES POINT.
methods ON_VALUE_CHANGE for event VALUE_CHANGE of
CL_GUI_CHART_ENGINE
importing
SERIES POINT VALUE.
methods ON_PROPERTY_CHANGE for event PROPERTY_CHANGE of
CL_GUI_CHART_ENGINE
importing
ELEMENT NAME VALUE.
endclass. "lcl_ce_viewer_eh DEFINITION
data: G_CE_VIEWER_EH type ref to LCL_CE_VIEWER_EH.
data: G_CE_VIEWER_EH_NEW type ref to LCL_CE_VIEWER_EH.
entry point
start-of-selection.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
start-of-selection.
select * from SFLIGHT into table GT_SFLIGHT up to G_MAX rows.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clear GS_LAYOUT.
create global objects
G_IXML = CL_IXML=>CREATE( ).
G_IXML_SF = G_IXML->CREATE_STREAM_FACTORY( ).
G_REPID = SY-REPID.
§ 2.At least field REPORT of this structure has to be filled!
GS_LAYOUT-REPORT = G_REPID.
X_SAVE = 'A'. "The user may save all types of a layout
call screen '100'.
ENDREPORT GRAPHICS_GUI_CE_DEMO.
*& Module STATUS_0100 OUTPUT
text
module STATUS_0100 output.
data: L_IXML_DATA_DOC type ref to IF_IXML_DOCUMENT,
L_IXML_CUSTOM_DOC type ref to IF_IXML_DOCUMENT,
L_OSTREAM type ref to IF_IXML_OSTREAM,
L_XSTR type XSTRING.
set pf-status '100'.
if G_CE_CONTAINER is initial.
create object G_CE_CONTAINER
exporting
CONTAINER_NAME = 'CONTAINER'.
create object G_CE_VIEWER
exporting
PARENT = G_CE_CONTAINER.
create object G_CE_VIEWER_EH.
set handler G_CE_VIEWER_EH->ON_CLICK for G_CE_VIEWER.
set handler G_CE_VIEWER_EH->ON_VALUE_CHANGE for G_CE_VIEWER.
set handler G_CE_VIEWER_EH->ON_PROPERTY_CHANGE for G_CE_VIEWER.
perform CREATE_DATA_DEMO using L_IXML_DATA_DOC.
L_OSTREAM = G_IXML_SF->CREATE_OSTREAM_XSTRING( L_XSTR ).
call method L_IXML_DATA_DOC->RENDER
exporting
OSTREAM = L_OSTREAM.
G_CE_VIEWER->SET_DATA( XDATA = L_XSTR ).
clear L_XSTR.
perform CREATE_CUSTOM_DEMO using L_IXML_CUSTOM_DOC.
L_OSTREAM = G_IXML_SF->CREATE_OSTREAM_XSTRING( L_XSTR ).
call method L_IXML_CUSTOM_DOC->RENDER
exporting
OSTREAM = L_OSTREAM.
G_CE_VIEWER->SET_CUSTOMIZING( XDATA = L_XSTR ).
endif.
call method G_CE_VIEWER->RENDER.
if CUSTOM_CONTAINER is initial.
create a custom container control for our ALV Control
create object CUSTOM_CONTAINER
exporting
CONTAINER_NAME = MYCONTAINER
exceptions
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
if SY-SUBRC ne 0.
add your handling, for example
call function 'POPUP_TO_INFORM'
exporting
TITEL = G_REPID
TXT2 = SY-SUBRC
TXT1 = 'The control could not be created'(510).
endif.
create object GRID1
exporting I_PARENT = CUSTOM_CONTAINER.
§ 4.Transfer your structure and your variable using parameters
IS_VARIANT and I_SAVE of method set_table_for_first_display.
call method GRID1->SET_TABLE_FOR_FIRST_DISPLAY
exporting
I_STRUCTURE_NAME = 'SFLIGHT'
IS_VARIANT = GS_LAYOUT "&see below
I_SAVE = X_SAVE "&see below
I_DEFAULT = 'X'
changing
IT_OUTTAB = GT_SFLIGHT.
& If you leave out the these parameters, the menu beneath
the layout icon disappears.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module USER_COMMAND_0100 input.
G_SAVE_OKCODE = OKCODE.
clear OKCODE.
case G_SAVE_OKCODE.
when 'DESIGN'.
perform TOGGLE_DESIGN_MODE.
when 'VALUE'.
perform TOGGLE_VALUE_CHANGE.
when 'SAVE'.
perform SAVE_CUSTOMIZING.
when 'PRINT'.
perform PRINT.
when 'EXIT'.
leave program.
when 'BACK'.
leave program.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& IMPLEMENTATION
text
class CL_ABAP_CHAR_UTILITIES definition load.
*& Form create_data_demo
text
form CREATE_DATA_DEMO using P_IXML_DOC type ref to IF_IXML_DOCUMENT.
data: L_SIMPLECHARTDATA type ref to IF_IXML_ELEMENT,
L_CATEGORIES type ref to IF_IXML_ELEMENT,
L_SERIES type ref to IF_IXML_ELEMENT,
L_ELEMENT type ref to IF_IXML_ELEMENT,
L_ENCODING type ref to IF_IXML_ENCODING.
P_IXML_DOC = G_IXML->CREATE_DOCUMENT( ).
L_ENCODING = G_IXML->CREATE_ENCODING(
BYTE_ORDER = IF_IXML_ENCODING=>CO_LITTLE_ENDIAN
CHARACTER_SET = 'utf-8' ).
P_IXML_DOC->SET_ENCODING( L_ENCODING ).
L_SIMPLECHARTDATA = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'SimpleChartData' PARENT = P_IXML_DOC ).
L_CATEGORIES = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Categories' PARENT = L_SIMPLECHARTDATA ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'C' PARENT = L_CATEGORIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '1st quarter' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'C' PARENT = L_CATEGORIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '2nd quarter' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'C' PARENT = L_CATEGORIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '3rd quarter' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'C' PARENT = L_CATEGORIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '4th quarter' ).
L_SERIES = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Series' PARENT = L_SIMPLECHARTDATA ).
L_SERIES->SET_ATTRIBUTE( NAME = 'label' VALUE = 'Coffee' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '94' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '110' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '139' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '192' ).
L_SERIES = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Series' PARENT = L_SIMPLECHARTDATA ).
L_SERIES->SET_ATTRIBUTE( NAME = 'label' VALUE = 'Espresso' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '35' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '39' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '38' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'S' PARENT = L_SERIES ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '59' ).
endform. " create_data_demo
*& Form create_custom_demo
text
form CREATE_CUSTOM_DEMO using P_IXML_DOC type ref to IF_IXML_DOCUMENT.
data: L_ROOT type ref to IF_IXML_ELEMENT,
L_GLOBALSETTINGS type ref to IF_IXML_ELEMENT,
L_DEFAULT type ref to IF_IXML_ELEMENT,
L_ELEMENTS type ref to IF_IXML_ELEMENT,
L_CHARTELEMENTS type ref to IF_IXML_ELEMENT,
L_TITLE type ref to IF_IXML_ELEMENT,
L_ELEMENT type ref to IF_IXML_ELEMENT,
L_ENCODING type ref to IF_IXML_ENCODING.
P_IXML_DOC = G_IXML->CREATE_DOCUMENT( ).
L_ENCODING = G_IXML->CREATE_ENCODING(
BYTE_ORDER = IF_IXML_ENCODING=>CO_LITTLE_ENDIAN
CHARACTER_SET = 'utf-8' ).
P_IXML_DOC->SET_ENCODING( L_ENCODING ).
L_ROOT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'SAPChartCustomizing' PARENT = P_IXML_DOC ).
L_ROOT->SET_ATTRIBUTE( NAME = 'version' VALUE = '1.1' ).
L_GLOBALSETTINGS = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'GlobalSettings' PARENT = L_ROOT ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'FileType' PARENT = L_GLOBALSETTINGS ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( 'PNG' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Dimension' PARENT = L_GLOBALSETTINGS ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( 'PseudoThree' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Width' PARENT = L_GLOBALSETTINGS ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '640' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Height' PARENT = L_GLOBALSETTINGS ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( '360' ).
L_DEFAULT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Defaults' PARENT = L_GLOBALSETTINGS ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'FontFamily' PARENT = L_DEFAULT ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( 'Arial' ).
L_ELEMENTS = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Elements' PARENT = L_ROOT ).
L_CHARTELEMENTS = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'ChartElements' PARENT = L_ELEMENTS ).
L_TITLE = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Title' PARENT = L_CHARTELEMENTS ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Extension' PARENT = L_TITLE ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( 'href="sapevent:onclick?Title"' ).
L_ELEMENT = P_IXML_DOC->CREATE_SIMPLE_ELEMENT(
NAME = 'Caption' PARENT = L_TITLE ).
L_ELEMENT->IF_IXML_NODE~SET_VALUE( 'Caffeine Consumption' ).
endform. " create_custom_demo
*& Form toggle_design_mode
text
form TOGGLE_DESIGN_MODE .
data: L_WIN_CHART type ref to CL_GUI_CHART_ENGINE_WIN.
catch system-exceptions MOVE_CAST_ERROR = 1.
L_WIN_CHART ?= G_CE_VIEWER->GET_CONTROL( ).
endcatch.
if SY-SUBRC is initial.
if G_DESIGN_MODE is initial.
G_DESIGN_MODE = 'X'.
else.
G_DESIGN_MODE = ' '.
endif.
L_WIN_CHART->SET_DESIGN_MODE( FLAG = G_DESIGN_MODE EVENT = 'X' ).
L_WIN_CHART->RESTRICT_CHART_TYPES( CHARTTYPES = 'Columns|Lines' ).
L_WIN_CHART->RESTRICT_PROPERTY_EVENTS( EVENTS = 'ChartType' ).
endif.
endform. " toggle_design_mode
*& Form toggle_value_change
text
form TOGGLE_VALUE_CHANGE .
data: L_WIN_CHART type ref to CL_GUI_CHART_ENGINE_WIN.
catch system-exceptions MOVE_CAST_ERROR = 1.
L_WIN_CHART ?= G_CE_VIEWER->GET_CONTROL( ).
endcatch.
if SY-SUBRC is initial.
if G_VALUE_CHANGE is initial.
G_VALUE_CHANGE = 'X'.
L_WIN_CHART->ENABLE_VALUE_CHANGE( ).
else.
G_VALUE_CHANGE = ' '.
L_WIN_CHART->DISABLE_VALUE_CHANGE( ).
endif.
endif.
endform. " toggle_value_change
*& Form save_customizing
text
form SAVE_CUSTOMIZING .
data: L_XML_CUSTOMIZING type W3HTMLTABTYPE,
L_WIN_CHART type ref to CL_GUI_CHART_ENGINE_WIN,
L_FILENAME type STRING,
L_FILEPATH type STRING,
L_FILESIZE type I,
L_PATH type STRING.
catch system-exceptions MOVE_CAST_ERROR = 1.
L_WIN_CHART ?= G_CE_VIEWER->GET_CONTROL( ).
endcatch.
if SY-SUBRC is initial.
L_WIN_CHART->GET_CUSTOMIZING(
importing
DATA_TABLE = L_XML_CUSTOMIZING
describe table L_XML_CUSTOMIZING lines L_FILESIZE.
multiply L_FILESIZE by 255.
L_FILENAME = 'customizing.xml'.
call method CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
exporting
DEFAULT_FILE_NAME = L_FILENAME
changing
FILENAME = L_FILENAME
PATH = L_PATH
FULLPATH = L_FILEPATH.
if not L_FILEPATH is initial.
call method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
exporting
FILETYPE = 'BIN'
FILENAME = L_FILEPATH
BIN_FILESIZE = L_FILESIZE
changing
DATA_TAB = L_XML_CUSTOMIZING
exceptions
FILE_WRITE_ERROR = 1
others = 22.
endif.
endif.
endform. " save_customizing
*& Form print
text
form PRINT .
data: L_WIN_CHART type ref to CL_GUI_CHART_ENGINE_WIN,
L_S_PRINT_PARAMETERS type PRI_PARAMS.
call function 'GET_PRINT_PARAMETERS'
exporting
DESTINATION = 'LOCL'
MODE = 'CURRENT'
NO_DIALOG = ''
importing
OUT_PARAMETERS = L_S_PRINT_PARAMETERS
VALID = L_VALID
exceptions
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
others = 4.
if SY-SUBRC <> 0.
BREAK USCGXS22.
endif.
catch system-exceptions MOVE_CAST_ERROR = 1.
L_WIN_CHART ?= G_CE_VIEWER->GET_CONTROL( ).
endcatch.
if SY-SUBRC is initial.
new-page print on parameters L_S_PRINT_PARAMETERS no dialog.
L_WIN_CHART->PRINT( ).
new-page print off.
endif.
endform. " print
*& Clas lcl_ce_viewer_eh
text
class LCL_CE_VIEWER_EH implementation.
method ON_CLICK.
data: L_MSG type STRING,
L_SERIES type STRING,
L_POINT type STRING.
L_SERIES = SERIES.
L_POINT = POINT.
concatenate 'Element clicked:'(M01) ELEMENT
'Series:'(T01) L_SERIES
'Point:'(T02) L_POINT
into L_MSG separated by SPACE.
message L_MSG type 'S'.
endmethod. "on_click
method ON_VALUE_CHANGE.
data: L_MSG type STRING,
L_SERIES type STRING,
L_POINT type STRING,
L_VALUE type STRING.
L_SERIES = SERIES.
L_POINT = POINT.
L_VALUE = VALUE.
concatenate 'Value changed:'(M02)
'Series:'(T01) L_SERIES
'Point:'(T02) L_POINT
'Value:'(T03) L_VALUE
into L_MSG separated by SPACE.
message L_MSG type 'S'.
endmethod. "on_value_change
method ON_PROPERTY_CHANGE.
data: L_MSG type STRING.
concatenate 'Property changed:'(M03)
'Element:'(T04) ELEMENT
'Name:'(T05) NAME
'Value:'(T03) VALUE
into L_MSG separated by SPACE.
message L_MSG type 'S'.
endmethod. "on_property_change
endclass. "lcl_ce_viewer_eh IMPLEMENTATION
2nd Example:
REPORT zmar_graphics .
This program illustrates a call to SAP Business Graphics. *
Each row in the DATA table contains one text label and a *
single numeric value. *
DATA: BEGIN OF data OCCURS 1,
text(25),
value TYPE p,
END OF data.
DATA: tcol1(5) VALUE '#1991'.
DATA: title(25) VALUE 'Sales'.
SET PF-STATUS 'GRAF'.
data-text = 'Product_1'.
data-value = 153470.
APPEND data.
data-text = 'Product_2'.
data-value = 253150.
APPEND data.
data-text = 'Product_3'.
data-value = 53470.
APPEND data.
data-text = 'Product_4'.
data-value = 182000.
APPEND data.
data-text = 'Product_5'.
data-value = 92410.
APPEND data.
WRITE: / 'Products',22 tcol1.
SKIP 2.
LOOP AT data.
WRITE: / data-text, 12 data-value.
ENDLOOP.
PF11: Put out a 2D graphic *
AT PF11.
CALL FUNCTION 'GRAPH_2D'
EXPORTING
titl = title
TABLES
data = data.
2nd Example:
REPORT zmar_graphics1.
Data for 2D-Modification
DATA: BEGIN OF data OCCURS 1,
text(25),
value TYPE p,
END OF data.
DATA: tcol1(5) VALUE '#1993'.
DATA: title(25) VALUE 'Merchandise 1993'.
DATA: tit2(10) VALUE 'Product'.
DATA: mod_row(5), mod_col(5), mod_val(20).
DATA: m_typ, b_typ, busg_stat.
FIELD-SYMBOLS: .
data-text = 'Refrigerators'.
data-value = 12345.
APPEND data.
data-text = 'Freezers'.
data-value = 22222.
APPEND data.
data-text = 'Ovens'.
data-value = 11111.
APPEND data.
data-text = 'Dishwashers'.
data-value = 54321.
APPEND data.
PERFORM output_2d.
AT PF08.
busg_stat = space. "// start and wait
Event-Loop
DO.
CALL FUNCTION 'GRAPH_2D'
EXPORTING
stat = busg_stat
inform = '7' "// allow modify
mail_allow = 'X' "// allow mail
IMPORTING
m_typ = m_typ
b_typ = b_typ
mod_row = mod_row
mod_col = mod_col
mod_val = mod_val
TABLES
data = data.
busg_stat = '4'. "// Just wait next time
CASE m_typ.
WHEN 'D'. "// Programm ended
EXIT.
WHEN 'I'. "// Valid message
IF b_typ = 'M'. "// Modify-event
READ TABLE data INDEX mod_row.
ASSIGN COMPONENT mod_col OF STRUCTURE data TO = mod_val.
MODIFY data INDEX mod_row.
ENDIF.
IF b_typ = 'S'. "// Select-event (ignored)
ENDIF. "// For element (MOD_ROW-MOD_COL)
ENDCASE.
ENDDO.
PERFORM output_2d.
FORM OUTPUT_2D (Show the actual data)
FORM output_2d.
WRITE: / 'Products',22 tcol1.
SKIP 2.
LOOP AT data.
WRITE: / data-text, 22 data-value.
ENDLOOP.
ENDFORM.
3rd Example:
REPORT zmar_graphics3.
DATA: BEGIN OF hpgl OCCURS 1,
entry(128),
END OF hpgl.
hpgl = 'SP6;PUPA0,0;'. APPEND hpgl.
hpgl = 'PDPA100,100,100,200,200,200,200,100,100,100;'. APPEND hpgl.
hpgl = 'SP1;PUPA100,150;'. APPEND hpgl.
hpgl = 'PDPA100,150,150,200,200,150,150,100,100,150;'. APPEND hpgl.
CALL FUNCTION 'GRAPH_HPGL'
TABLES
data = hpgl.
4th Example:
REPORT zmar_graphics4.
DATA: BEGIN OF objt OCCURS 1. "// Object Attributes
INCLUDE STRUCTURE gpoobjt.
DATA: END OF objt.
DATA: BEGIN OF area_tab OCCURS 1. "// Areas (unused)
INCLUDE STRUCTURE gpoarea.
DATA: END OF area_tab.
DATA: BEGIN OF col_text OCCURS 1, "// Value columns
c(40),
END OF col_text.
DATA: BEGIN OF values OCCURS 1, "// Object fields
p1 TYPE p,
p2 TYPE p,
p3 TYPE p,
p4 TYPE p,
p5 TYPE p,
p6 TYPE p,
p7 TYPE p,
p8 TYPE p,
p9 TYPE p,
END OF values.
DATA: BEGIN OF axis OCCURS 4.
INCLUDE STRUCTURE gpoaxis.
DATA: END OF axis.
DATA save LIKE sy-tabix.
SET PF-STATUS 'GRAF'.
Constraints: Number of VALUES rows == Number of OBJT rows
: Num of VALUES columns == Number of COL_TEXT rows
Column title for $OBJD::VALTIT
col_text = '% Market share'. APPEND col_text.
col_text = '% Growth'. APPEND col_text.
col_text = 'Sales'. APPEND col_text.
col_text = 'Market share trend'. APPEND col_text.
col_text = 'Growth trend'. APPEND col_text.
col_text = 'Fixed costs'. APPEND col_text.
col_text = 'Overhead costs'. APPEND col_text.
col_text = 'Admin. costs'. APPEND col_text.
col_text = 'Estimated profits'. APPEND col_text.
Attributes for $AXIS
axis-pos = 'RIGHT'.
axis-backclr = 'DARKGRAY'.
axis-textclr = 'WHITE'.
axis-scalclr = 'WHITE'.
axis-shadow = 'N'.
axis-ticks = '50'.
axis-start = '0'.
axis-end = '100'.
APPEND axis.
axis-pos = 'TOP'.
axis-backclr = 'DARKGRAY'.
axis-textclr = 'WHITE'.
axis-scalclr = 'WHITE'.
axis-shadow = space.
axis-ticks = '50'.
axis-start = '0'.
axis-end = '100'.
APPEND axis.
axis-pos = 'LEFT'.
axis-backclr = 'DARKGRAY'.
axis-textclr = 'WHITE'.
axis-scalclr = 'WHITE'.
axis-shadow = 'N'.
axis-ticks = '10'.
axis-start = '0'.
axis-end = '100'.
APPEND axis.
axis-pos = 'BOTTOM'.
axis-backclr = 'DARKGRAY'.
axis-textclr = 'WHITE'.
axis-scalclr = 'WHITE'.
axis-shadow = 'N'.
axis-ticks = '50'.
axis-start = '0'.
axis-end = '100'.
APPEND axis.
Objects
*BJT-LINECLR = 'WHITE'.
1. Trend line
objt-form = 'RECTANGLE'.
objt-fillclr = 'YELLOW'.
objt-textclr = 'BLUE'.
objt-title = 'Clarion 1990'.
objt-info = 'Sales in 1990'.
values-p1 = 10.
values-p2 = 20.
values-p3 = 10000.
values-p4 = 22.
values-p5 = 22.
values-p6 = 400.
values-p7 = 300.
values-p8 = 200.
values-p9 = 100.
APPEND objt.
APPEND values.
objt-form = 'RECTANGLE'.
objt-fillclr = 'YELLOW'.
objt-textclr = 'BLUE'.
objt-title = 'Clarion 1991'.
objt-info = 'Sales in 1991'.
values-p1 = 22.
values-p2 = 22.
values-p3 = 15000.
values-p4 = 45.
values-p5 = 35.
values-p6 = 100.
values-p7 = 200.
values-p8 = 300.
values-p9 = 400.
APPEND objt.
APPEND values.
objt-form = 'RECTANGLE'.
objt-fillclr = 'YELLOW'.
objt-textclr = 'BLUE'.
objt-title = 'Clarion 1992'.
objt-info = 'Sales in 1992'.
values-p1 = 45.
values-p2 = 35.
values-p3 = 22000.
values-p4 = 62.
values-p5 = 33.
values-p6 = 20.
values-p7 = 40.
values-p8 = 80.
values-p9 = 160.
APPEND objt.
APPEND values.
objt-form = 'RECTANGLE'.
objt-fillclr = 'YELLOW'.
objt-textclr = 'BLUE'.
objt-title = 'Clarion 1993'.
objt-info = 'Sales in 1993'.
values-p1 = 62.
values-p2 = 33.
values-p3 = 12000.
values-p4 = 62.
values-p5 = 33.
values-p6 = 600.
values-p7 = 700.
values-p8 = 600.
values-p9 = 700.
APPEND objt.
APPEND values.
2. Trend line
objt-form = 'CIRCLE'.
objt-fillclr = 'GREEN'.
objt-textclr = 'BLUE'.
objt-title = 'Sony 1988'.
objt-info = 'Sony UX400/CD, Sales in 1988'.
values-p1 = 2.
values-p2 = 50.
values-p3 = 2500.
values-p4 = 26.
values-p5 = 57.
values-p6 = 100.
values-p7 = 700.
values-p8 = 20.
values-p9 = 50.
APPEND objt.
APPEND values.
objt-form = 'CIRCLE'.
objt-fillclr = 'GREEN'.
objt-textclr = 'BLUE'.
objt-title = 'Sony 1989'.
objt-info = 'Sony UX400/CD, Sales in 1989'.
values-p1 = 26.
values-p2 = 57.
values-p3 = 3500.
values-p4 = 58.
values-p5 = 70.
values-p6 = 100.
values-p7 = 600.
values-p8 = 20.
values-p9 = 70.
APPEND objt.
APPEND values.
objt-form = 'CIRCLE'.
objt-fillclr = 'GREEN'.
objt-textclr = 'BLUE'.
objt-title = 'Sony 1990'.
objt-info = 'Sony UX400/CD, Sales in 1990'.
values-p1 = 58.
values-p2 = 70.
values-p3 = 11000.
values-p4 = 79.
values-p5 = 68.
values-p6 = 100.
values-p7 = 500.
values-p8 = 25.
values-p9 = 90.
APPEND objt.
APPEND values.
objt-form = 'CIRCLE'.
objt-fillclr = 'GREEN'.
objt-textclr = 'BLUE'.
objt-title = 'Sony 1991'.
objt-info = 'Sony UX400/CD, Sales 1991'.
values-p1 = 79.
values-p2 = 68.
values-p3 = 13000.
values-p4 = 87.
values-p5 = 54.
values-p6 = 100.
values-p7 = 430.
values-p8 = 45.
values-p9 = 120.
APPEND objt.
APPEND values.
objt-form = 'CIRCLE'.
objt-fillclr = 'GREEN'.
objt-textclr = 'BLUE'.
objt-title = 'Sony 1992'.
objt-info = 'Sony UX400/CD, Sales in 1992'.
values-p1 = 87.
values-p2 = 54.
values-p3 = 13500.
values-p4 = 80.
values-p5 = 34.
values-p6 = 90.
values-p7 = 390.
values-p8 = 44.
values-p9 = 150.
APPEND objt.
APPEND values.
objt-form = 'CIRCLE'.
objt-fillclr = 'GREEN'.
objt-textclr = 'BLUE'.
objt-title = 'Sony 1993'.
objt-info = 'Sony UX400/CD, Sales in 1993'.
values-p1 = 80.
values-p2 = 34.
values-p3 = 23000.
values-p4 = 80. "// Line to itself
values-p5 = 34.
values-p6 = 90.
values-p7 = 370.
values-p8 = 47.
values-p9 = 165.
APPEND objt.
APPEND values.
area_tab-form = 'RECTANGLE'.
area_tab-fillclr = 'RED'.
area_tab-xfrom = '10'.
area_tab-yfrom = '70'.
area_tab-xto = '40'.
area_tab-yto = '90'.
area_tab-title = 'Winner takes all'.
APPEND area_tab.
LOOP AT objt.
WRITE: / objt-title(20).
save = sy-tabix.
READ TABLE values INDEX save.
WRITE 25 values-p3.
ENDLOOP.
AT PF11.
CALL FUNCTION 'GRAPH_PORT'
EXPORTING
title_title = 'Trend-Portfolio for Sony and Clarion Radio'
title_info = 'The two objects over several years'
title_textclr = 'YELLOW'
title_backclr = 'DARKGRAY'
title_size = '2'
frm_backclr = 'GRAY'
frm_cordclr = 'WHITE'
frm_scalclr = 'WHITE'
frm_scalmod = 'LONGDASH'
frm_gridx = '10'
frm_gridy = '10'
frm_shadow = 'X'
obj_xval = '0'
obj_yval = '1'
obj_sval = '2'
obj_xarr = '3'
obj_yarr = '4'
TABLES
axis = axis
col_text = col_text
objt = objt
values = values
area_tab = area_tab.[/code]
Reward if usefull -
Graphical representation of standard SAP reports
Hi,
Can we get graphical representation of Standard SAP CO Reports? Is there any setting that has to be activated to get these? We are using FI, CO & MM.
Regards,
SangeetaDear Sangeeta,
This refered report is prepared through report painter. Transaction code GRR1-2-3. Graphical representation facility is available only in drilldown reporting which was used in FI module but not in CO.e.g. to see & modify GL related repots transaction code is FSI2.Where in you can go to output type tab & you will find the option.
As your query is relating to CO you can try transaction code GR11where you design the layout for report painter reports.This might help you.
Else if your requirement is such that you want each details through graphycal representation you can use report interface which will direct to graphycaly represented report.
Regards,
Abhijit -
List of Standard QM reports with Graphical Representation
Dear Users
Does any one have the list of Standard Quality Module Reports which have Graphical Representations also.
Regards
SAMUse T.codes QM10 To QM15 transaction codes.
If you want to know more about QM reports
Goto SAP easy access-->Information Systems -->Logistics -->Quality management
here you will get list of standard reports
Edited by: Sridhar Jayavarapu on Apr 2, 2009 8:42 AM -
Graphical Representation in Abap
Hi Abappers,
How to show Graphical Representation in Abap.If is possible plz send by showing examples.
Regards,
vani.Hi,
The following FM's are used to create graphs in SAP...
You can execute them and check the paramters to be passed
BUSG SAP Business Graphics
GRAPH_2D Calling up the 2D business graphics
GRAPH_2D_MENUE DO NOT USE (use 'GRAPH_2D' and 'GRAPH_BUSG_MENU_SET')
GRAPH_3D Calling up the 3D presentation graphics
GRAPH_BUSG_COLOR_SET Definition of color pallets for business graphics
GRAPH_BUSG_MENU_SET Pushbutton menu (tool bar) for all BUSG modules
GRAPH_MATRIX Calling up SAP Business Graphics (2D, 3D and 4D)
GRAPH_MATRIX_2D Calling up the 2D graphics (user-friendly version)
GRAPH_MATRIX_3D Structure of 3D graphics (user-friendly version)
GRAPH_MATRIX_4D Calling up a 3D graphic (4th dimension stacked representation)
Regards
Sk -
Graphical representation for ME1P
Hi
I need to create a line graph between date and price of a material using transaction ME1P.
For this i need to add a button on the application toolbar (PF Status) for choosing graphical representation and then display the result as a graph.
Are their any screen exits or enhancement points for this?hi
I am using transaction ME1P. MY requirement is that on executing this transaction, the data i get as output i need to download that into an excel file on the applicatin server. When I open the excel file, I should automatically get a graph between date and price.
Downloading the data is possible through GUI_DOWNLOAD FM.
How can i make the excel automatically show the data in graphical form? -
Org Management graphical representation
Hi
I am trying to create org structure using expert mode method. created the realtionship to department wise position wise. But i am not able to view the graphical structure of the org chart.
I have checked with my seniors as well. They are also unable to resolve the issue. I am not getting any error message but when i click on graphical view method. it automatically logsoff from the SAP.Hi Rashee,
Use transction code PPOS _old _display then select the infotype you want to see graphically and click on graph (which is on top of your screen in Tool bar). You will get the graphical representation. -
Hi Experts,
I have a discrete manufacturing scenario. What are the transactions in which I will be able to see the graphical representations of the production orders? Also, is the MF50 transaction limited only to the repetitive manufacturing scenario?
Regards,
SachinHi,
Not sure if my interpretation of your query is correct, but if you want to do capacity leveling, then
Work Center View
CM21 (planning table - graphical)
CM22 (planning table - tabular)
Individual Capacity View
CM27 (planning table - graphical)
CM28 (planning table - tabular)
Order View
CM31 (planning table - graphical)
CM23 (planning table - tabular)
Also you may use CM25 - online & CM40 for background.
Check if the above meets your need.
Regards,
Vivek -
Print Graphical Representation of Binary Search Tree
I need to print out a graphical representation of a binary search tree. Here is the source code I'm working with but it doesn't display the children correctly sometimes, especially with large trees.
Stack globalStack = new Stack();
globalStack.push(root);
int nBlanks = 32;
boolean isRowEmpty = false;
System.out.println("************************************************");
while (isRowEmpty == false) {
Stack localStack = new Stack();
isRowEmpty =true;
for (int i=0; i < nBlanks; i ++);
System.out.print(' ');
while (globalStack.isEmpty()==false) {
Node temp = (Node)globalStack.pop();
if (temp != null) {
System.out.print(temp.data);
localStack.push(temp.leftChild);
localStack.push(temp.rightChild);
if (temp.leftChild != null || temp.rightChild != null)
isRowEmpty = false;
} else {
System.out.print(" -- ");
localStack.push(null);
localStack.push(null);
for (int i = 0 ; i < nBlanks*2-2; i++)
System.out.print(' ');
} //end while loop isEmpty is false
System.out.println();
nBlanks /= 2;
while (localStack.isEmpty()==false)
globalStack.push (localStack.pop());
}//end while loop isRowEmpty is false
System.out.println("************************************************");
Here is an example (here the bottom children aren't aligned correctly)
4
3 20
-- -- 11 23
-- -- -- -- -- 15 -- --Well, using System.out is not really the best way for a Graphical representation...
May be java.awt.Graphics would be far better, both for the programmer and the user of your application. And please use tags when you post code, - makes it readable. -
Graphical representation of Cisco Agent Desktop info
I have a weird request of me. Someone want to have a more graphical representation of the real-time data on their Cisco Agent Desktop. I don;t know where to begin to be honest.
Does anyone know of third party plug-in or something that I can be pointed to?
Thanks!Assuming this is UCCX, with version 10 you will get CUIC real time reporting, which might solve the problem.
Chris -
Graphics controller not functional
Hi, my computer wont start up all i get is a blank screen, but apparantly the caps and num lights flash a code which mine does. I get 4 flashes which according to the hp website is a Graphics controller not functional. Does anyone know what could be causing this or had this problem. I really wont to just be able to fix it without the hassle of going through Hp.
Any help appreciated
Thanks
This question was solved.
View Solution.Try removing the hard disk and then starting up the PC. That way we can isolate the issue. If you make it to the BIOS screen then you hard drive might be faulty, not your motherboard
****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
2015 Microsoft MVP - Windows Experience Consumer -
Graphical representation order progress
Hi
where i can get graphical representation of prodcution order progress........Hi,
After Executing in MD4C go to Menu -
> LIst -
> Graphic.
So you will be able to have graphical view of the same.
Hope this helps.
Regards,
Tejas -
Very urgent - Usage of IsError function in HFR
Hi All,
Its very urgent requirement for us.
How can we use the is error function in HFR.bcoz if the both values in formula ex: a/b ; a=0,b=0; then it shows some garbage value.i came to know we can achieve that
by using iserror function.but i dnt know how use it.
Thanks,
RaviHi
It can be done in this way using IfThen condition
IfThen(IsErr((reference row/column),0,(reference row/column))
where IfThen checks the condition
Condition is IsErr, it returns true when reference formula row/column,has #error value, so you many assign 0 (or whatever value you want) else returns actual calulated value from formula row/column,.
PS: Only formula rows and columns can result in #error.
Cheers
Vikas Naidu -
Displaying graphical representation of data in hash tables as bar chart?
I want to be able to display results in my hash table as a bar chart i don't know how to do it could someone help me I've looked through tutorials couldn't find any information that actually helped.
In my program it doesnt allow matching the capital and small letters
so for instance if I already have Mike it allows for me to input mike in again so there are 2 Mikes.
I also want to do a simple user interface the tutorial for it is not simple to understand could any one tell me how to create a simple user interface like putting a button into a place wher i want it to be.
im not asking anyone to do it for me i just want people to show me how to do it
thank you
Edited by: Tek_Hedef on Dec 1, 2007 4:30 AMThanks for the ideas pal but I did have a go at it but my bit of code is making it crash but i removed it now so here's what I have so far
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
class StudentDetails extends JFrame implements ActionListener
private JTextField StudentNameTxt, StudentMarkTxt;
private JButton DeleteStudentDetailsBtn, DisplayAllStudentsBtn, SearchStudentBtn, FailedStudentsBtn, PassedStudentsBtn, DistinctionStudentsBtn, AddStudentDetailsBtn, ExitBtn;
private JPanel DisplayStudentDetailsPnl;
private JLabel StudentNameLbl, StudentMarkLbl;
private JTextArea DisplayResultsTxt;
private Hashtable StudentDetailsTbl;
private String StudentName, StudentMark;
public static void main(String[] args)
StudentDetails frame = new StudentDetails();
frame.setSize(600,600);
frame.createGUI();
frame.setVisible(true);
public void display(JPanel DisplayStudentDetailsPnl)
Graphics paper = DisplayStudentDetailsPnl.getGraphics();
paper.setColor(Color.white);
paper.fillRect(0, 0, 500, 500);
paper.setColor(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255) ));
private void createGUI()
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container window = getContentPane();
window.setLayout(new FlowLayout());
StudentDetailsTbl = new Hashtable();
StudentNameLbl = new JLabel("Student Name");
window.add(StudentNameLbl);
StudentNameTxt = new JTextField(15);
window.add(StudentNameTxt);
StudentMarkLbl = new JLabel("Student Mark");
window.add(StudentMarkLbl);
StudentMarkTxt = new JTextField(3);
window.add(StudentMarkTxt);
AddStudentDetailsBtn = new JButton("Add Student and Mark");
window.add(AddStudentDetailsBtn);
AddStudentDetailsBtn.addActionListener(this);
DeleteStudentDetailsBtn = new JButton("Delete Student");
window.add(DeleteStudentDetailsBtn);
DeleteStudentDetailsBtn.addActionListener(this);
DisplayAllStudentsBtn = new JButton("Display all Students and Marks");
window.add(DisplayAllStudentsBtn);
DisplayAllStudentsBtn.addActionListener(this);
SearchStudentBtn = new JButton("Search Student");
window.add(SearchStudentBtn);
SearchStudentBtn.addActionListener(this);
FailedStudentsBtn = new JButton("Students which Failed");
window.add(FailedStudentsBtn);
FailedStudentsBtn.addActionListener(this);
PassedStudentsBtn = new JButton("Students which Passed");
window.add(PassedStudentsBtn);
PassedStudentsBtn.addActionListener(this);
DistinctionStudentsBtn = new JButton("Students with Distinction");
window.add(DistinctionStudentsBtn);
DistinctionStudentsBtn.addActionListener(this);
ExitBtn = new JButton("Exit");
window.add(ExitBtn);
ExitBtn.addActionListener(this);
DisplayResultsTxt = new JTextArea();
DisplayResultsTxt.setPreferredSize(new Dimension(200, 200));
DisplayResultsTxt.setBackground(Color.white);
window.add(DisplayResultsTxt);
DisplayResultsTxt.enable(false);
public void actionPerformed (ActionEvent e)
if (e.getSource()== AddStudentDetailsBtn)
StudentName = StudentNameTxt.getText();
StudentMark = StudentMarkTxt.getText();
DisplayResultsTxt.setText("");
StudentDetailsTbl.put(StudentName, StudentMark);
Enumeration enumStudentName = StudentDetailsTbl.keys();
Enumeration enumStudentMark = StudentDetailsTbl.elements();
String[] keys = (String[]) StudentDetailsTbl.keySet().toArray(new String[0]);
Arrays.sort(keys);
for (String key : keys)
DisplayResultsTxt.append(key + " : " + StudentDetailsTbl.get(key)+ "\n");
StudentNameTxt.setText("");
StudentMarkTxt.setText("");
if (e.getSource() == DeleteStudentDetailsBtn )
if (StudentDetailsTbl.containsKey(StudentNameTxt.getText().trim()))
DisplayResultsTxt.setText("");
String txt = StudentNameTxt.getText();
Enumeration enumStudentName = StudentDetailsTbl.keys() ;
String currentelement = (String)enumStudentName.nextElement();
StudentDetailsTbl.remove(txt);
DisplayResultsTxt.append(txt + " has been deleted");
if (e.getSource() == SearchStudentBtn)
if (StudentDetailsTbl.containsKey(StudentNameTxt.getText().trim()))
String txt = StudentNameTxt.getText();
String result;
DisplayResultsTxt.setText("");
Enumeration enumStudentName = StudentDetailsTbl.keys();
Enumeration enumStudentMark = StudentDetailsTbl.elements();
while (enumStudentName.hasMoreElements())
String currentelement = (String)enumStudentName.nextElement();
result = (StudentDetailsTbl.get(currentelement).toString());
if (txt.equals(currentelement))
DisplayResultsTxt.append(currentelement + " " + result);
else JOptionPane.showMessageDialog(null, "Student Name could not be identified");
if (e.getSource() == DisplayAllStudentsBtn)
DisplayResultsTxt.setText("");
Enumeration enumStudentName = StudentDetailsTbl.keys();
Enumeration enumStudentMark = StudentDetailsTbl.elements();
while (enumStudentName.hasMoreElements())
DisplayResultsTxt.append(enumStudentName.nextElement()+ " " + enumStudentMark.nextElement()+ "\n");
if (e.getSource() == PassedStudentsBtn)
DisplayResultsTxt.setText("");
Enumeration enumStudentName = StudentDetailsTbl.keys();
Enumeration enumStudentMark = StudentDetailsTbl.elements();
while (enumStudentName.hasMoreElements())
int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
String Name = (String)enumStudentName.nextElement();
if (Mark >=40)
DisplayResultsTxt.append(Name + " " + Mark + "\n");
if (e.getSource() == FailedStudentsBtn)
DisplayResultsTxt.setText("");
Enumeration enumStudentName = StudentDetailsTbl.keys();
Enumeration enumStudentMark = StudentDetailsTbl.elements();
while (enumStudentName.hasMoreElements())
int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
String Name = (String)enumStudentName.nextElement();
if (Mark <40)
DisplayResultsTxt.append(Name + " " + Mark + "\n");
if (e.getSource() == DistinctionStudentsBtn)
DisplayResultsTxt.setText("");
Enumeration enumStudentName = StudentDetailsTbl.keys();
Enumeration enumStudentMark = StudentDetailsTbl.elements();
while (enumStudentName.hasMoreElements())
int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
String Name = (String)enumStudentName.nextElement();
if (Mark >=75)
DisplayResultsTxt.append(Name + " " + Mark + "\n");
} -
Urgent help for table function
I Have a table tab1
SQL> select * from tab1;
A B C
maqdoom 12 syed
aamer 323 army
king 343 khan
keerthi 52 kaat
I Have created an Object
CREATE TYPE object_row_type AS OBJECT1 (
name VARCHAR2(30),
lname VARCHAR2(18))
CREATE TYPE object_table_type1 AS TABLE OF object_row_type1;
I write a function such a way that
when we enter a trackinnumber it return the whole record with respective the query
CREATE OR REPLACE FUNCTION test1 (trackingnumber IN NUMBER)
RETURN object_table_type1
IS
--tracking_num NUMBER (10);
v_tab object_table_type1 := object_table_type1 ();
BEGIN
FOR cur IN (SELECT a AS NAME, c AS LNAME
FROM TAB1
WHERE b=trackingnumber)
LOOP
v_tab.EXTEND;
v_tab(v_tab.LAST) :=object_row_type1(cur.name,cur.lname);
end loop;
RETURN v_tab;
END;
every thing runs fine
But
Can an one show me
1. how to handle an exception ... when someone enters a wrong tracking number I should get some message displaying that 'its a wrong tracking number'.
thank youSQL> CREATE TYPE object_row_type AS OBJECT(
2 name VARCHAR2(30),
3 lname VARCHAR2(18));
4 /
Type created.
SQL> CREATE TYPE object_table_type AS TABLE OF object_row_type;
2
3 /
Type created.
SQL> select * from test;
A B C
maqdoom 12 syed
aamer 323 army
king 343 khan
keerthi 52 kaat
SQL> CREATE OR REPLACE FUNCTION f1 (trackingnumber IN NUMBER)
2 RETURN object_table_type
3 IS
4 cnt number := 0;
5 v_tab object_table_type := object_table_type ();
6 BEGIN
7 FOR cur IN (SELECT a AS NAME, c AS LNAME
8 FROM test
9 WHERE b=trackingnumber)
10 LOOP
11 cnt := 1;
12 v_tab.EXTEND;
13 v_tab(v_tab.LAST) :=object_row_type(cur.name,cur.lname);
14 end loop;
15 if cnt = 0 then
16 dbms_output.put_line('No data!');
17 end if;
18 RETURN v_tab;
19 END;
20 /
Function created.
SQL> set serverout on
SQL> declare
2 a object_table_type;
3 begin
4 a := f1(12);
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 a object_table_type;
3 begin
4 a := f1(1);
5* end;
SQL> /
No data!
PL/SQL procedure successfully completed.
<br>
<br>
But you can use BULK COLLECT here..
Try it yourself..
Maybe you are looking for
-
My Firefox automatically updated to Firefox 8. Since doing so, when I open the browser the screen displays a box saying 'Unable to connect' and says the same for any website. My internet connection is fine. I uninstalled and installed Firefox again,
-
Excise capture in S TO of Custom bonded warehouse
hi all, i have created a bonded ware house plant and transferring the material from the bonded warehouse to other plant by the following way. ME21N - Create STO (in Main Plant, Supplying Plant as Bonded Warehouse Plant) Here in this PO, maintain all
-
Tab control only allows two page selections
I am having a hard time understanding why my VI only allows two specific tab clicks every time I run it. Should I be using shift registers with the "initializing" Tab Controls on the left of the VI before it enters the loop? No matter what I do, it w
-
Function module: cube partitioning
Hi, I have one big cube that should be split into smaller cubes. Each year ("Posting Date" InfoObject) will get one cube. So I have my DataSource, InfoSource, update rule, big cube. It's a 3.x data flow. Is it possible to write a function module (and
-
Maximum line display in reports ex : Normal or ALV.
Hi , I like to know maximum lines display in reports normal classsical or ALV report .Can any one let me know . regards, veera