Wrong result in DMBTR in material statement report
Hi Gurus,
I am creating Material Statement Report for that i am getting data from MSEG table. From this table i am taking two fields SALK3 and LBKUM now division of this two field assigning in DMBTR
like WA_MSEGDATA-DMBTR = ( ( WA_MSEGDATA-SALK3 / WA_MSEGDATA-LBKUM ) * WA_MSEGDATA-MENGE ).
here WA_MSEGDATA-SALK3 = 1,533.87 and WA_MSEGDATA-LBKUM = 2,442.000 and WA_MSEGDATA-MENGE = 1.000
finally in WA_MSEGDATA-DMBTR = 0.00
every time i am getting wrong answer in WA_MSEGDATA-DMBTR Please Solve me This problem......
My code is as under.....
<<post only relevant portions of the code>>
Edited by: kishan P on Jan 30, 2012 11:27 AM
HI Mahi,
As what I understand from your problem, please check sample code it is working fine.
and take care after decimal how many digits you are looking for if you are using dmbtr type mseg-dmbtr then it will be of curr 13, 2 . you may check how many digits you require after decimal accordingly you define your data type for dmbtr.
types: begin of ty_test,
lv_salk3 type mseg-salk3 ,
lv_lbkum type mseg-lbkum ,
lv_menge type mseg-menge ,
lv_dmbtr type mseg-dmbtr ,
end of ty_test.
data : it_test type table of ty_test,
wa_test like line of it_test.
select menge lbkum salk3 from mseg into table
it_test up to 10 rows.
delete it_test where lv_lbkum = '0.000'.
loop at it_test into wa_test.
wa_test-lv_dmbtr = ( wa_test-lv_salk3 / wa_test-lv_lbkum ) * wa_test-lv_menge.
modify it_test from wa_test transporting lv_dmbtr.
endloop.
if sy-subrc = 0.
endif.
Similar Messages
-
Wrong result in Web Intelligence Report
Post Author: shriram81
CA Forum: WebIntelligence Reporting
When I run a query for web inteeligence documnet I receive a wrong result. But when I run the same SQL query in SQL analyzer of MS SQL server I get correct result.
e.g. I get the same value of measure object against different dimension in web inteeligence report but I get correct values of measure when I run the query in query analyzer on SQl server
Pl guide me to get correct result in WebiPost Author: GregPye
CA Forum: WebIntelligence Reporting
Are you copying and pasting the query from WebI into SQL Server? Seems a bit odd, as the SQL should be sent to SQL Server to run...
I would check the report level settings, such as filters, or what have you... also check that there aren't more than one SQL query being run in WebI that you haven't noticed...
Cheers -
Bug 2679062 - Wrong results possible from multi-column INLIST - though stat
Hi,
The following test case is supplied in the metalink in bug no. 2871341, the base bug for this bug is 2679062.
REPRODUCIBILITY:
Reproduces constantly with simple test case below:
TEST CASE:
DROP TABLE A1
CREATE TABLE A1 (X1 VARCHAR2(10), X2 VARCHAR2(10))
REM *********** Create the second table: ***************
DROP TABLE A2
CREATE TABLE A2 (X1 VARCHAR2(10), X2 VARCHAR2(10))
INSERT INTO A1 VALUES ('1','2');
INSERT INTO A2 VALUES ('3','4');
COMMIT;
CREATE INDEX A1_X1 ON A1(X1 );
CREATE INDEX A1_X2 ON A1(X2);
CREATE INDEX A2_X1 ON A2(X1);
CREATE INDEX A2_X2 ON A2(X2);
CREATE OR REPLACE VIEW A_ALL AS SELECT * FROM A1 UNION ALL SELECT * FROM A2;
ANALYZE TABLE A1 COMPUTE STATISTICS;
ANALYZE TABLE A2 COMPUTE STATISTICS;
SELECT * FROM A_ALL;
SELECT * FROM A_ALL WHERE (X1='1' AND X2='2') ;
SELECT * FROM A_ALL WHERE ((X1='1' AND X2='2') OR (X1='3' AND X2='4'));
The 2nd query returns answer while the second is not !
The following is published in the 9.2.0.4 fixed bug list:
" 9204 - 2679062 - Wrong results possible from multi-column INLIST "
I have installed 9.2.0.4 patch set on a win 2000 machine Oracle and saw that the above case is actually solved but our application which has a very similar case doesn't.
After investigating I found the following test case that fails, it reproduces only when you have index on all columns (covering index):
drop table t1_1;
drop table t1_2;
create table t1_1(c1 number, c2 number, c3 number);
create table t1_2(c1 number, c2 number, c3 number);
create index t1_1_ix on t1_1(c1, c2, c3);
create index t1_2_ix on t1_2(c1, c2, c3);
create or replace view t1 as select * from t1_1 union all select * from t1_2;
insert into t1_1 values(1, 2, 100);
insert into t1_2 values(1, 2, 200);
commit;
analyze table t1_1 compute statistics;
analyze table t1_2 compute statistics;
prompt
prompt #######################################
prompt try 1 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( (c2=2) and (c3=100)
prompt
prompt #######################################
prompt try 2 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
(c2=2) and (c3=200)
prompt
prompt #######################################
prompt try 3 - try 1 OR try 2 does not work !
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( ( (c2=2) and (c3=100) )
or
( (c2=2) and (c3=200) )
opened a TAR and wanted to share with you.
Tal Olier ([email protected]).Hi,
The following test case is supplied in the metalink in bug no. 2871341, the base bug for this bug is 2679062.
REPRODUCIBILITY:
Reproduces constantly with simple test case below:
TEST CASE:
DROP TABLE A1
CREATE TABLE A1 (X1 VARCHAR2(10), X2 VARCHAR2(10))
REM *********** Create the second table: ***************
DROP TABLE A2
CREATE TABLE A2 (X1 VARCHAR2(10), X2 VARCHAR2(10))
INSERT INTO A1 VALUES ('1','2');
INSERT INTO A2 VALUES ('3','4');
COMMIT;
CREATE INDEX A1_X1 ON A1(X1 );
CREATE INDEX A1_X2 ON A1(X2);
CREATE INDEX A2_X1 ON A2(X1);
CREATE INDEX A2_X2 ON A2(X2);
CREATE OR REPLACE VIEW A_ALL AS SELECT * FROM A1 UNION ALL SELECT * FROM A2;
ANALYZE TABLE A1 COMPUTE STATISTICS;
ANALYZE TABLE A2 COMPUTE STATISTICS;
SELECT * FROM A_ALL;
SELECT * FROM A_ALL WHERE (X1='1' AND X2='2') ;
SELECT * FROM A_ALL WHERE ((X1='1' AND X2='2') OR (X1='3' AND X2='4'));
The 2nd query returns answer while the second is not !
The following is published in the 9.2.0.4 fixed bug list:
" 9204 - 2679062 - Wrong results possible from multi-column INLIST "
I have installed 9.2.0.4 patch set on a win 2000 machine Oracle and saw that the above case is actually solved but our application which has a very similar case doesn't.
After investigating I found the following test case that fails, it reproduces only when you have index on all columns (covering index):
drop table t1_1;
drop table t1_2;
create table t1_1(c1 number, c2 number, c3 number);
create table t1_2(c1 number, c2 number, c3 number);
create index t1_1_ix on t1_1(c1, c2, c3);
create index t1_2_ix on t1_2(c1, c2, c3);
create or replace view t1 as select * from t1_1 union all select * from t1_2;
insert into t1_1 values(1, 2, 100);
insert into t1_2 values(1, 2, 200);
commit;
analyze table t1_1 compute statistics;
analyze table t1_2 compute statistics;
prompt
prompt #######################################
prompt try 1 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( (c2=2) and (c3=100)
prompt
prompt #######################################
prompt try 2 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
(c2=2) and (c3=200)
prompt
prompt #######################################
prompt try 3 - try 1 OR try 2 does not work !
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( ( (c2=2) and (c3=100) )
or
( (c2=2) and (c3=200) )
opened a TAR and wanted to share with you.
Tal Olier ([email protected]). -
Material Stock Report for tcode MB5B
Hello Expert
I have a SAP report for stock posting date with T-Code as MB5B and
the report name is RM07MLBD.
When I enter Material no, plant code , Movement type (101) and selection
dates for a month, The report is displaying but not break by Movement type instead it is showing all the movement type....?
Can anyone have idea about this
REPORT RM07MLBD NO STANDARD PAGE HEADING MESSAGE-ID M7 LINE-SIZE 95.
REPORT RM07MLBD (Transaktionscode MB5B) *
correction June 2004 MM "n747306
wrong the assignment of the MM and FI documents for data "n747306
constellation : n MM doc items --> 1 FI doc item "n747306
ABAP-Preprocessor removed "n599218 A
- this version is for release 4.6C and higher "n599218 A
- process database table OBEW always "n599218 A
- IS-OIL specific functions : "n599218 A
- define IS-OIL workings fields "n599218 A
- transport and process these fields only when "n599218 A
structure MSEG comprise these fields "n599218 A
Improvements : Dec. 2003 MM "n599218
- print the page numbers "n599218
"n599218
- send warnings and error messages only when report is "n599218
launched / advoid warnings when user changes entries on "n599218
the selection screen "n599218
- send warning M7 689 when user does not restrict the "n599218
database in dialog or print mode "n599218
- send warning M7 393 when user deletes the initial "n599218
display variant "n599218
"n599218
- allow to process the fields MAT_KDAUF, MAT_KDPOS, and "n599218
MAT_PSPNR from release 4.5B and higher "n599218
"n599218
- show the current activity and the progress "n599218
"n599218
- error message 'programmfehler' improved "n599218
"n599218
- new categories for scope of list "n599218
"n599218
- use function module for database commit for the update "n599218
of the parameters in table ESDUS. This allows to record "n599218
this transaction for a batch input session using "n599218
transaction SHDB "n599218
"n599218
- reset the entries for plant when valuation level is "n599218
is company code and mode is valuated stock "n599218
"n599218
- enable this report to run in the webreporting mode "n599218
Dec. 2002 MM "n571473
the definition of the selection screen moved from include "n571473
RM07MLBP into this report "n571473
Sept 2002 MM "n555246
log function tax auditor "n555246
note 547170 : August 2002 MM "n547170
- representation of tied empties improved "n547170
active this function automatically in retail systems "n547170
- FORM routines without preprocessor commands and without "n547170
text elements moved to the new include reports "n547170
RM07MLBD_FORM_01and RM07MLBD_FORM_02 "n547170
- the function module FI_CHECK_DATE of note 486477 will "n547170
be processed when it exists "n547170
- function and documentation of parameter XONUL improved "n547170
- display MM documents with MIGO or MB03 depending from "n547170
the release "n547170
- get and save the parameters per user in dialog mode "n547170
only in release >= 4.6 "n547170
the following items were improved with note 497992 "n497992
- wrong results when remaining BSIM entries contain "n497992
an other quantity unit as material master MEINS "n497992
- improve check FI summarization "n497992
- the messages M7 390, M7 391, and M7 392 "n497992
- definition of field g_f_repid for all releases "n497992
- incomplete key for access of internal table IT134M "n497992
causes wrong plant selection "n497992
- the function "no reversal movement" did not surpress "n497992
the original movements; fields "SJAHR" was moved from "n497992
from report RM07MLBD_CUST_FIELDS to RM07MLBD "n497992
- process valuated subcontractor stock from database "n497992
table OBEW if it exists "n497992
- if FI summarization is active process warning M7 390 "n497992
for stock type = valuated stock "n497992
- the user wants to restrict the movement type : process "n497992
warning M7 391 "n497992
- the user wants to surpress the reversal movements : "n497992
process warning M7 392 "n497992
- consider special gain/loss-handling of IS-OIL "n497992
- automatic insert of field WAERS currency key into the "n497992
field catalogue : "n497992
- at least one ref. field is active -> WAERS active "n497992
- all reference fields are hidden -> WAERS hidden "n497992
- the length of sum fields for values was increased "n497992
- customizing for the selection of remaining BSIM entries "n497992
- customizing for the processing of tied empties "n497992
separate time depending authorization for tax auditor "n486477
additional fields are displayed in wrong format "n480130
report RM07MLBD and its includes improved Nov 2001 "n451923
- merging FI doc number into table G_T_MSEG_LEAN improved "n451923
- handling of the short texts improved "n451923
- some types and data definitions -> include RM07MLDD "n451923
error for split valuation and valuated special stock "n450764
process 'goods receipt/issue slip' as hidden field "n450596
error at start date : material without stock has value "n443935
wrong results for docs with customer consignment "W" "n435403
error during data selection for plants "n433765
report RM07MLBD and its includes improved May 10th, 2001 "n400992
!!! IMPORTANT : DO NOT CHANGE OR DELETE THE COMMENT LINES !!! *
- consider the material number during looking for FI documents
- field "g_cust_color" in include report "RM07MLBD_CUST_FIELDS"
allows the customer to activate or inactivate the colors in the
lines with the documents.
- error during calcuation of start stock for special stock "M"
- valuted stocks required : no documents found ? continue and
process empty document table
- the length of sum fields for quantities has been increased
to advoid decimal overflow
- table ORGAN is replaced by G_T_ORGAN
- it is filled by the following ways :
- at process time at selection screen if the
user wants the selection via cc or plant
- otherwise after the database selection of the stock
tables
- it contains less data fields
- it contains all entries twice, for binary search
with plant or valuation area
- selection of databases MKPF and MSEG in one SELECT
command with an inner JOIN
- authority checks after the database selections
- result of database selection from the both database tables
MSEG and MKPF in working table G_F_MSEG_LEAN instead of
the tables IMSEG and IMKPF
- the number of processed data fields was reduced
- the user has the possibility to increase the number of
the processed fields deleting the '*' in the types-command
in include report RM07MLBD_CUST_FIELDS
- the creation of the field catalog for the ALV considers
only the fields of structure G_S_MSEG_LEAN
- the new table G_T_BELEG contains the results for the ALV.
the number of fields of table G_T_BELEG corresponds with
the number of fields of table G_T_MSEG_LEAN.
- the functions "define breakdown" and "choose" are inactivated
in the menue, because they are are not carried out correctly
in all blocks of the list
Anzeige der Materialbestände in einem Zeitintervall *
Der Report gliedert sich im wesentlichen in folgende Verarbeitungs- *
blöcke: *
1) Definition des Einstiegsbildes und Vorbelegung einzelner *
Selektionsfelder, sowie Prüfung der eingegebenen Selektions- *
parameter und Berechtigungsprüfung *
2) Lesen der aktuellen Bestandswerte *
3) Lesen und Verarbeiten der Materialbelege *
4) Berechnung der Bestandswerte zu den vorgegebenen Datümern *
5) Ausgabe der Bestände und Materialbelege *
*eject
*# APP_CALL_DECLARE TEST
this definitions depend on the release
TYPE-POOLS: IMREP, " Typen Bestandsführungsreporting
SLIS. " Typen Listviewer
for the selection of the reversal movements only in release >=45B
DATA: BEGIN OF STORNO OCCURS 0,
MBLNR LIKE MSEG-MBLNR,
MJAHR LIKE MSEG-MJAHR,
ZEILE LIKE MSEG-ZEILE,
SMBLN LIKE MSEG-SMBLN,
SJAHR LIKE MSEG-SJAHR,
SMBLP LIKE MSEG-SMBLP,
END OF STORNO.
include: rm07mldd, " reportspezifische Datendefinitionen
rm07grid. " Gitternetz, Formatierung, Farbgebung
INCLUDE RM07APP1. "ABAP-PREPROCESSOR "TEST
"n571473
define the selection screen here "n571473
"n571473
SELECTION-SCREEN BEGIN OF BLOCK Database-selection
WITH FRAME TITLE TEXT-001.
Text-001: Datenbankabgrenzungen
SELECT-OPTIONS: MATNR FOR MARD-MATNR MEMORY ID MAT
MATCHCODE OBJECT MAT1,
BUKRS FOR T001-BUKRS MEMORY ID BUK,
WERKS FOR T001W-WERKS MEMORY ID WRK,
LGORT FOR T001L-LGORT,
CHARG FOR MCHB-CHARG,
BWTAR FOR MBEW-BWTAR,
BWART FOR MSEG-BWART.
PARAMETERS SOBKZ LIKE MSEG-SOBKZ.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS: DATUM FOR MKPF-BUDAT NO-EXTENSION.
Datumsintervall für Selektion
SELECTION-SCREEN END OF BLOCK Database-selection.
SELECTION-SCREEN BEGIN OF BLOCK BESTANDSART
WITH FRAME TITLE TEXT-002.
Text-002: Bestandsart
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS LGBST LIKE AM07M-LGBST RADIOBUTTON GROUP BART DEFAULT 'X'.
SELECTION-SCREEN COMMENT 4(50) TEXT-010 FOR FIELD LGBST.
Text-010: Lagerort-/Chargenbestand
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS BWBST LIKE AM07M-BWBST RADIOBUTTON GROUP BART.
SELECTION-SCREEN COMMENT 4(50) TEXT-011 FOR FIELD BWBST.
Text-011: bewerteter Bestand
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS SBBST LIKE AM07M-SBBST RADIOBUTTON GROUP BART.
SELECTION-SCREEN COMMENT 4(50) TEXT-012 FOR FIELD SBBST.
Text-012: Sonderbestand
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BESTANDSART.
improved definition of parameters for scope of list "n599218
SELECTION-SCREEN BEGIN OF BLOCK listumfang
with frame title text-003. "Listumfang
the following 3 parameters became obsolete do not use "n599218
anymor. They are still here to inform the user about "n599218
that he is using old variants or SUBMIT commands "n599218
PARAMETERS : "n599218
XONUL LIKE AM07M-XONUL no-display, "n599218
XVBST LIKE AM07M-XVBST no-display, "n599218
XNVBST LIKE AM07M-XNVBS no-display. "n599218
7 new categories for the scope of list "n599218
"n599218
cat. I docs I stock on I I stock on I Parameter "n599218
I I start date I I end date I "n599218
---+--+--------++------+-------- "n599218
1 I yes I = zero I = I = zero I pa_wdzer "n599218
2 I yes I = zero I <> I <> zero I pa_wdzew "n599218
3 I yes I <> zero I <> I = zero I pa_wdwiz "n599218
4 I yes I <> zero I <> I <> zero I pa_wdwuw "n599218
5 I yes I <> zero I = I <> zero I pa_wdwew "n599218
I I I I I "n599218
6 I no I = zero I = I = zero I pa_ndzer "n599218
7 I no I <> zero I = I <> zero I pa_ndsto "n599218
"n599218
definition of the pushbutton : show or hide the following "n599218
parameters for the scope of list "n599218
SELECTION-SCREEN PUSHBUTTON /1(20) PB_LIU "n599218
USER-COMMAND LIU. "n599218
"n599218
text line : materials with movements "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN COMMENT 1(55) TEXT-072 "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
with movements / start = zero = end = zero "n599218
1 I yes I = zero I = I = zero I pa_wdzer "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN POSITION 2. "n599218
PARAMETERS : pa_wdzer LIKE AM07M-MB5B_XONUL "n599218
modif id liu. "n599218
text-083 : no opening stock ; no closing stock "n599218
SELECTION-SCREEN COMMENT 5(70) text-083 "n599218
FOR FIELD pa_wdzer "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
with movements / start = zero = end <> zero "n599218
2 I yes I = zero I <> I <> zero I pa_wdzew "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN POSITION 2. "n599218
PARAMETERS : pa_wdzew LIKE AM07M-MB5B_XONUL "n599218
modif id liu. "n599218
text-084 : no opening stock ; with closing stock "n599218
SELECTION-SCREEN COMMENT 5(70) text-084 "n599218
FOR FIELD pa_wdzew "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
with movements / start stock <> 0 / end stock = 0 "n599218
3 I yes I <> zero I <> I = zero I pa_wdwiz "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN POSITION 2. "n599218
PARAMETERS : pa_wdwiz LIKE AM07M-MB5B_XONUL "n599218
modif id liu. "n599218
text-085 : with opening stock ; no closing stock "n599218
SELECTION-SCREEN COMMENT 5(70) text-085 "n599218
FOR FIELD pa_wdwiz "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
with movements / with start and end stocks / different "n599218
4 I yes I <> zero I <> I <> zero I pa_wdwuw "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN POSITION 2. "n599218
PARAMETERS : pa_wdwuw LIKE AM07M-MB5B_XONUL "n599218
modif id liu. "n599218
with opening stock ; with closing stock ; changed "n599218
SELECTION-SCREEN COMMENT 5(70) text-086 "n599218
FOR FIELD pa_wdwuw "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
with movements / with start and end stock / equal "n599218
5 I yes I <> zero I = I <> zero I pa_wdwew "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN POSITION 2. "n599218
PARAMETERS : pa_wdwew LIKE AM07M-MB5B_XONUL "n599218
modif id liu. "n599218
with opening stock ; with closing stock ; non-changed "n599218
SELECTION-SCREEN COMMENT 5(70) text-087 "n599218
FOR FIELD pa_wdwew "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
text line : materials without movements "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN COMMENT 1(55) TEXT-073 "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
materials without movements / stocks = zero "n599218
6 I no I = zero I = I = zero I pa_ndzer "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN POSITION 2. "n599218
PARAMETERS : pa_ndzer LIKE AM07M-MB5B_XONUL "n599218
modif id liu. "n599218
text-083 : no opening stock ; no closing stock "n599218
SELECTION-SCREEN COMMENT 5(70) text-083 "n599218
FOR FIELD pa_ndzer "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
materials without movements / with start or end stock "n599218
7 I no I <> zero I = I <> zero I pa_ndsto "n599218
SELECTION-SCREEN BEGIN OF LINE. "n599218
SELECTION-SCREEN POSITION 2. "n599218
PARAMETERS : pa_ndsto LIKE AM07M-MB5B_XONUL "n599218
modif id liu. "n599218
with opening stock ; with closing stock ; non-changed "n599218
SELECTION-SCREEN COMMENT 5(70) text-087 "n599218
FOR FIELD pa_ndsto "n599218
modif id liu. "n599218
SELECTION-SCREEN END OF LINE. "n599218
"n599218
SELECTION-SCREEN END OF BLOCK listumfang.
SELECTION-SCREEN BEGIN OF BLOCK EINSTELLUNGEN
WITH FRAME TITLE TEXT-068. "Settings
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
PARAMETERS XSUM LIKE AM07M-XSUM.
SELECTION-SCREEN COMMENT 4(50) TEXT-019 FOR FIELD XSUM.
Text-019: nur Summen
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
PARAMETERS XCHAR LIKE AM07M-XCHRG.
SELECTION-SCREEN COMMENT 4(50) TEXT-015 FOR FIELD XCHAR.
Text-015: nur chargenpflichtige Materialien
Das Kennzeichen 'xchar' bestimmt die Art der Listausgabe entweder
auf Material- oder Chargenebene.
SELECTION-SCREEN END OF LINE.
the function "No reversal movements" is only "n571473
available from relaese 4.5B and higher "n571473
( TEXT-026 : No reversal movements ) "n571473
SELECTION-SCREEN BEGIN OF LINE. "n571473
SELECTION-SCREEN POSITION 1. "n571473
PARAMETERS NOSTO LIKE AM07M-NOSTO. "n571473
SELECTION-SCREEN COMMENT 4(50) TEXT-026 "n571473
FOR FIELD NOSTO. "n571473
SELECTION-SCREEN END OF LINE. "n571473
SELECTION-SCREEN END OF BLOCK EINSTELLUNGEN.
SELECTION-SCREEN BEGIN OF BLOCK LISTE WITH FRAME TITLE TEXT-040.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK LISTE.
*eject
new data definitions
working fields for reading structures from DDIC "n599218 A
and check whether IS-OIL is active "n599218 A
types : stab_x031l type standard table of x031l "n599218 A
with default key. "n599218 A
"n599218 A
data : g_s_x031l type x031l, "n599218 A
g_t_x031l type stab_x031l. "n599218 A
"n599218 A
data : g_f_dcobjdef-name like dcobjdef-name, "n599218 A
g_flag_is_oil_active(01) type c, "n599218 A
g_cnt_is_oil type i. "n599218 A
contains the a structure with the max. number of fields of
the database table MSEG, but those lines are comment lines
with a '*'. The customer can achtivate those lines.
The activated fields will be selected from the database table
and are hidden in the list. With the settings in the display
variant the can be shown.
INCLUDE RM07MLBD_CUST_FIELDS.
common types structure for working tables
a) g_t_mseg_lean results form database selection
b) g_t_beleg data table for ALV
TYPES : BEGIN OF STYPE_MSEG_LEAN,
MBLNR LIKE MKPF-MBLNR,
MJAHR LIKE MKPF-MJAHR,
VGART LIKE MKPF-VGART,
BLART LIKE MKPF-BLART,
BUDAT LIKE MKPF-BUDAT,
CPUDT LIKE MKPF-CPUDT,
CPUTM LIKE MKPF-CPUTM,
USNAM LIKE MKPF-USNAM,
process 'goods receipt/issue slip' as hidden field "n450596
XABLN LIKE MKPF-XABLN, "n450596
LBBSA LIKE T156M-LBBSA,
BWAGR LIKE T156S-BWAGR,
BUKRS LIKE T001-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
WAERS LIKE MSEG-WAERS,
ZEILE LIKE MSEG-ZEILE,
BWART LIKE MSEG-BWART,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
LGORT LIKE MSEG-LGORT,
CHARG LIKE MSEG-CHARG,
BWTAR LIKE MSEG-BWTAR,
KZVBR LIKE MSEG-KZVBR,
KZBEW LIKE MSEG-KZBEW,
SOBKZ LIKE MSEG-SOBKZ,
KZZUG LIKE MSEG-KZZUG,
BUSTM LIKE MSEG-BUSTM,
BUSTW LIKE MSEG-BUSTW,
MENGU LIKE MSEG-MENGU,
WERTU LIKE MSEG-WERTU,
SHKZG LIKE MSEG-SHKZG,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
DMBTR LIKE MSEG-DMBTR,
DMBUM LIKE MSEG-DMBUM,
XAUTO LIKE MSEG-XAUTO,
KZBWS LIKE MSEG-KZBWS,
special flag for retail "n497992
retail(01) type c, "n497992
define the fields for the IO-OIL specific functions "n599218 A
mseg-oiglcalc CHAR 1 "n599218 A
mseg-oiglsku QUAN 13 "n599218 A
oiglcalc(01) type c, "n599218 A
oiglsku(07) type p decimals 3, "n599218 A
insmk like mseg-insmk, "n599218 A
the following fields are used for the selection of
the reversal movements
SMBLN LIKE MSEG-SMBLN, " No. doc
SJAHR LIKE MSEG-SJAHR, " Year "n497992
SMBLP LIKE MSEG-SMBLP. " Item in doc
additional fields : the user has the possibility to activate
these fields in the following include report
INCLUDE TYPE STYPE_MB5B_ADD.
TYPES : END OF STYPE_MSEG_LEAN.
TYPES: STAB_MSEG_LEAN TYPE STANDARD TABLE OF STYPE_MSEG_LEAN
WITH KEY MBLNR MJAHR.
data tables with the results for the ALV
TYPES : BEGIN OF STYPE_BELEGE.
INCLUDE TYPE STYPE_MSEG_LEAN.
TYPES : FARBE TYPE SLIS_T_SPECIALCOL_ALV.
TYPES : END OF STYPE_BELEGE.
TYPES : STAB_BELEGE TYPE STANDARD TABLE OF STYPE_BELEGE
WITH KEY BUDAT MBLNR ZEILE.
DATA : G_T_BELEGE TYPE STAB_BELEGE WITH HEADER LINE,
G_T_BELEGE1 TYPE STAB_BELEGE WITH HEADER LINE.
global working areas data from MSEG and MKPF
FIELD-SYMBOLS : TYPE STYPE_MSEG_LEAN.
DATA : G_S_MSEG_LEAN TYPE STYPE_MSEG_LEAN,
G_S_MSEG_UPDATE TYPE STYPE_MSEG_LEAN, "n443935
G_T_MSEG_LEAN TYPE STAB_MSEG_LEAN.
working table for the control break "n451923
types : begin of stype_mseg_work. "n451923
include type stype_mseg_lean. "n451923
types : tabix like sy-tabix, "n451923
end of stype_mseg_work, "n451923
"n451923
stab_mseg_work type standard table of "n451923
stype_mseg_work "n451923
with default key. "n451923
"n451923
data : g_t_mseg_work type stab_mseg_work, "n443935
g_s_mseg_work type stype_mseg_work. "n443935
working table for the requested field name from MSEG and MKPF
TYPES: BEGIN OF STYPE_FIELDS,
FIELDNAME TYPE NAME_FELD,
END OF STYPE_FIELDS.
TYPES: STAB_FIELDS TYPE STANDARD TABLE OF STYPE_FIELDS
WITH KEY FIELDNAME.
DATA: G_T_MSEG_FIELDS TYPE STAB_FIELDS,
G_S_MSEG_FIELDS TYPE STYPE_FIELDS.
working table for the requested numeric fields of MSEG
types : begin of stype_color_fields,
FIELDNAME TYPE NAME_FELD,
type(01) type c,
end of stype_color_fields,
stab_color_fields type standard table of
stype_color_fields
with default key.
data: g_t_color_fields type stab_color_fields
with header line.
DATA: BEGIN OF IMSWEG OCCURS 1000,
MBLNR LIKE MSEG-MBLNR,
MJAHR LIKE MSEG-MJAHR,
ZEILE LIKE MSEG-ZEILE,
MATNR LIKE MSEG-MATNR,
CHARG LIKE MSEG-CHARG,
BWTAR LIKE MSEG-BWTAR,
WERKS LIKE MSEG-WERKS,
LGORT LIKE MSEG-LGORT,
SOBKZ LIKE MSEG-SOBKZ,
BWART LIKE MSEG-BWART,
SHKZG LIKE MSEG-SHKZG,
XAUTO LIKE MSEG-XAUTO,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
DMBTR LIKE MSEG-DMBTR,
DMBUM LIKE MSEG-DMBUM,
BUSTM LIKE MSEG-BUSTM,
BUSTW LIKE MSEG-BUSTW, "147374
define the fields for the IO-OIL specific functions "n599218 A
mseg-oiglcalc CHAR 1 "n599218 A
mseg-oiglsku QUAN 13 "n599218 A
oiglcalc(01) type c, "n599218 A
oiglsku(07) type p decimals 3, "n599218 A
insmk like mseg-insmk, "n599218 A
END OF IMSWEG.
User settings for the checkboxes "n547170
DATA: oref_settings TYPE REF TO cl_mmim_userdefaults. "n547170
*eject
HAUPTPROGRAMM *********************************
F4-Hilfe für Reportvariante -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
"n599218
INITIALIZATION "n599218
"n599218
"n599218
pay attentions : this process time will not be processed "n599218
in the webreporting mode "n599218
INITIALIZATION.
PERFORM APP_PROCESS USING 'ME'. "TEST
PERFORM initialisierung.
get the parameters from the last run "n547170
perform esdus_get_parameters. "n547170
set flag when INITILIZATION is processed
move 'X' to g_flag_initialization.
"n599218
AT SELECTION-SCREEN "n599218
"n599218
Prüfung der eingegebenen Selektionsparameter, -
Berechtigungsprüfung -
AT SELECTION-SCREEN.
the following 3 parameters XONUL, XVBST, and XNVBST "n599218
became obsolete; send error when they should be filled. "n599218
This could be possible if the user works with old "n599218
selection variants or this report is launched by a "n599218
SUBMIT command "n599218
if XONUL is initial and "n599218
XVBST is initial and "n599218
XNVBST is initial. "n599218
ok, the old parameters are empty "n599218
else. "n599218
text-088 : note 599218 : obsolete parameter used "n599218
MESSAGE E895 with text-088. "n599218
endif.
did the user hit the pushbutton "Category" ? "n599218
case SSCRFIELDS-UCOMM. "n599218
when 'LIU '. "n599218
yes, the pushbutton "Category" was hit "n599218
IF g_flag_status_liu = C_HIDE. "n599218
show the 7 parameters on the selection srceen "n599218
MOVE C_SHOW TO g_flag_status_liu. "n599218
ELSE. "n599218
hide the 7 paramaters "n599218
MOVE C_HIDE TO g_flag_status_liu. "n599218
ENDIF. "n599218
ENDcase. "n599218
"n599218
go on only if the user wants to launch this report "n599218
check : sy-ucomm = 'ONLI' or "n599218
sy-ucomm = 'PRIN' or "n599218
sy-ucomm = 'SJOB'. "n599218
PERFORM eingaben_pruefen.
check whether FI summarization is active and other "n547170
restrictions could deliver wrong results "n547170
perform f0800_check_restrictions. "n547170
- the user wants to surpress the reversal movements : "n497992
process warning M7 392 "n497992
IF NOT NOSTO IS INITIAL. "n497992
emerge warning ? "n497992
CALL FUNCTION 'ME_CHECK_T160M' "n497992
EXPORTING "n497992
I_ARBGB = 'M7' "n497992
I_MSGNR = '392' "n497992
EXCEPTIONSPlease read the KBA document 2012912 - Changeablility of the field "material group" in purchasing documents
It clearly says that material group can't be changed in case you will use material master in purchase order.
So, it is clear that you can't use different material group for material master in purchase order.
For stock report, system will only show you the material group which is assigned to the material master (MARA-MATKL). System will not look into the purchase order section (like EKPO). -
Finacial statement report Comparison with Previous year in report painter
Hi Experts,
I am new to report Painter.I developed financial statement report in report painter with following data:
Table: FAGLFLEXT
Rows:GL Account Hierarchy(defined Manually)
General data selection: Ledger
Column 1: CCode,record type,version,period,fiscalyear
Column 2: Ccode,record type,version,period,fiscalyear
I tried various variables for fiscal year in both columns but in general data selection two fiscal year fields appeared and in output it is showing values according to only one fiscal year field in general data selection hence it is displaying values only in first columns and empty values in second column.
I hardcoded fiscal year values in both columns but still fiscal year field is appearing in general data selection and value input to that fiscal year results in displaying values in first column and empty values in second column in output.Please let me know where i went wrong.
Thanks&Regards,
narasimha.Hi Narasimha,
Can you please post your solution.
Thanks,
Srini -
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 . -
Wrong results after upgrading 10g database to 11.2.0.2.6
Hi,
Do anyone know, why the following query results are different?
Not Working query:
sql1:
select col1 from tab1
where col1 = (select '123' from dual)
Working query:
sql2:
select col1 from tab1
where col1 = '123';
Both the sql1 and sql2 are returning same reseults in 10g database , but not in 11g.Pl post OS details along with sample outputs and explain plans from the the sql1 statement from the two databases. These MOS Docs may help also
Things to Consider Before Upgrading to 11.2.0.2 to Avoid Poor Performance or Wrong Results [ID 1320966.1]
Wrong Results on 11.2.0.2 with Function-Based Index and OR Expansion [ID 1264550.1]
Wrong Results/No Rows for Sql Involving Functions in 11.2.0.2. [ID 1380679.1]
HTH
Srini -
What is material Yeilding report
hi ,
what is material yeilding report , is there any standard program for determing the same . If any one has the sample code for the same it will be of great use for me .
thanks in advance ...Hello
I am not sure if you saied "ExpectYieldVar" in production order/process order, you can Press F4 this field for SAP help, saied"Expected yield variance
Specifies whether a yield variance is to be expected when the finished product is delivered to stock, as the result of confirmations that have already been entered.
A yield deficit occurs during final confirmation of operations, as soon as a yield quantity is confirmed that is smaller than the planned order quantity. The confirmed scrap is not taken into account.
A yield increment occurs during partial confirmation or final confirmation of operations, as soon as a yield quantity is confirmed that is greater than the planned order quantity. The confirmed scrap is not taken into account."
also you can use COOIS report for order Yield in header level .
Benny -
Hi All,
I am working on comparitive statement report,i am getting the output in horizontal rows in ALV.
But i have to get it like ME49 output. i.e.,
Vendor number----
Vendor Number
100016----
100017
Gross Price 200----
250
Vat 8.00----
4.00
Discount 1.00----
1.00
i have tried it using fieldcatalog_merge, list_display,Grd_dislay,but it did not work
can anybody help me out to put these horizontal rows,vertically like as above mentioned.
Thanks in Advance.
With Regards,
Sharmishta.see the following example
*REPORT z_alv_hierseq_list.
Program with FM REUSE_ALV_HIERSEQ_LIST_DISPLAY
TYPE-POOLS: slis. " ALV Global types
CONSTANTS :
c_x VALUE 'X',
c_gt_vbap TYPE slis_tabname VALUE 'GT_VBAP',
c_gt_vbak TYPE slis_tabname VALUE 'GT_VBAK'.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(02) TYPE n DEFAULT '10' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_2 FOR FIELD p_expand. "#EC NEEDED
PARAMETERS p_expand AS CHECKBOX DEFAULT c_x.
SELECTION-SCREEN END OF LINE.
TYPES :
1st Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
kunnr TYPE vbak-kunnr, " Sold-to party
netwr TYPE vbak-netwr, " Net Value of the Sales Order
erdat TYPE vbak-erdat, " Creation date
waerk TYPE vbak-waerk, " SD document currency
expand TYPE xfeld,
END OF ty_vbak,
2nd Table
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document
matnr TYPE vbap-matnr, " Material number
arktx TYPE vbap-arktx, " Material description
netwr TYPE vbap-netwr, " Net Value of the Sales Order
waerk TYPE vbap-waerk, " SD document currency
END OF ty_vbap.
DATA :
1st Table
gt_vbak TYPE TABLE OF ty_vbak,
2nd Table
gt_vbap TYPE TABLE OF ty_vbap.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
v_2 = 'With ''EXPAND'' field'.
START-OF-SELECTION.
Read Sales Document: Header Data
SELECT vbeln kunnr netwr waerk erdat
FROM vbak
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_vbak.
IF gt_vbak[] IS NOT INITIAL.
Read Sales Document: Item Data
SELECT vbeln posnr matnr arktx netwr waerk
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE gt_vbap
FOR ALL ENTRIES IN gt_vbak
WHERE vbeln = gt_vbak-vbeln.
ENDIF.
END-OF-SELECTION.
PERFORM f_display.
Form F_DISPLAY
FORM f_display.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-tabname = &1.
ls_fieldcat-fieldname = &2.
ls_fieldcat-ref_tabname = &3.
ls_fieldcat-cfieldname = &4. " Field with currency unit
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-tabname = &1.
ls_sort-fieldname = &2.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_layout TYPE slis_layout_alv,
ls_keyinfo TYPE slis_keyinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv," Sort table
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog
ls_layout-group_change_edit = c_x.
ls_layout-colwidth_optimize = c_x.
ls_layout-zebra = c_x.
ls_layout-detail_popup = c_x.
ls_layout-get_selinfos = c_x.
IF p_expand = c_x.
ls_layout-expand_fieldname = 'EXPAND'.
ENDIF.
Build field catalog and sort table
m_fieldcat c_gt_vbak 'VBELN' 'VBAK' ''.
m_fieldcat c_gt_vbak 'KUNNR' 'VBAK' ''.
m_fieldcat c_gt_vbak 'NETWR' 'VBAK' 'WAERK'.
m_fieldcat c_gt_vbak 'WAERK' 'VBAK' ''.
m_fieldcat c_gt_vbak 'ERDAT' 'VBAK' ''.
m_fieldcat c_gt_vbap 'POSNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'MATNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'ARKTX' 'VBAP' ''.
m_fieldcat c_gt_vbap 'NETWR' 'VBAP' 'WAERK'.
m_fieldcat c_gt_vbap 'WAERK' 'VBAP' ''.
m_sort c_gt_vbak 'KUNNR'.
m_sort c_gt_vbap 'NETWR'.
ls_keyinfo-header01 = 'VBELN'.
ls_keyinfo-item01 = 'VBELN'.
ls_keyinfo-item02 = 'POSNR'.
Dipslay Hierarchical list
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
i_tabname_header = c_gt_vbak
i_tabname_item = c_gt_vbap
is_keyinfo = ls_keyinfo
i_save = 'A'
TABLES
t_outtab_header = gt_vbak
t_outtab_item = gt_vbap
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " F_LIST_DISPLAY
Form USER_COMMAND *
FORM user_command USING i_ucomm TYPE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
DATA ls_vbak TYPE ty_vbak.
CASE i_ucomm.
WHEN '&IC1'. " Pick
CASE is_selfield-tabname.
WHEN c_gt_vbap.
WHEN c_gt_vbak.
READ TABLE gt_vbak INDEX is_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
Sales order number
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
Display Sales Order
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND -
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-PAGEIt 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. -
Select for update gives wrong results. Is it a bug?
Hi,
Select for update gives wrong results. Is it a bug?
CREATE TABLE TaxIds
TaxId NUMBER(6) NOT NULL,
LocationId NUMBER(3) NOT NULL,
Status NUMBER(1)
PARTITION BY LIST (LocationId)
PARTITION P111 VALUES (111),
PARTITION P222 VALUES (222),
PARTITION P333 VALUES (333)
ALTER TABLE TaxIds ADD ( CONSTRAINT PK_TaxIds PRIMARY KEY (TaxId));
CREATE INDEX NI_TaxIdsStatus ON TaxIds ( NVL(Status,0) ) LOCAL;
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100101, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100102, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100103, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100104, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200101, 222, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200102, 222, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200103, 222, NULL);
--Session_1 return TAXID=100101
select TAXID from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_2 waits commit
select TAXID from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_1
update TAXIDS set STATUS=1 Where TaxId=100101;
commit;
--Session_2 return 100101 opps!?
--Session_1 return TAXID=100102
select TAXID, STATUS from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_2 waits commit
select TAXID, STATUS from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_1
update TAXIDS set STATUS=1 Where TaxId=100102;
commit;
--Session_2 return 100103This is a bug. Got to be a bug.
This should be nothing to do with indeterminate results from ROWNUM, and nothing to do with read consistency at the point of statement start time in session2., surely.
Session 2 should never return 100101 once the lock from session 1 is released.
The SELECT FOR UPDATE should restart and 100101 should not be selected as it does not meet the criteria of the select.
A statement restart should ensure this.
A number of demos highlight this.
Firstly, recall the original observation in the original test case.
Setup
SQL> DROP TABLE taxids;
Table dropped.
SQL>
SQL> CREATE TABLE TaxIds
2 (TaxId NUMBER(6) NOT NULL,
3 LocationId NUMBER(3) NOT NULL,
4 Status NUMBER(1))
5 PARTITION BY LIST (LocationId)
6 (PARTITION P111 VALUES (111),
7 PARTITION P222 VALUES (222),
8 PARTITION P333 VALUES (333));
Table created.
SQL>
SQL> ALTER TABLE TaxIds ADD ( CONSTRAINT PK_TaxIds PRIMARY KEY (TaxId));
Table altered.
SQL>
SQL> CREATE INDEX NI_TaxIdsStatus ON TaxIds ( NVL(Status,0) ) LOCAL;
Index created.
SQL>
SQL>
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100101, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100102, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100103, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100104, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200101, 222, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200102, 222, NULL);
1 row created.
SQL> commit;
Commit complete.
SQL> Original observation:
Session1>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100101
Session1>
--> Session 2 with same statement hangs until
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> At which point, Session 2 returns
Session2>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100101
Session2>There's no way that session 2 should have returned 100101. That is the point of FOR UPDATE. It completely reintroduces the lost UPDATE scenario.
Secondly, what happens if we drop the index.
Let's reset the data and drop the index:
Session1>UPDATE taxids SET status=0 where taxid=100101;
1 row updated.
Session1>commit;
Commit complete.
Session1>drop index NI_TaxIdsStatus;
Index dropped.
Session1>Then try again:
Session1>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100101
Session1>
--> Session 2 hangs again until
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> At which point in session 2:
Session2>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100102
Session2>Proves nothing, Non-deterministic ROWNUM you say.
Then let's reset, recreate the index and explicity ask then for row 100101.
It should give the same result as the ROWNUM query without any doubts over the ROWNUM, etc.
If the original behaviour was correct, session 2 should also be able to get 100101:
Session1>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND taxid = 100101
6 FOR UPDATE;
TAXID
100101
Session1>
--> same statement hangs in session 2 until
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> so session 2 stops being blocked and:
Session2>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND taxid = 100101
6 FOR UPDATE;
no rows selected
Session2>Of course, this is how it should happen, surely?
Just to double check, let's reintroduce ROWNUM but force the order by to show it's not about read consistency at the start of the statement - restart should prevent it.
(reset, then)
Session1> select t.taxid
2 from
3 (select taxid, rowid rd
4 from taxids
5 where locationid = 111
6 and nvl(status,0) = 0
7 order by taxid) x
8 , taxids t
9 where t.rowid = x.rd
10 and rownum = 1
11 for update of t.status;
TAXID
100101
Session1>
--> Yes, session 2 hangs until...
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> and then
Session2> select t.taxid
2 from
3 (select taxid, rowid rd
4 from taxids
5 where locationid = 111
6 and nvl(status,0) = 0
7 order by taxid) x
8 , taxids t
9 where t.rowid = x.rd
10 and rownum = 1
11 for update of t.status;
TAXID
100102
Session2>Session 2 should never be allowed to get 100101 once the lock is released.
This is a bug.
The worrying thing is that I can reproduce in 9.2.0.8 and 11.2.0.2. -
Simple query with like return wrong result
Hi,
I run simple query with like.
If I use parameter I get wrong results.
If I use query without parameter results are ok.
My script:
ALTER SESSION SET NLS_SORT=BINARY_CI;
ALTER SESSION SET NLS_COMP=LINGUISTIC;
-- drop table abcd;
create table abcd (col1 varchar2(10));
INSERT INTO ABCD VALUES ('122222');
insert into abcd values ('111222');
SELECT * FROM ABCD WHERE COL1 LIKE :1; -- wrong result with value 12%
COL1
122222
*111222*
select * from abcd where col1 like '12%'; -- result ok
COL1
122222
I use Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
and query run in Oracle SQL Developer 3.1.07.Hi,
welcome to the forum.
When you put some code please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
You should specify exactly how you run your code.
If I run this statement in SQL Plus:SQL> ALTER SESSION SET NLS_SORT=BINARY_CI;
Session altered.
SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;
Session altered.
SQL>
SQL> -- drop table abcd;
SQL> create table abcd (col1 varchar2(10));
Table created.
SQL>
SQL> INSERT INTO ABCD VALUES ('122222');
1 row created.
SQL> insert into abcd values ('111222');
1 row created.
SQL>
SQL> SELECT * FROM ABCD WHERE COL1 LIKE :1;
SP2-0552: Bind variable "1" not declared.
SQL>
I got this error. So I wonder how you set value 12%
Please specify exactly how you run your test as we cannot reproduce your problem.
Regards.
Al -
Not able to see the result in particular column of BPC report
Dear All,
I have problem in one of the BPC report where I am not able to see the result into one column but rest of the users are able to see the result for same column in same report without any issues.
Generally, I used this report frequently but having such problem from last few days. Excel has created any logs which I need to clear? Please advice.
Request your help to resolve such problem please.
If you need any information, please let me know.
Thank You
Kind Regards
AnukulHello Anukul,
In the report what type of data you are trying to check in that column. can you please brief about report.
And also please check the excel cell format (right click and check it is a numeric or character), which may help to resolve this issue.
Regards,
Rajesh.K -
Hi
I need the Material Ageing report as the given following requirement
1) Material With GR Date
2) The Ageing will be for 30, 60, 90, 180, 270, 360
3) Material with Normal & Special Stock
4) Material with the Split Valuation
If any one have worked on this developement then ReplyHi,
Check the report in t.codes MC.9,MC.A,MC.B & MC.C
OR
Go for development with an ABAP report
Regards,
Biju K -
AR Customer statements report Page numbers Reset based on customer number
Hello,
In the AR Customer statements report, If I ran the report for multiple customers, page number has to be reset for each customer...
Group Started like below,
<?for-each-group:G_STATEMENT;STATEMENT_DATE?><?for-each-group:current-group();SEND_TO_ADDRESS_ID?>Hi Kittu,
I got the answer using @section command.
Below are the complete syntax in my case.
Form field --Xml Tag
If Data Found --<?choose@section:?><?when:count(G_SETUP)!=0?>
Group G_SETUP --<?for-each@section:G_SETUP?>
Group G_STATEMENT --<?for-each-group@section:G_STATEMENT;STATEMENT_DATE?><?for-each-group@section:current-group();SEND_TO_ADDRESS_ID?>
Its working for me.
Let me know if you required more information.
Regards,
Dasarath
Maybe you are looking for
-
Very urgent:Updating maintenance view
Hi I would like to know that if i update a maintenance view and attach the same to the request,will it be included in the correction instructions ? Or do i need to do anything special for the same? Please let me know Regards Leon
-
How can I get rejected photos out of LR5 and off the HD?
When I try to deleted rejected photos in LR5 on my iMac, I get a dialog saying they can't be sent to the trash. How can I get unwanted photos out of LR5 and off the hard drive?
-
This is my situation: (been banging my head against the wall voer this thing. Hopefully I can get some direction here.) I have a system for reserving one single condo unit. An admin can enter the specific rates for the unit based on the time of year.
-
I was wondering if you could help we with this. PART 1 i have a table of students info. I give the students praise points for doing well in the lesson. I want to compare two students's praise points, if one is bigger (Higher) than the other i want to
-
Using my parents' Mac OS X 10.5 to replace my 10.4?
I have a MacBook with OS X 10.4. My parents got a computer about 3 years ago that has OS X 10.5. I was looking through the software discs, and saw a couple for the installation of the 10.5. Now... my question is this: Would it be at all possible for