Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Bar chart in abap.

Former Member
0 Kudos

Hi all,

I have a requirement where in the out put needs to shown in bar charts. Please let me know if any worked on this.. please provide the sample code.

Thanks

Raju

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi

hope this will help you.

Reward if help.

To Create a Bar code prefix:

1) Go to T-code - SPAD -> Full Administration -> Click on Device Type -> Double click the device for which you wish to create the print control -> Click on Print Control tab ->Click on change mode -> Click the plus sign to add a row or prefix say SBP99 (Prefix must start with SBP) -> save you changes , it will ask for request -> create request and save

2) Now when you go to SE73 if you enter SBP00 for you device it will add the newly created Prefix

Create a character format C1.Assign a barcode to the character format.Check the check box for the barcode.

The place where you are using the field value use like this

<C1> &itab-field& </C1>.

You will get the field value in the form of barcode.

Which barcode printer are you using ? Can you download this file and see.

http://www.servopack.de/Files/HB/ZPLcommands.pdf.

It will give an idea about barcode commands.

Check this link:

http://www.sap-img.com/abap/questions-about-bar-code-printing-in-sap.htm

Check this link:

http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a94c851ea11d189570000e829fbbd/content.htm

Hope this link ll be useful..

http://help.sap.com/saphelp_nw04/helpdata/en/66/1b45c136639542a83663072a74a21c/content.htm

go through these links and cose u r previous threads,

http://www.sap-img.com/abap/questions-about-bar-code-printing-in-sap.htm

http://www.erpgenie.com/abap/smartforms.htm

http://sap.ittoolbox.com/groups/technical-functional/sap-basis/print-barcode-with-smartform-634396

http://sap.ittoolbox.com/groups/technical-functional/sap-dev/printing-barcode-733550

Detailed information about SAP Barcodes

A barcode solution consists of the following:

- a barcode printer

- a barcode reader

- a mobile data collection application/program

A barcode label is a special symbology to represent human readable information such as a material number or batch number

in machine readable format.

There are different symbologies for different applications and different industries. Luckily, you need not worry to much about that as the logistics supply chain has mostly standardized on 3 of 9 and 128 barcode symbologies - which all barcode readers support and which SAP support natively in it's printing protocols.

You can print barcodes from SAP by modifying an existing output form.

Behind every output form is a print program that collects all the data and then pass it to the form. The form contains the layout as well as the font, line and paragraph formats. These forms are designed using SAPScript (a very easy but frustratingly simplistic form format language) or SmartForms that is more of a graphical form design tool.

Barcodes are nothing more than a font definition and is part of the style sheet associated with a particular SAPScript form. The most important aspect is to place a parameter in the line of the form that points to the data element that you want to represent as barcode on the form, i.e. material number. Next you need to set the font for that parameter value to one of the supported barcode symbologies.

7 REPLIES 7

Former Member
0 Kudos

use FM :

GRAPH_MATRIX_3D or

GRAPH_MATRIX_2D

sample code:

DATA: BEGIN OF ITAB_DATA OCCURS 0,

DATANAME(15),

QUANTITY1 TYPE I,

QUANTITY2 TYPE I,

QUANTITY3 TYPE I,

END OF ITAB_DATA,

BEGIN OF ITAB_OPTIONS OCCURS 0,

OPTION(20),

END OF ITAB_OPTIONS.

ITAB_DATA-DATANAME = 'Electricity'.

ITAB_DATA-QUANTITY1 = 55.

ITAB_DATA-QUANTITY2 = 62.

ITAB_DATA-QUANTITY3 = 59.

APPEND ITAB_DATA.

ITAB_DATA-DATANAME = 'Gas'.

ITAB_DATA-QUANTITY1 = 35.

ITAB_DATA-QUANTITY2 = 52.

ITAB_DATA-QUANTITY3 = 44.

APPEND ITAB_DATA.

ITAB_DATA-DATANAME = 'Water'.

ITAB_DATA-QUANTITY1 = 18.

ITAB_DATA-QUANTITY2 = 22.

ITAB_DATA-QUANTITY3 = 19.

APPEND ITAB_DATA.

CALL FUNCTION 'GRAPH_MATRIX_3D'

EXPORTING

COL1 = 'Jan'

COL2 = 'Feb'

COL3 = 'Mar'

TITL = 'Utility Expenses in US$.'

TABLES

DATA = ITAB_DATA

OPTS = ITAB_OPTIONS

EXCEPTIONS

OTHERS = 1.

Edited by: Srinivas Gurram Reddy on Mar 7, 2008 4:55 PM

Former Member
0 Kudos

hi

hope this will help you.

Reward if help.

To Create a Bar code prefix:

1) Go to T-code - SPAD -> Full Administration -> Click on Device Type -> Double click the device for which you wish to create the print control -> Click on Print Control tab ->Click on change mode -> Click the plus sign to add a row or prefix say SBP99 (Prefix must start with SBP) -> save you changes , it will ask for request -> create request and save

2) Now when you go to SE73 if you enter SBP00 for you device it will add the newly created Prefix

