Grahical reports in abap how to devlop
hi all
can u please tell me how to display reports in graphical form 2d or 3d using abap programming
Hi ,
Paste this code in se38,
PERFORM create_chart is important for you.
*& Report ZMM_INV_TURNS_REPORT *
*& Author Vijay Babu Dudla *
*& Date 25th April 2008 *
Description : Inventory Turns Report *
Inputs: *
Tables: *
ECMT - COGS data *
GLTO - Inventory Data *
Parameters: *
From Period *
Year *
To Period *
Year *
Company Code
Parameters: *
N/A *
Outputs: A ALV report is generated to display the Inventory Turns *
External Routines *
Classes: CL_GUI_ALV_GRID *
CL_IGS_CHART *
Transactions : No *
Programs : No *
Return Codes: No *
Ammendments: *
Programmer Date Req. # Action *
================ ========== ====== ==============================*
Vijay Dudla 04/15/2008 RD4K900255 Initial Development *
RMANDAL 05/18/2008 RD4K900419 1) Getting COGS values *
from ZSCOMMON *
2) Displying values in *
Graph *
REPORT zmm_inv_turns_report MESSAGE-ID zi.
*-TYPES Declaration
*- Period Details
TYPES: BEGIN OF ty_period,
perid TYPE fc_perid, " Period
END OF ty_period.
*-Year Details
TYPES: BEGIN OF ty_year,
gjahr TYPE gjahr, " Year
END OF ty_year.
*-Final Display Table
TYPES: BEGIN OF ty_data,
texts(20), " Col Value
per01(20), " Period1
per02(20), " Period2
per03(20), " Period3
per04(20), " Period4
per05(20), " Period5
per06(20), " Period6
per07(20), " Period7
per08(20), " Period8
per09(20), " Period9
per10(20), " Period10
per11(20), " Period11
per12(20), " Period12
year TYPE gjahr,
END OF ty_data.
*-Period Balance information
TYPES: BEGIN OF ty_balance,
period TYPE fc_perid, " Period
gjahr TYPE gjahr, " Year
tslvt TYPE tslxx, " Balance
END OF ty_balance.
*- Period and Year info
TYPES: BEGIN OF ty_per_year,
period TYPE fc_perid, " Period
gjahr TYPE gjahr, " Year
END OF ty_per_year.
*- Field Symbols
FIELD-SYMBOLS: <fs> TYPE ANY.
*- Data Declarations
*- Internal Table Decleations
DATA: it_fieldcat TYPE lvc_t_fcat, " Fieldcatalog
it_per TYPE STANDARD TABLE OF zmm_year_period,
it_year_per TYPE zmm_t_inv_period,
it_final TYPE STANDARD TABLE OF ty_data,
it_year TYPE STANDARD TABLE OF ty_year,
it_period TYPE STANDARD TABLE OF ty_period,
it_common TYPE STANDARD TABLE OF zscommon,
BEGIN OF INSERT BY RMANDAL - 19/05/2008 - RD4K900419
it_common1 TYPE STANDARD TABLE OF zscommon,
END OF INSERT BY RMANDAL - 19/05/2008 - RD4K900419
it_inv TYPE STANDARD TABLE OF glt0,
it_cogs TYPE STANDARD TABLE OF ecmct,
it_inv_data TYPE STANDARD TABLE OF zfi_year_period,
it_balance TYPE STANDARD TABLE OF ty_balance,
it_peryear TYPE STANDARD TABLE OF ty_per_year
WITH HEADER LINE.
*- Work Area declarations
DATA: wa_fieldcat TYPE lvc_s_fcat,
w_per TYPE zmm_year_period,
w_period TYPE zmm_inv_period,
wa_final TYPE ty_data,
wa_inv TYPE zfi_year_period,
wa_per TYPE ty_period,
wa_balance TYPE ty_balance.
*- Range table Declations
DATA: return TYPE TABLE OF ddshretval WITH HEADER LINE,
r_year TYPE RANGE OF gjahr WITH HEADER LINE,
r_yr TYPE RANGE OF gjahr WITH HEADER LINE,
r_per TYPE RANGE OF fc_perid WITH HEADER LINE,
r_saknr TYPE RANGE OF racct.
*- Variable to Period and Year
DATA: perid TYPE fc_perid,
year TYPE gjahr,
w_bukrs TYPE glt0-bukrs.
*- Graph Display
DATA: g_html TYPE w3htmltabtype,
g_url TYPE w3url.
*-Controls for Displaying the Grpah and ALV Report
DATA: grid TYPE REF TO cl_gui_alv_grid,
split TYPE REF TO cl_gui_splitter_container,
cont TYPE REF TO cl_gui_custom_container,
gridcon TYPE REF TO cl_gui_container,
htmlcon TYPE REF TO cl_gui_container,
html_control TYPE REF TO cl_gui_html_viewer.
*& Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-ttl.
SELECT-OPTIONS: s_per FOR perid NO-EXTENSION NO INTERVALS OBLIGATORY,
" Period
s_year FOR year NO-EXTENSION NO INTERVALS OBLIGATORY.
" Year
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-tt2.
SELECT-OPTIONS: s_per2 FOR perid NO-EXTENSION NO INTERVALS OBLIGATORY,
" Period
s_year2 FOR year NO-EXTENSION NO INTERVALS OBLIGATORY.
" Year
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-tt3 .
PARAMETERS: p_rep RADIOBUTTON GROUP g1 DEFAULT 'X',
p_grp RADIOBUTTON GROUP g1,
p_bot RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b3.
PARAMETERS: p_bukrs LIKE glt0-bukrs DEFAULT '3000' OBLIGATORY.
*& AT SELECTION-SCREEN ON VALUE REQUEST *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_year-low.
*-Value help for year
PERFORM get_hlp_for_year.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_per-low.
*-Value help for Period
PERFORM get_hlp_for_period.
*& AT SELECTION-SCREEN *
AT SELECTION-SCREEN .
*-Validations
*- Per Period should be 1 to 12
LOOP AT s_per.
IF s_per-low GT 12 OR s_per-low LT 1.
MESSAGE e000(zi) WITH 'Enter Period between 1 and 12'.
ENDIF. " IF s_per-low GT 12 OR s_per-low
IF NOT s_per-high IS INITIAL.
IF s_per-high GT 12 OR s_per-high LT 1.
MESSAGE e000(zi) WITH 'Enter Period between 1 and 12'.
ENDIF. " IF s_per-high GT 12 OR
ENDIF. " IF NOT s_per-high IS INITIAL
ENDLOOP. " LOOP AT s_per
IF s_per-low GE sy-datum+4(2) AND
s_year-low GE sy-datum+0(4).
MESSAGE e000(zi) WITH text-002 text-003.
ENDIF. " IF s_per-low GE sy-datum+4(2)
LOOP AT s_per2.
IF s_per2-low GT 12 OR s_per2-low LT 1.
MESSAGE e000(zi) WITH 'Enter Period between 1 and 12'.
ENDIF. " IF s_per2-low GT 12 OR
ENDLOOP. " LOOP AT s_per2.
IF s_per2-low GE sy-datum+4(2) AND
s_year2-low GE sy-datum+0(4).
MESSAGE e000(zi) WITH text-002 text-003.
ENDIF. " IF s_per2-low GE sy-datum+4(2)
Company Code Validation
IF p_bukrs IS NOT INITIAL.
SELECT
SINGLE bukrs " Company Code
FROM t001
INTO w_bukrs
WHERE bukrs = p_bukrs.
IF sy-subrc NE 0.
MESSAGE e000(zi) WITH 'Enter Valid Company code '.
ENDIF. " IF sy-subrc NE 0.
CLEAR w_bukrs.
ENDIF. " IF p_bukrs IS NOT
*& START OF SELECTION *
START-OF-SELECTION.
*-Get the GL Accounts from table ZSCOMMON
PERFORM get_gl_information.
*-Get the Inventory Details
PERFORM get_inventory_data.
*-Get the COGS details
PERFORM get_cogs_data.
*-Population of Period Table
PERFORM populate_period_data.
*-Populate the Final Data
PERFORM populate_final_data.
*& END OF SELECTION *
END-OF-SELECTION.
*-Display the Output
PERFORM display_inv_turn_data.
*& Form get_hlp_for_year
Get the Value help for Year
FORM get_hlp_for_year.
*-Populate the F4 Values for Year
SELECT pabrj
FROM t549q
INTO
TABLE it_year.
IF sy-subrc EQ 0.
SORT it_year.
DELETE it_year WHERE gjahr = ''.
DELETE ADJACENT DUPLICATES FROM it_year
COMPARING gjahr.
*-Attaching the F4 Help to The Selection parameter
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'GJAHR'
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = it_year
return_tab = return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc EQ 0.
READ TABLE return INDEX 1.
s_year-low = return-fieldval.
ENDIF. " IF sy-subrc EQ 0
ENDIF. " IF sy-subrc EQ 0
ENDFORM. " get_hlp_for_year
*& Form get_hlp_for_period
Get the Search help for Period
FORM get_hlp_for_period.
*-Population of Period to Display the F4 values
CLEAR return[].
wa_per-perid = '001'.
DO 12 TIMES.
APPEND wa_per TO it_period.
wa_per-perid = wa_per-perid + 1.
ENDDO. " DO 12 TIMES.
*-Attaching the F4 values to the selection parameter
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'PERID'
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = it_period
return_tab = return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc EQ 0.
READ TABLE return INDEX 1.
s_per-low = return-fieldval.
ENDIF. " IF sy-subrc EQ 0
ENDFORM. " get_hlp_for_period
*& Form GET_GL_INFORMATION
Get the GL account Information from ZSCOMMON table
FORM get_gl_information .
DATA: wa_common TYPE zscommon,
wa_saknr LIKE LINE OF r_saknr.
*-GL Accounts from ZSCOMMON
SELECT *
FROM zscommon
INTO
TABLE it_common
WHERE programm = sy-repid AND
code = 'GLAC'.
IF sy-subrc EQ 0.
wa_saknr-sign = 'I'.
wa_saknr-option = 'EQ'.
LOOP AT it_common INTO wa_common.
wa_saknr-low = wa_common-valuestrng.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_saknr-low
IMPORTING
output = wa_saknr-low.
APPEND wa_saknr TO r_saknr.
ENDLOOP. " LOOP AT it_common
ENDIF. " IF sy-subrc EQ 0
ENDFORM. " GET_GL_INFORMATION
*& Form GET_INVENTORY_DATA
Get the Inventory Data
FORM get_inventory_data .
REFRESH r_year.
r_year-sign = 'I'.
r_year-option = 'EQ'.
*-Populate the Year from Selection Parameters
LOOP AT s_year.
r_year-low = s_year-low.
APPEND r_year.
r_year-low = r_year-low - 1.
APPEND r_year.
r_year-low = s_year-low.
IF s_year2-low IS NOT INITIAL.
DO.
r_year-low = r_year-low + 1.
IF r_year-low GT s_year2-low.
EXIT.
ENDIF. " IF r_year-low GT
APPEND r_year.
ENDDO. " DO
ENDIF. " IF s_year2-low IS NOT
ENDLOOP. " LOOP AT s_year
CLEAR r_year.
SORT r_year BY low.
DELETE ADJACENT DUPLICATES FROM r_year COMPARING low.
r_yr-sign = 'I'.
r_yr-option = 'EQ'.
LOOP AT s_year.
r_yr-low = s_year-low.
APPEND r_yr.
IF s_year2-low IS NOT INITIAL.
DO.
r_yr-low = r_yr-low + 1.
IF r_yr-low GT s_year2-low.
EXIT.
ENDIF. " IF r_yr-low GT s_year2-low
APPEND r_yr.
ENDDO. " DO
ENDIF. " IF s_year2-low IS NOT
ENDLOOP. " LOOP AT s_year
*-Get the Inventory Data
SELECT *
FROM glt0
INTO TABLE it_inv
WHERE bukrs = p_bukrs AND
ryear IN r_year AND
racct IN r_saknr.
ENDFORM. " GET_INVENTORY_DATA
*& Form GET_COGS_DATA
Get the COGS data
FORM get_cogs_data .
DATA: s_item TYPE RANGE OF fc_item,
wa_item LIKE LINE OF s_item.
BEGIN OF INSERT BY RMANDAL ON - 05/19/2008- RD4K900419
data: wa_common1 TYPE zscommon.
SELECT *
FROM zscommon
INTO
TABLE it_common1
WHERE programm = sy-repid AND
code = 'CCOA'.
IF sy-subrc EQ 0.
wa_item-sign = 'I'.
wa_item-option = 'EQ'.
LOOP AT it_common1 INTO wa_common1.
wa_item-low = wa_common1-valuestrng.
APPEND wa_item TO s_item.
ENDLOOP. " LOOP AT it_common1
ENDIF. " IF sy-subrc EQ 0
wa_item-sign = 'I'.
wa_item-option = 'EQ'.
wa_item-low = '0000005000'.
APPEND wa_item TO s_item.
wa_item-low = '0000006100'.
APPEND wa_item TO s_item.
wa_item-low = '0000007900'.
APPEND wa_item TO s_item.
END OF INSERT BY RMANDAL ON - 05/19/2008- RD4K900419
*-Population of COGS information
SELECT *
FROM ecmct
INTO TABLE it_cogs
WHERE ryear IN r_year AND
rbunit EQ '000000000000003000' AND
ritem IN s_item AND
( ( sityp EQ '2 ' AND
subit EQ '0100 ')
OR
( sityp EQ ' ' AND
subit EQ ' ') ).
IF sy-subrc EQ 0.
ENDIF. " IF sy-subrc EQ 0
ENDFORM. " GET_COGS_DATA
*& Form POPULATE_FINAL_DATA
Population of final Data
FORM populate_final_data .
DATA: inc(2) TYPE n,
w_pert(15),
col(5).
*Field catalog population.
wa_fieldcat-fieldname = 'TEXTS'.
wa_fieldcat-outputlen = 20.
wa_fieldcat-coltext = 'Info'.
APPEND wa_fieldcat TO it_fieldcat.
inc = 1.
DO 12 TIMES.
CONCATENATE 'PER' inc INTO wa_fieldcat-fieldname.
CONCATENATE 'PER' inc INTO wa_fieldcat-coltext.
wa_fieldcat-outputlen = 20.
wa_fieldcat-just = 'R'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat .
inc = inc + 1.
ENDDO. " DO 12 TIMES.
SORT it_per BY year period.
inc = 1.
*-Final Internal table formation
LOOP AT it_per INTO w_per.
READ TABLE it_final WITH KEY year = w_per-year
TRANSPORTING NO FIELDS.
IF sy-subrc NE 0.
wa_final-texts = w_per-year.
wa_final-year = w_per-year.
inc = 1.
DO 12 TIMES.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
ASSIGN (w_pert) TO <fs>.
<fs> = inc.
inc = inc + 1.
ENDDO. " DO 12 TIMES
APPEND wa_final TO it_final.
CLEAR wa_final.
inc = w_per-period+1(2).
wa_final-year = w_per-year.
wa_final-texts = 'COGS Tot(12 months)'.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-cogs.
APPEND wa_final TO it_final.
wa_final-texts = 'Inv Total(12 months)'.
wa_final-year = w_per-year.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-invtot.
APPEND wa_final TO it_final.
wa_final-texts = 'Inv Avg(monthly)'.
wa_final-year = w_per-year.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-invavg.
APPEND wa_final TO it_final.
wa_final-texts = 'Turns(COGS/Inv.Avg)'.
wa_final-year = w_per-year.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-invturn.
APPEND wa_final TO it_final.
CLEAR wa_final.
APPEND wa_final TO it_final.
ELSE.
inc = w_per-period+1(2).
wa_final-texts = 'COGS Total(12 months)'.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
CONCATENATE 'PER' inc INTO col.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-cogs.
MODIFY it_final FROM wa_final TRANSPORTING (col)
WHERE texts = 'COGS Tot(12 months)'
AND year = w_per-year.
wa_final-texts = 'Inv Total(12 months)'.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
CONCATENATE 'PER' inc INTO col.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-invtot.
MODIFY it_final FROM wa_final TRANSPORTING (col)
WHERE texts = 'Inv Total(12 months)'
AND year = w_per-year .
wa_final-texts = 'Inv Avg(monthly)'.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
CONCATENATE 'PER' inc INTO col.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-invavg.
MODIFY it_final FROM wa_final TRANSPORTING (col)
WHERE texts = 'Inv Avg(monthly)'
AND year = w_per-year
wa_final-texts = 'Turns(COGS/Inv.Avg)'.
CONCATENATE 'WA_FINAL-PER' inc INTO w_pert.
CONCATENATE 'PER' inc INTO col.
ASSIGN (w_pert) TO <fs>.
<fs> = w_per-invturn.
MODIFY it_final FROM wa_final TRANSPORTING (col)
WHERE texts = 'Turns(COGS/Inv.Avg)'
AND year = w_per-year .
CLEAR wa_final.
ENDIF. " IF sy-subrc NE 0
ENDLOOP. " LOOP AT it_per INTO
ENDFORM. " POPULATE_FINAL_DATA
*& Form DISPLAY_INV_TURN_DATA
Display Inventory Turns Report
FORM display_inv_turn_data .
IF NOT it_final IS INITIAL.
*-Save the Data
PERFORM save_data.
CALL SCREEN 100.
ELSE.
MESSAGE s000(zi) WITH 'No data for selection'.
ENDIF. " IF NOT it_final
ENDFORM. " DISPLAY_INV_TURN_DATA
*& Form POPULATE_PERIOD_DATA
Populate the Period Data
FORM populate_period_data .
*- Work Variables
DATA: wa_inv TYPE glt0,
wa_cog TYPE ecmct,
w_amt(12),
w_debit TYPE tslxx,
w_credit TYPE tslxx,
w_invtot TYPE tslxx,
w_cogstot TYPE tslxx,
w_bal1 TYPE tslxx,
w_bal2 TYPE tslxx,
w_total TYPE tslxx,
w_inc(2) TYPE n,
w_perd TYPE fc_perid,
w_bal(12),
lv_period TYPE fc_perid,
lv_year TYPE gjahr,
w_change.
*- Field Symbols
FIELD-SYMBOLS: <fs> TYPE ANY,
<fs_bal> TYPE ANY.
*-Population of Balance for all Periods.
SORT it_inv BY ryear.
LOOP AT r_year.
CLEAR: w_debit,w_credit,
w_bal1,w_bal2,w_total.
wa_balance-gjahr = r_year-low.
LOOP AT it_inv INTO wa_inv WHERE ryear = r_year-low AND
drcrk = 'S' .
w_bal1 = w_bal1 + wa_inv-tslvt.
CLEAR wa_inv-tslvt.
ENDLOOP. " LOOP AT it_inv
LOOP AT it_inv INTO wa_inv WHERE ryear = r_year-low AND
drcrk = 'H' .
wa_inv-tslvt = wa_inv-tslvt * -1.
w_bal2 = w_bal2 + wa_inv-tslvt.
CLEAR wa_inv-tslvt.
ENDLOOP. " LOOP AT it_inv INTO wa_inv
w_total = w_bal1 - w_bal2.
w_inc = 1.
DO 12 TIMES.
LOOP AT it_inv INTO wa_inv WHERE ryear = r_year-low AND
drcrk = 'S' .
CLEAR: w_bal.
CONCATENATE 'WA_INV-TSL' w_inc INTO w_bal.
ASSIGN (w_bal) TO <fs_bal>.
w_debit = w_debit + <fs_bal>.
UNASSIGN <fs_bal>.
ENDLOOP. " LOOP AT it_inv INTO wa_inv
LOOP AT it_inv INTO wa_inv WHERE ryear = r_year-low AND
drcrk = 'H' .
CLEAR: w_bal.
CONCATENATE 'WA_INV-TSL' w_inc INTO w_bal.
ASSIGN (w_bal) TO <fs_bal>.
<fs_bal> = <fs_bal> * -1.
w_credit = w_credit + <fs_bal>.
UNASSIGN <fs_bal>.
ENDLOOP. " LOOP AT it_inv INTO wa_inv
wa_balance-tslvt = w_debit - w_credit + w_total.
wa_balance-period = w_inc.
APPEND wa_balance TO it_balance.
w_inc = w_inc + 1.
ENDDO. " DO 12 TIMES
ENDLOOP. " LOOP AT r_year
CLEAR: w_credit,w_debit.
r_per-sign = 'I'.
r_per-option = 'EQ'.
CLEAR it_peryear[].
*-Populate the periods
r_per-low = s_per-low.
lv_year = s_year-low.
DO .
it_peryear-period = r_per-low.
it_peryear-gjahr = lv_year.
APPEND it_peryear.
IF r_per-low GE s_per2-low AND
lv_year EQ s_year2-low.
EXIT.
ENDIF. " IF r_per-low GE s_per2
IF r_per-low = 12.
r_per-low = 1.
lv_year = lv_year + 1.
ELSE.
r_per-low = r_per-low + 1.
ENDIF. " IF r_per-low = 12
ENDDO. " DO
CLEAR: r_per,r_year,w_change.
*-Population of the Turns information based on Period and year
LOOP AT it_peryear.
w_perd = it_peryear-period.
LOOP AT r_yr WHERE low = it_peryear-gjahr.
w_per-period = it_peryear-period.
IF w_change = ''.
w_per-year = r_yr-low.
ENDIF. " IF w_change = ''
IF w_per-period = 12.
IF s_per-low <> w_per-period.
r_yr-low = r_yr-low - 1.
w_change = 'X'.
ENDIF. " IF s_per-low <> w_per-period
w_per-year = r_yr-low.
ENDIF. " IF w_per-period = 1
CLEAR: w_invtot,
w_cogstot.
*-For each period populate the Credit and Debit info
DO 12 TIMES.
w_period-period = it_peryear-period.
w_period-year = r_yr-low.
CLEAR: w_amt,w_debit,w_bal1.
CONCATENATE 'WA_INV-TSL' w_period-period+1(2) INTO w_amt.
LOOP AT it_inv INTO wa_inv WHERE ryear = w_period-year AND
drcrk = 'S' .
ASSIGN (w_amt) TO <fs>.
w_debit = w_debit + <fs>.
UNASSIGN <fs>.
CLEAR wa_inv-tslvt.
ENDLOOP. " LOOP AT it_inv INTO wa_inv
CLEAR: w_credit,w_bal2.
LOOP AT it_inv INTO wa_inv WHERE ryear = w_period-year AND
drcrk = 'H' .
ASSIGN (w_amt) TO <fs>.
<fs> = <fs> * -1.
w_credit = w_credit + <fs>.
UNASSIGN <fs>.
CLEAR wa_inv-tslvt.
ENDLOOP. " LOOP AT it_inv INTO wa_inv
w_period-tsl01 = w_debit - w_credit.
CLEAR w_amt.
CONCATENATE 'WA_COG-TSL' w_period-period+1(2) INTO w_amt.
LOOP AT it_cogs INTO wa_cog WHERE ryear = w_period-year.
ASSIGN (w_amt) TO <fs>.
w_period-tsl02 = w_period-tsl02 + <fs>.
UNASSIGN <fs>.
ENDLOOP. " LOOP AT it_cogs INTO wa_cog
*-Calculate the total amounts
w_invtot = w_invtot + w_period-tsl01.
w_cogstot = w_cogstot + w_period-tsl02.
APPEND w_period TO it_year_per.
CLEAR: w_period-tsl02,w_period-tsl01.
IF it_peryear-period EQ 1.
it_peryear-period = 12.
r_yr-low = r_yr-low - 1.
ELSE.
it_peryear-period = it_peryear-period - 1.
ENDIF. " IF it_peryear-period
ENDDO. " DO 12 TIMES.
lv_period = w_per-period.
lv_year = w_per-year.
DO 12 TIMES.
READ TABLE it_balance INTO wa_balance
WITH KEY period = lv_period
gjahr = lv_year.
w_per-invtot = w_invtot .+ wa_balance-tslvt.
w_per-invtot = w_per-invtot + wa_balance-tslvt.
IF lv_period = 1.
lv_period = 12.
lv_year = lv_year - 1.
ELSE.
lv_period = lv_period - 1.
ENDIF. " IF lv_period = 1
CLEAR wa_balance-tslvt.
ENDDO. " DO 12 TIMES
w_per-cogs = w_cogstot.
w_per-invavg = w_per-invtot / 12.
IF w_per-invavg NE 0.
w_per-invturn = w_per-cogs / w_per-invavg.
ENDIF. " IF w_per-invavg NE 0
w_per-year = it_peryear-gjahr.
w_per-info = it_year_per.
APPEND w_per TO it_per.
CLEAR: w_per-period,
w_per-invtot,
w_per-invavg,
w_per-cogs,
w_per-invturn,
w_per-info,it_year_per.
ENDLOOP. " LOOP AT r_yr WHERE
ENDLOOP. " LOOP AT it_peryear
ENDFORM. " POPULATE_PERIOD_DATA
*& Form create_chart
Display the Chart
FORM create_chart USING p_html TYPE w3htmltabtype p_real.
DATA:
igs_chart TYPE REF TO cl_igs_chart,
line TYPE igs_data,
data TYPE igs_data_tab,
ext_line TYPE igs_ext,
extension TYPE igs_ext_tab,
mime TYPE w3mimetabtype,
html TYPE w3htmltabtype,
html_line TYPE w3html,
url TYPE w3url,
content_length TYPE i,
content_type TYPE w3param-cont_type,
content_subtype TYPE w3param-cont_type.
DATA: val TYPE char30.
empty result table
REFRESH p_html.
create chart object
CREATE OBJECT igs_chart.
set chart type
igs_chart->type = cl_igs_chart=>co_type_lines.
set picture size
igs_chart->width = 640.
igs_chart->height = 480.
igs_chart->width = 1024.
igs_chart->height = 680.
data to be displayed in the form of Graph
SORT it_per BY period.
LOOP AT it_per INTO w_per.
line-groupid = w_per-year.
line-x = w_per-period.
IF w_per-invturn < 0.
w_per-invturn = w_per-invturn * -1.
CLEAR val.
val = w_per-invturn .
CONCATENATE '-' val INTO line-y.
ELSE.
line-y = w_per-invturn.
ENDIF. " IF w_per-invturn < 0
BEGIN OF INSERT BY RMANDAL - 19/05/2008 - RD4K900419
To dislay the values in Graph
line-DATALABEL = line-y.
condense line-datalabel.
END OF INSERT BY RMANDAL - 19/05/2008 - RD4K900419
APPEND line TO data.
CLEAR line.
ENDLOOP. " LOOP AT it_per INTO w_per
*-Populate the IGS data
igs_chart->data = data.
set titles
igs_chart->title = 'Inventory Turns'.
igs_chart->title_values = 'No of Turns'.
igs_chart->title_categories = 'Period'.
create picture
CALL METHOD igs_chart->send
IMPORTING
content_type = content_type
content_length = content_length
content = mime
imagemap = html
EXCEPTIONS
rfc_communication_error = 1
rfc_system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc IS INITIAL AND p_real NE space.
SPLIT content_type AT '/' INTO content_type content_subtype.
CALL METHOD html_control->load_data
EXPORTING
type = content_type
subtype = content_subtype
size = content_length
IMPORTING
assigned_url = url
CHANGING
data_table = mime.
CONCATENATE
'<HTML><HEAD><TITLE>SAP IGS Chart</TITLE></HEAD>'
'<BODY BGCOLOR=#DEDEC8>'
'<MAP NAME=chart>'
INTO html_line-line.
APPEND html_line TO p_html.
APPEND LINES OF html TO p_html.
CONCATENATE
'</MAP>'
'<IMG SRC="' url '" USEMAP=#chart BORDER=0>'
'</BODY></HTML>'
INTO html_line-line.
APPEND html_line TO p_html.
ENDIF. " IF sy-subrc IS INITIAL AND..
ENDFORM. " create_chart
*& Module STATUS_0100 OUTPUT
Status and Controls Initialzation
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZTURN'.
SET TITLEBAR 'ZTURN'.
DATA: layout TYPE lvc_s_layo.
*-Create the Container
CREATE OBJECT cont
EXPORTING
container_name = 'CONT'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc NE 0
*-If Report option
IF p_rep EQ 'X'.
*-Creation of Grid Object
CREATE OBJECT grid
EXPORTING
i_parent = cont
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc NE 0
layout-zebra = 'X'.
layout-no_headers = 'X'.
layout-cwidth_opt = 'X'.
layout-grid_title = 'Inventory Turns Report'.
*-Display the ALV
grid->set_table_for_first_display(
EXPORTING
is_layout = layout
CHANGING
it_outtab = it_final
it_fieldcatalog = it_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc NE 0
*-If Graph Option selected
ELSEIF p_grp EQ 'X'.
set rfc destination
cl_gfw=>its_rfc_dest = 'IGS_RFC_DEST'.
create hmtl control
CREATE OBJECT html_control
EXPORTING parent = cont.
PERFORM create_chart USING g_html 'X'.
get url of output data
CALL METHOD html_control->load_data
EXPORTING
type = 'text'
subtype = 'html'
IMPORTING
assigned_url = g_url
CHANGING
data_table = g_html.
Load the picture by using the url generated by the data .
CALL METHOD html_control->show_url
EXPORTING
url = g_url.
*-If Both Report and Graph Selected
ELSE.
set rfc destination
cl_gfw=>its_rfc_dest = 'IGS_RFC_DEST'.
Create Splitter for custom_container
CREATE OBJECT split
EXPORTING
parent = cont
rows = 2
columns = 1.
CALL METHOD split->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = htmlcon.
CALL METHOD split->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = gridcon.
create hmtl control
CREATE OBJECT html_control
EXPORTING parent = htmlcon.
PERFORM create_chart USING g_html 'X'.
get url of output data
CALL METHOD html_control->load_data
EXPORTING
type = 'text'
subtype = 'html'
IMPORTING
assigned_url = g_url
CHANGING
data_table = g_html.
Load the picture by using the url generated by the data .
CALL METHOD html_control->show_url
EXPORTING
url = g_url.
CREATE OBJECT grid
EXPORTING
i_parent = gridcon
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc NE 0
layout-zebra = 'X'.
layout-no_headers = 'X'.
layout-cwidth_opt = 'X'.
layout-grid_title = 'Inventory Turns Report'.
grid->set_table_for_first_display(
EXPORTING
is_layout = layout
CHANGING
it_outtab = it_final
it_fieldcatalog = it_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc NE 0
ENDIF. " IF p_rep EQ 'X'
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
User Action Handling
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
*-Handling the User actions
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
Similar Messages
-
How to write ABAP HR reports in ABAP web dynapro
Hi All,
How to write ABAP HR reports in ABAP web dynapro? We can add HR REPORT CATEGORY in ABAP HR using logical database like PNP.How to add HR REPORT CATEGORY in ABAP Webdynapro ?
Thanks.You can't use legacy concepts like logical databases directly in Web Dynpro ABAP. Even if you could do so, you shouldn't. Web Dynpro ABAP should always follow MVC - meaning that your business logic (the model) should be separated from WD as much as possible. This means calling function modules or class methods to consume the business logic and data. So in general there should be no difference between building HR reports or any other type of report in WDA - since from the WDA side you are calling other objects to consume the data.
This probably does mean that you will need to create classes to expose the HR data that you want in your WDA. -
How to activate SAP Visual Composer Reporting on ABAP Side
Hello,
How can we activate SAP Visual Composer Reporting on ABAP Side in ECC 6?
It is not in BI or in Portal.
And I have some problem to find documentation about it.
Thank you a lot!
ManuHi Manish, Is not posible to migrate iviews, you need to do a new deploy in the new server.
Regards.
Ignacio. -
How to setup variants for webdynpro report in ABAP? Help!
Hi Experts,
I have a webdynpro for ABAP report with selection screen.
How to setup variants for webdynpro report in ABAP?
Thanks
GopalHi Gopal,
There is no concept of Variant in Webdynpro ABAP. But in our project we have some tool to do that. Its not release to the client I think. In my scenarieo, We create the Screen variant and program name will be supplied to the tool that will generate the ouput in PDF and Selection screen in One view. But the same is not avilable .
If you want the same concept in Webdynpro ABAP, you need to go for Dynamic programming only. This is the only option is avilable.
Warm Regards,
Vijay -
How to activate a report in abap
hi experts,
how to activate a report in abap?
geraldFirst you need a Developer Key to create or activate ABAP Reports. If you dont have any, Please ask your BASIS team. They can generate one for you.
When you done with the report hit 'Activate button' ( A Candle icon on top).
Cheers
Praveen -
Crystal report using ABAP from SAP ECC6.0 EHP 3.0
Hi Gurus,
Can i create crystal report using ABAP in SAP ECC 6.0 EHP 3 . as i am not able to see this link in SPRO.
IMG > SAP NetWeaver > Application Server > SAP List Viewer > Maintain SAP GUI Specific Settings.
Kindly guide me urgently.http://help.sap.com/saphelp_slc/helpdata/en/27/c9ee1951fc4fb9ac322ac7e6fa7372/content.htm
If I understood your question correctly.
Have a look in the link above.
It is possible to use Crystal Reports from ALV.
Tammy Powlas also has some good guides on how to do this.
The ABAP however is not covered that much.
Best Regards
Ingrid -
Hoe top create summary and detail report using ABAP QUERY
Hi ,
Can any one suggest me how to create summary and detailed report using ABAP Quey.
Regards,
Raghu.Hi,
Table Declaration
tables:mara,mast.
*Declaring the internal table
data: begin of itab_new occurs 0,
matnr like mara-matnr, "Material No
ernam like mara-ernam, "Material Created by
mtart like mara-mtart, "Material Type
matkl like mara-matkl, "Material Desc
werks like mast-werks, "Plant
aenam like mast-aenam, "BOM created
stlal like mast-stlal, "Alternative BOM
end of itab_new.
select-options: p_matnr for mara-matnr.
CODE A : Retrieving the data from the database
select f~matnr f~ernam f~mtart f~matkl m~werks m~aenam m~stlal
into table itab_new
from mara as f inner join mast as m
on f~matnr = m~matnr
where f~matnr in p_matnr.
CODE B : Retrieving the data from the database.
SELECT FMATNR FERNAM FMTART FMATKL MWERKS MAENAM M~STLAL
INTO TABLE ITAB_NEW
FROM MARA AS F INNER JOIN MAST AS M
ON FMATNR = MMATNR
WHERE F~MATNR = P_MATNR.
SORT ITAB_NEW BY ERNAM.
loop at itab_new.
write:/5 itab_new-matnr,itab_new-ernam,itab_new-mtart,itab_new-matkl,itab_new-werks,itab_new-aenam,itab_new-stlal.
endloop.
*TABLES: MARA , MAST.
*DATA:BEGIN OF ITAB_NEW OCCURS 0,
MATNR LIKE MARA-MATNR,
ERNAM LIKE MARA-ERNAM,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
END OF ITAB_NEW.
SELECT MATNR ERNAM MTART MATKL
INTO TABLE ITAB_NEW
FROM MARA
WHERE MTART = 'T'
ORDER BY MATNR ERNAM MTART MATKL.
*DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF ITAB.
Thank U,
Jay.... -
Hi experts,
I publish a CR report to BOE. Can I open that CR report using ABAP? If it can, How to do it ?
ThanksHi Henry,
There is an environment for report layout designing. For a list of possible data sources, take a look at http://support.businessobjects.com/library/kbase/articles/c2001031.asp.
Also you can refer to the following ling for all CR related implementation in SAP:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/004aacbb-4983-2b10-8da7-cdff5dcbb948.
Hope it helps... -
Generating a report using ABAP query
Hi All,
I want to generate a anlytical report using ABAP query, There are 3 different transactions/steps have to be executed to get this data in an actionable form.
1. MB52 - Unrestricted Stock
2. ZCustomquery - Custom query in SAP R3
3. Combine above two in a single report.
Please suggest me how can i proceed,
1. Example i have created query name called Finalrepot
2. How can i call above zcustomquery and Transaction (MB52) in the Query.
Thanks for your help
PradeepHi,
Check below link to create ABAP query (SAP Query)
http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
Best regards,
Brijesh -
SAP CRM Interactive reporting Enhancement Workbench - How does it work?
Hi Everyone,
I am trying to enhance the SAP given reporting areas in CRM Interactive Reporting tool. I have the SAP documentation, I know I have to use transaction code CRMD_IREW; but I am not sure of the rest of the steps SAP has given.
Does anyone has any experience with this; can anyone share their thoughts and possible configuration steps and if possible please give a brief overview of how the fields get added to the reporting area, do they get added to the datasources first and then we need to manually add them to the virtual cubes and also in BEx query and then it gets reflected in Reporting area or how does it work?
Any inputs will be greatly appreciated!
Thanks & Regards,
SRVHi,
In general, we add enhanced field to extract structure by appending method.
later we can implement logic at COMD or by using BADI to fill the data for added field.
do test run at RSA3 and replicate into bw side.
About CMOD Logic, WIth help abap epxert you need to find relation between data source base tables and added field base table. then only we can fill data to into it.
Can we know what is your data source?
Which field you want add from which table?
Thanks -
Development of Reports using ABAP Query
Hi
can anyone please tell me about 'Development of Reports using ABAP Query' and how to use it in real time
Thanks
jaylook here:
http://help.sap.com/saphelp_47x200/helpdata/en/b7/26ddebb1f311d295f40000e82de14a/frameset.htm
A. -
Interactive reports in abap objects
Hi,
plz send me the code of interactive report using ABAP Objects .
Thanks,
T.Sreekanth.Hi,
It will be similar to what you do in normal report.
Here you may create an object instance and then call some method on the object.
AT LINE-SELECTION.
create object obj.
CALL METHOD obj->method1
IMPORTING
text = im_text.
write: im_text.
Regards,
Sesh -
In Standard Report Of ALV How Can Set PF Status.
In Standard Report Of ALV How Can Set PF Status.
Thanking in anticipation.in the call function module, you pass the PF status parameter.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = pgm
<i> <u> i_callback_pf_status_set = 'SET_PF_STATUS'</u></i>
it_fieldcat = fieldcat
is_variant = disvariant
is_layout = layout
is_print = print
i_save = 'A'
it_events = eventcat
it_sort = sortcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = a_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "LIST_DISPLAY
FORM SET_PF_STATUS *
FORM set_pf_status USING extab TYPE slis_t_extab.
SET PF-STATUS 'ZZSTD'.
ENDFORM. "set_pf_status
Here double Click on ZZSTD. IT will take you to a different screen and you have to set it.
Ster. -
Web dynpro for abap how to create a customize search help in alv column
hi:
Web dynpro for abap how to create a customize search help in alv column and put search help value into alv column?
Are there specific examples ?
thanks!!HI:
I want to created a freely programed help which include date&time,and put help value to alv column.
I have created a freely programed help in web dynpro for abpa application,I refer:
**************** - WebDynpro for ABAP
but have a problem!
If you focus on the the input field in the first row, you get the value help
However if I go to the second row and focus on the same input field in this column, I don't get the value help:
What is a good way to solve similar problems?
thanks -
When syncing iPod the PC lost power. once power restored synced iPod but the sleeve detail has been blanked. Also when syncing a 'miss-match' message is reported on iTunes. how do I get the sleeve detail back onto iPod?
http://ww2.cs.fsu.edu/~rosentha/linux/2.6.26.5/docs/DocBook/libata/ch07.html#excatATAbusErr wrote:
ATA bus error means that data corruption occurred during transmission over ATA bus (SATA or PATA). This type of errors can be indicated by
ICRC or ABRT error as described in the section called “ATA/ATAPI device error (non-NCQ / non-CHECK CONDITION)”.
Controller-specific error completion with error information indicating transmission error.
On some controllers, command timeout. In this case, there may be a mechanism to determine that the timeout is due to transmission error.
Unknown/random errors, timeouts and all sorts of weirdities.
As described above, transmission errors can cause wide variety of symptoms ranging from device ICRC error to random device lockup, and, for many cases, there is no way to tell if an error condition is due to transmission error or not; therefore, it's necessary to employ some kind of heuristic when dealing with errors and timeouts. For example, encountering repetitive ABRT errors for known supported command is likely to indicate ATA bus error.
Once it's determined that ATA bus errors have possibly occurred, lowering ATA bus transmission speed is one of actions which may alleviate the problem.
I'd also add; make sure you have good backups when ATA errors are frequent
Maybe you are looking for
-
Hi Experts, I want to prepare a new custom report in which the PO number should appear. I was advised to use EKBE table. On checking I found that I can pass only Material doc# and Fiscal Year and No company code field is found. Is it reliable to use
-
No values from selection screen
Hi ppl, I have written a report program which has 3 parameters on the selection screen (Personnel number - pernr, trip number - reinr and status - abrec). I have a subroutine to check for the validity of the personnel number entered on the screen. Th
-
having trouble downloading music from itunes store, some downloads play well before i purchase, but after my purchase the music has skips on playback?
-
I have many photos taken on a Leica P&S. It records record raw format and jpg. Some of the photos were actually of important subjects that I would like to preserve. I have recently noticed that the Raw files become corrupted when I open them in the C
-
Why are there duplicate contacts in my contact list?
I just edited some names in my contact list like I added a couple phone numbers and emails but after I was done those names I edited duplicated? Why is this?