Dump Error in MAterial Consumption Report
Hi all Gurus
[1] I need help from your side i am doing one material consumption report in that i did all thing but it is giving me dump error while i was using sort in to ALV
so please any one help me out this .......
[2] I am Printing sum of quantity in Header area of smartform it is printing with using comma e.x 43,000 but in body area it is showing with decimal point
e.x 43.000
Following is my ALV reports code please check it it is giving me short dump while using sort ..............
I am very much in neeed
Thanx for your suggestion in advanc.....
and god bless you............
*& Report ZCONSUM
REPORT ZCONSUM.
*& Report ZCONSUMPTION
TYPE-POOLS : SLIS.
TABLES:marc,
mara,
makt,
mard,
mbew,
mseg,
mkpf.
TYPES:
BEGIN OF s_mseg,
mblnr LIKE mseg-mblnr,
mjahr LIKE mseg-mjahr,
zeile LIKE mseg-zeile,
bwart LIKE mseg-bwart,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
budat LIKE mkpf-budat,
mtart LIKE mara-matnr,
matkl LIKE mara-matkl,
END OF s_mseg,
BEGIN OF s_t001w,
werks LIKE t001w-werks,
name1 LIKE t001w-name1,
END OF s_t001w,
BEGIN OF s_mara,
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
matkl LIKE mara-matkl,
END OF s_mara,
BEGIN OF s_makt,
matnr LIKE makt-matnr,
spras LIKE makt-spras,
maktx LIKE makt-maktx,
END OF s_makt,
BEGIN OF s_calc,
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
matkl LIKE mara-matkl,
maktx LIKE makt-maktx,
menge_t LIKE mseg-menge,
menge_t1 LIKE mseg-menge,
menge_con_261 LIKE mseg-menge,
menge_con_262 LIKE mseg-menge,
menge_con1_261 LIKE mseg-menge,
menge_con1_262 LIKE mseg-menge,
menge_ret_291 LIKE mseg-menge,
menge_ret1_291 LIKE mseg-menge,
menge_ret_292 LIKE mseg-menge,
menge_ret1_292 LIKE mseg-menge,
menge_unit_301 LIKE mseg-menge,
menge_unit1_301 LIKE mseg-menge,
menge_unit_302 LIKE mseg-menge,
menge_unit1_302 LIKE mseg-menge,
menge_sub LIKE mseg-menge,
menge_sub1 LIKE mseg-menge,
menge_oth LIKE mseg-menge,
menge_oth1 LIKE mseg-menge,
END OF s_calc,
BEGIN OF s_data,
matnr LIKE mara-matnr,
matkl LIKE mara-matkl,
mtart LIKE mara-mtart,
maktx LIKE makt-maktx,
menge_t LIKE mseg-menge,
menge_t1 LIKE mseg-menge,
menge_con LIKE mseg-menge,
menge_con1 LIKE mseg-menge,
menge_ret LIKE mseg-menge,
menge_ret1 LIKE mseg-menge,
menge_unit LIKE mseg-menge,
menge_unit1 LIKE mseg-menge,
menge_sub LIKE mseg-menge,
menge_sub1 LIKE mseg-menge,
menge_oth LIKE mseg-menge,
menge_oth1 LIKE mseg-menge,
END OF s_data.
DATA: w_mseg TYPE s_mseg,
i_mseg TYPE s_mseg OCCURS 0,
w_t001w TYPE s_t001w,
i_t001w TYPE s_t001w OCCURS 0,
w_mara TYPE s_mara,
i_mara TYPE s_mara OCCURS 0,
w_makt TYPE s_makt,
i_makt TYPE s_makt OCCURS 0,
w_calc TYPE s_calc,
i_calc TYPE s_calc OCCURS 0,
w_data TYPE s_data,
i_data TYPE s_data OCCURS 0.
DATA: line_cnt TYPE i,
v_temp TYPE p DECIMALS 2.
ALV DATA DECLERATION
DATA : IT_FIELD TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELD TYPE SLIS_FIELDCAT_ALV.
DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
IT_LAYOUT-ZEBRA = 'X'.
IT_LAYOUT-TOTALS_TEXT = 'Grand Total'.
IT_LAYOUT-SUBTOTALS_TEXT = 'Sub Total'.
IT_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
DATA: WA_COMMENTRY TYPE SLIS_LISTHEADER.
DATA: IT_COMMENTRY TYPE SLIS_T_LISTHEADER.
DATA: WA_COMMENTRY1 TYPE SLIS_LISTHEADER.
DATA: IT_COMMENTRY1 TYPE SLIS_T_LISTHEADER.
DATA: WA_EVENT TYPE SLIS_ALV_EVENT.
DATA: IT_EVENT TYPE SLIS_T_EVENT.
WA_EVENT-NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'TOP'.
APPEND WA_EVENT TO IT_EVENT.
DATA : WA_SORT TYPE slis_sortinfo_alv,
IT_SORT TYPE SLIS_T_SORTINFO_ALV.
CLEAR WA_SORT.
WA_SORT-SPOS = '1'.
WA_SORT-FIELDNAME = 'MATKL'.
WA_SORT-TABNAME = 'I_DATA'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-SPOS = '2'.
WA_SORT-FIELDNAME = 'MTART'.
WA_SORT-TABNAME = 'I_DATA'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
DEFINE MAC1.
WA_FIELD-TABNAME = 'I_DATA'.
WA_FIELD-FIELDNAME = &1.
WA_FIELD-COL_POS = &2.
WA_FIELD-SELTEXT_L =&3.
WA_FIELD-DO_SUM = &4.
APPEND WA_FIELD TO IT_FIELD.
END-OF-DEFINITION.
MAC1 'MATKL' '1' 'MATERIAL GROUP' 'X'.
MAC1 'MTART' '2' 'MATERIAL TYPE' 'X'.
MAC1 'MATNR' '3' 'MATERIAL NO' 'X'.
MAC1 'MAKTX' '4' 'DESCRIPTION' 'X'.
MAC1 'MENGE_CON1' '5' 'CONSUMPTION FOR PERIOD' 'X'.
MAC1 'MENGE_CON' '6' 'CONSUMPTION FOR CUMULATIVE' 'X'.
MAC1 'MENGE_RET1' '7' 'RETURN FROM DEPT. FOR PERIOD' 'X'.
MAC1 'MENGE_RET' '8' 'RETURN FROM DEPT.CUMULATIVE' 'X'.
MAC1 'MENGE_UNIT1' '9' 'INTER UNIT FOR PERIOD' 'X'.
MAC1 'MENGE_UNIT' '10' 'INTER UNIT CUMULATIVE' 'X'.
MAC1 'MENGE_SUB1' '11' 'SUB CONTRACTOR FOR PERIOD' 'X'.
MAC1 'MENGE_SUB' '12' 'SUB CONTRACTOR CUMULATIVE' 'X'.
MAC1 'MENGE_OTH1' '13' 'OTHERS FOR PERIOD' 'X'.
MAC1 'MENGE_OTH' '14' 'OTHERS CUMULATIVE' 'X'.
MAC1 'MENGE_t1' '15' 'TOTAL FOR PERIOD' 'X'.
MAC1 'MENGE_t' '16' 'TOTAL CUMULATIVE' 'X'.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
PARAMETERS: p_werks LIKE t001w-werks DEFAULT '1023' OBLIGATORY.
select-options: s_matkl FOR mara-matkl,
s_mtart FOR mara-mtart,
s_matnr FOR mara-matnr,
s_budat FOR mkpf-budat OBLIGATORY.
PARAMETERS: year(4) DEFAULT '2007'.
SELECTION-SCREEN:END OF BLOCK B1.
START-OF-SELECTION.
SELECT lk~mblnr
lk~mjahr
lk~budat
lp~zeile
lp~bwart
lp~matnr
lp~werks
lp~menge
ma~mtart
ma~matkl
INTO CORRESPONDING FIELDs OF TABLE i_mseg
FROM MSEG AS lp INNER JOIN MKPF AS lk
ON lkmblnr EQ lpmblnr
AND lkmjahr EQ lkmjahr
INNER JOIN mara AS ma
ON mamatnr EQ lpmatnr
WHERE lp~werks EQ p_werks
AND lp~matnr IN s_matnr
AND lk~budat LE s_budat-high.
clear line_cnt. "Count line of i_table i_mseg
DESCRIBE TABLE i_mseg LINES line_cnt.
IF line_cnt GT 0. "If i_mseg has records
SELECT matnr "Collect material description
maktx
spras
INTO CORRESPONDING FIELDS OF TABLE i_makt
FROM makt
FOR ALL ENTRIES IN i_mseg
WHERE matnr EQ i_mseg-matnr
AND spras EQ 'E'.
CLEAR line_cnt.
DESCRIBE TABLE i_makt LINES line_cnt.
IF line_cnt GT 0.
SORT i_makt BY MATNR ASCENDING.
DELETE ADJACENT DUPLICATES FROM i_makt COMPARING matnr.
ENDIF.
SELECT werks "Collect plant name
name1
INTO CORRESPONDING FIELDS OF TABLE i_t001w
FROM t001w
FOR ALL ENTRIES IN i_mseg
WHERE werks EQ i_mseg-werks.
CLEAR line_cnt.
DESCRIBE TABLE i_t001w LINES line_cnt.
IF line_cnt GT 0.
SORT i_t001w BY werks ASCENDING.
DELETE ADJACENT DUPLICATES FROM i_t001w COMPARING werks.
ENDIF.
LOOP AT i_mseg INTO w_mseg. "Move recored into data i_tab
w_calc-matnr = w_mseg-matnr.
w_calc-mtart = w_mseg-mtart.
w_calc-matkl = w_mseg-matkl.
READ TABLE i_makt WITH KEY matnr = w_mseg-matnr INTO w_makt.
IF sy-subrc = 0.
w_calc-maktx = w_makt-maktx.
ENDIF.
IF w_mseg-bwart EQ '261' .
w_calc-menge_con_261 = w_mseg-menge.
IF w_mseg-budat GE s_budat-low.
w_calc-menge_con1_261 = w_mseg-menge.
ENDIF.
ENDIF.
IF w_mseg-bwart EQ '262' .
w_calc-menge_con_262 = w_mseg-menge.
IF w_mseg-budat GE s_budat-low.
w_calc-menge_con1_262 = w_mseg-menge.
ENDIF.
ENDIF.
IF w_mseg-bwart EQ '291' OR w_mseg-bwart EQ '201'.
w_calc-menge_ret_291 = w_mseg-menge.
IF w_mseg-budat GE s_budat-low.
w_calc-menge_ret1_291 = w_mseg-menge.
ENDIF.
ENDIF.
IF w_mseg-bwart EQ '292' OR w_mseg-bwart EQ '202'.
w_calc-menge_ret_292 = w_mseg-menge.
IF w_mseg-budat GE s_budat-low.
w_calc-menge_ret1_292 = w_mseg-menge.
ENDIF.
ENDIF.
IF w_mseg-bwart EQ '301'.
w_calc-menge_unit_301 = w_mseg-menge.
IF w_mseg-budat GE s_budat-low.
w_calc-menge_unit1_301 = w_mseg-menge.
ENDIF.
ENDIF.
IF w_mseg-bwart EQ '302'.
w_calc-menge_unit_302 = w_mseg-menge.
IF w_mseg-budat GE s_budat-low.
w_calc-menge_unit1_302 = w_mseg-menge.
ENDIF.
ENDIF.
IF w_mseg-bwart EQ '543'.
w_calc-menge_sub = w_mseg-menge.
IF w_mseg-budat GE s_budat-low.
w_calc-menge_sub1 = w_mseg-menge.
ENDIF.
ENDIF.
COLLECT w_calc INTO i_calc.
ENDLOOP. "ENDLOOP of Move recored into data i_tab
LOOP AT i_calc INTO w_calc.
w_data-matnr = w_calc-matnr.
w_data-mtart = w_calc-mtart.
w_data-matkl = w_calc-matkl.
w_data-maktx = w_calc-maktx.
v_temp = w_calc-menge_con_261 - w_calc-menge_con_262.
w_data-menge_con = v_temp.
CLEAR v_temp.
v_temp = w_calc-menge_con1_261 - w_calc-menge_con1_262.
w_data-menge_con1 = v_temp.
CLEAR v_temp.
v_temp = w_calc-menge_ret_291 - w_calc-menge_ret_292.
w_data-menge_ret = v_temp.
CLEAR v_temp.
v_temp = w_calc-menge_ret1_291 - w_calc-menge_ret1_292.
w_data-menge_ret1 = v_temp.
CLEAR v_temp.
v_temp = w_calc-menge_unit_301 - w_calc-menge_unit_302.
w_data-menge_unit = v_temp.
CLEAR v_temp.
v_temp = w_calc-menge_unit1_301 - w_calc-menge_unit1_302.
w_data-menge_unit1 = v_temp.
CLEAR v_temp.
w_data-menge_sub = w_calc-menge_sub.
w_data-menge_sub1 = w_calc-menge_sub.
v_temp = w_data-menge_con + w_data-menge_ret + w_data-menge_unit + w_data-menge_sub.
w_data-menge_t = v_temp.
CLEAR v_temp.
v_temp = w_data-menge_con1 + w_data-menge_ret1 + w_data-menge_unit1 + w_data-menge_sub1.
w_data-menge_t1 = v_temp.
CLEAR v_temp.
APPEND w_data TO i_data.
ENDLOOP.
ENDIF. "ENDIf i_mseg has records
Display_ALV
END-OF-SELECTION.
DATA : DATE(85),
DATE_LOW(10),
DATE_HIGH(10),
MSK TYPE STRING,
DATE1(10),
date2(10).
WA_COMMENTRY-TYP = 'H'.
WA_COMMENTRY-INFO = 'Material Consumption Report'.
APPEND WA_COMMENTRY TO IT_COMMENTRY.
CLEAR WA_COMMENTRY.
CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/' S_BUDAT-LOW+0(4) INTO DATE1.
CONCATENATE S_BUDAT-high6(2) '/' S_BUDAT-high4(2) '/' S_BUDAT-high+0(4) INTO DATE2.
CONCATENATE 'Material Consumption Report :' DATE1 'To' date2 INTO DATE SEPARATED BY SPACE.
WA_COMMENTRY-TYP = 'S'.
WA_COMMENTRY-INFO = DATE.
APPEND WA_COMMENTRY TO IT_COMMENTRY.
CLEAR WA_COMMENTRY.
*SORT I_DATA BY MTART MATKL .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_BACKGROUND_ID = 'ALV_BACKGROUNG'
I_GRID_TITLE = 'STOCK LEDGER SUMMARY'
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD
IT_SORT = IT_SORT
I_SAVE = 'X'
IT_EVENTS = IT_EVENT
TABLES
T_OUTTAB = I_DATA.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM TOP .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_COMMENTRY
I_LOGO = 'INOXLOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM.
REFRESH IT_COMMENTRY.
ENDFORM. " TOP-OF-PAGE
It is giving me error on sort statement
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_BACKGROUND_ID = 'ALV_BACKGROUNG'
I_GRID_TITLE = 'STOCK LEDGER SUMMARY'
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD
IT_SORT = IT_SORT <<<<<<<<<<<<<<<<<<<<<<<<<<<
I_SAVE = 'X'
IT_EVENTS = IT_EVENT
TABLES
T_OUTTAB = I_DATA.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Similar Messages
-
Excess Material Consumption Report - For a Particular Period
Hi,
For a particular Time Period, say 30 days, I require excess material consumption report. This report is for the materials ( say ROH, or HALB) that are confirmed through co11n. Taking MTS into consideration with Strategy Group 40, please suggest a standard report (if there is any).
Regards,
PavanThe T code for viewing the standard report for
Material Analysis - MCP5.
Production Order - MCP3.
Material Usage Analysis - MCRE.
Please try it.
Regards
R.Brahmankar -
Material consumption report for sales made artcle wise - help urgent
Hi Folks,
My client need a report which consist of
The raw material consumption report
1. Article wise (material group)
2. QTY
3. Value
4. or all sales made for foreign customers
5. Business area
Please help me
Thanks
NarasimHi,
Check COOIS report.
It will show the consumption order wise just filter Movement type 261.
Regards,
Shayam -
Hi Guys,
I have to develop a custom report intended for use by our factories and is design to give them detail information on raw materials actual usage relative to how much should have been used (standard usage) by an individual product or product group.
The column of the report that is probably the most challenging to determine by taking the BOM quantities for each product in the product group under consideration and multiplying them by the actual output achieved for the respective products in order obtain the standard usage.
I have been looking at doing the following. Substracting the fields of txn COR3(Display process order material list), from txn CORT(Process order confirmation display: goods movement). Is this the right approach.
Any screens, transactions, tables, structures for me to do this report would be greatly appreciated.
Thank you for the help.
Sumit.Hi,
Have you tried looking at the standard material consumption report - Transaction MCRE?
Rgds. -
Material Consumption Report all expert requested to check my code
Hi all guru
Plz
I am creating Material Consumption Report
so all expert are requested to check my code
bcz its giving me wrong value change if nessary
*& Report Z_MATERIAL_CONSUPTION
*&IEDK901096
REPORT Z_MATERIAL_CONSUPTION
LINE-COUNT 65(2)
LINE-SIZE 345
MESSAGE-ID zate_msg
NO STANDARD PAGE HEADING.
*T A B L E S
TABLES:MARC,
mara,
makt,
mard,
mbew,
mseg,
mkpf.
T Y P E S
Types for MARC
TYPES: begin of ty_marc,
matnr LIKE marc-matnr,
werks LIKE marc-werks,
end of ty_marc.
********Types for T001W*****
TYPES:BEGIN OF ty_t001w,
werks LIKE t001w-werks,
name1 LIKE t001w-name1,
END OF ty_t001w.
********Types for MARA*****
TYPES:BEGIN OF TY_MARA,
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
matkl LIKE mara-mtart,
END OF ty_mara.
********Types for MAKT*****
TYPES:BEGIN OF ty_makt,
matnr LIKE makt-matnr,
spras LIKE makt-spras,
maktx LIKE makt-maktx,
END OF ty_makt.
********Types for MKPF*****
TYPES:BEGIN OF ty_mkpf,
mblnr LIKE mkpf-mblnr,
budat LIKE mkpf-budat,
END OF ty_mkpf.
********Types for MSEG*****
TYPES:BEGIN OF ty_mseg,
mblnr LIKE mseg-mblnr,
mjahr LIKE mseg-mjahr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
END OF ty_mseg.
Types for main **************
TYPES: begin of ty_main,
matkl LIKE mara-mtart,
mtart LIKE mara-mtart,
matnr LIKE mara-matnr,
werks LIKE marc-werks,
name1 LIKE t001w-name1,
maktx LIKE makt-maktx,
budat LIKE mkpf-budat,
mblnr LIKE mseg-mblnr,
mjahr LIKE mseg-mjahr,
menge LIKE mseg-menge,
menge1 LIKE mseg-menge,
bwart LIKE mseg-bwart,
ret_qty LIKE mseg-menge,
ret_*** LIKE mseg-menge,
unit_qty LIKE mseg-menge,
unit_*** LIKE mseg-menge,
wip_qty LIKE mseg-menge,
wip_*** LIKE mseg-menge,
sub_qty LIKE mseg-menge,
sub_*** LIKE mseg-menge,
oth_qty LIKE mseg-menge,
oth_*** LIKE mseg-menge,
end of ty_main.
Types for main2 **************
TYPES: begin of ty_main2,
mblnr LIKE mseg-mblnr,
werks LIKE marc-werks,
mjahr LIKE mseg-mjahr,
menge LIKE mseg-menge,
bwart LIKE mseg-bwart,
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
matkl LIKE mara-mtart,
end of ty_main2.
*I N T E R N A L T A B L E S
DATA:it_mara TYPE ty_mara OCCURS 0 WITH HEADER LINE,
it_marc TYPE ty_marc OCCURS 0 WITH HEADER LINE,
it_t001w TYPE ty_t001w OCCURS 0 WITH HEADER LINE,
it_makt TYPE ty_makt OCCURS 0 WITH HEADER LINE,
it_main TYPE ty_main OCCURS 0 WITH HEADER LINE,
it_main2 TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_mkpf TYPE ty_mkpf OCCURS 0 WITH HEADER LINE,
it_mseg TYPE ty_mseg OCCURS 0 WITH HEADER LINE,
it_mseg TYPE ty_main OCCURS 0 WITH HEADER LINE,
it_dept TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_unit TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_WIP TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_subcon TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_others TYPE ty_main2 OCCURS 0 WITH HEADER LINE.
**********I N T E R N A L T A B L E S for Cumulative Calculation**********
DATA:it_mseg1 TYPE ty_main OCCURS 0 WITH HEADER LINE,
it_dept1 TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_unit1 TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_WIP1 TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_subcon1 TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
it_others1 TYPE ty_main2 OCCURS 0 WITH HEADER LINE.
W O R K A R E A
DATA:wa_mara TYPE ty_mara,
wa_marc TYPE ty_marc,
wa_t001w TYPE ty_t001w,
wa_makt TYPE ty_makt,
wa_main TYPE ty_main,
wa_main2 TYPE ty_main2,
wa_mkpf TYPE ty_mkpf,
wa_mseg TYPE ty_mseg,
wa_mseg1 TYPE ty_mseg,
wa_dept TYPE ty_main2,
wa_ret_qty TYPE ty_main2,
wa_ret_*** TYPE ty_main2.
V A R I A B L E S D E C L A R A T I O N
DATA: MYDATE TYPE SY-DATUM,
per_qty TYPE p,
***_qty TYPE p ,
final_total TYPE p DECIMALS 2.
S E L E C T I O N S C R E E N
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
PARAMETERS:Plant LIKE marc-werks DEFAULT '1023'.
select-options:Mat_Grp FOR mara-matkl,
Mat_Type FOR mara-mtart,
MATERIAL FOR MARC-MATNR,
Period FOR mydate.
PARAMETERS:Year LIKE mseg-mjahr DEFAULT '2007'.
SELECTION-SCREEN:END OF BLOCK B1.
I N I T I A L I Z A T I O N
INITIALIZATION.
MATERIAL-LOW = '100'.
MATERIAL-HIGH = '200'.
APPEND MATERIAL.
*MAT_TYPE-LOW = 'ABF'.
*MAT_TYPE-HIGH = 'FERT'.
*APPEND MAT_TYPE.
*MAT_GRP-LOW = '100'.
*MAT_GRP-HIGH = '200'.
*APPEND MAT_GRP.
*PERIOD-LOW = '20071001'.
*PERIOD-HIGH = '20071031'.
*APPEND PERIOD.
S T A R T O F S E L E C T I O N
start-of-selection.
PERFORM it_mara_data.
PERFORM it_marc_data.
PERFORM it_t001w_data.
PERFORM it_makt_data.
PERFORM it_mseg_data.
PERFORM it_mseg1_data. "CUMULATIVE CALCULATION
PERFORM it_mkpf_data.
PERFORM it_dept_data.
PERFORM it_dept1_data. "CUMULATIVE CALCULATION
PERFORM it_unit_data.
PERFORM it_unit_data1. "CUMULATIVE CALCULATION
PERFORM it_wip_data.
PERFORM it_wip_data1. "CUMULATIVE CALCULATION
PERFORM it_sub_contract.
PERFORM it_sub_contract1. "CUMULATIVE CALCULATION
PERFORM it_main_data.
T O P O F P A G E
TOP-OF-PAGE.
WRITE: /1 'INOX AIR PRODUCTS LTD',plant,it_t001w-name1,
/1 'TOTAL CONSUMPTION FOR THE PERIODE:',Period-low,'To',period-high.
skip 2.
FORMAT COLOR 1.
ULINE.
WRITE: /1'|','CODE ' ,
15 'MATERIAL' ,
30 'DESCRIPTION',
90'CONSUMPTION' ,
135'RETURN FROM DEPT.' ,
170'INTER UNIT' ,
210'W.I.P' ,
240'SUB-CONTRACTOR' ,
275'OTHERS' ,
310'TOTAL',345'|' ,
/1'|',15 'TYPE',
85'FOR PERIOD' ,
100 ' CUMULATIVE' ,
130'FOR PERIOD' ,
145 'CUMULATIVE' ,
165'FOR PERIOD' ,
180 'CUMULATIVE' ,
200'FOR PERIOD' ,
215'CUMULATIVE' ,
235'FOR PERIOD' ,
250'CUMULATIVE' ,
265'FOR PERIOD' ,
280 'CUMULATIVE' ,
300'FOR PERIOD' ,
315' CUMULATIVE' ,
345'|' .
ULINE.
E N D O F S E L E C T I O N
end-OF-SELECTION.
PERFORM display_data.
FORM it_mara_data.
SELECT matnr
mtart
matkl
FROM mara INTO CORRESPONDING FIELDS OF TABLE it_mara
WHERE matnr IN material AND
mtart IN mat_type AND
matkl IN mat_grp.
ENDFORM. " it_mara_data
FORM it_marc_data .
select matnr
werks
from marc
into CORRESPONDING FIELDS OF TABLE it_marc
FOR ALL ENTRIES IN it_mara
WHERE MATNR eq it_mara-matnr AND
werks eq plant.
ENDFORM. " it_marc_data
FORM it_makt_data .
SELECT
matnr
maktx
FROM makt INTO
CORRESPONDING FIELDS OF TABLE it_makt
FOR ALL ENTRIES IN it_mara
WHERE matnr eq it_mara-matnr.
ENDFORM. " it_makt_data
FORM it_main_data .
*BREAK-POINT.
loop at it_mara.
wa_main-matnr = it_mara-matnr.
wa_main-mtart = it_mara-mtart.
wa_main-matkl = it_mara-matkl.
READ TABLE it_marc WITH KEY matnr = it_mara-matnr.
wa_main-werks = it_marc-werks.
READ TABLE it_t001w WITH KEY werks = it_marc-werks.
wa_main-name1 = it_t001w-name1.
READ TABLE it_makt WITH KEY matnr = it_mara-matnr.
wa_main-maktx = it_makt-maktx.
READ TABLE it_mseg1 INDEX sy-tabix.
wa_main-mjahr = it_mseg1-mjahr.
wa_main-menge1 = it_mseg1-menge.
READ TABLE it_mseg WITH KEY matnr = it_mara-matnr.
READ TABLE it_mseg INDEX sy-tabix.
wa_main-mblnr = it_mseg-mblnr.
wa_main-menge = it_mseg-menge.
READ TABLE it_dept WITH KEY mblnr = it_mseg-mblnr.
wa_main-ret_qty = it_dept-menge.
READ TABLE it_dept1 WITH KEY werks = it_marc-werks.
READ TABLE it_dept1 INDEX sy-tabix.
wa_main-ret_*** = it_dept1-menge.
READ TABLE it_mkpf WITH KEY mblnr = it_mseg-mblnr.
wa_main-budat = it_mkpf-budat.
READ TABLE it_unit1 WITH KEY werks = it_marc-werks.
READ TABLE it_unit1 INDEX sy-tabix. "BINARY SEARCH.
wa_main-unit_*** = it_unit1-menge.
READ TABLE it_unit WITH KEY mblnr = it_mseg-mblnr.
wa_main-unit_qty = it_unit-menge.
READ TABLE it_wip WITH KEY mblnr = it_mseg-mblnr.
wa_main-wip_qty = it_wip-menge.
READ TABLE it_wip1 WITH KEY werks = it_marc-werks.
READ TABLE it_wip1 INDEX sy-tabix.
wa_main-wip_qty = it_wip1-menge.
READ TABLE it_subcon WITH KEY mblnr = it_mseg-mblnr.
wa_main-sub_qty = it_subcon-menge.
READ TABLE it_subcon1 WITH KEY werks = it_marc-werks.
READ TABLE it_subcon1 INDEX sy-tabix.
wa_main-sub_*** = it_subcon1-menge.
READ TABLE it_others WITH KEY mblnr = it_mseg-mblnr.
wa_main-oth_qty = it_others-menge.
READ TABLE it_others1 WITH KEY werks = it_marc-werks.
READ TABLE it_others1 INDEX sy-tabix.
wa_main-oth_*** = it_others1-menge.
APPEND wa_main to it_main.
CLEAR : wa_main,
it_mseg1,
it_main.
ENDLOOP.
LOOP at it_mseg1.
READ TABLE it_mseg INDEX sy-index.
MOVE-CORRESPONDING it_mseg1 to it_main.
append LINES OF it_mseg1 TO it_main.
IF sy-subrc <> 0.
exit.
ENDIF.
ENDLOOP.
ENDFORM. " it_main_data
FORM display_data .
SORT it_main by matkl mtart maktx.
LOOP AT it_main ."WHERE menge eq it_mseg1-menge.
at NEW matkl.
FORMAT COLOR 2 INTENSIFIED ON.
WRITE:/5 it_main-matkl." COLOR 2.
ENDAT.
at NEW mtart.
FORMAT COLOR 3 INTENSIFIED ON.
WRITE:/15 it_main-mtart." COLOR 3.
ENDAT.
at NEW maktx.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/ it_main-maktx UNDER 'DESCRIPTION'.
ENDAT.
FORMAT COLOR 2 INTENSIFIED ON.
WRITE:/75 it_main-menge, "it_main-maktx UNDER 'DESCRIPTION',
95 it_main-menge1,
125 it_main-ret_qty,
140 it_main-ret_***,
160 it_main-unit_qty,
175 it_main-unit_***,
195 it_main-wip_qty,
210 it_main-wip_***,
225 it_main-sub_qty,
240 it_main-sub_***,
255 it_main-oth_qty,
270 it_main-oth_***.
FORMAT COLOR 2 INTENSIFIED OFF.
at END OF mtart.
sum.
uline.
WRITE:/30 'MAT. TYPE WISE SUB TOTAL' COLOR COL_GROUP,
60 IT_MAIN-MTART COLOR 2,
75 '*',it_main-menge,'*' COLOR 4,
95 it_main-menge1,
125 it_main-ret_qty,
140 it_main-ret_***,
160 it_main-unit_qty,
175 it_main-unit_***,
195 it_main-wip_qty,
210 it_main-wip_***,
225 it_main-sub_qty,
240 it_main-sub_***,
260 it_main-oth_qty,
270 it_main-oth_***.
uline.
ENDAT.
at END OF matkl.
sum.
uline.
WRITE:/30 'GROUPWISE SUB TOTAL ' COLOR 5,
60 IT_MAIN-MATKL COLOR 2,
75 '*',it_main-menge,'*' COLOR 4,
95 it_main-menge1,
125 it_main-ret_qty,
140 it_main-ret_***,
160 it_main-unit_qty,
175 it_main-unit_***,
195 it_main-wip_qty,
210 it_main-wip_***,
225 it_main-sub_qty,
240 it_main-sub_***,
260 it_main-oth_qty,
270 it_main-oth_***.
uline.
ENDAT.
at LAST.
sum.
uline.
WRITE:/30 'GROSS TOTAL' COLOR 6,
60 IT_MAIN-MATKL COLOR 2,
75 '*',it_main-menge,'*' COLOR 4,
95 it_main-menge1,
125 it_main-ret_qty,
140 it_main-ret_***,
160 it_main-unit_qty,
175 it_main-unit_***,
195 it_main-wip_qty,
210 it_main-wip_***,
225 it_main-sub_qty,
240 it_main-sub_***,
260 it_main-oth_qty,
270 it_main-oth_***.
uline.
ENDAT.
per_qty = it_main-menge.
***_qty = it_main-menge1.
final_total = per_qty + ***_qty.
at last.
WRITE:/95 sy-uline(30).
write:/65 'Final Cumulative Qty >>>>>>>>>',final_total color 6.
WRITE:/95 sy-uline(30).
ENDAT.
FORMAT INTENSIFIED off.
ENDLOOP.
ENDFORM. " display_data
" it_mkpf_data
FORM it_mseg_data .
SELECT
mblnr
matnr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_mseg
FOR ALL ENTRIES IN it_mara
WHERE matnr eq it_mara-matnr AND
werks eq plant AND
bwart eq 261." AND bwart eq 262.
CLEAR it_mseg.
ENDFORM. " it_mseg_data
FORM it_mkpf_data .
SELECT
mblnr
budat
FROM mkpf INTO CORRESPONDING FIELDS OF TABLE it_mkpf
FOR ALL ENTRIES IN it_mseg
WHERE mblnr eq it_mseg-mblnr." AND
budat BETWEEN Period-low AND period-high.
ENDFORM.
FORM it_t001w_data .
SELECT werks name1 FROM t001w INTO CORRESPONDING FIELDS OF TABLE it_t001w
FOR ALL ENTRIES IN it_marc
WHERE werks eq it_marc-werks.
ENDFORM. " it_t001w_data
FORM it_mseg1_data .
SELECT
mblnr
mjahr
ZEILE
matnr
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_mseg1
FOR ALL ENTRIES IN it_mara
WHERE matnr eq it_mara-matnr AND
werks eq plant AND
mjahr eq Year AND
bwart eq 261." AND bwart eq 262.
CLEAR it_mseg1.
ENDFORM. " it_mseg1_data
FORM it_dept_data .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_dept
FOR ALL ENTRIES IN it_mseg
WHERE mblnr eq it_mseg-mblnr AND
werks eq it_mseg-WERKS AND
bwart ge 291 AND bwart le 292.
ENDFORM.
" it_dept_data
FORM it_dept1_data .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_dept1
FOR ALL ENTRIES IN it_mara
WHERE matnr eq it_mara-matnr AND
werks eq plant AND
mjahr eq YEAR AND
bwart ge 291 and bwart le 292.
ENDFORM. " it_dept1_data
FORM it_unit_data .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_unit
FOR ALL ENTRIES IN it_mseg
WHERE mblnr eq it_mseg-mblnr AND
werks eq it_mseg-WERKS AND
bwart ge 301 AND bwart le 302.
ENDFORM. " it_unit_data
FORM it_unit_data1 .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_unit1
FOR ALL ENTRIES IN it_mara
WHERE matnr eq it_mara-matnr AND
werks eq plant AND
mjahr eq YEAR AND
bwart ge 301 AND bwart le 302.
ENDFORM. " it_unit_data1
FORM it_wip_data .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_wip
FOR ALL ENTRIES IN it_mseg
WHERE mblnr eq it_mseg-mblnr AND
werks eq it_mseg-WERKS AND
bwart ge 301 AND bwart le 302.
ENDFORM. " it_wip_data
FORM it_wip_data1 .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_wip1
FOR ALL ENTRIES IN it_mara
WHERE matnr eq it_mara-matnr AND
werks eq plant AND
mjahr eq YEAR AND
bwart ge 301 AND bwart le 302.
ENDFORM. " it_wip_data1
FORM it_sub_contract .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_subcon
FOR ALL ENTRIES IN it_mseg
WHERE mblnr eq it_mseg-mblnr AND
werks eq it_mseg-WERKS AND
bwart eq 541." AND bwart eq 542.
ENDFORM. " it_sub_contract
FORM it_sub_contract1 .
SELECT
mblnr
mjahr
ZEILE
werks
menge
bwart
FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_subcon1
FOR ALL ENTRIES IN it_mara
WHERE matnr eq it_mara-matnr AND
werks eq plant AND
mjahr eq YEAR AND
bwart eq 541." AND bwart eq 542.
ENDFORM. " it_sub_contract1Hi,
When ever you are using a read statement check sy-subrc is initial or not then only you move the data
and clear the work area after use.
The mistake you have done is not clearing the work areas after use and sy-subrc check after read.
If you fail to do so the data will be clubbed and wrong data will be shown.
Regards,
Siva
Pls reward points if usefull . -
I am getting dump error while running one report in one select query
Hi,
While running a report program, I am getting a dump error in one select query. So could you please correct the select query so that I can't face the dump error.
SELECT vbeln parvw kunnr INTO CORRESPONDING FIELDS OF TABLE l_t_vbpa
FROM vbpa
FOR ALL ENTRIES IN l_t_backorder_item
WHERE vbeln = l_t_backorder_item-vbeln AND
( ( parvw = c_we AND kunnr IN rng_shipto ) OR ( parvw = c_ag AND
kunnr IN rng_soldto ) ) .
<removed by moderator>
Best Regards,
BDP
Edited by: Thomas Zloch on Apr 30, 2010 12:31 PMHi Bansidhar,
It would be helpful if you could tell what type of dump it is.
If it is a timeout you should check whether l_t_backorder_item is empty - in this case ALL document numbers are selected. f you get the timeout with a populated table consider converting the l_t_backorder_item table into one ore more ranges tables - the select with ranges tables is way quicker than 'for all entries'. But take care the ranges table has not to many entries - the SAP SQL converter puts this into one huge SQL statement and this might become too big to be handled by the database (depends on the actual underlying database).
I would also consider splitting the SELECT into two (2nd one with 'appending into table') to make the code easier to understand It also helps the database system determining a strategy for the select.
Regards,
Gerd Rother -
Dump Error In Material Master Transaction
Dear Experts,
When i am creating or changing any material master record, i am getting the below dump error while saving the material.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLC1F2" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
The following syntax error occurred in program "SAPLC1AX " in include "%_CESPCL
" in
line 77:
"Component called ATWRT already exists. ."
The include has been created and last changed by:
Created by: "SAP "
Last changed by: "SAP "
Error in the ABAP Application Program
The current ABAP program "SAPLC1F2" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
The following syntax error was found in the program SAPLC1AX :
"Component called ATWRT already exists. ."
Trigger Location of Runtime Error
Program SAPLC1F2
Include LC1F2U10
Row 594
Module type (FUNCTION)
Module Name C1F2_SUBSTANCES_SAVE_TO_DB
Can you please help me out with this?
Thanks,
PraveenHi,
I have not made any changes in the Enhancements/BADIS which are related to ATWRT, but created one ZTable for linking the
Vendor (LIFNR), Material (MATNR) & Manufacturer (ATWRT).
Here are the additional details of the dump which i am getting in MM01/MM02 transactions for your reference.
Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of the dump
Can you please help me with this?
Thanks,
Praveen
Edited by: Rob Burbank on Feb 2, 2011 9:29 AM -
Day wise raw material consumption report query
Hi,
I was wondering if there was a way to extract the day wise consumption of all the raw materials that we use at the factory. The standard report in SAP B1 only gives me the total raw material consumption within a period of time and I need to drill down a couple of levels to see the individual raw material transferred.
I basically wanted to use this data to establish the weekly consumption of my raw materials as the goods issue team enters this on a daily basis.
Thanks in advance.Sorry for not having included it earlier. The website did not let me attach an excel sheet.so I've attached a csv file for you to take a look at but basically these are the only fields I need:
Date
Item No.
Item Name
Issue Qty [Out Qty]
01-01-2014
CSPLPIC001
Raw Material 1
740
01-01-2014
CSPLPIC002
Raw Material 2
950
01-01-2014
CSPLPIC003
Raw Material 3
793
01-01-2014
CSPLPIC005
Raw Material 4
980
01-01-2014
CSPLPIS001
Raw Material 5
487
01-01-2014
CSPLPIS002
Raw Material 6
927
07-01-2014
CSPLPMC001
Raw Material 7
907
08-01-2014
CSPLPMC002
Raw Material 8
669
09-01-2014
CSPLPMC005
Raw Material 9
41
10-01-2014
CSPLPIC001
Raw Material 1
599
10-01-2014
CSPLPIC002
Raw Material 2
473
10-01-2014
CSPLPIC003
Raw Material 3
619
10-01-2014
CSPLPIC005
Raw Material 4
477
10-01-2014
CSPLPIS003
Raw Material 5
408
Please do let me know if there is any other information that you need. -
Trading Partner wise material consumption report
Dear Freinds,
I want to know can we prepare Trading partner wise material consumtion report in BW . This information will help in intercompany elimination.
we had activated Trading partner info in Vendor master.
Pleasee some ways to get the information.HI
Have you try Inventory Audit Report.
I think that will be useful for you.
regards
kamlesh -
Raw Material Consumption Report
Dear Forum,
The users want to generate the report from the system that would give the item wise details of the Raw Material Cosnumption for the Period selected. How could we generate the same and also the users want to reconcile the same with the GL Account.
Your help would be much appreciated.
Regardshi
first take out which movements ur using for consumption like 201 261 etc
now goto mb51 here select those movements and materials u need with prorper business area,dates and execute
now u will get the report for the consumption
just match this with the GL accts
u can use transaction type WA also
regards
kunal -
Material consumption report for workcenter in REM
Hi,
I am using REM. Is it possible to get report on materials consumption for a work center in Repetetive manufacturing.
If possible.Please explain me how.
thanks and regards
MurugesanHi,
For MF60, settings should be done in OSPP , here give ur plant & movement type as 311
1) MF60 - in MF60, Global settings icon plays a major role & check the date which ur giving
2) take ur current plan orders and input in plan order option
3) then go to Global settings remove all ticks & execute
Regards
kumar
Edited by: kumar kumar on Sep 19, 2009 1:14 PM -
LSMW error in material consumption value upload
Hi Guys,
I am using standard program RMDATIND for creating LSMW to upload consumption value for materials , i am getting error consumption period can not be determined, can anybody tell me what period format should be used?
Thanks and regards
Thamizhchelvan GHi,
It would be helpful if you have identified the issue.
Please let us know the resolution, which would help me.
I am facing the same issue.
Thanks
Sudheer -
Regarding reports on material consumption
Hi all
can give me the solution for below
"Material consumption reports this report will generate a report grouped on plants to list the consumption of material in that plant in a year."see the functionality behind this is
1.A material can be present in different plants " table marc
2.further a plant can have multiple storage locations "tables mard .
so material consumption will be to check how much material is consumed in a year .
This u can do by first calulating the stock present during the year ( as on jan 1 2006) say total stock for that material is 10,000 units (mara-meins)
so in the fiscal year 2006 how much was the material consumed means i need to see how much stock was posted during the year .
say stock avaliable as of 2006 december 31 is 3700 units
so now my material consumption is
10000 (stock present at the start of the year ) - 3700 ( stock present at the end of the year ) = 6300
so 6300 will be ur material consumed .
these details can be fetched from MARD table s
so finally the report will show 10000 37000 and 6300
try to understand the relation between mara marc and mard tables rest is numeric calulation in the internal tables.
i took the dates for example generally it will be posting dates for fiscal year .
regards,
vijay -
Product wise raw material consumption
Raw material consumption is not coming correctly product wise (not matched with data extracted through MB51 material consumption report).What will be the possible error?
N.B. Material Ledger is not active but variant configuration is on.Hi
MB51 contains total movements list which may include material issued to Production as well as to Cost center/Mat moved from one store to other store and so on. where as RM consumption you may be trying to match with the GL In some of the above transactions only material documents are created and FI docs may or may not be created hence the two may not match.
Regards
Rajneesh Saxena -
Report for Material consumption quantity & its cost in Repetitive MFG.
Hello,
Is there any Standard Report available in SAP to check the Quantity of raw / intermediate material consumed & their cost in Repetitive manufacturing Backflush transaction MFBF?
ThanksHere I'm interesed in the MFBF Qty & against which the consumption of Raw Materials & their cost.
The reports which you asked me to check are all structures & not much of use for individual analysis.
My requirement: When we access the material document(MB51) of the individual MFBF we get all the Raw material Consumption Qty & from there we can go to FI Doc (A/c Document).In A/c documet we get the cost of all Raw materials consumed alongwith the Qty.
Is there any report or I need to develope a new report?
Maybe you are looking for
-
How to Print Document Numering In PLD
Hi, I am creating a report for Goods Receipt PO . I need the PO no ( base doc no) along with its Document Numbering ie; the prefix and suffix that we define for the purchase order using Numbering type in Administration. I am getting the PO no in the
-
Add ons do not appear in My Phone
Can anyone confirm that Add-ons to your phone line e.g. Anytine Unlimited Calls or International Freedom do not appear under the My Phone ssection of your My BT portal and are only listed on your monthly bill? All that I have as evidence until my ne
-
How to remove the last blank line in the downloaded text file?
Hi All, I am downloading the one internal table content using the GUI_DOWNLOAD to a text file(.txt). The cursor is in last position of the text file where there is no content. For example consider the below is downloaded txt file: This is test file.
-
Misinterpreting asterisk as command line argument
I want to convert arithmetic expressions from infixed to postfixed. I want to be able to enter the expression on the command line. But when I do same, asterisks are not treated as a character in the string for: public static viod(String[] arg). For i
-
Unable to create JVM using JNI
Hai, I am new to java programming. I am trying to invoke native application using JVM. I have a written a pilot code in C using JNI. I am getting the following error when I try to run the binary. I think that the problem is from the fact that 1.2.2 i