Create a character format C1.Assign a barcode to the character format.Check the check box for the barcode.

The place where you are using the field value use like this

<C1> &itab-field& </C1>.

You will get the field value in the form of barcode.

Which barcode printer are you using ? Can you download this file and see.

http://www.servopack.de/Files/HB/ZPLcommands.pdf.

It will give an idea about barcode commands.

Check this link:

http://www.sap-img.com/abap/questions-about-bar-code-printing-in-sap.htm

Check this link:

http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a94c851ea11d189570000e829fbbd/content.htm

Hope this link ll be useful..

http://help.sap.com/saphelp_nw04/helpdata/en/66/1b45c136639542a83663072a74a21c/content.htm

go through these links and cose u r previous threads,

http://www.sap-img.com/abap/questions-about-bar-code-printing-in-sap.htm

http://www.erpgenie.com/abap/smartforms.htm

http://sap.ittoolbox.com/groups/technical-functional/sap-basis/print-barcode-with-smartform-634396

http://sap.ittoolbox.com/groups/technical-functional/sap-dev/printing-barcode-733550

Detailed information about SAP Barcodes

A barcode solution consists of the following:

- a barcode printer

- a barcode reader

- a mobile data collection application/program

A barcode label is a special symbology to represent human readable information such as a material number or batch number

in machine readable format.

There are different symbologies for different applications and different industries. Luckily, you need not worry to much about that as the logistics supply chain has mostly standardized on 3 of 9 and 128 barcode symbologies - which all barcode readers support and which SAP support natively in it's printing protocols.

You can print barcodes from SAP by modifying an existing output form.

Behind every output form is a print program that collects all the data and then pass it to the form. The form contains the layout as well as the font, line and paragraph formats. These forms are designed using SAPScript (a very easy but frustratingly simplistic form format language) or SmartForms that is more of a graphical form design tool.

Barcodes are nothing more than a font definition and is part of the style sheet associated with a particular SAPScript form. The most important aspect is to place a parameter in the line of the form that points to the data element that you want to represent as barcode on the form, i.e. material number. Next you need to set the font for that parameter value to one of the supported barcode symbologies.

0 Kudos

Hi,

Thanks for response. But I am not working with bar codes.. I need to give the output in bar graph... like v see bar graph in xls or lotus123....

Thanks

Venkat

0 Kudos

Hi,

Copy paste below code and check if it is usefull for u. U can change some parameters as per your requirement. Check FM documentation.

REPORT ztest.

TYPES: BEGIN OF t_data,

class(20) TYPE c,

value1 TYPE i,

value2 TYPE i,

value3 TYPE i,

value4 TYPE i,

value5 TYPE i,

value6 TYPE i,

END OF t_data,

BEGIN OF t_opts,

value(20) TYPE c,

END OF t_opts.

DATA: i_data TYPE STANDARD TABLE OF t_data,

i_opts TYPE STANDARD TABLE OF t_opts,

wa_data TYPE t_data,

wa_opts TYPE t_opts.

*----


*Selection Screen

*----


SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-s01.

SELECTION-SCREEN BEGIN OF BLOCK sub1 WITH FRAME TITLE text-s02.

PARAMETERS: po_1 AS CHECKBOX USER-COMMAND ucomm DEFAULT 'X',

po_c2008(15) TYPE c,

po_c2007(15) TYPE c,

po_c2006(15) TYPE c,

po_c2005(15) TYPE c,

po_c2004(15) TYPE c,

po_c2003(15) TYPE c.

SELECTION-SCREEN END OF BLOCK sub1.

SELECTION-SCREEN BEGIN OF BLOCK sub2 WITH FRAME TITLE text-s03.

PARAMETERS: po_2 AS CHECKBOX USER-COMMAND ucomm DEFAULT 'X',

po_s2008(15) TYPE c,

po_s2007(15) TYPE c,

po_s2006(15) TYPE c,

po_s2005(15) TYPE c,

po_s2004(15) TYPE c,

po_s2003(15) TYPE c.

SELECTION-SCREEN END OF BLOCK sub2.

SELECTION-SCREEN BEGIN OF BLOCK sub3 WITH FRAME TITLE text-s04.

PARAMETERS: po_3 AS CHECKBOX USER-COMMAND ucomm DEFAULT 'X',

po_f2008(15) TYPE c,

po_f2007(15) TYPE c,

po_f2006(15) TYPE c,

po_f2005(15) TYPE c,

po_f2004(15) TYPE c,

po_f2003(15) TYPE c.

SELECTION-SCREEN END OF BLOCK sub3.

SELECTION-SCREEN END OF BLOCK main.

AT SELECTION-SCREEN ON po_1.

IF po_1 IS INITIAL.

LOOP AT SCREEN.

CHECK screen-name EQ 'PO_C2008'

OR screen-name EQ 'PO_C2007'

OR screen-name EQ 'PO_C2006'

OR screen-name EQ 'PO_C2005'

OR screen-name EQ 'PO_C2004'

OR screen-name EQ 'PO_C2003'.

screen-active = 0.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

START-OF-SELECTION.

IF NOT po_1 IS INITIAL.

CLEAR: wa_data.

MOVE: ' Test1' TO wa_data-class,

po_c2008 TO wa_data-value1,

po_c2007 TO wa_data-value2,

po_c2006 TO wa_data-value3,

po_c2005 TO wa_data-value4,

po_c2004 TO wa_data-value5,

po_c2003 TO wa_data-value6.

APPEND: wa_data TO i_data.

ENDIF.

IF NOT po_2 IS INITIAL.

CLEAR: wa_data.

MOVE: 'Test2' TO wa_data-class,

po_s2008 TO wa_data-value1,

po_s2007 TO wa_data-value2,

po_s2006 TO wa_data-value3,

po_s2005 TO wa_data-value4,

po_s2004 TO wa_data-value5,

po_s2003 TO wa_data-value6.

APPEND: wa_data TO i_data.

ENDIF.

IF NOT po_3 IS INITIAL.

CLEAR: wa_data.

MOVE: 'Test3' TO wa_data-class,

po_f2008 TO wa_data-value1,

po_f2007 TO wa_data-value2,

po_f2006 TO wa_data-value3,

po_f2005 TO wa_data-value4,

po_f2004 TO wa_data-value5,

po_f2003 TO wa_data-value6.

APPEND: wa_data TO i_data.

ENDIF.

CLEAR: wa_opts.

MOVE 'P2TYPE = VB' TO wa_opts-value.

APPEND wa_opts TO i_opts.

CALL FUNCTION 'GRAPH_MATRIX_3D'

EXPORTING

auto_cmd_1 = ' '

auto_cmd_2 = ' '

col1 = '2003'

col2 = '2004'

col3 = '2005'

col4 = '2006'

col5 = '2007'

col6 = '2008'

dim1 = 'Years'

dim2 = 'Product'

inbuf = ' '

inform = ' '

mail_allow = ' '

pwdid = ' '

set_focus = 'x'

smfont = ' '

so_contents = ' '

so_receiver = ' '

so_send = ' '

so_title = ' '

stat = ' '

super = ' '

timer = ' '

titl = 'vinus test program'

valt = 'Sales in $MUSD'

wdid = ' '

winid = ' '

winpos = ' '

winszx = '50'

winszy = '50'

x_opt = ' '

notify = ' '

  • IMPORTING

  • b_key =

  • b_typ =

  • cua_id =

  • mod_col =

  • mod_row =

  • mod_val =

  • m_typ =

  • rbuff =

  • rwnid =

TABLES

data = i_data

opts = i_opts.

Thanks,

Vinod.

Former Member
0 Kudos

hi,

i think you can use ALV's for having the desired output ie. in graphs etc..

regards,

raghu

Former Member
0 Kudos

hi

good

USE FM

GRAPH_MATRIX_2D

Check the program : BCGRBU11 , BCGRBU12

reward point if helpful.

thanks

mrutyun^

Former Member
0 Kudos

Hi,

Please refer the code below :


*&---------------------------------------------------------------------*
*& Report  ZGRAPH_TEST
*&
*&---------------------------------------------------------------------*
REPORT  ZGRAPH_TEST.
DATA: BEGIN OF TAB OCCURS 5,
      CLASS(5) TYPE C,
      VAL1(2) TYPE I,
      VAL2(2) TYPE I,
      VAL3(2) TYPE I,
      END OF TAB.
DATA: BEGIN OF OPTTAB OCCURS 1,
        C(20),
      END OF OPTTAB.
MOVE: 'fan' TO TAB-CLASS,
      12 TO TAB-VAL1, 8 TO TAB-VAL2, 15 TO TAB-VAL3.
APPEND TAB.
CLEAR TAB.
MOVE: 'cool' TO TAB-CLASS,
      15 TO TAB-VAL1, 10 TO TAB-VAL2, 18 TO TAB-VAL3.
APPEND TAB.
CLEAR TAB.MOVE: 'DA' TO TAB-CLASS,
      17 TO TAB-VAL1, 11 TO TAB-VAL2, 20 TO TAB-VAL3.
APPEND TAB.
CLEAR TAB.
OPTTAB = 'FIFRST = 3D'.     APPEND OPTTAB.      "// Grafik-Typ
OPTTAB = 'P3TYPE = TO'.     APPEND OPTTAB.      "// Objektart
OPTTAB = 'P3CTYP = RO'.     APPEND OPTTAB.      "// Farben der Objekte
OPTTAB = 'TISIZE = 2'.      APPEND OPTTAB.      "// Haupttitelgröße
OPTTAB = 'CLBACK = X'.      APPEND OPTTAB.      "// Background Color
CALL FUNCTION 'GRAPH_MATRIX_3D'
     EXPORTING
          COL1        = '1997'
          COL2        = '1998'
          COL3        = '1999'
          DIM2        = 'Products'
          DIM1        = 'Years'
          TITL        = 'Sales In Rs. Crores'
     TABLES
          DATA        = TAB
          OPTS        = OPTTAB
     EXCEPTIONS
          OTHERS      = 1.
LEAVE PROGRAM. 

Thanks,

Sriram Ponna.