Posted: Sat Sep 20, 2008 10:18 pm Post subject: MB5B improved
Code:
REPORT Y_AC_RM07MLBD NO STANDARD PAGE HEADING MESSAGE-ID M7 LINE-SIZE 280.
*MB5B improved regarding accessibilty "n773673
*- the top_of_page headlines are now printed with the
*ALV tools
*- the non ALV sum function was replaced by a hierarchical
*and a non-hierarchical ALV lists
*- double click in the sum lists shows the normal list for
*the selected material
*- the function special processing was changed : This
*function depended on the retail system settings or
*a modifiaction. Now this function depends on the found
*MM documents
*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 Materialbestande in einem Zeitintervall *
************************************************************************
*Der Report gliedert sich im wesentlichen in folgende Verarbeitungs- *
*blocke: *
*1) Definition des Einstiegsbildes und Vorbelegung einzelner *
*Selektionsfelder, sowie Prufung der eingegebenen Selektions- *
*parameter und Berechtigungsprufung *
*2) Lesen der aktuellen Bestandswerte *
*3) Lesen und Verarbeiten der Materialbelege *
*4) Berechnung der Bestandswerte zu den vorgegebenen Datumern *
*5) Ausgabe der Bestande und Materialbelege *
************************************************************************
*-----------------------------------------------------------"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.
***********
************
*************
*FINAL CHANGE BY ALKA 07.02.08
*SELECT-OPTIONS: DATUM FOR BSIM-BUDAT ,
*S_SAKTO FOR MSEG-SAKTO.
************
*************
*FINAL CHANGE BY ALKA 07.02.08*2
SELECT-OPTIONS: DATUM FOR MKPF-BUDAT NO-EXTENSION,
************ALKA****
SAKTO FOR BSEG-HKONT NO-EXTENSION.
*************end change***********
*Datumsintervall fur 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.
----------------------------------------------------------------------
*Commented By Rachit Material group Not Required
*improved definition of parameters for scope of list "n599218
*SELECTION-SCREEN BEGIN OF BLOCK MARA WITH FRAME TITLE TEXT-040.
**selection-screen begin of line.
*PARAMETERS P_MATKL LIKE MARA-MATKL.
*
**selection-screen end of line.
**SELECTION-SCREEN COMMENT 4(50) TEXT-030 for fieLD s_matkl.
*SELECTION-SCREEN END OF BLOCK MARA.
*
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
*parameter for totals only - hierseq. list
*corresponding display variant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
PARAMETERS XSUM LIKE AM07M-XSUM.
SELECTION-SCREEN COMMENT 4(60) TEXT-090 FOR FIELD XSUM.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(30) TEXT-091 FOR FIELD PA_SUVAR.
*Commented by Rachit
SELECTION-SCREEN POSITION 40.
PARAMETERS: PA_SUVAR LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF LINE.
*parameter for totals only - flat list + corresponding display variant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
PARAMETERS PA_SUMFL LIKE AM07M-XSUM.
SELECTION-SCREEN COMMENT 4(60) TEXT-092 FOR FIELD PA_SUMFL.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(30) TEXT-091 FOR FIELD PA_SFLVA.
SELECTION-SCREEN POSITION 40.
PARAMETERS: PA_SFLVA LIKE DISVARIANT-VARIANT.
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.
----------------------------------------------------------------------
*Rachit
SELECTION-SCREEN BEGIN OF BLOCK LISTE WITH FRAME TITLE TEXT-040.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK LISTE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_SUVAR.
PERFORM VARIANT_VALUE_REQUEST_F4
USING PA_SUVAR G_S_VARI_SUMHQ.
*-----------------------------------------------------------"n599218
*INITIALIZATION "n599218
*-----------------------------------------------------------"n599218
"n599218
*pay attentions : this process time will not be processed "n599218
*in the webreporting mode "n599218
*preprae the working areas for the variants
MOVE : REPID TO G_S_VARI_SUMHQ-REPORT,
'SUHQ' TO G_S_VARI_SUMHQ-HANDLE,
REPID TO G_S_VARI_SUMFL-REPORT,
'SUFL' TO G_S_VARI_SUMFL-HANDLE.
MOVE-CORRESPONDING : G_S_VARI_SUMHQ TO G_S_VARI_SUMHQ_DEF,
G_S_VARI_SUMFL TO G_S_VARI_SUMFL_DEF.
PERFORM GET_THE_DEFAULT_VARIANT
USING PA_SFLVA
G_S_VARI_SUMFL
G_S_VARI_SUMFL_DEF.
PERFORM GET_THE_DEFAULT_VARIANT
USING PA_SUVAR
G_S_VARI_SUMHQ
G_S_VARI_SUMHQ_DEF.
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.
----------- Prufung der eingegebenen Selektionsparameter, ------------
---------------------- Berechtigungsprufung --------------------------
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
*only one sum function can be processed
IF XSUM = 'X' AND
PA_SUMFL = 'X'.
SET CURSOR FIELD 'XSUM'.
*select one sum list only
MESSAGE E895 WITH TEXT-093.
ENDIF.
PERFORM EINGABEN_PRUEFEN.
SET CURSOR FIELD 'PA_SFLVA'.
PERFORM VARIANT_CHECK_EXISTENCE
USING PA_SFLVA
G_S_VARI_SUMFL
G_S_VARI_SUMFL_DEF.
SET CURSOR FIELD 'PA_SUVAR'.
PERFORM VARIANT_CHECK_EXISTENCE
USING PA_SUVAR
G_S_VARI_SUMHQ
G_S_VARI_SUMHQ_DEF.
*
*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
EXCEPTIONS "n497992
NOTHING = 0 "n497992
OTHERS = 1. "n497992
"n497992
IF SY-SUBRC 0. "n497992
SET CURSOR FIELD 'NOSTO'. "n497992
*to surpress the reversal movements could cause ... "n497992
MESSAGE W392. "n497992
ENDIF. "n497992
ENDIF. "n497992
*carry out special authotity check for the tax auditor "n547170
PERFORM TPC_CHECK_TAX_AUDITOR. "n547170
*does the user wants a selection via company code or a plant ?
*fill range table g_ra_werks
REFRESH : G_RA_BWKEY, G_RA_WERKS, G_T_ORGAN.
CLEAR : G_RA_BWKEY, G_RA_WERKS, G_T_ORGAN, G_S_ORGAN.
REFRESH : G_0000_RA_BWKEY, G_0000_RA_WERKS, G_0000_RA_BUKRS.
CLEAR : G_0000_RA_BWKEY, G_0000_RA_WERKS, G_0000_RA_BUKRS.
IF G_F_CNT_LINES_BUKRS > 0 OR
G_F_CNT_LINES_WERKS > 0.
*fill range tables for the CREATION OF TABLE G_T_ORGAN
MOVE : WERKS] TO G_0000_RA_WERKS[,
BUKRS] TO G_0000_RA_BUKRS[.
PERFORM F0000_CREATE_TABLE_G_T_ORGAN
USING C_ERROR.
ENDIF.
*save the parameters of this run "n547170
PERFORM ESDUS_SAVE_PARAMETERS. "n547170
AT SELECTION-SCREEN OUTPUT. "n599218
"n599218
IF G_FLAG_INITIALIZATION IS INITIAL. "n599218
*the process time INITIALIZATION was not done, so "n599218
*carry out the functions here "n599218
MOVE 'X' TO G_FLAG_INITIALIZATION. "n599218
"n599218
PERFORM INITIALISIERUNG. "n599218
"n599218
*get the parameters from the last run "n599218
PERFORM ESDUS_GET_PARAMETERS. "n599218
ENDIF. "n599218
"n599218
*how to handle the 7 paramaters for the scope of list ? "n599218
LOOP AT SCREEN. "n599218
*modify the selection screen "n599218
CASE SCREEN-GROUP1. "n599218
WHEN 'LIU'. "n599218
IF G_FLAG_STATUS_LIU = C_SHOW. "n599218
SCREEN-ACTIVE = '1'. "show parameters "n599218
ELSE. "n599218
SCREEN-ACTIVE = '0'. "Hide parameters "n599218
ENDIF. "n599218
"n599218
MODIFY SCREEN. "n599218
ENDCASE. "n599218
ENDLOOP. "n599218
"n599218
*adapt the icon on the pushbutton depending on the status "n599218
CASE G_FLAG_STATUS_LIU. "n599218
WHEN C_HIDE. "n599218
MOVE TEXT-081 TO PB_LIU. "@0E\Q@ Scope ... "n599218
WHEN C_SHOW. "n599218
MOVE TEXT-082 TO PB_LIU. "@0H\Q@ Scope ... "n599218
WHEN OTHERS. "n599218
ENDCASE. "n599218
"n599218
*-----------------------------------------------------------"n599218
*If no date is given at all, the range is set to the maximum
*extend (1.1.0000 - 31.12.9999).
*If only datum-low is set, it is interpreted as the day for
*which the analysis is wanted --> datum-high is filled up.
IF DATUM-LOW IS INITIAL.
DATUM-LOW = '00000101'.
IF DATUM-HIGH IS INITIAL.
DATUM-HIGH = '99991231'.
ENDIF.
ELSE.
IF DATUM-HIGH IS INITIAL.
DATUM-HIGH = DATUM-LOW.
ENDIF.
ENDIF.
MOVE: DATUM-LOW(4) TO JAHRLOW,
DATUM-LOW+4(2) TO MONATLOW,
DATUM-LOW+6(2) TO TAGLOW,
DATUM-HIGH(4) TO JAHRHIGH,
DATUM-HIGH+4(2) TO MONATHIGH,
DATUM-HIGH+6(2) TO TAGHIGH.
SET TITLEBAR 'MAN'
WITH TAGLOW MONATLOW JAHRLOW TAGHIGH MONATHIGH JAHRHIGH.
*create the headlines using the titelbar "n599218
PERFORM CREATE_HEADLINE. "n599218
*calculate the offsets for the list header
PERFORM CALCULATE_OFFSETS.
*for the representation of tied empties "n547170
PERFORM F0700_PREPARE_TIED_EMPTIES. "n547170
*create table g_t_mseg_fields with the names of all
*wanted fields from MSEG and MKPF
PERFORM F0300_GET_FIELDS.
*set a break-point : is IS-OIL active ? "n599218 A
"n599218 A
*check whether this is a IS-OIL system "n599218 A
PERFORM CHECK_IS_OIL_SYSTEM. "n599218 A
"n599218 A
IF G_FLAG_IS_OIL_ACTIVE = 'X'. "IS-OIL ? "n599218 A
*the 2 IS-OIL specific data fields will be inserted into "n599218 A
*working table G_T_MSEG_FIELDS. Then these fields will "n599218 A
*transported from database table MSEG, too "n599218 A
APPEND 'MSEG~OIGLCALC' TO G_T_MSEG_FIELDS. "n599218 A
APPEND 'MSEG~OIGLSKU' TO G_T_MSEG_FIELDS. "n599218 A
ENDIF. "n599218 A
*create the ALV fieldcatalog for the main list always
MOVE 'G_T_BELEGE' TO G_F_TABNAME.
PERFORM F0400_CREATE_FIELDCAT.
*do not print the ALV-statistics and selection criteria
CLEAR G_S_PRINT.
G_S_PRINT-NO_PRINT_SELINFOS = 'X'.
G_S_PRINT-NO_PRINT_LISTINFOS = 'X'."
*create the range table for the storage location
PERFORM F0600_CREATE_RANGE_LGORT.
*- show the current activity and the progress "n599218
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' "n599218
EXPORTING "n599218
TEXT = TEXT-063. "Reading current stocks "n599218
*get the stock tables
PERFORM AKTUELLE_BESTAENDE.
PERFORM TABELLEN_LESEN.
*- show the current activity and the progress "n599218
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' "n599218
EXPORTING "n599218
TEXT = TEXT-064. "Reading MM documents "n599218
*results of all the autority checks
PERFORM F9100_AUTH_PLANT_RESULT.
*- show the current activity and the progress "n599218
IF BWBST = 'X'. "n599218
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' "n599218
EXPORTING "n599218
TEXT = TEXT-066. "Calculating Stocks and Values "n599218
ELSE. "n599218
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' "n599218
EXPORTING "n599218
TEXT = TEXT-067. "Calculating Stocks "n599218
ENDIF. "n599218
PERFORM SUMMEN_BILDEN.
PERFORM BESTAENDE_BERECHNEN.
PERFORM LISTUMFANG.
*- show the current activity and the progress "n599218
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' "n599218
EXPORTING "n599218
TEXT = TEXT-065. "Preparing list output "n599218
*stop if table bestand is empty
LOOP AT BESTAND.
SELECT SINGLE MATKL FROM MARA INTO CORRESPONDING FIELDS OF BESTAND
WHERE
MATNR = BESTAND-MATNR.
MODIFY BESTAND INDEX SY-TABIX.
ENDLOOP.
DESCRIBE TABLE BESTAND LINES G_F_CNT_LINES.
IF G_F_CNT_LINES IS INITIAL.
*Keinen Eintrag zu den Suchbegriffen gefunden/selektiert
MESSAGE S083.
*perform anforderungsbild.
ELSE.
*process log function if the use is a tax auditor "n555246
*and the database selection was successful "n555246
IF G_FLAG_TPCUSER = '1'. "n555246
PERFORM TPC_WRITE_LOG. "n555246
ENDIF. "n555246
PERFORM FELDGRUPPEN_AUFBAUEN.
*sort table with header data per material
IF BWBST IS INITIAL.
SORT BESTAND BY MATNR WERKS CHARG.
ELSE.
SORT BESTAND BY MATNR BWKEY.
ENDIF.
*which function does the user want ?
IF XSUM = 'X'.
*hierseq. alv with sums
PERFORM CREATE_TABLE_TOTALS_HQ.
PERFORM CREATE_FIELDCAT_TOTALS_HQ.
PERFORM ALV_HIERSEQ_LIST_TOTALS.
ENDIF.
IF FLAG NE 'X'.
IF PA_SUMFL = 'X'.
*elseif pa_sumfl = 'X'.
*show the sums only in a flat ALV
PERFORM CREATE_TABLE_TOTALS_FLAT.
PERFORM CREATE_FIELDCAT_TOTALS_FLAT.
PERFORM ALV_FLAT_LIST_SUMS_ONLY.
ELSE.
*display the full list using the APPEND ALV
*PERFORM BESTAENDE_AUSGEBEN.
ENDIF.
ENDIF.
FLAG = ' '.
ENDIF.
CLEAR: G_T_MSEG_LEAN, G_T_BSIM_LEAN, BESTAND. "n443935
GET PARAMETER ID 'BUK' FIELD G_SAVE_PARAMS-BUKRS.
GET PARAMETER ID 'WRK' FIELD G_SAVE_PARAMS-WERKS.
GET PARAMETER ID 'MAT' FIELD G_SAVE_PARAMS-MATNR.
GET PARAMETER ID 'CHA' FIELD G_SAVE_PARAMS-CHARG.
GET PARAMETER ID 'BLN' FIELD G_SAVE_PARAMS-BELNR.
GET PARAMETER ID 'BUK' FIELD G_SAVE_PARAMS-BUKRS.
GET PARAMETER ID 'GJR' FIELD G_SAVE_PARAMS-GJAHR.
SET PARAMETER ID 'BUK' FIELD G_SAVE_PARAMS-BUKRS.
SET PARAMETER ID 'WRK' FIELD G_SAVE_PARAMS-WERKS.
SET PARAMETER ID 'MAT' FIELD G_SAVE_PARAMS-MATNR.
SET PARAMETER ID 'CHA' FIELD G_SAVE_PARAMS-CHARG.
GET PARAMETER ID 'BLN' FIELD G_SAVE_PARAMS-BELNR.
GET PARAMETER ID 'BUK' FIELD G_SAVE_PARAMS-BUKRS.
GET PARAMETER ID 'GJR' FIELD G_SAVE_PARAMS-GJAHR.
FORM USER_COMMAND_TOTALS "#EC CALLED
USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CLEAR G_S_BESTAND_KEY.
CASE R_UCOMM.
WHEN '*GRPT'.
SORT BESTAND BY BWKEY MATKL.
FLAG = 'X'.
PERFORM GRP_TOTAL(ZGRP_TOTAL) TABLES BESTAND.
IF FLAG = 'X'.
EXIT.
ENDIF.
WHEN '*STR'.
IF BWBST = 'X'.
IF FLAG = 'X'.
*clear: LGBST,BWBST ,SBBST.
*PERFORM GRP_TOTAL(ZGRP_TOTAL1) TABLES BESTAND.
SUBMIT ZRM07MLBD2 WITH LGBST = 'X'
WITH WERKS = '1000'
WITH BUKRS = '1001'
WITH XSUM = 'X'
WITH PA_WDZER = PA_WDZER
WITH PA_WDZEW = PA_WDZEW
WITH PA_WDWIZ = PA_WDWIZ
WITH PA_WDWUW = PA_WDWUW
WITH PA_WDWEW = PA_WDWEW
WITH PA_NDZER = PA_NDZER
WITH PA_NDSTO = PA_NDSTO
WITH LGORT IN LGORT
WITH DATUM IN DATUM
WITH MATNR IN MATNR VIA SELECTION-SCREEN
AND RETURN.
CLEAR: LGBST.
ELSE.
MESSAGE E345(0) WITH 'First see the grp total'.
ENDIF.
ELSE.
MESSAGE E345(0) WITH 'Stock type chosen was not valuated'.
TYPES: BEGIN OF TY_MTART,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
END OF TY_MTART.
DATA: L_REC_QTY TYPE P DECIMALS 3,
L_ISS_QTY TYPE P DECIMALS 3,
L_REC_AMT TYPE P DECIMALS 3,
L_ISS_AMT TYPE P DECIMALS 3,
L_OTHERS_QTY TYPE P DECIMALS 3,
L_SALE_QTY TYPE P DECIMALS 3,
L_SALE_AMT TYPE P DECIMALS 3,
L_OTHERS_AMT TYPE P DECIMALS 3.
DATA: IT_MAKT TYPE STANDARD TABLE OF MAKT WITH HEADER LINE,
IT_T023T TYPE STANDARD TABLE OF T023T WITH HEADER LINE,
IT_T134 TYPE STANDARD TABLE OF T134T WITH HEADER LINE.
DATA: IT_MTART TYPE STANDARD TABLE OF TY_MTART WITH HEADER LINE.
REFRESH BESTAND_QTR.
REFRESH: IT_MAKT,IT_T023T,IT_T134,IT_MTART.
SORT BESTAND BY MATNR.
SELECT * FROM MAKT INTO TABLE IT_MAKT FOR ALL ENTRIES IN BESTAND WHERE MATNR = BESTAND-MATNR.
SELECT MATNR MTART FROM MARA INTO TABLE IT_MTART FOR ALL ENTRIES IN BESTAND WHERE MATNR = BESTAND-MATNR.
SELECT * FROM T023T INTO TABLE IT_T023T FOR ALL ENTRIES IN BESTAND WHERE MATKL = BESTAND-MATKL AND SPRAS = 'E'.
SELECT * FROM T134T INTO TABLE IT_T134 FOR ALL ENTRIES IN IT_MTART WHERE MTART = IT_MTART-MTART AND SPRAS = 'E'.
SORT G_T_MSEG_LEAN BY MATNR.
*******Changes added*
TYPES: BEGIN OF TY_TAB1,
HKONT TYPE BSIS-HKONT,
POSTDT TYPE BSIS-ZUONR,
KOSTL TYPE BSIS-KOSTL,
MATNR TYPE TY_BESTAND-MATNR,
END OF TY_TAB1.
DATA: ITAB TYPE TABLE OF BSIS WITH HEADER LINE,
ITAB1 TYPE TABLE OF TY_TAB1 WITH HEADER LINE,
WATAB1 TYPE TY_TAB1,
ITAB2 TYPE TABLE OF TY_TAB1 WITH HEADER LINE,
WATAB2 TYPE TY_TAB1.
SELECT DISTINCT HKONT ZUONR KOSTL FROM BSIS INTO TABLE ITAB1
WHERE ZUONR IN DATUM
AND HKONT IN SAKTO.
LOOP AT ITAB1 INTO WATAB1.
SELECT SINGLE MATNR INTO WATAB1-MATNR FROM BSEG
WHERE GJAHR = WATAB1-POSTDT+0(4)
AND HKONT = WATAB1-HKONT
AND KOSTL = WATAB1-KOSTL
AND MATNR ''.
IF SY-SUBRC = 0.
MOVE WATAB1-HKONT TO BESTAND_QTR-HKONT.
MOVE WATAB1-POSTDT TO BESTAND_QTR-DATUM.
READ TABLE BESTAND WITH KEY MATNR = WATAB1-MATNR.
CLEAR WATAB1.
IF SY-SUBRC = 0.
*ENDLOOP.
*ENDIF.
*LOOP AT bestand .
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN WHERE WERKS EQ BESTAND-BWKEY." added by Garima on 21.04.07
IF G_S_MSEG_LEAN-MATNR = BESTAND-MATNR.
IF G_S_MSEG_LEAN-SHKZG = 'H'.
G_S_MSEG_LEAN-MENGE = G_S_MSEG_LEAN-MENGE * ( -1 ).
G_S_MSEG_LEAN-DMBTR = G_S_MSEG_LEAN-DMBTR * ( -1 ).
ENDIF.
IF G_S_MSEG_LEAN-BWART = '105' OR G_S_MSEG_LEAN-BWART = '106' OR G_S_MSEG_LEAN-BWART = '122' OR G_S_MSEG_LEAN-BWART = '101' OR G_S_MSEG_LEAN-BWART = '102' OR G_S_MSEG_LEAN-BWART = '561'
OR G_S_MSEG_LEAN-BWART = '562'.
ELSEIF G_S_MSEG_LEAN-BWART IS NOT INITIAL AND G_S_MSEG_LEAN-BWART '601' AND G_S_MSEG_LEAN-BWART '602' .
L_ISS_QTY = L_ISS_QTY + G_S_MSEG_LEAN-MENGE.
L_ISS_AMT = L_ISS_AMT + G_S_MSEG_LEAN-DMBTR.
ELSEIF G_S_MSEG_LEAN-BWART IS NOT INITIAL AND ( G_S_MSEG_LEAN-BWART = '601' OR G_S_MSEG_LEAN-BWART = '602' ).
L_SALE_QTY = L_SALE_QTY + G_S_MSEG_LEAN-MENGE.
L_SALE_AMT = L_SALE_AMT + G_S_MSEG_LEAN-DMBTR.
ELSEIF G_S_MSEG_LEAN-BWART IS INITIAL.
L_OTHERS_QTY = L_OTHERS_QTY + G_S_MSEG_LEAN-MENGE.
L_OTHERS_AMT = L_OTHERS_AMT + G_S_MSEG_LEAN-DMBTR.
ENDIF.
ENDIF.
ENDLOOP.
MOVE BESTAND-MATNR TO BESTAND_QTR-MATNR.
READ TABLE IT_MAKT WITH KEY MATNR = BESTAND-MATNR.
IF SY-SUBRC = 0.
MOVE IT_MAKT-MAKTX TO BESTAND_QTR-MAKTX.
ENDIF.
READ TABLE IT_T023T WITH KEY MATKL = BESTAND-MATKL.
IF SY-SUBRC = 0.
MOVE IT_T023T-WGBEZ TO BESTAND_QTR-WGBEZ.
ENDIF.
READ TABLE IT_MTART WITH KEY MATNR = BESTAND-MATNR.
IF SY-SUBRC = 0.
MOVE IT_MTART-MTART TO BESTAND_QTR-MTART.
READ TABLE IT_T134 WITH KEY MTART = IT_MTART-MTART.
IF SY-SUBRC = 0.
MOVE IT_T134-MTBEZ TO BESTAND_QTR-MTBEZ.
ENDIF.
ENDIF.
MOVE BESTAND-ANFMENGE TO BESTAND_QTR-ANFMENGE.
MOVE BESTAND-ENDMENGE TO BESTAND_QTR-ENDMENGE.
MOVE BESTAND-ANFWERT TO BESTAND_QTR-ANFWERT.
MOVE BESTAND-ENDWERT TO BESTAND_QTR-ENDWERT.
MOVE BESTAND-MATKL TO BESTAND_QTR-MATKL.
MOVE BESTAND-MEINS TO BESTAND_QTR-MEINS.
MOVE L_REC_QTY TO BESTAND_QTR-SOLL.
MOVE L_ISS_QTY TO BESTAND_QTR-HABEN.
MOVE L_REC_AMT TO BESTAND_QTR-SOLLWERT.
MOVE L_ISS_AMT TO BESTAND_QTR-HABENWERT.
MOVE L_OTHERS_QTY TO BESTAND_QTR-QTY_OTHERS.
MOVE L_OTHERS_AMT TO BESTAND_QTR-AMT_OTHERS.
MOVE L_SALE_QTY TO BESTAND_QTR-QTY_SALE.
MOVE L_SALE_AMT TO BESTAND_QTR-AMT_SALE.
APPEND BESTAND_QTR.
CLEAR BESTAND_QTR.
CLEAR : L_REC_QTY,L_ISS_QTY,L_REC_AMT,L_ISS_AMT,L_OTHERS_QTY,L_OTHERS_AMT,L_SALE_QTY,L_SALE_AMT.
ENDIF.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
IF RS_SELFIELD-TABNAME = 'G_T_TOTALS_HEADER'.
*get the selected entry from table G_T_TOTALS
READ TABLE G_T_TOTALS_HEADER
INTO G_S_TOTALS_HEADER
INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC IS INITIAL.
MOVE-CORRESPONDING G_S_TOTALS_HEADER
TO G_S_BESTAND_KEY.
ENDIF.
ELSEIF RS_SELFIELD-TABNAME = 'G_T_TOTALS_ITEM'.
*get the selected entry from table G_T_TOTALS
READ TABLE G_T_TOTALS_ITEM
INTO G_S_TOTALS_ITEM
INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC IS INITIAL.
MOVE-CORRESPONDING G_S_TOTALS_ITEM
TO G_S_BESTAND_KEY.
ENDIF.
ELSEIF RS_SELFIELD-TABNAME = 'G_T_TOTALS_FLAT'.
*get the selected entry from table G_T_TOTALS
READ TABLE G_T_TOTALS_FLAT
INTO G_S_TOTALS_FLAT
INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC IS INITIAL.
MOVE-CORRESPONDING G_S_TOTALS_FLAT
TO G_S_BESTAND_KEY.
ENDIF.
ENDIF.
IF G_S_BESTAND_KEY IS INITIAL. "notinh found ?
*Place the cursor on a table line
MESSAGE S322.
EXIT.
ENDIF.
*get the line from the main table BESTAND depending on the mode
IF BWBST IS INITIAL.
*sort sequence = matnr werks charg
READ TABLE BESTAND
WITH KEY MATNR = G_S_BESTAND_KEY-MATNR
WERKS = G_S_BESTAND_KEY-WERKS
CHARG = G_S_BESTAND_KEY-CHARG
BINARY SEARCH.
ELSE.
*sort sequence = matnr bwkey
READ TABLE BESTAND
WITH KEY MATNR = G_S_BESTAND_KEY-MATNR
BWKEY = G_S_BESTAND_KEY-BWKEY
BINARY SEARCH.
ENDIF.
IF SY-SUBRC IS INITIAL.
MOVE-CORRESPONDING BESTAND TO G_S_BESTAND_DETAIL.
APPEND G_S_BESTAND_DETAIL TO G_T_BESTAND_DETAIL.
*does the ALV return with an error ?
IF NOT SY-SUBRC IS INITIAL. "Fehler vom ALV ?
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " list_output_detail
*form USER_COMMAND using r_ucomm like sy-ucomm
*rs_selfield type slis_selfield.
*case r_ucomm.
*
*
*WHEN 'UPLOAD'.
*endcase.
*endform.
*---------------------------------------------------------------------
** TOP_OF_PAGE_TOTALS
*---------------------------------------------------------------------
*FORM TOP_OF_PAGE_TOTALS. "#EC CALLED
*
*
*go on when the report runs in print mode -> last line
*check not sy-prdsn is initial.
*
*data: lr_content type ref to cl_salv_form_element.
*
**... (1) create the information to be displayed by using
*
*the ALV Form elements
*perform top_of_page_totals_render changing lr_content.
*
**... (2) Sending the information to the ALV
*
*Once the inforation to be displayed has been
*created the information has to be sent to the ALV
*This is done by calling the static method
*CL_SALV_FORM_CONTENT=>SET( ) with the content
*which is to be displayed.
*Alternativly the function module REUSE_ALV_COMMENTARY_WRITE
*can still be used.
*cl_salv_form_content=>set( lr_content ).
*
*ENDFORM. "TOP_OF_PAGE_TOTALS
*
*---------------------------------------------------------------------
** TOP_OF_PAGE_TOTALS_RENDER
*---------------------------------------------------------------------
*
*FORM TOP_OF_PAGE_TOTALS_RENDER
*changing cr_content type ref to cl_salv_form_element.
*
*data: lr_grid type ref to cl_salv_form_layout_grid,
*lr_flow type ref to cl_salv_form_layout_flow,
*l_text(500) type c,
*l_char(500) type c.
*
**... create a grid
*create object lr_grid.
*
*lr_flow = lr_grid->create_flow( row = 1 column = 1 ).
*
*if bwbst is initial. "n599218
*stocks only "n599218
*write : sy-pagno no-sign to g_s_header_77-page. "n599218
*move : g_s_header_77 to l_text.
*else. "n599218
*stocks and values "n599218
*write : sy-pagno no-sign to g_s_header_91-page. "n599218
*move : g_s_header_91 to l_text. "n599218
*endif. "n599218
*
*
*add line to object
*form top_of_page_render.
*
*
*interface structurebegin of g_s_bestand.
*
*data: lr_content type ref to cl_salv_form_element.
*
**... (1) create the information to be displayed by using
*
*the ALV Form elements
*perform create_alv_form_content_top changing lr_content.
*
**... (2) Sending the information to the ALV
*
*Once the inforation to be displayed has been
*created the information has to be sent to the ALV
*This is done by calling the static method
*CL_SALV_FORM_CONTENT=>SET( ) with the content
*which is to be displayed.
*Alternativly the function module REUSE_ALV_COMMENTARY_WRITE
*can still be used.
*form create_alv_form_content_top
*changing cr_content type ref to cl_salv_form_element
*.
*
*data: lr_grid type ref to cl_salv_form_layout_grid,
*lr_flow type ref to cl_salv_form_layout_flow,
*l_text(500) type c,
*l_char(500) type c.
*
*data: l_row type i,
*l_figure(24) type c,
*l_flag_tied_empties(01) type c.
*
**----------------------------------------------------------------------
**
*
*
**... create a grid
*create object lr_grid.
*
*
*the current data are in interface structure g_s_bestand.
*
*
*in the case the report run in print or background mode
*--> print the old headlines
*
*if not sy-prdsn is initial.
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*if bwbst is initial.
*stocks only
*write : sy-pagno no-sign to g_s_header_77-page.
*move : g_s_header_77 to l_text.
*else.
*stocks and values
*write : sy-pagno no-sign to g_s_header_91-page.
*move : g_s_header_91 to l_text.
*endif.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*
*add 1 to l_row.
*endif.
*
*
*first line : plant or valuation area
*---------------------------------
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*if bwbst is initial.
*move : text-020 to l_text,
*g_s_bestand-werks to l_text+g_offset_header.
*else.
*show valuation area
*move : text-025 to l_text,
*g_s_bestand-bwkey to l_text+g_offset_header.
*endif.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*
*
*second line : material number
*----------------------------------------
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*move : text-021 to l_text.
*write : g_s_bestand-matnr to l_text+g_offset_header.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*
*
*third line : material short text
*-------------------------------------
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*PERFORM F2100_MAT_TEXT USING g_s_BESTAND-MATNR.
*
*move : text-022 to l_text,
*G_S_MAKT-MAKTX to l_text+g_offset_header.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*
*
*fourth line : batch if required
*--------------------------------------
*IF xchar = 'X'.
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*move : text-023 to l_text,
*G_S_bestand-charg to l_text+g_offset_header.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*endif.
*
*
*line : stock and value on start date
*with one empty line
*add 2 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*clear l_text.
*IF bwbst is initial.
*stock on start date
*move : g_date_line_from to l_text.
*write g_s_bestand-anfmenge to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*else.
*stocks and values on start date
*move : g_date_line_from to l_text.
*write g_s_bestand-anfmenge to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*
*write g_s_bestand-anfwert to l_figure
*CURRENCY g_s_bestand-waers.
*move l_figure to l_text+g_offset_value(24).
*move g_s_bestand-waers to l_text+g_offset_curr.
*endif.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*
*
*line : total quantity and value of goods receipts
*--------------------
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*clear l_text.
*
*IF bwbst is initial.
*total quantities of goods receipts
*move : text-005 to l_text+2.
*write g_s_bestand-soll to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*else.
*total quantities and values of goods receipts
*move : text-030 to l_text+2.
*write g_s_bestand-soll to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*
*write g_s_bestand-sollwert to l_figure
*CURRENCY g_s_bestand-waers.
*move l_figure to l_text+g_offset_value(24).
*move g_s_bestand-waers to l_text+g_offset_curr.
*endif.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*
*
*line : total quantity and value of goods issues
*----------------------
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*clear l_text.
*
*IF bwbst is initial.
*total quantities of goods issues
*move : text-006 to l_text+2.
*compute g_s_bestand-haben = g_s_bestand-haben * -1.
*write g_s_bestand-haben to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*else.
*total quantities of goods issues
*move : text-031 to l_text+2.
*compute g_s_bestand-haben = g_s_bestand-haben * -1.
*write g_s_bestand-haben to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*
*compute g_s_bestand-habenwert = g_s_bestand-habenwert * -1.
*write g_s_bestand-habenwert to l_figure
*CURRENCY g_s_bestand-waers.
*move l_figure to l_text+g_offset_value(24).
*move g_s_bestand-waers to l_text+g_offset_curr.
*endif.
*
*
*add line to object
*lr_flow->create_text( text = l_text ).
*
*
*line : stock and value on end date
*add 1 to l_row.
*lr_flow = lr_grid->create_flow( row = l_row column = 1 ).
*
*clear l_text.
*
*IF bwbst is initial.
*stock on end date
*move : g_date_line_to to l_text.
*write g_s_bestand-endmenge to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*else.
*stocks and values on end date
*move : g_date_line_to to l_text.
*write g_s_bestand-endmenge to l_figure
*unit g_s_bestand-meins.
*move l_figure to l_text+g_offset_qty(24).
*move g_s_bestand-meins to l_text+g_offset_unit.
*
*write g_s_bestand-endwert to l_figure
*CURRENCY g_s_bestand-waers.
*move l_figure to l_text+g_offset_value(24).
*move g_s_bestand-waers to l_text+g_offset_curr.
*endif.
*
*
*add line to object
**----------------------------------------------------------------------
**
*
FORM CREATE_TABLE_TOTALS_HQ.
*create output table
LOOP AT BESTAND.
*part 1 : create header table g_t_totals_header
MOVE-CORRESPONDING BESTAND TO G_S_TOTALS_HEADER.
MOVE SOBKZ TO G_S_TOTALS_HEADER-SOBKZ.
PERFORM F2100_MAT_TEXT USING BESTAND-MATNR.
MOVE G_S_MAKT-MAKTX TO G_S_TOTALS_HEADER-MAKTX.
IF BWBST IS INITIAL.
*mode : stocks or special stocks
PERFORM F2200_READ_T001 USING BESTAND-WERKS.
MOVE T001W-NAME1 TO G_S_TOTALS_HEADER-NAME1.
ELSE.
*mode : valuated stocks
IF CURM = '3'.
*valuation level is company code
SELECT SINGLE BUTXT FROM T001
INTO G_F_BUTXT
WHERE BUKRS = BESTAND-BWKEY.
IF SY-SUBRC IS INITIAL.
MOVE G_F_BUTXT TO G_S_TOTALS_HEADER-NAME1.
ELSE.
CLEAR G_S_TOTALS_HEADER-NAME1.
ENDIF.
ELSE.
*valuation level is plant -> take the name of the plant
PERFORM F2200_READ_T001 USING BESTAND-WERKS.
MOVE T001W-NAME1 TO G_S_TOTALS_HEADER-NAME1.
ENDIF.
ENDIF.
APPEND G_S_TOTALS_HEADER TO G_T_TOTALS_HEADER.
*part 2 : create 4 lines in item table g_t_totals_item
CLEAR G_S_TOTALS_ITEM.
MOVE : BESTAND-BWKEY TO G_S_TOTALS_ITEM-BWKEY,
BESTAND-WERKS TO G_S_TOTALS_ITEM-WERKS,
BESTAND-MATNR TO G_S_TOTALS_ITEM-MATNR,
BESTAND-CHARG TO G_S_TOTALS_ITEM-CHARG,
BESTAND-MEINS TO G_S_TOTALS_ITEM-MEINS,
BESTAND-WAERS TO G_S_TOTALS_ITEM-WAERS.
*line with the stock on start date
MOVE : G_DATE_LINE_FROM TO G_S_TOTALS_ITEM-STOCK_TYPE,
BESTAND-ANFMENGE TO G_S_TOTALS_ITEM-MENGE,
BESTAND-ANFWERT TO G_S_TOTALS_ITEM-WERT.
PERFORM CREATE_TABLE_TOTALS_HQ_1.
*line with the good receipts
IF BWBST = 'X'.
MOVE : TEXT-030 TO G_S_TOTALS_ITEM-STOCK_TYPE+2,
BESTAND-SOLL TO G_S_TOTALS_ITEM-MENGE,
BESTAND-SOLLWERT TO G_S_TOTALS_ITEM-WERT.
ELSE.
MOVE : TEXT-005 TO G_S_TOTALS_ITEM-STOCK_TYPE+2,
BESTAND-SOLL TO G_S_TOTALS_ITEM-MENGE.
ENDIF.
PERFORM CREATE_TABLE_TOTALS_HQ_1.
*line with the good issues
IF BWBST = 'X'.
MOVE : TEXT-031 TO G_S_TOTALS_ITEM-STOCK_TYPE+2.
G_S_TOTALS_ITEM-MENGE = BESTAND-HABEN * -1.
G_S_TOTALS_ITEM-WERT = BESTAND-HABENWERT * -1.
ELSE.
MOVE : TEXT-006 TO G_S_TOTALS_ITEM-STOCK_TYPE+2.
G_S_TOTALS_ITEM-MENGE = BESTAND-HABEN * -1.
ENDIF.
PERFORM CREATE_TABLE_TOTALS_HQ_1.
*line with the tock on end date
MOVE : G_DATE_LINE_TO TO G_S_TOTALS_ITEM-STOCK_TYPE,
BESTAND-ENDMENGE TO G_S_TOTALS_ITEM-MENGE,
BESTAND-ENDWERT TO G_S_TOTALS_ITEM-WERT.
*colorize the numeric fields depending on the sign and append the
*entries into table G_T_TOTALS_ITEM
FORM CREATE_TABLE_TOTALS_HQ_1.
REFRESH G_T_COLOR.
CLEAR G_S_COLOR.
*colorize the quntities always
IF G_S_TOTALS_ITEM-MENGE > 0.
*positive value -> green
MOVE : 'MENGE' TO G_S_COLOR-FIELDNAME,
'5' TO G_S_COLOR-COLOR-COL, "green
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
MOVE : 'MEINS' TO G_S_COLOR-FIELDNAME,
'5' TO G_S_COLOR-COLOR-COL, "green
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
ELSEIF G_S_TOTALS_ITEM-MENGE
*negative value -> red
MOVE : 'MENGE' TO G_S_COLOR-FIELDNAME,
'6' TO G_S_COLOR-COLOR-COL, "red
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
MOVE : 'MEINS' TO G_S_COLOR-FIELDNAME,
'6' TO G_S_COLOR-COLOR-COL, "red
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
ENDIF.
IF BWBST = 'X'.
*colorize the values only in mode valuated stock
IF G_S_TOTALS_ITEM-WERT > 0.
*positive value -> green
MOVE : 'WERT' TO G_S_COLOR-FIELDNAME,
'5' TO G_S_COLOR-COLOR-COL, "green
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
MOVE : 'WAERS' TO G_S_COLOR-FIELDNAME,
'5' TO G_S_COLOR-COLOR-COL, "green
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
ELSEIF G_S_TOTALS_ITEM-WERT
*negative value -> red
MOVE : 'WERT' TO G_S_COLOR-FIELDNAME,
'6' TO G_S_COLOR-COLOR-COL, "red
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
MOVE : 'WAERS' TO G_S_COLOR-FIELDNAME,
'6' TO G_S_COLOR-COLOR-COL, "red
'0' TO G_S_COLOR-COLOR-INT.
APPEND G_S_COLOR TO G_T_COLOR.
ENDIF.
ENDIF.
IF G_T_COLOR[] IS INITIAL.
CLEAR : G_S_TOTALS_ITEM-COLOR.
ELSE.
*customizing : set the color information
IF G_CUST_COLOR = 'X'.
MOVE G_T_COLOR[] TO G_S_TOTALS_ITEM-COLOR.
ENDIF.
ENDIF.
ADD 1 TO G_S_TOTALS_ITEM-COUNTER.
APPEND G_S_TOTALS_ITEM TO G_T_TOTALS_ITEM.
CLEAR : G_S_TOTALS_ITEM-STOCK_TYPE.
STATICS : L_FLAG_SORTED(01) TYPE C.
DATA : L_TABIX LIKE SY-TABIX.
*sort table with the documents
IF L_FLAG_SORTED IS INITIAL.
SORT G_T_MSEG_LEAN
BY MATNR WERKS CHARG BUDAT MBLNR ZEILE BELNR.
MOVE 'X' TO L_FLAG_SORTED.
ENDIF.
REFRESH G_T_BELEGE1.
*find the first entry with this material number
READ TABLE G_T_MSEG_LEAN INTO G_S_MSEG_LEAN
WITH KEY MATNR = G_S_BESTAND_DETAIL-MATNR
BINARY SEARCH.
IF SY-SUBRC IS INITIAL.
MOVE SY-TABIX TO L_TABIX.
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN
FROM L_TABIX.
*leave this loop when the material number changes
IF G_S_MSEG_LEAN-MATNR NE G_S_BESTAND_DETAIL-MATNR.
EXIT.
ENDIF.
IF BWBST IS INITIAL.
CHECK : XCHAR IS INITIAL OR
G_S_MSEG_LEAN-CHARG = BESTAND-CHARG.
MOVE-CORRESPONDING G_S_MSEG_LEAN
TO G_T_BELEGE1.
*enrich some fields with color and numeric fields with sign
PERFORM F9500_SET_COLOR_AND_SIGN
USING G_T_BELEGE1 'G_T_BELEGE1'.
APPEND G_T_BELEGE1.
ELSE.
*get the valuation area for this plant
PERFORM F9300_READ_ORGAN
USING C_WERKS G_S_MSEG_LEAN-WERKS.
CHECK : G_S_ORGAN-BWKEY = BESTAND-BWKEY. "184465
MOVE-CORRESPONDING G_S_MSEG_LEAN
TO G_T_BELEGE1.
*enrich some fields with color and numeric fields with sign
PERFORM F9500_SET_COLOR_AND_SIGN
USING G_T_BELEGE1 'G_T_BELEGE1'.
*create output table G-T-totals_flat
LOOP AT BESTAND.
REFRESH G_T_COLOR.
MOVE-CORRESPONDING BESTAND TO G_S_TOTALS_FLAT.
MOVE SOBKZ TO G_S_TOTALS_FLAT-SOBKZ.
PERFORM F2100_MAT_TEXT USING BESTAND-MATNR.
*show the GI with negative sign
G_S_TOTALS_FLAT-HABEN = G_S_TOTALS_FLAT-HABEN * -1.
MOVE : G_S_MAKT-MAKTX TO G_S_TOTALS_FLAT-MAKTX,
DATUM-LOW TO G_S_TOTALS_FLAT-START_DATE,
DATUM-HIGH TO G_S_TOTALS_FLAT-END_DATE.
PERFORM COLORIZE_TOTALS_FLAT USING 'ANFMENGE'.
PERFORM COLORIZE_TOTALS_FLAT USING 'SOLL'.
PERFORM COLORIZE_TOTALS_FLAT USING 'HABEN'.
PERFORM COLORIZE_TOTALS_FLAT USING 'ENDMENGE'.
IF BWBST = 'X'.
G_S_TOTALS_FLAT-HABENWERT = G_S_TOTALS_FLAT-HABENWERT * -1.
PERFORM COLORIZE_TOTALS_FLAT USING 'ANFWERT'.
PERFORM COLORIZE_TOTALS_FLAT USING 'SOLLWERT'.
PERFORM COLORIZE_TOTALS_FLAT USING 'HABENWERT'.
PERFORM COLORIZE_TOTALS_FLAT USING 'ENDWERT'.
ENDIF.
IF G_T_COLOR[] IS INITIAL.
CLEAR G_S_TOTALS_FLAT-COLOR.
ELSE.
MOVE G_T_COLOR[] TO G_S_TOTALS_FLAT-COLOR.
ENDIF.
APPEND G_S_TOTALS_FLAT TO G_T_TOTALS_FLAT.
ENDLOOP.
IF BWBST = 'X'.
*valuated stock
PERFORM FC_S_FLAT USING 'BWKEY' 'MBEW' 'BWKEY'.
ELSE.
*take the plant
PERFORM FC_S_FLAT USING 'WERKS' 'MARC' 'WERKS'.
IF XCHAR = 'X'.
*take the batch number
PERFORM FC_S_FLAT USING 'CHARG' 'MCHB' 'CHARG'.
ENDIF.
ENDIF.
PERFORM FC_S_FLAT USING 'MATNR' 'MARA' 'MATNR' .
PERFORM FC_S_FLAT USING 'MATKL' 'MARA' 'MATKL' .
MOVE 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_S_FLAT USING 'MAKTX' 'MAKT' 'MAKTX'.
IF SOBKZ IS INITIAL.
MOVE 'X' TO G_S_FIELDCAT-NO_OUT.
ENDIF.
PERFORM FC_S_FLAT USING 'SOBKZ' 'MSLB' 'SOBKZ'.
MOVE : TEXT-094 TO G_S_FIELDCAT-SELTEXT_L, "from date
'L' TO G_S_FIELDCAT-DDICTXT,
15 TO G_S_FIELDCAT-OUTPUTLEN.
PERFORM FC_S_FLAT USING 'START_DATE' 'MKPF' 'BUDAT'.
MOVE : TEXT-095 TO G_S_FIELDCAT-SELTEXT_L, "to date
'L' TO G_S_FIELDCAT-DDICTXT,
15 TO G_S_FIELDCAT-OUTPUTLEN.
PERFORM FC_S_FLAT USING 'END_DATE' 'MKPF' 'BUDAT'.
MOVE : TEXT-096 TO G_S_FIELDCAT-SELTEXT_L, "opening stock
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'MEINS' TO G_S_FIELDCAT-QFIELDNAME.
PERFORM FC_S_FLAT USING 'ANFMENGE' 'MARD' 'LABST'.
MOVE : TEXT-097 TO G_S_FIELDCAT-SELTEXT_L, "sum receipts
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'MEINS' TO G_S_FIELDCAT-QFIELDNAME.
PERFORM FC_S_FLAT USING 'SOLL' 'MSEG' 'MENGE'.
MOVE : TEXT-098 TO G_S_FIELDCAT-SELTEXT_L, "sum issues
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'MEINS' TO G_S_FIELDCAT-QFIELDNAME.
PERFORM FC_S_FLAT USING 'HABEN' 'MSEG' 'MENGE'.
MOVE : TEXT-099 TO G_S_FIELDCAT-SELTEXT_L, "end stock
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'MEINS' TO G_S_FIELDCAT-QFIELDNAME.
PERFORM FC_S_FLAT USING 'ENDMENGE' 'MARD' 'LABST'.
PERFORM FC_S_FLAT USING 'MEINS' 'MARA' 'MEINS'.
IF BWBST = 'X'.
*process the values, too
MOVE : TEXT-100 TO G_S_FIELDCAT-SELTEXT_L, "opening value
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'WAERS' TO G_S_FIELDCAT-CFIELDNAME.
PERFORM FC_S_FLAT USING 'ANFWERT' 'MBEW' 'LBKUM'.
MOVE : TEXT-101 TO G_S_FIELDCAT-SELTEXT_L, "sum GR values
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'WAERS' TO G_S_FIELDCAT-CFIELDNAME.
PERFORM FC_S_FLAT USING 'SOLLWERT' 'MSEG' 'DMBTR'.
MOVE : TEXT-102 TO G_S_FIELDCAT-SELTEXT_L, "sum GI values
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'WAERS' TO G_S_FIELDCAT-CFIELDNAME.
PERFORM FC_S_FLAT USING 'HABENWERT' 'MSEG' 'DMBTR'.
MOVE : TEXT-103 TO G_S_FIELDCAT-SELTEXT_L, "end value
'L' TO G_S_FIELDCAT-DDICTXT,
23 TO G_S_FIELDCAT-OUTPUTLEN,
'WAERS' TO G_S_FIELDCAT-CFIELDNAME.
PERFORM FC_S_FLAT USING 'ENDWERT' 'MBEW' 'LBKUM'.
PERFORM FC_S_FLAT USING 'WAERS' 'T001' 'WAERS'.
ENDIF.
FORM FC_S_FLAT USING L_FIELDNAME TYPE FIELDNAME
L_REF_TABNAME TYPE DDOBJNAME
L_REF_FIELDNAME TYPE FIELDNAME.
ADD : 1 TO G_F_COL_POS.
MOVE : L_FIELDNAME TO G_S_FIELDCAT-FIELDNAME,
G_F_COL_POS TO G_S_FIELDCAT-COL_POS,
'G_T_TOTALS_FLAT' TO G_S_FIELDCAT-TABNAME,
L_REF_TABNAME TO G_S_FIELDCAT-REF_TABNAME,
L_REF_FIELDNAME TO G_S_FIELDCAT-REF_FIELDNAME.
APPEND G_S_FIELDCAT TO G_T_FIELDCAT_TOTALS_FLAT.
CLEAR G_S_FIELDCAT.
*assign the form routines to the events
MOVE : 'PF_STATUS_SET' TO G_T_EVENTS_TOTALS_FLAT-NAME,
'PF_STATUS_SET_TOTALS' TO G_T_EVENTS_TOTALS_FLAT-FORM.
APPEND G_T_EVENTS_TOTALS_FLAT.
MOVE : 'USER_COMMAND' TO G_T_EVENTS_TOTALS_FLAT-NAME,
'USER_COMMAND_TOTALS' TO G_T_EVENTS_TOTALS_FLAT-FORM.
APPEND G_T_EVENTS_TOTALS_FLAT.
************************************************************************
********
MOVE : 'TOP_OF_PAGE' TO G_T_EVENTS_TOTALS_FLAT-NAME,
'TOP_OF_PAGE_TOTALS' TO G_T_EVENTS_TOTALS_FLAT-FORM.
APPEND G_T_EVENTS_TOTALS_FLAT.
MOVE : 'END_OF_LIST' TO G_T_EVENTS_TOTALS_FLAT-NAME,
'PRINT_END_OF_LIST' TO G_T_EVENTS_TOTALS_FLAT-FORM.
APPEND G_T_EVENTS_TOTALS_FLAT.
************************************************************************
********
*handling for double click
G_S_LAYOUT_TOTALS_FLAT-F2CODE = '9PBP'.
G_S_LAYOUT_TOTALS_FLAT-COLTAB_FIELDNAME = 'COLOR'.
*part 1 : for the header table
IF BWBST IS INITIAL.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
ENDIF.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'BWKEY' 'MBEW' 'BWKEY'.
IF BWBST = 'X'.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
ENDIF.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'WERKS' 'MARC' 'WERKS'.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'NAME1' 'T001W' 'NAME1'.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'MATNR' 'MARA' 'MATNR'.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'MATKL' 'MARA' 'MATKL'.
IF SOBKZ IS INITIAL.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
ENDIF.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'SOBKZ' 'MSLB' 'SOBKZ'.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'MAKTX' 'MAKT' 'MAKTX'.
IF XCHAR IS INITIAL.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
ENDIF.
PERFORM FC_HQ
USING 'G_T_TOTALS_HEADER' 'CHARG' 'MCHB' 'CHARG'.
*
*part 2 : for the item table
*hidden key fields
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'BWKEY' 'MBEW' 'BWKEY'.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'WERKS' 'MARC' 'WERKS'.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'MATNR' 'MARA' 'MATNR'.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'MATKL' 'MARA' 'MATKL'.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'CHARG' 'MCHB' 'CHARG'.
MOVE : 'X' TO G_S_FIELDCAT-NO_OUT.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'COUNTER' ' ' ''.
MOVE : 40 TO G_S_FIELDCAT-OUTPUTLEN.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'STOCK_TYPE' SPACE SPACE.
MOVE : 23 TO G_S_FIELDCAT-OUTPUTLEN,
TEXT-104 TO G_S_FIELDCAT-SELTEXT_L, "quantities
'L' TO G_S_FIELDCAT-DDICTXT,
'MENGE_D' TO G_S_FIELDCAT-ROLLNAME,
'MEINS' TO G_S_FIELDCAT-QFIELDNAME.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'MENGE' SPACE SPACE.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'MEINS' 'MARA' 'MEINS'.
IF BWBST = 'X'.
*with valuation
MOVE : 23 TO G_S_FIELDCAT-OUTPUTLEN,
TEXT-105 TO G_S_FIELDCAT-SELTEXT_L, "values
'L' TO G_S_FIELDCAT-DDICTXT,
'DMBTR' TO G_S_FIELDCAT-ROLLNAME,
'WAERS' TO G_S_FIELDCAT-CFIELDNAME.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'WERT' SPACE SPACE.
PERFORM FC_HQ
USING 'G_T_TOTALS_ITEM' 'WAERS' 'T001' 'WAERS'.
ENDIF.
FORM FC_HQ USING L_TABNAME TYPE DDOBJNAME
L_FIELDNAME TYPE FIELDNAME
L_REF_TABNAME TYPE DDOBJNAME
L_REF_FIELDNAME TYPE FIELDNAME.
ADD : 1 TO G_F_COL_POS.
MOVE : L_FIELDNAME TO G_S_FIELDCAT-FIELDNAME,
G_F_COL_POS TO G_S_FIELDCAT-COL_POS,
L_TABNAME TO G_S_FIELDCAT-TABNAME,
L_REF_TABNAME TO G_S_FIELDCAT-REF_TABNAME,
L_REF_FIELDNAME TO G_S_FIELDCAT-REF_FIELDNAME.
APPEND G_S_FIELDCAT TO G_T_FIELDCAT_TOTALS_HQ.
CLEAR G_S_FIELDCAT.
*fill layout : consider double click and color subtables
G_S_LAYOUT_TOTALS_HQ-COLTAB_FIELDNAME = 'COLOR'.
G_S_LAYOUT_TOTALS_HQ-F2CODE = '9PBP'.
*create other tables and structures
MOVE : 'BWKEY' TO G_S_KEYINFO_TOTALS_HQ-HEADER01,
'BWKEY' TO G_S_KEYINFO_TOTALS_HQ-ITEM01,
'WERKS' TO G_S_KEYINFO_TOTALS_HQ-HEADER02,
'WERKS' TO G_S_KEYINFO_TOTALS_HQ-ITEM02,
'MATNR' TO G_S_KEYINFO_TOTALS_HQ-HEADER03,
'MATNR' TO G_S_KEYINFO_TOTALS_HQ-ITEM03,
'CHARG' TO G_S_KEYINFO_TOTALS_HQ-HEADER04,
'CHARG' TO G_S_KEYINFO_TOTALS_HQ-ITEM04,
'COUNTER' TO G_S_KEYINFO_TOTALS_HQ-ITEM05.
*create the events table
MOVE : 'PF_STATUS_SET' TO EVENTS_HIERSEQ-NAME,
'PF_STATUS_SET_TOTALS' TO EVENTS_HIERSEQ-FORM.
APPEND EVENTS_HIERSEQ.
MOVE : 'USER_COMMAND' TO EVENTS_HIERSEQ-NAME,
'USER_COMMAND_TOTALS' TO EVENTS_HIERSEQ-FORM.
APPEND EVENTS_HIERSEQ.
MOVE : 'TOP_OF_PAGE' TO EVENTS_HIERSEQ-NAME,
'TOP_OF_PAGE_TOTALS' TO EVENTS_HIERSEQ-FORM.
APPEND EVENTS_HIERSEQ.
MOVE : 'END_OF_LIST' TO EVENTS_HIERSEQ-NAME,
'PRINT_END_OF_LIST' TO EVENTS_HIERSEQ-FORM.
APPEND EVENTS_HIERSEQ.
*create the sort table g_t_SORT_totals_hq
CLEAR G_S_SORT_TOTALS_HQ.
MOVE : 'G_T_TOTALS_ITEM' TO G_S_SORT_TOTALS_HQ-TABNAME,
'X' TO G_S_SORT_TOTALS_HQ-UP.
MOVE 'BWKEY' TO G_S_SORT_TOTALS_HQ-FIELDNAME.
ADD 1 TO G_S_SORT_TOTALS_HQ-SPOS.
APPEND G_S_SORT_TOTALS_HQ TO G_T_SORT_TOTALS_HQ.
MOVE 'WERKS' TO G_S_SORT_TOTALS_HQ-FIELDNAME.
ADD 1 TO G_S_SORT_TOTALS_HQ-SPOS.
APPEND G_S_SORT_TOTALS_HQ TO G_T_SORT_TOTALS_HQ.
MOVE 'MATNR' TO G_S_SORT_TOTALS_HQ-FIELDNAME.
ADD 1 TO G_S_SORT_TOTALS_HQ-SPOS.
APPEND G_S_SORT_TOTALS_HQ TO G_T_SORT_TOTALS_HQ.
MOVE 'CHARG' TO G_S_SORT_TOTALS_HQ-FIELDNAME.
ADD 1 TO G_S_SORT_TOTALS_HQ-SPOS.
APPEND G_S_SORT_TOTALS_HQ TO G_T_SORT_TOTALS_HQ.
MOVE 'COUNTER' TO G_S_SORT_TOTALS_HQ-FIELDNAME.
ADD 1 TO G_S_SORT_TOTALS_HQ-SPOS.
APPEND G_S_SORT_TOTALS_HQ TO G_T_SORT_TOTALS_HQ.
*Aus dieser Unterroutine heraus werden implizit, d.h. in der Schleife
*uber alle selektierten Bestande, die zugehorigen Materialbelege
*aufgerufen.
*Die Bestande werden zum Anfangs- und Enddatum als Summen zu
*folgendem Schlussel, der im Listkopf gefuhrt wird, ausgegeben:
*Buchungskreis bzw. Werk, Material, Charge. Nicht-chargenpflichtige
*Materialien werden auf Materialebene angezeigt.
*Es folgt jeweils eine Liste mit den einzelnen Belegpositionen.
*********************** Ende HAUPTPROGRAMM *****************************
*---------------------------------------------------------------------
** Form EINGABEN_PRUEFEN
*---------------------------------------------------------------------
*Prufung der Eingaben auf dem Selektionsbild *
----------------------------------------------------------------------
FORM EINGABEN_PRUEFEN.
*check the entries only in releases >= 46B
CALL FUNCTION 'MMIM_ENTRYCHECK_MAIN'
TABLES
IT_MATNR = MATNR
IT_WERKS = WERKS
IT_LGORT = LGORT
IT_BWART = BWART
IT_BUKRS = BUKRS.
*Die Selektionseingaben Buchungskreis und Werk werden hierarchisch
*verstanden, d.h. es werden nur Werke innerhalb der angegebenen
*Buchungskreise selektiert.
*Lagerort-/Chargenbestand: Da die Werksbezeichnung eindeutig ist,
*finden alle Selektionen auf Werksebene bzw. - falls mindestens ein
*Lagerort eingegeben wurde - auf der Ebene der eingegebenen Lagerorte
*statt. Die Ausgabe erfolgt auf Werksebene des Materials / der Charge.
*Bewerteter Bestand: Die Ausgabe erfolgt auf Bewertungskreisebene,
*d.h. je nach Einstellung in der Tabelle TCURM auf Werks- oder
*Buchungskreisebene.
*Feststellen, ob der Bewertungskreis auf Buchungskreis- oder
*Werksebene liegt:
*tcurm-bwkrs_cus = 1 => Bewertungskreis auf Werksebene,
*tcurm-bwkrs_cus = 3 => Bewertungskreis auf Buchungskreisebene.
SELECT BWKRS_CUS FROM TCURM INTO CURM. ENDSELECT.
IF XCHAR = ' ' AND NOT CHARG-LOW IS INITIAL.
XCHAR = 'X'.
ENDIF.
IF SBBST = 'X' AND SOBKZ IS INITIAL.
MESSAGE E286.
*Bitte ein Sonderbestandskennzeichen eingeben.
ELSEIF SBBST = ' ' AND NOT SOBKZ IS INITIAL.
CLEAR SOBKZ.
MESSAGE W287.
*Sonderbestandskennzeichen wird zuruckgesetzt.
ENDIF.
*reset the entries for plant when valuation area is "n599218
*company code and mode is valuated stock "n599218
IF CURM = '3' AND "n599218
BWBST = 'X'. "n599218
IF NOT WERKS[] IS INITIAL. "n599218
*reset the restricts for plants "n599218
CLEAR WERKS. "n599218
REFRESH WERKS. "n599218
*text-074 : valuation area = company code "n599218
*text-075 : entries for plant will be reset "n599218
MESSAGE W010(AD) WITH TEXT-074 TEXT-075 SPACE SPACE. "n599218
ENDIF. "n599218
ENDIF. "n599218
IF BWBST = 'X' AND NOT CHARG IS INITIAL
OR BWBST = 'X' AND NOT XCHAR IS INITIAL.
CLEAR CHARG. REFRESH CHARG.
MESSAGE W285.
*Charge wird zuruckgesetzt.
ENDIF.
**------------------------------Change by Madhu---------------------
IF BWBST = 'X' AND NOT LGORT IS INITIAL.
CLEAR LGORT. REFRESH LGORT.
MESSAGE W284.
*Lagerort wird zuruckgesetzt.
ENDIF.
**------------------------------Change by Madhu---------------------
*consider and prepare select-options depending on the required
*special stock indicator
REFRESH G_RA_SOBKZ.
CLEAR G_RA_SOBKZ.
IF LGBST = 'X'. "only Storage loc./batch stock
*create ranges table : select only sobkz = space
PERFORM F0500_APPEND_RA_SOBKZ USING C_SPACE.
ELSEIF BWBST = 'X'. "only valuated stocks
*take all special stock indicators / the record selection
*will be done after the database selection
ELSEIF SBBST = 'X'. "only special stocks
PERFORM F0500_APPEND_RA_SOBKZ USING SOBKZ.
IF SOBKZ = 'O' OR
SOBKZ = 'V' OR
SOBKZ = 'W' OR
SOBKZ = 'E' OR
SOBKZ = 'K' OR
SOBKZ = 'M' OR
SOBKZ = 'Q'.
*ok; no aktion taken
ELSE.
SET CURSOR FIELD 'SOBKZ'.
*Sonderbestandskennzeichen nicht vorhanden
MESSAGE E221.
ENDIF.
ENDIF.
IF BWBST = 'X' AND NOT BWART IS INITIAL.
CLEAR BWART. REFRESH BWART.
MESSAGE W298.
*Bewegungsart wird zuruckgesetzt
ENDIF.
IF BWBST = ' ' AND NOT BWTAR IS INITIAL.
CLEAR BWTAR. REFRESH BWTAR.
MESSAGE W288.
*Bewertungsart wird zuruckgesetzt.
ENDIF.
*The function "no cancellations" is not possible
*for valuated stock
*for the selection of the reversal movements only in release >=45B
IF NOSTO = 'X' AND BWBST = 'X'. "204463
MESSAGE E151(E1) WITH 'VALUATED_STOCK' "204463
'NO_CANCELLATIONS'. "204463
ENDIF. "204463
IF NOT P_VARI IS INITIAL.
MOVE VARIANTE TO DEF_VARIANTE.
MOVE P_VARI TO DEF_VARIANTE-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = VARIANT_SAVE
CHANGING
CS_VARIANT = DEF_VARIANTE.
VARIANTE = DEF_VARIANTE.
ELSE.
*the user wants no initial display variant "n599218
IF NOT ALV_DEFAULT_VARIANT IS INITIAL. "n599218
*but the SAP-LIST-VIEWER will apply the existing "n599218
*initial display variant / emerge warning 393 ? "n599218
CALL FUNCTION 'ME_CHECK_T160M' "n599218
EXPORTING "n599218
I_ARBGB = 'M7' "n599218
I_MSGNR = '393' "n599218
EXCEPTIONS "n599218
NOTHING = 0 "n599218
OTHERS = 1. "n599218
"n599218
IF SY-SUBRC 0. "n599218
*list will be created using the initial layout * "n599218
MESSAGE W393(M7) WITH ALV_DEFAULT_VARIANT. "n599218
ENDIF. "n599218
ENDIF. "n599218
*in the case the variant does not exist this function
*module sends the error message directly
ELSE.
*the user wants no initial display variant
IF NOT LS_VARI_DEF-VARIANT IS INITIAL.
*but the SAP-LIST-VIEWER will apply the existing "n599218
*initial display variant / emerge warning 393 ? "n599218
CALL FUNCTION 'ME_CHECK_T160M' "n599218
EXPORTING "n599218
I_ARBGB = 'M7' "n599218
I_MSGNR = '393' "n599218
EXCEPTIONS "n599218
NOTHING = 0 "n599218
OTHERS = 1. "n599218
"n599218
IF SY-SUBRC 0. "n599218
*list will be created using the initial layout * "n599218
MESSAGE W393(M7) WITH LS_VARI_DEF-VARIANT. "n599218
ENDIF. "n599218
ENDIF. "n599218
ENDIF.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF VARIANT_EXIT = SPACE.
MOVE LS_VARI_RETURN-VARIANT TO L_VARI.
ENDIF.
ENDIF.
---------------------- bewerteter Bestand ----------------------------
FORM AKTUELLE_BST_BWBST.
*define local working areas / for the result of the "n450764
*database selections and the control break "n450764
DATA : L_T_MBEW TYPE STAB_MBEW, "n450764
L_S_MBEW TYPE STYPE_MBEW, "n450764
"n450764
L_S_MBEW_SPLIT TYPE STYPE_MBEW, "n450764
L_S_MBEW_NORMAL TYPE STYPE_MBEW, "n450764
L_FLAG_SPLIT(01) TYPE C. "n450764
"n450764
*read the matching valuation entries "n450764
**--------------------change in logic------Madhu----------------------
SELECT MATNR BWKEY BWTAR LBKUM SALK3 FROM MBEW "n450764
INTO CORRESPONDING FIELDS OF TABLE L_T_MBEW "n450764
WHERE MATNR IN MATNR "n450764
AND BWKEY IN G_RA_BWKEY "n450764
AND BWTAR IN BWTAR.
IF SY-SUBRC NE 0. "n450764
MESSAGE S289. "n450764
*Kein Material in Selektion vorhanden. "n450764
PERFORM ANFORDERUNGSBILD. "n450764
ENDIF.
**--------------------change in logic------Madhu---------------------- . "n450764
"n450764
*read the matching valuation records of the valuated "n450764
*special stock sales order "n450764
SELECT MATNR BWKEY BWTAR "n450764
SUM( LBKUM ) AS LBKUM "n450764
SUM( SALK3 ) AS SALK3 FROM EBEW "n450764
APPENDING CORRESPONDING FIELDS OF TABLE L_T_MBEW "n450764
WHERE MATNR IN MATNR "n450764
AND BWKEY IN G_RA_BWKEY "n450764
AND BWTAR IN BWTAR "n450764
GROUP BY MATNR BWKEY BWTAR. "n450764
*read the matching valuation records of the valuated "n450764
*special stock projects "n450764
SELECT MATNR BWKEY BWTAR "n450764
SUM( LBKUM ) AS LBKUM "n450764
SUM( SALK3 ) AS SALK3 FROM QBEW "n450764
APPENDING CORRESPONDING FIELDS OF TABLE L_T_MBEW "n450764
WHERE MATNR IN MATNR "n450764
AND BWKEY IN G_RA_BWKEY "n450764
AND BWTAR IN BWTAR "n450764
GROUP BY MATNR BWKEY BWTAR. "n450764
*read the matching valuation records of the valuated "n497992
*special subcontractor stock OBEW "n497992
SELECT MATNR BWKEY BWTAR "n497992
SUM( LBKUM ) AS LBKUM "n497992
SUM( SALK3 ) AS SALK3 FROM OBEW "n497992
APPENDING CORRESPONDING FIELDS OF TABLE L_T_MBEW "n497992
WHERE MATNR IN MATNR "n497992
AND BWKEY IN G_RA_BWKEY "n497992
AND BWTAR IN BWTAR "n497992
GROUP BY MATNR BWKEY BWTAR.
*create table g_t_organ if it is still empty
IF G_T_ORGAN[] IS INITIAL. "n433765
*create working table G_0000_RA_BWKEY with the valuation areas
LOOP AT L_T_MBEW INTO L_S_MBEW. "n450764
ON CHANGE OF L_S_MBEW-BWKEY. "n450764
MOVE : L_S_MBEW-BWKEY "n450764
TO G_0000_RA_BWKEY-LOW, "n450764
'I' TO G_0000_RA_BWKEY-SIGN, "n450764
'EQ' TO G_0000_RA_BWKEY-OPTION. "n450764
COLLECT G_0000_RA_BWKEY. "n450764
ENDON. "n450764
ENDLOOP.
PERFORM F0000_CREATE_TABLE_G_T_ORGAN
USING C_NO_ERROR.
ENDIF.
SORT L_T_MBEW BY MATNR BWKEY. "n450764
"n450764
LOOP AT L_T_MBEW INTO L_S_MBEW. "n450764
*process a single entry / add the stock and value "n450764
IF L_S_MBEW-BWTAR IS INITIAL. "n450764
MOVE : L_S_MBEW-MATNR TO L_S_MBEW_NORMAL-MATNR, "n450764
L_S_MBEW-BWKEY TO L_S_MBEW_NORMAL-BWKEY. "n450764
ADD : L_S_MBEW-LBKUM TO L_S_MBEW_NORMAL-LBKUM, "n450764
L_S_MBEW-SALK3 TO L_S_MBEW_NORMAL-SALK3. "n450764
ELSE. "n450764
*material has split valuation "n450764
MOVE : 'X' TO L_FLAG_SPLIT, "n450764
L_S_MBEW-MATNR TO L_S_MBEW_SPLIT-MATNR, "n450764
L_S_MBEW-BWKEY TO L_S_MBEW_SPLIT-BWKEY. "n450764
ADD : L_S_MBEW-LBKUM TO L_S_MBEW_SPLIT-LBKUM, "n450764
L_S_MBEW-SALK3 TO L_S_MBEW_SPLIT-SALK3. "n450764
ENDIF. "n450764
"n450764
*control break after material and valuation area "n450764
AT END OF BWKEY. "n450764
*create a entry for the next working table "n450764
IF L_FLAG_SPLIT = 'X'. "n450764
*if the material has split valuation, take only "n450764
*the sums from the entries with valuation type "n450764
MOVE-CORRESPONDING L_S_MBEW_SPLIT TO G_S_MBEW. "n450764
ELSE. "n450764
MOVE-CORRESPONDING L_S_MBEW_NORMAL TO G_S_MBEW. "n450764
ENDIF. "n450764
"n450764
*check the authority "n450764
PERFORM F9300_READ_ORGAN "n450764
USING C_BWKEY G_S_MBEW-BWKEY. "n450764
"n450764
IF SY-SUBRC IS INITIAL. "n450764
*enrich the entries with the field currency key "n450764
MOVE G_S_ORGAN-WAERS TO G_S_MBEW-WAERS. "n450764
APPEND G_S_MBEW TO G_T_MBEW. "n450764
"n450764
*create the key table for the material texts "n450764
PERFORM F9400_MATERIAL_KEY "n450764
USING G_S_MBEW-MATNR. "n450764
ENDIF. "n450764
"n450764
*clear the working areas for the next group "n450764
CLEAR : L_FLAG_SPLIT, L_S_MBEW_NORMAL, L_S_MBEW_SPLIT."n450764
ENDAT. "n450764
ENDLOOP. "n450764
*no entries left in table g_t_mbew ?
IF G_T_MBEW[] IS INITIAL. "n450764
MESSAGE S289.
*Kein Material in Selektion vorhanden.
PERFORM ANFORDERUNGSBILD.
ENDIF.
ENDFORM. "aktuelle_bst_bwbst
*---------------------------------------------------------------------
** Form BEWEGUNGSARTEN_LESEN
*---------------------------------------------------------------------
*Lesen der Tabellen zur Bewegungsart *
----------------------------------------------------------------------
FORM BEWEGUNGSARTEN_LESEN.
DATA: BEGIN OF K2 OCCURS 0,
BWART LIKE T156S-BWART,
END OF K2.
REFRESH K2.
*select the movement types from the selected documents
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN.
MOVE G_S_MSEG_LEAN-BWART TO K2-BWART.
COLLECT K2.
ENDLOOP.
*Read data for movement type from new tables
*T156SY/C/Q with function module from release >=46B
DATA: T_ST156S LIKE ST156S OCCURS 0
WITH HEADER LINE.
IF SY-SUBRC = 0. "311588
LOOP AT T_ST156S.
MOVE-CORRESPONDING T_ST156S TO IT156.
APPEND IT156.
ENDLOOP.
ENDIF.
ENDLOOP.
SORT IT156 BY BWART WERTU MENGU SOBKZ KZBEW KZZUG KZVBR.
SELECT * FROM T156M INTO CORRESPONDING FIELDS OF TABLE IT156X
FOR ALL ENTRIES IN IT156 WHERE BUSTM EQ IT156-BUSTM.
LOOP AT IT156.
CLEAR IT156-LBBSA.
READ TABLE IT156X WITH KEY BUSTM = IT156-BUSTM.
IT156-LBBSA = IT156X-LBBSA.
MODIFY IT156.
ENDLOOP.
DATA: RC TYPE I. "147374
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN.
*find and delete reversal movements / only in releases >= 45B
IF NOT NOSTO IS INITIAL AND
NOT ( G_S_MSEG_LEAN-SMBLN IS INITIAL OR
G_S_MSEG_LEAN-SMBLP IS INITIAL ).
MOVE-CORRESPONDING G_S_MSEG_LEAN
TO STORNO.
RC = SY-SUBRC. "147374
IF G_S_MSEG_LEAN-BUSTM = SPACE AND
G_S_MSEG_LEAN-BUSTW = SPACE AND
RC = 0. "147374
MOVE : IT156-BUSTM TO G_S_MSEG_LEAN-BUSTM, "147374
IT156-BUSTW TO G_S_MSEG_LEAN-BUSTW. "147374
ENDIF.
IF RC = 0. "147374
MOVE : IT156-LBBSA TO G_S_MSEG_LEAN-LBBSA.
IF NOT IT156-BWAGR IS INITIAL.
MOVE : IT156-BWAGR TO G_S_MSEG_LEAN-BWAGR.
ELSE.
MOVE : 'REST' TO G_S_MSEG_LEAN-BWAGR.
ENDIF.
ELSE.
MOVE : 'REST' TO G_S_MSEG_LEAN-BWAGR.
ENDIF. "147374
MODIFY G_T_MSEG_LEAN FROM G_S_MSEG_LEAN.
ENDLOOP.
ENDFORM. " BEWEGUNGSARTEN_LESEN
*---------------------------------------------------------------------
** Form SUMMEN_BILDEN
*---------------------------------------------------------------------
*Bestandssummen zur Berechnung der Bestande *
*zu 'datum-low' und 'datum-high' *
----------------------------------------------------------------------
FORM SUMMEN_BILDEN.
*Some explanatory words on the strategy of material
*counting/valuation:
*======================================================
*1) Stock overview (no valuation):
*The material document is accepted, if is has not been created
*automatically or if it is not related to movements out of
*the stock. For example, if a stock transfer is posted, the
*system creates a material document with two lines: Out of
*the old stock (accepted) and into the transfer stock (rejected,
*because the material is not yet visible in the target location).
*When the movement into the stock is posted, this is accepted.
*2) Valuated stock:
*a) Movements within a single plant (MA05, MA06 =
*movement types 313-316) are ignored.
*b) The moving of material out of a plant (303/304)
*is counted and valuated in the emitting plant and
*the target plant. The moving in
*(305/306) is ignored, because
*the valuated stock appears in the target at the
*very moment of leaving the emitter.
*c) Material documents without valuation string are ignored.
------------- Summen von 'datum-high' bis Gegenwart ------------------
IF NOT INDEX_2 IS INITIAL.
IF BWBST = ' '.
IF XCHAR = ' '.
SORT IMSWEG BY WERKS MATNR SHKZG. "auf Materialebene
LOOP AT IMSWEG.
IF ( IMSWEG-XAUTO IS INITIAL ) OR
( IMSWEG-BUSTM 'MA02' AND IMSWEG-BUSTM 'MA05' ).
MOVE-CORRESPONDING IMSWEG TO WEG_MAT.
COLLECT WEG_MAT.
ELSE.
DELETE IMSWEG.
ENDIF.
ENDLOOP.
ELSEIF XCHAR = 'X'.
SORT IMSWEG BY WERKS MATNR CHARG SHKZG. "auf Chargenebene
LOOP AT IMSWEG.
IF ( IMSWEG-XAUTO IS INITIAL ) OR
( IMSWEG-BUSTM 'MA02' AND IMSWEG-BUSTM 'MA05' ).
MOVE-CORRESPONDING IMSWEG TO WEG_CHAR.
COLLECT WEG_CHAR.
ELSE.
DELETE IMSWEG.
ENDIF.
ENDLOOP.
ENDIF.
ELSEIF BWBST = 'X'.
SORT IMSWEG BY WERKS MATNR SHKZG.
LOOP AT IMSWEG.
*consider special gain/loss-handling of IS-OIL "n497992
*
*
*IF EXIST OI001
**" IF ( imsweg-bustm 'MEU1' ) OR "n497992
**" ( imsweg-bustm = 'MEU1' "n497992
**" AND not imsweg-OIGLCALC IS INITIAL "n497992
**" AND not imsweg-OIGLSKU IS INITIAL ). "n497992
**" MOVE-CORRESPONDING imsweg TO mat_weg. "n497992
**" COLLECT mat_weg. "n497992
**" ELSE. "n497992
**" DELETE imsweg. "n497992
**" ENDIF . "n497992
*
*
*ELSE
*MOVE-CORRESPONDING imsweg TO mat_weg. "n497992
*COLLECT mat_weg. "n497992
*
*ENDIF
*IS-OIL specific functions without ABAP preprocessor "n599218 A
IF G_FLAG_IS_OIL_ACTIVE = 'X'. "IS-OIL ? "n599218 A
IF ( IMSWEG-BUSTM 'MEU1' ) OR "n599218 A
( IMSWEG-BUSTM = 'MEU1' "n599218 A
AND NOT IMSWEG-OIGLCALC IS INITIAL "n599218 A
AND NOT IMSWEG-OIGLSKU IS INITIAL ). "n599218 A
MOVE-CORRESPONDING IMSWEG TO MAT_WEG. "n599218 A
COLLECT MAT_WEG. "n599218 A
ELSE. "n599218 A
DELETE IMSWEG. "n599218 A
ENDIF. "n599218 A
ELSE. "n599218 A
MOVE-CORRESPONDING IMSWEG TO MAT_WEG. "n599218 A
COLLECT MAT_WEG. "n599218 A
ENDIF. "n599218 A
ENDLOOP.
LOOP AT MAT_WEG.
IF CURM = '1'.
MAT_WEG-BWKEY = MAT_WEG-WERKS.
ELSEIF CURM = '3'.
*
*look for the corresponding valuation area
*READ TABLE organ WITH KEY werks = mat_weg-werks.
*mat_weg-bwkey = organ-bwkey.
PERFORM F9300_READ_ORGAN
USING C_WERKS MAT_WEG-WERKS.
MOVE : G_S_ORGAN-BWKEY TO MAT_WEG-BWKEY.
ENDIF.
MODIFY MAT_WEG.
ENDLOOP.
IF CURM = '3'.
SORT MAT_WEG BY BWKEY MATNR SHKZG.
LOOP AT MAT_WEG.
MOVE-CORRESPONDING MAT_WEG TO MAT_WEG_BUK.
COLLECT MAT_WEG_BUK.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
------------- Summen von 'datum-low' bis 'datum-high' ----------------
IF BWBST = ' '.
IF XCHAR = ' '. "auf Materialebene
SORT G_T_MSEG_LEAN BY WERKS MATNR SHKZG DESCENDING.
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN.
IF ( G_S_MSEG_LEAN-XAUTO IS INITIAL ) OR
( G_S_MSEG_LEAN-BUSTM 'MA02' AND
G_S_MSEG_LEAN-BUSTM 'MA05' ).
MOVE-CORRESPONDING G_S_MSEG_LEAN TO SUM_MAT.
COLLECT SUM_MAT.
ELSE.
DELETE G_T_MSEG_LEAN.
ENDIF.
ENDLOOP.
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN.
IF ( G_S_MSEG_LEAN-XAUTO IS INITIAL ) OR
( G_S_MSEG_LEAN-BUSTM 'MA02' AND
G_S_MSEG_LEAN-BUSTM 'MA05' ).
MOVE-CORRESPONDING G_S_MSEG_LEAN
TO SUM_CHAR.
COLLECT SUM_CHAR.
ELSE.
DELETE G_T_MSEG_LEAN.
ENDIF.
ENDLOOP.
ENDIF.
ELSEIF BWBST = 'X'.
SORT G_T_MSEG_LEAN BY WERKS MATNR SHKZG DESCENDING.
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN.
*consider special gain/loss-handling of IS-OIL "n497992
*
*
*IF EXIST OI001
**" IF ( G_S_MSEG_LEAN-bustm 'MEU1' ) OR "n497992
**" ( G_S_MSEG_LEAN-bustm = 'MEU1' "n497992
**" AND not G_S_MSEG_LEAN-OIGLCALC IS INITIAL "n497992
**" AND not G_S_MSEG_LEAN-OIGLSKU IS INITIAL ). "n497992
*
*
*IS-OIL specific functions without ABAP preprocessor "n599218 A
IF G_FLAG_IS_OIL_ACTIVE = 'X'. "IS-OIL ? "n599218 A
IF ( G_S_MSEG_LEAN-BUSTM 'MEU1' ) OR "n599218 A
( G_S_MSEG_LEAN-BUSTM = 'MEU1' "n599218 A
AND NOT G_S_MSEG_LEAN-OIGLCALC IS INITIAL "n599218 A
AND NOT G_S_MSEG_LEAN-OIGLSKU IS INITIAL ). "n599218 A
MOVE-CORRESPONDING G_S_MSEG_LEAN "n599218 A
TO MAT_SUM. "n599218 A
COLLECT MAT_SUM. "n599218 A
ELSE. "n599218 A
DELETE G_T_MSEG_LEAN. "n599218 A
ENDIF. "n599218 A
ELSE. "n599218 A
MOVE-CORRESPONDING G_S_MSEG_LEAN "n599218 A
TO MAT_SUM. "n599218 A
COLLECT MAT_SUM. "n599218 A
ENDIF. "n599218 A
ENDLOOP.
LOOP AT MAT_SUM.
IF CURM = '1'.
MAT_SUM-BWKEY = MAT_SUM-WERKS.
ELSEIF CURM = '3'.
PERFORM F9300_READ_ORGAN
USING C_WERKS MAT_SUM-WERKS.
MOVE : G_S_ORGAN-BWKEY TO MAT_SUM-BWKEY.
ENDIF.
MODIFY MAT_SUM.
ENDLOOP.
IF CURM = '3'. "Materialbelege auf Buchungskreisebene
SORT MAT_SUM BY BWKEY MATNR SHKZG DESCENDING.
LOOP AT MAT_SUM.
MOVE-CORRESPONDING MAT_SUM TO MAT_SUM_BUK.
COLLECT MAT_SUM_BUK.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " SUMMEN_BILDEN
*---------------------------------------------------------------------
** Form BELEGSELEKTION
*---------------------------------------------------------------------
FORM BELEGSELEKTION.
*does the user wants the valuated stocks ?
IF BWBST = 'X'.
*delete the MM-documents without values
PERFORM UNBEWERTET_WEG.
IF G_T_MBEW[] IS INITIAL. "n450764
MESSAGE S289.
*Kein Material in Selektion vorhanden.
PERFORM ANFORDERUNGSBILD.
ENDIF.
*select the corresponding FI-documents
PERFORM FI_BELEGE_LESEN.
ENDIF.
IF SBBST IS INITIAL.
PERFORM KONTIERT_AUSSORTIEREN.
ENDIF.
PERFORM BEWEGUNGSARTEN_LESEN.
*does the user want no reversal movements ? only in releases >=45B
IF NOT NOSTO IS INITIAL.
PERFORM STORNO.
ENDIF.
*does the user wants the valuated stocks ?
IF BWBST = 'X'.
PERFORM BELEGE_ERGAENZEN.
*Change by Rachit 27.09.2006 Not required
**-------------------change in logic -----Madhu-------
*DELETE G_T_MSEG_LEAN WHERE LGORT IS INITIAL.
ENDIF.
PERFORM BELEGE_SORTIEREN.
ENDFORM. "BELEGSELEKTION
*--------------------------------------------------------------------
** FELDGRUPPEN_AUFBAUEN
*--------------------------------------------------------------------
** create table GRUPPEN with the parameter for special groups *
*--------------------------------------------------------------------
*---------------------------------------------------------------------
** Form UEBERSCHRIFT
*---------------------------------------------------------------------
FORM UEBERSCHRIFT. "#EC CALLED
MOVE-CORRESPONDING BESTAND
TO G_S_BESTAND.
*perform top_of_page_render.
*
ENDFORM. " UEBERSCHRIFT
*---------------------------------------------------------------------
** Form UEBERSCHRIFT1
*---------------------------------------------------------------------
FORM UEBERSCHRIFT1. "#EC CALLED
MOVE-CORRESPONDING BESTAND1
TO G_S_BESTAND.
*perform top_of_page_render.
ENDFORM. " UEBERSCHRIFT1
*---------------------------------------------------------------------
** Form UEBERSCHRIFT_DETAIL
*---------------------------------------------------------------------
FORM UEBERSCHRIFT_DETAIL. "#EC CALLED
MOVE-CORRESPONDING G_S_BESTAND_DETAIL
TO G_S_BESTAND.
*perform top_of_page_render.
ENDFORM. " UEBERSCHRIFT_DETAIL
*---------------------------------------------------------------------
** Form STORNO
*---------------------------------------------------------------------
*Stornobewegungen vernachlassigen
----------------------------------------------------------------------
*delete the reversal movements from the working
*table with the documents / only in releases >=45B
FORM STORNO.
LOOP AT STORNO.
DELETE G_T_MSEG_LEAN
WHERE MBLNR = STORNO-SMBLN "204463
AND MJAHR = STORNO-SJAHR "204463
AND ZEILE = STORNO-SMBLP. "204463
ENDLOOP.
----------------------------------------------------------------------
*F0400_CREATE_FIELDCAT
----------------------------------------------------------------------
*
*create field catalog for the ALV
*take only the field of structure MSEG_LEAN who are in working
*table g_f_mseg_fields
*--> input name of ALV input data table
*
*
----------------------------------------------------------------------
FORM F0400_CREATE_FIELDCAT.
CLEAR G_S_FIELDCAT.
*lagerort storage location
*the following special stocks O, V, W need no storage location
IF SOBKZ = 'O' OR
SOBKZ = 'V' OR
SOBKZ = 'W'.
ELSE.
G_S_FIELDCAT-FIELDNAME = 'LGORT'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
ENDIF.
*Bewegungsart movement type
G_S_FIELDCAT-FIELDNAME = 'BWART'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
*Sonderbestandskennzeichen Special stock indicator
G_S_FIELDCAT-FIELDNAME = 'SOBKZ'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
*Nummer des Materialbelegs Number of material document
G_S_FIELDCAT-FIELDNAME = 'MBLNR'.
G_S_FIELDCAT-REF_TABNAME = 'MKPF'.
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
*Position im Materialbeleg Item in material document
G_S_FIELDCAT-FIELDNAME = 'ZEILE'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
IF BWBST = 'X'.
*Nummer Buchhaltungsbeleg Accounting document number
G_S_FIELDCAT-FIELDNAME = 'BELNR'.
G_S_FIELDCAT-REF_TABNAME = 'BSIM'.
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
ENDIF.
*Buchungsdatum im Beleg Posting date in the document
G_S_FIELDCAT-FIELDNAME = 'BUDAT'.
G_S_FIELDCAT-REF_TABNAME = 'MKPF'.
G_S_FIELDCAT-SP_GROUP = 'D'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
G_S_FIELDCAT-FIELDNAME = 'MEINS'. " Basismengeneinheit
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Base unit of measure
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
IF NOT BWBST IS INITIAL. "mit bewertetem Bestand
*Betrag in Hauswaehrung Amount in local currency
G_S_FIELDCAT-FIELDNAME = 'DMBTR'.
G_S_FIELDCAT-REF_TABNAME = 'BSIM'.
G_S_FIELDCAT-CFIELDNAME = 'WAERS'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT.
ENDIF. "note 201670
*the following fields are always in g_s_mseg_lean, but they are
*hidden in the list
G_S_FIELDCAT-FIELDNAME = 'MJAHR'. " Materialbelegjahr
G_S_FIELDCAT-REF_TABNAME = 'MKPF'. " Material doc. year
G_S_FIELDCAT-SP_GROUP = 'D'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'GJAHR'. " Geschaftsjahr
G_S_FIELDCAT-REF_TABNAME = 'BKPF'. " Fiscal Year
G_S_FIELDCAT-SP_GROUP = 'D'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'VGART'. " Vorgangsart
G_S_FIELDCAT-REF_TABNAME = 'MKPF'. " Transaction/event type
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'USNAM'. " Name des Benutzers
G_S_FIELDCAT-REF_TABNAME = 'MKPF'. " User name
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'CPUDT'. " Tag der Erfassung
G_S_FIELDCAT-REF_TABNAME = 'MKPF'. " Acc. doc. entry date
G_S_FIELDCAT-SP_GROUP = 'D'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'CPUTM'. " Uhrzeit der Erfassung
G_S_FIELDCAT-REF_TABNAME = 'MKPF'. " Time of entry
G_S_FIELDCAT-SP_GROUP = 'D'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
*Kennzeichen: Mengenfortschreibung im Materialstammsatz
*Quantity Updating in Material Master Record
G_S_FIELDCAT-FIELDNAME = 'MENGU'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
*Kennzeichen: Wertfortschreibung im Materialstammsatz
*Value Updating in Material Master Record
G_S_FIELDCAT-FIELDNAME = 'WERTU'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
*Bewegungsartengruppe zur Bestandsauswertung
*Movement type group for stock analysis
G_S_FIELDCAT-FIELDNAME = 'BWAGR'.
*the reference table changed in release 46B
G_S_FIELDCAT-REF_TABNAME = 'T156Q'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT.
*process 'goods receipt/issue slip' as hidden field "n450596
G_S_FIELDCAT-FIELDNAME = 'XABLN'. "n450596
G_S_FIELDCAT-REF_TABNAME = 'MKPF'. "n450596
G_S_FIELDCAT-SP_GROUP = 'S'. "n450596
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT. "n450596
*the following fields will be processed if they are in working table
*g_t_mseg_fields Customer Exit :
*these fields can be activated in include RM07MLBD_CUST_FIELDS
G_S_FIELDCAT-FIELDNAME = 'INSMK'. " Bestandsart
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " stock type
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'KUNNR'. " Kontonummer des Kunden
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " account number of customer
G_S_FIELDCAT-SP_GROUP = 'V'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*process the sales order number and sales order item "n599218
*depending on the release "n599218
*release field "n599218
*4.5B and higher MAT_KDAUF, MAT_KDPOS "n599218
*4.0B KDAUF, KDPOS "n599218
*"n599218
G_S_FIELDCAT-FIELDNAME = 'MAT_KDAUF'. "n599218
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. "n599218
G_S_FIELDCAT-SP_GROUP = 'V'. "n599218
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT. "n599218
"n599218
G_S_FIELDCAT-FIELDNAME = 'MAT_KDPOS'. "n599218
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. "n599218
G_S_FIELDCAT-SP_GROUP = 'V'. "n599218
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT. "n599218
G_S_FIELDCAT-FIELDNAME = 'KDAUF'. " Kundenauftragsnummer
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Sales Order Number
G_S_FIELDCAT-SP_GROUP = 'V'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'KDPOS'. " Positionsnummer
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Item number in Sales Order
G_S_FIELDCAT-SP_GROUP = 'V'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Einteilung Kundenauftrag Delivery schedule for sales order
G_S_FIELDCAT-FIELDNAME = 'KDEIN'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'F'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Menge in Erfassungsmengeneinheit Quantity in unit of entry
G_S_FIELDCAT-FIELDNAME = 'ERFMG'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-QFIELDNAME = 'ERFME'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'ERFME'. " Erfassungsmengeneinheit
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Unit of entry
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Menge in Bestellpreismengeneinheit
*Quantity in purchase order price unit
G_S_FIELDCAT-FIELDNAME = 'BPMNG'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-QFIELDNAME = 'BPRME'.
G_S_FIELDCAT-SP_GROUP = 'E'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'BPRME'. " Bestellpreismengeneinheit
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Order price unit
G_S_FIELDCAT-SP_GROUP = 'E'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'EBELN'. " Bestellnummer
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Purchase order number
G_S_FIELDCAT-SP_GROUP = 'E'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Positionsnummer des Einkaufsbelegs
*Item Number of Purchasing Document
G_S_FIELDCAT-FIELDNAME = 'EBELP'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'E'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'SJAHR'. " Materialbelegjahr
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Material doc. year
G_S_FIELDCAT-SP_GROUP = 'D'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'SMBLN'. " Nummer des Materialbelegs
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Number of material doc.
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'SMBLP'. " Position im Materialbeleg
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Item in material document
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'KOSTL'. " Kostenstelle
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Cost Center
G_S_FIELDCAT-SP_GROUP = 'K'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'AUFNR'. " Auftragsnummer
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Order Number
G_S_FIELDCAT-SP_GROUP = 'K'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'ANLN1'. " Anlagen-Hauptnummer
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Main asset number
G_S_FIELDCAT-SP_GROUP = 'K'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Nummer der Reservierung / des Sekundarbedarfs
*Number of reservation/dependent requirements
G_S_FIELDCAT-FIELDNAME = 'RSNUM'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Positionsnummer der Reservierung / des Sekundarbedarfs
*Item number of reservation/dependent requirements
G_S_FIELDCAT-FIELDNAME = 'RSPOS'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Final issue for this reservation
G_S_FIELDCAT-FIELDNAME = 'KZEAR'. " Kennzeichen: Endausfassung
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*empfangendes/abgebendes Material
*Receiving/issuing material
G_S_FIELDCAT-FIELDNAME = 'UMMAT'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Empfangendes/Abgebendes Werk
*Receiving plant/issuing plant
G_S_FIELDCAT-FIELDNAME = 'UMWRK'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Kennzeichen: Grund der Bewegung
*Reason for movement
G_S_FIELDCAT-FIELDNAME = 'GRUND'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Netzplannummer fur Kontierung
*Network Number for Account Assignment
G_S_FIELDCAT-FIELDNAME = 'NPLNR'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'K'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Plannummer zu Vorgangen im Auftrag
*Routing number for operations in the order
G_S_FIELDCAT-FIELDNAME = 'AUFPL'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'K'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'AUFPS'. " Nummer der Auftragsposition
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Order item number
G_S_FIELDCAT-SP_GROUP = 'K'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Wareneingangsmenge in Bestellmengeneinheit
*Goods receipt quantity in order unit
G_S_FIELDCAT-FIELDNAME = 'BSTMG'.
G_S_FIELDCAT-QFIELDNAME = 'BSTME'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'E'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'BSTME'. " Bestellmengeneinheit
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Order unit
G_S_FIELDCAT-SP_GROUP = 'E'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Extern eingegebener Buchungsbetrag in Hauswahrung
*Externally entered posting amount in local currency
G_S_FIELDCAT-FIELDNAME = 'EXBWR'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-CFIELDNAME = 'WAERS'.
G_S_FIELDCAT-SP_GROUP = 'S'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Wert zu Verkaufspreisen mit Mehrwertsteuer
*Value at sales prices including value-added tax
G_S_FIELDCAT-FIELDNAME = 'VKWRT'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-CFIELDNAME = 'WAERS'.
G_S_FIELDCAT-SP_GROUP = 'V'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Verfallsdatum oder Mindesthaltbarkeitsdatum
*Shelf Life Expiration Date
G_S_FIELDCAT-FIELDNAME = 'VFDAT'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Extern eingegebener Verkaufswert in Hauswahrung
*Externally entered sales value in local currency
G_S_FIELDCAT-FIELDNAME = 'EXVKW'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-CFIELDNAME = 'WAERS'.
G_S_FIELDCAT-SP_GROUP = 'S'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'PPRCTR'. " Partner-Profit Center
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Partner-Profit Center
G_S_FIELDCAT-SP_GROUP = 'O'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Material, auf dem der Bestand gefuhrt wird
*Material on which stock is managed
G_S_FIELDCAT-FIELDNAME = 'MATBF'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Empfangendes/Abgebendes Material
*Receiving/issuing material
G_S_FIELDCAT-FIELDNAME = 'UMMAB'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Gesamter bewerteter Bestand
*Total valuated stock before the posting
G_S_FIELDCAT-FIELDNAME = 'LBKUM'.
G_S_FIELDCAT-QFIELDNAME = 'MEINS'. "note 201670
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Wert des gesamten bewerteten Bestandes
*Value of total valuated stock before the posting
G_S_FIELDCAT-FIELDNAME = 'SALK3'.
G_S_FIELDCAT-CFIELDNAME = 'WAERS'. "note 201670
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'B'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
G_S_FIELDCAT-FIELDNAME = 'VPRSV'. " Preissteuerungskennzeichen
G_S_FIELDCAT-REF_TABNAME = 'MSEG'. " Price control indicator
G_S_FIELDCAT-SP_GROUP = 'S'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Wert zu Verkaufspreisen ohne Mehrwertsteuer
*Value at sales prices excluding value-added tax
G_S_FIELDCAT-FIELDNAME = 'VKWRA'.
G_S_FIELDCAT-CFIELDNAME = 'WAERS'. "note 201670
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'S'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Ursprungszeile im Materialbeleg
*Original line in material document
G_S_FIELDCAT-FIELDNAME = 'URZEI'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'S'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Menge in Mengeneinheit aus Lieferschein
*Quantity in unit of measure from delivery note
G_S_FIELDCAT-FIELDNAME = 'LSMNG'.
G_S_FIELDCAT-QFIELDNAME = 'LSMEH'. "note 201670
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*Mengeneinheit aus Lieferschein
*Unit of measure from delivery note
G_S_FIELDCAT-FIELDNAME = 'LSMEH'.
G_S_FIELDCAT-REF_TABNAME = 'MSEG'.
G_S_FIELDCAT-SP_GROUP = 'M'.
PERFORM F0410_FIELDCAT USING C_CHECK C_NO_OUT.
*if the field catalog contains a field with values in currency,
*add the currency to to field-catalogue
DATA : L_CNT_WAERS_ACTIVE TYPE I, "n497992
L_CNT_WAERS_TOTAL TYPE I. "n497992
"n497992
LOOP AT FIELDCAT INTO G_S_FIELDCAT. "n497992
CHECK : G_S_FIELDCAT-CFIELDNAME = 'WAERS'. "n497992
*this field has a reference to the currency key "n497992
ADD 1 TO L_CNT_WAERS_TOTAL. "n497992
"n497992
CHECK : G_S_FIELDCAT-NO_OUT IS INITIAL. "n497992
*this field is active "n497992
ADD 1 TO L_CNT_WAERS_ACTIVE. "n497992
ENDLOOP. "n497992
"n497992
IF L_CNT_WAERS_ACTIVE > 0. "n497992
*there is at least one active reference field "n497992
*declare currency key WAERS active, too "n497992
G_S_FIELDCAT-FIELDNAME = 'WAERS'. "Currency Key "n497992
G_S_FIELDCAT-REF_TABNAME = 'T001'. "n497992
G_S_FIELDCAT-SP_GROUP = 'M'. "n497992
PERFORM F0410_FIELDCAT USING C_TAKE C_OUT. "n497992
"n497992
ELSEIF L_CNT_WAERS_TOTAL > 0. "n497992
*there are only hidden reference fields "n497992
*declare currency key WAERS hidden, too "n497992
G_S_FIELDCAT-FIELDNAME = 'WAERS'. "Currency Key "n497992
G_S_FIELDCAT-REF_TABNAME = 'T001'. "n497992
G_S_FIELDCAT-SP_GROUP = 'M'. "n497992
PERFORM F0410_FIELDCAT USING C_TAKE C_NO_OUT. "n497992
ENDIF. "n497992
FORM F0410_FIELDCAT
USING L_F_CHECK
L_F_NO_OUT TYPE SLIS_FIELDCAT_MAIN-NO_OUT.
DATA : L_F_CONTINUE(01) TYPE C,
L_F_TYPE(01) TYPE C,
L_F_FIELDNAME TYPE STYPE_FIELDS.
FIELD-SYMBOLS : .
IF L_F_CHECK = C_TAKE.
*take this entry without check
MOVE 'X' TO L_F_CONTINUE.
ELSE.
*create key and look for fieldname
CONCATENATE G_S_FIELDCAT-REF_TABNAME
'~'
G_S_FIELDCAT-FIELDNAME
INTO L_F_FIELDNAME.
READ TABLE G_T_MSEG_FIELDS INTO G_S_MSEG_FIELDS
WITH KEY
FIELDNAME = L_F_FIELDNAME
BINARY SEARCH.
IF SY-SUBRC IS INITIAL.
MOVE 'X' TO L_F_CONTINUE.
ELSE.
*additional fields are displayed in wrong format : "n480130
*clear the working area for the field catalog when "n480130
*the current field should not be processed "n480130
CLEAR G_S_FIELDCAT. "n480130
CLEAR L_F_CONTINUE.
ENDIF.
ENDIF.
*append entry to field catalog if field is in structure
*else leave this routine
IF L_F_CONTINUE IS INITIAL.
CLEAR G_S_FIELDCAT.
EXIT.
ENDIF.
IF NOT L_F_NO_OUT IS INITIAL.
MOVE L_F_NO_OUT TO G_S_FIELDCAT-NO_OUT.
ENDIF.
ADD : 1 TO G_F_COL_POS.
MOVE : G_F_COL_POS TO G_S_FIELDCAT-COL_POS,
G_F_TABNAME TO G_S_FIELDCAT-TABNAME.
APPEND G_S_FIELDCAT TO FIELDCAT.
*create the table with the fields who will be enriched with colors
*and sign
IF G_S_FIELDCAT-FIELDNAME = 'MENGE' OR
G_S_FIELDCAT-FIELDNAME = 'MEINS' OR
G_S_FIELDCAT-FIELDNAME = 'DMBTR' OR
G_S_FIELDCAT-FIELDNAME = 'WAERS' OR
G_S_FIELDCAT-FIELDNAME = 'ERFMG' OR
G_S_FIELDCAT-FIELDNAME = 'ERFME' OR
G_S_FIELDCAT-FIELDNAME = 'BPMNG' OR
G_S_FIELDCAT-FIELDNAME = 'BPRME' OR
G_S_FIELDCAT-FIELDNAME = 'BSTMG' OR
G_S_FIELDCAT-FIELDNAME = 'BSTME' OR
G_S_FIELDCAT-FIELDNAME = 'EXBWR' OR
G_S_FIELDCAT-FIELDNAME = 'VKWRT' OR
G_S_FIELDCAT-FIELDNAME = 'EXVKW' OR
G_S_FIELDCAT-FIELDNAME = 'VKWRA' OR
G_S_FIELDCAT-FIELDNAME = 'LSMNG' OR
G_S_FIELDCAT-FIELDNAME = 'LSMEH' OR
G_S_FIELDCAT-FIELDNAME = 'SHKZG' OR
G_S_FIELDCAT-FIELDNAME = 'BAL_QTY' OR
G_S_FIELDCAT-FIELDNAME = 'BAL_AMT'.
*look for the type of this field
CONCATENATE G_S_FIELDCAT-REF_TABNAME
'-'
G_S_FIELDCAT-FIELDNAME
INTO L_F_FIELDNAME.
ASSIGN (L_F_FIELDNAME) TO .
IF SY-SUBRC IS INITIAL.
DESCRIBE FIELD TYPE L_F_TYPE.
MOVE : G_S_FIELDCAT-FIELDNAME
TO G_T_COLOR_FIELDS-FIELDNAME,
L_F_TYPE TO G_T_COLOR_FIELDS-TYPE.
APPEND G_T_COLOR_FIELDS.
ENDIF.
ENDIF.
CLEAR G_S_FIELDCAT.
ENDFORM. "F0410_FIELDCAT
**----------------------------------------------------------"n443935
"n443935
*---------------------------------------------------------------------
** Form belege_ergaenzen_2
*---------------------------------------------------------------------
*text
----------------------------------------------------------------------
FORM BELEGE_ERGAENZEN_2. "n443935
"n443935
*control break : process the entries from a group "n443935
"n443935
*look for the matching FI documents with set and get "n443935
MOVE : G_S_MSEG_OLD-MBLNR TO MATKEY-MBLNR, "n443935
G_S_MSEG_OLD-MJAHR TO MATKEY-MJAHR. "n443935
"n443935
READ TABLE G_T_BSIM_LEAN INTO G_S_BSIM_LEAN "n443935
WITH KEY BUKRS = G_S_MSEG_OLD-BUKRS "n443935
BWKEY = G_S_MSEG_OLD-BWKEY "n443935
MATNR = G_S_MSEG_OLD-MATNR "n443935
BWTAR = G_S_MSEG_OLD-BWTAR "n443935
SHKZG = G_S_MSEG_OLD-SHKZG "n443935
MEINS = G_S_MSEG_OLD-MEINS "n443935
BUDAT = G_S_MSEG_OLD-BUDAT "n443935
BLART = G_S_MSEG_OLD-BLART "n443935
AWKEY = MATKEY "n443935
BINARY SEARCH. "n443935
"n443935
IF SY-SUBRC IS INITIAL. "n443935
MOVE SY-TABIX TO G_F_TABIX_START. "n443935
"n443935
*continue with sequential read of working table "n443935
LOOP AT G_T_BSIM_LEAN INTO G_S_BSIM_LEAN "n443935
FROM G_F_TABIX_START. "n443935
"n443935
IF G_S_BSIM_LEAN-BUKRS = G_S_MSEG_OLD-BUKRS AND "n443935
G_S_BSIM_LEAN-BWKEY = G_S_MSEG_OLD-BWKEY AND "n443935
G_S_BSIM_LEAN-MATNR = G_S_MSEG_OLD-MATNR AND "n443935
G_S_BSIM_LEAN-BWTAR = G_S_MSEG_OLD-BWTAR AND "n443935
G_S_BSIM_LEAN-SHKZG = G_S_MSEG_OLD-SHKZG AND "n443935
G_S_BSIM_LEAN-MEINS = G_S_MSEG_OLD-MEINS AND "n443935
G_S_BSIM_LEAN-BUDAT = G_S_MSEG_OLD-BUDAT AND "n443935
G_S_BSIM_LEAN-BLART = G_S_MSEG_OLD-BLART AND "n443935
G_S_BSIM_LEAN-AWKEY = MATKEY. "n443935
*select all matching entries "n443935
ADD 1 TO G_CNT_BSIM_ENTRIES. "n443935
MOVE-CORRESPONDING G_S_BSIM_LEAN "n443935
TO G_S_BSIM_WORK. "n443935
MOVE SY-TABIX TO G_S_BSIM_WORK-TABIX. "n443935
APPEND G_S_BSIM_WORK TO G_T_BSIM_WORK. "n443935
ELSE. "n443935
EXIT. "n443935
ENDIF. "n443935
ENDLOOP. "n443935
ENDIF. "n443935
"n443935
*set a break-point : results in contol break "n443935
*how many matching entries from BSIM found ? "n443935
IF G_CNT_BSIM_ENTRIES IS INITIAL. "n443935
*no BSIM entries found -> no action. "n443935
"n443935
ELSEIF G_CNT_BSIM_ENTRIES = 1 AND "n443935
G_CNT_MSEG_ENTRIES = 1. "n443935
*the ideal case 1 MM and 1 FI document; "n443935
*mark this FI doc for deletion "n443935
LOOP AT G_T_BSIM_WORK INTO G_S_BSIM_WORK. "n443935
READ TABLE G_T_BSIM_LEAN INTO G_S_BSIM_LEAN "n443935
INDEX G_S_BSIM_WORK-TABIX. "n443935
"n443935
CHECK : SY-SUBRC IS INITIAL. "n443935
MOVE : 'D' TO G_S_BSIM_LEAN-ACCESSED. "n443935
MODIFY G_T_BSIM_LEAN FROM G_S_BSIM_LEAN "n443935
INDEX G_S_BSIM_WORK-TABIX "n443935
TRANSPORTING ACCESSED. "n451923
"n443935
*set the FI doc number into the entry of the MM doc "n443935
READ TABLE G_T_MSEG_WORK INTO G_S_MSEG_WORK "n443935
INDEX 1. "n443935
CHECK : SY-SUBRC IS INITIAL. "n443935
"n443935
MOVE : G_S_BSIM_WORK-BELNR "n443935
TO G_S_MSEG_WORK-BELNR, "n443935
G_S_BSIM_WORK-GJAHR "n443935
TO G_S_MSEG_WORK-GJAHR. "n443935
*consider special gain/loss-handling of IS-OIL "n497992
*
*IF EXIST OI001
**" if g_s_mseg_work-oiglcalc = 'L' and "n497992
**" g_s_mseg_work-shkzg = 'H' and "n497992
**" g_s_mseg_work-dmbtr = 0. "n497992
**" move g_s_bsim_work-dmbtr "n497992
**" to g_s_mseg_work-dmbtr. "n497992
**" endif. "n497992
**" "n497992
**" MODIFY G_T_MSEG_work "n497992
**" FROM G_S_MSEG_work "n497992
**" INDEX 1 "n497992
**" TRANSPORTING BELNR GJAHR dmbtr. "n497992
*
*
*IS-OIL specific functions without ABAP preprocessor "n599218 A
IF G_FLAG_IS_OIL_ACTIVE = 'X'. "IS-OIL ? "n599218 A
IF G_S_MSEG_WORK-OIGLCALC = 'L' AND "n599218 A
G_S_MSEG_WORK-SHKZG = 'H' AND "n599218 A
G_S_MSEG_WORK-DMBTR = 0. "n599218 A
MOVE G_S_BSIM_WORK-DMBTR "n599218 A
TO G_S_MSEG_WORK-DMBTR. "n599218 A
ENDIF. "n599218 A
"n599218 A
MODIFY G_T_MSEG_WORK "n599218 A
FROM G_S_MSEG_WORK "n599218 A
INDEX 1 "n599218 A
TRANSPORTING BELNR GJAHR DMBTR. "n599218 A
ELSE. "n599218 A
MODIFY G_T_MSEG_WORK FROM G_S_MSEG_WORK "n599218 A
INDEX 1 "n599218 A
TRANSPORTING BELNR GJAHR. "n599218 A
ENDIF. "n599218 A
ENDLOOP. "n443935
"n443935
ELSE. "n443935
*there are a lot of MM docs "n443935
PERFORM BELEGE_ERGAENZEN_SEVERAL_DOCS. "n443935
"n443935
ENDIF. "n443935
"n443935
*copy the number and fiscal year into the matching "n451923
*entry of the main table G_T_MSEG_LEAN "n451923
LOOP AT G_T_MSEG_WORK INTO G_S_MSEG_WORK. "n451923
*only with useful FI doc data "n451923
CHECK : NOT G_S_MSEG_WORK-BELNR IS INITIAL. "n451923
"n443935
*read the original entry and change it "n451923
READ TABLE G_T_MSEG_LEAN INTO G_S_MSEG_UPDATE "n451923
INDEX G_S_MSEG_WORK-TABIX. "n451923
"n443935
CHECK : SY-SUBRC IS INITIAL. "entry found ? "n451923
MOVE : G_S_MSEG_WORK-BELNR "n451923
TO G_S_MSEG_UPDATE-BELNR, "n451923
G_S_MSEG_WORK-GJAHR "n451923
TO G_S_MSEG_UPDATE-GJAHR. "n451923
*consider special gain/loss-handling of IS-OIL "n497992
*
*IF EXIST OI001
**" move g_s_mseg_work-dmbtr "n497992
**" to g_s_mseg_update-dmbtr. "n497992
**" "n497992
**" MODIFY G_T_MSEG_lean "n497992
**" FROM G_S_MSEG_update "n497992
**" index g_s_mseg_work-tabix "n497992
**" TRANSPORTING BELNR GJAHR dmbtr. "n497992
*
*
*IS-OIL specific functions without ABAP preprocessor "n599218 A
IF G_FLAG_IS_OIL_ACTIVE = 'X'. "IS-OIL ? "n599218 A
MOVE G_S_MSEG_WORK-DMBTR "n599218 A
TO G_S_MSEG_UPDATE-DMBTR. "n599218 A
"n599218 A
MODIFY G_T_MSEG_LEAN "n599218 A
FROM G_S_MSEG_UPDATE "n599218 A
INDEX G_S_MSEG_WORK-TABIX "n599218 A
TRANSPORTING BELNR GJAHR DMBTR. "n599218 A
ELSE. "n599218 A
MODIFY G_T_MSEG_LEAN FROM G_S_MSEG_UPDATE "n599218 A
INDEX G_S_MSEG_WORK-TABIX "n599218 A
TRANSPORTING BELNR GJAHR. "n599218 A
ENDIF. "n599218 A
ENDLOOP. "n451923
PERFORM BELEGE_ERGAENZEN_CLEAR. "n443935
"n443935
ENDFORM. "belege_ergaenzen_2 "n443935
"n443935
**----------------------------------------------------------"n443935
** belege_ergaenzen_clear
**----------------------------------------------------------"n443935
"n443935
*---------------------------------------------------------------------
** Form belege_ergaenzen_clear
*---------------------------------------------------------------------
*text
----------------------------------------------------------------------
FORM BELEGE_ERGAENZEN_CLEAR. "n443935
"n443935
*clear working areas for the next group "n443935
REFRESH : G_T_BSIM_WORK, G_T_MSEG_WORK. "n443935
CLEAR : G_CNT_MSEG_ENTRIES, G_CNT_MSEG_DONE, "n443935
G_CNT_BSIM_ENTRIES. "n443935
"n443935
ENDFORM. "belege_ergaenzen_clear. "n443935
"n443935
**----------------------------------------------------------"n443935
*belege_ergaenzen_several_docs
**----------------------------------------------------------"n443935
"n443935
*---------------------------------------------------------------------
** Form belege_ergaenzen_several_docs
*---------------------------------------------------------------------
*text
----------------------------------------------------------------------
FORM BELEGE_ERGAENZEN_SEVERAL_DOCS. "n443935
"n443935
*first step : the entries must hit quantity and value "n443935
LOOP AT G_T_MSEG_WORK INTO G_S_MSEG_WORK. "n443935
"n443935
*look for a matching FI doc "n443935
LOOP AT G_T_BSIM_WORK INTO G_S_BSIM_WORK. "n443935
*ingnore the entries for deletion "n443935
CHECK : G_S_BSIM_WORK-ACCESSED NE 'D'. "n443935
"n443935
IF G_S_BSIM_WORK-MENGE = G_S_MSEG_WORK-MENGE AND "n443935
G_S_BSIM_WORK-DMBTR = G_S_MSEG_WORK-DMBTR. "n443935
*mark the entries "n443935
ADD 1 TO G_CNT_MSEG_DONE. "n443935
MOVE : G_S_BSIM_WORK-BELNR "n443935
TO G_S_MSEG_WORK-BELNR, "n443935
G_S_BSIM_WORK-GJAHR "n443935
TO G_S_MSEG_WORK-GJAHR. "n443935
MODIFY G_T_MSEG_WORK FROM G_S_MSEG_WORK "n443935
TRANSPORTING BELNR GJAHR. "n451923
"n443935
*mark the entries for deletion "n443935
MOVE 'D' TO G_S_BSIM_WORK-ACCESSED. "n443935
MODIFY G_T_BSIM_WORK FROM G_S_BSIM_WORK "n443935
TRANSPORTING ACCESSED. "n451923
EXIT. "Stop at the firts hit "n443935
ENDIF. "n443935
ENDLOOP. "n443935
ENDLOOP. "n443935
"n443935
*set a break-point : in control break after the 1st step "n443935
IF G_CNT_MSEG_ENTRIES NE G_CNT_MSEG_DONE. "n443935
*there are MM docs without FI doc left "n443935
"n443935
*subtract the quantity and value from MM doc from "n443935
*the fields of the FI doc "n443935
LOOP AT G_T_MSEG_WORK INTO G_S_MSEG_WORK. "n443935
"n443935
*take only the entries without FI doc number "n443935
CHECK : G_S_MSEG_WORK-BELNR IS INITIAL. "n443935
"n443935
LOOP AT G_T_BSIM_WORK INTO G_S_BSIM_WORK. "n443935
*ingnore the entries for deletion "n443935
CHECK : G_S_BSIM_WORK-ACCESSED NE 'D'. "n443935
"n443935
IF G_S_BSIM_WORK-MENGE GE G_S_MSEG_WORK-MENGE AND "n443935
G_S_BSIM_WORK-DMBTR GE G_S_MSEG_WORK-DMBTR. "n443935
"n443935
SUBTRACT : "n443935
G_S_MSEG_WORK-MENGE FROM G_S_BSIM_WORK-MENGE, "n443935
G_S_MSEG_WORK-DMBTR FROM G_S_BSIM_WORK-DMBTR. "n443935
"n443935
IF G_S_BSIM_WORK-MENGE IS INITIAL AND "n443935
G_S_BSIM_WORK-DMBTR IS INITIAL. "n443935
*mark the entry for deletion "n443935
MOVE 'D' TO G_S_BSIM_WORK-ACCESSED. "n443935
ELSE. "n443935
*set the flag for check the merge process "n443935
MOVE 'X' TO G_S_BSIM_WORK-ACCESSED. "n443935
ENDIF. "n443935
"n443935
MODIFY G_T_BSIM_WORK FROM G_S_BSIM_WORK "n443935
*change quantity and value in working table, too "n747306
TRANSPORTING ACCESSED MENGE DMBTR. "n747306
"n443935
*mark the entries "n443935
ADD 1 TO G_CNT_MSEG_DONE. "n443935
MOVE : G_S_BSIM_WORK-BELNR "n443935
TO G_S_MSEG_WORK-BELNR, "n443935
G_S_BSIM_WORK-GJAHR "n443935
TO G_S_MSEG_WORK-GJAHR. "n443935
MODIFY G_T_MSEG_WORK FROM G_S_MSEG_WORK "n443935
TRANSPORTING BELNR GJAHR. "n451923
EXIT. "Stop at the first hit "n443935
ENDIF. "n443935
ENDLOOP. "n443935
ENDLOOP. "n443935
ENDIF. "n443935
"n443935
*mark the processed FI docs for deletion "n443935
LOOP AT G_T_BSIM_WORK INTO G_S_BSIM_WORK. "n443935
CHECK G_S_BSIM_WORK-ACCESSED = 'D'. "n443935
"n443935
READ TABLE G_T_BSIM_LEAN INTO G_S_BSIM_LEAN "n443935
INDEX G_S_BSIM_WORK-TABIX. "n443935
"n443935
CHECK : SY-SUBRC IS INITIAL. "n443935
MOVE : 'D' TO G_S_BSIM_LEAN-ACCESSED. "n443935
MODIFY G_T_BSIM_LEAN FROM G_S_BSIM_LEAN "n443935
INDEX G_S_BSIM_WORK-TABIX "n443935
TRANSPORTING ACCESSED. "n451923
ENDLOOP. "n443935
"n443935
ENDFORM. "belege_ergaenzen_several_docs "n443935
"n443935
*---------------------------------------------------------------------
** Form USER_COMMAND *
*---------------------------------------------------------------------
FORM USER_COMMAND "#EC CALLED
USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
TYPES: BEGIN OF TY_S_SEL,
MBLNR LIKE MSEG-MBLNR,
MJAHR LIKE MSEG-MJAHR,
ZEILE LIKE MSEG-ZEILE,
BUKRS LIKE MSEG-BUKRS,
BELNR LIKE MSEG-BELNR,
GJAHR LIKE MSEG-GJAHR,
END OF TY_S_SEL,
TY_T_SEL TYPE TY_S_SEL OCCURS 0.
DATA: L_VALUE(10) TYPE N,
LS_SEL TYPE TY_S_SEL,
LT_SEL TYPE TY_T_SEL,
L_LINES LIKE SY-TABIX,
LS_FC TYPE SLIS_FIELDCAT_ALV,
LT_FC TYPE SLIS_T_FIELDCAT_ALV,
LS_SELFIELD TYPE SLIS_SELFIELD,
L_FI_DOC.
*Unfortunately the output list of this report consists
*of several ALVs, one started at the end-event of the other.
*This abstrucse programming style was chosen to create a list
*layout similar to the one in release 3.1. Now this causes a severe
*problem: When selecting a line, we do not know which ALV (and there-
*for which line in table IMSEG) has been selected. We can only use
*the value of the selected field to access the data-table.
*In case of ambiguities, a popup has to be transmitted where the
*user has to reselect the document he wants to see. This is
*difficult to understand, if you do not know the problems of
*programming ABAP.
CASE R_UCOMM.
WHEN '9PBP'.
*Get line of IMSEG which "look" like the one selected
L_VALUE = RS_SELFIELD-VALUE.
CHECK NOT L_VALUE IS INITIAL. "204872
IF RS_SELFIELD-SEL_TAB_FIELD = 'G_T_BELEGE-MBLNR' OR
RS_SELFIELD-SEL_TAB_FIELD = 'G_T_BELEGE1-MBLNR'.
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN
WHERE MBLNR = L_VALUE.
LS_SEL-MBLNR = G_S_MSEG_LEAN-MBLNR.
LS_SEL-MJAHR = G_S_MSEG_LEAN-MJAHR.
LS_SEL-ZEILE = G_S_MSEG_LEAN-ZEILE.
COLLECT LS_SEL INTO LT_SEL.
ENDLOOP.
ELSEIF RS_SELFIELD-SEL_TAB_FIELD = 'G_T_BELEGE-BELNR' OR
RS_SELFIELD-SEL_TAB_FIELD = 'G_T_BELEGE1-BELNR'.
L_FI_DOC = 'X'.
LOOP AT G_T_MSEG_LEAN INTO G_S_MSEG_LEAN
WHERE BELNR = L_VALUE.
LS_SEL-BELNR = G_S_MSEG_LEAN-BELNR.
LS_SEL-GJAHR = G_S_MSEG_LEAN-GJAHR.
LS_SEL-BUKRS = G_S_MSEG_LEAN-BUKRS.
COLLECT LS_SEL INTO LT_SEL.
ENDLOOP.
ENDIF.
SORT LT_SEL BY MJAHR MBLNR ZEILE BUKRS BELNR GJAHR.
*Read first line. If L_LINES = 1, LS_SEL is filled properly.
READ TABLE LT_SEL INTO LS_SEL INDEX 1.
DESCRIBE TABLE LT_SEL LINES L_LINES.
*If no line found, the cursor was not on a useful value.
IF L_LINES = 0.
MESSAGE S270.
EXIT.
ENDIF.
*If more than one line found, it gets difficult. We send a popup
*where the user may select a single line.
IF L_LINES > 1.
*Create fieldcatalog
DEFINE FC_ADD.
LS_FC-FIELDNAME = *1.
LS_FC-REF_TABNAME = *2.
LS_FC-REF_FIELDNAME = *3.
APPEND LS_FC TO LT_FC.
END-OF-DEFINITION.
CLEAR LS_SEL.
IF L_FI_DOC IS INITIAL.
FC_ADD 'MBLNR' 'MKPF' 'MBLNR'.
FC_ADD 'MJAHR' 'MKPF' 'MJAHR'.
FC_ADD 'ZEILE' 'MSEG' 'ZEILE'.
ELSE.
FC_ADD 'BUKRS' 'BKPF' 'BUKRS'.
FC_ADD 'BELNR' 'BKPF' 'BELNR'.
FC_ADD 'GJAHR' 'BKPF' 'GJAHR'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_ZEBRA = 'X'
I_TABNAME = 'LT_SEL'
IT_FIELDCAT = LT_FC
IMPORTING
ES_SELFIELD = LS_SELFIELD
TABLES
T_OUTTAB = LT_SEL.
*Read table with the unique index.
READ TABLE LT_SEL INTO LS_SEL INDEX LS_SELFIELD-TABINDEX.
IF SY-SUBRC 0.
EXIT.
ENDIF.
ENDIF.
*read and save the user parameters before calling
*transaction MIGO or FB03
PERFORM USER_PARAMETERS_SAVE.
*Now call the corresponding application. LS_SEL is always filled
*correctly.
IF L_FI_DOC IS INITIAL.
*call the display transcation MIGO for the MM document "TEST
CALL FUNCTION 'MIGO_DIALOG' "n547170
EXPORTING "n547170
I_ACTION = 'A04' "n547170
I_REFDOC = 'R02' "n547170
I_NOTREE = 'X' "n547170
I_NO_AUTH_CHECK = ' ' "n547170
I_DEADEND = 'X' "n547170
I_SKIP_FIRST_SCREEN = 'X' "n547170
I_OKCODE = 'OK_GO' "n547170
I_MBLNR = LS_SEL-MBLNR "n547170
I_MJAHR = LS_SEL-MJAHR "n547170
I_ZEILE = LS_SEL-ZEILE. "n547170
ELSE.
SET PARAMETER ID 'BLN' FIELD LS_SEL-BELNR.
SET PARAMETER ID 'BUK' FIELD LS_SEL-BUKRS.
SET PARAMETER ID 'GJR' FIELD LS_SEL-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
*restore the former user parameters
PERFORM USER_PARAMETERS_RESTORE.
FORM ESDUS_GET_PARAMETERS. "n547170
*-----------------------------------------------------------"n547170
*Initialization of the user defaults for the checkboxes
*read the settings from table ESDUS
*-----------------------------------------------------------
*only in dialog mode
CHECK : SY-BATCH IS INITIAL.
DATA : L_CNT_RADIOBUTTON TYPE I.
*get the parameters from the last run from table ESDUS as
*default values in release 4.6 and higher
IF OREF_SETTINGS IS INITIAL.
CREATE OBJECT OREF_SETTINGS
EXPORTING I_ACTION = 'RM07MLBD'.
ENDIF.
IF NOT LGBST IS INITIAL.
ADD 1 TO L_CNT_RADIOBUTTON.
ENDIF.
IF NOT BWBST IS INITIAL.
ADD 1 TO L_CNT_RADIOBUTTON.
ENDIF.
IF NOT SBBST IS INITIAL.
ADD 1 TO L_CNT_RADIOBUTTON.
ENDIF.
IF L_CNT_RADIOBUTTON NE 1.
*
*offend against radiobutton rules ?
*yes -> set the first and delete the rest
MOVE : 'X' TO LGBST.
CLEAR : BWBST, SBBST.
ENDIF.
*at the first time ( or in a lower release ) all seven "n599218
*list categories will be initial --> activate them all "n599218
PERFORM F0850_EMPTY_PARAMETERS. "n599218
"n599218
IF G_CNT_EMPTY_PARAMETER = 7. "n599218
MOVE : 'X' TO PA_WDZER, "n599218
'X' TO PA_WDZEW, "n599218
'X' TO PA_WDWIZ, "n599218
'X' TO PA_WDWUW, "n599218
'X' TO PA_WDWEW, "n599218
'X' TO PA_NDSTO, "n599218
'X' TO PA_NDZER. "n599218
ENDIF. "n599218
*carry out the database updates only; the normal commit "n599218
*command does not allow to record this transaction for "n599218
*a batch input session using transaction SHDB "n599218
CALL FUNCTION 'DB_COMMIT'. "n599218
ENDFORM. "esdus_save_parameters "n547170
*-----------------------------------------------------------"n547170
"n599218 A
*---------------------------------------------------------------------
** Form check_is_oil_system
*---------------------------------------------------------------------
*text
----------------------------------------------------------------------
FORM CHECK_IS_OIL_SYSTEM. "n599218 A
"n599218 A
MOVE 'OI001' TO G_F_DCOBJDEF_NAME. "n599218 A
CLEAR : G_FLAG_IS_OIL_ACTIVE, G_CNT_IS_OIL. "n599218 A
"n599218 A
*does database OI001 exist in this system ? "n599218 A
CALL FUNCTION 'DDIF_NAMETAB_GET' "n599218 A
EXPORTING "n599218 A
TABNAME = G_F_DCOBJDEF_NAME "n599218 A
TABLES "n599218 A
X031L_TAB = G_T_X031L "n599218 A
EXCEPTIONS "n599218 A
OTHERS = 1. "n599218 A
"n599218 A
CHECK SY-SUBRC IS INITIAL. "OI001 is available ? "n599218 A
"n599218 A
*check definition of MM document item MSEG "n599218 A
MOVE 'MSEG' TO G_F_DCOBJDEF_NAME. "n599218 A
"n599218 A
CALL FUNCTION 'DDIF_NAMETAB_GET' "n599218 A
EXPORTING "n599218 A
TABNAME = G_F_DCOBJDEF_NAME "n599218 A
TABLES "n599218 A
X031L_TAB = G_T_X031L "n599218 A
EXCEPTIONS "n599218 A
OTHERS = 1. "n599218 A
"n599218 A
CHECK SY-SUBRC IS INITIAL. "structure MSEG found "n599218 A
"n599218 A
*check whether the IS-OIL specific fields are available "n599218 A
LOOP AT G_T_X031L INTO G_S_X031L. "n599218 A
CASE G_S_X031L-FIELDNAME. "n599218 A
WHEN 'OIGLCALC'. "n599218 A
ADD 1 TO G_CNT_IS_OIL. "n599218 A
"n599218 A
WHEN 'OIGLSKU'. "n599218 A
ADD 2 TO G_CNT_IS_OIL. "n599218 A
ENDCASE. "n599218 A
ENDLOOP. "n599218 A
"n599218 A
*in the case structure MSEG comprises both fields "n599218 A
*-> activate the IS-OIL function "n599218 A
IF G_CNT_IS_OIL = 3. "n599218 A
MOVE 'X' TO G_FLAG_IS_OIL_ACTIVE. "n599218 A
ENDIF. "n599218 A
"n599218 A
ENDFORM. "check_is_oil_system. "n599218 A
"n599218 A
----------------------------------------------------------------------
*calculate_offsets.
----------------------------------------------------------------------
*calculate the offsets for the list header
FORM CALCULATE_OFFSETS.
*working area
DATA : L_TEXT(132) TYPE C.
*get the maximal length of the text elements to be used
PERFORM GET_MAX_TEXT_LENGTH USING TEXT-020.
PERFORM GET_MAX_TEXT_LENGTH USING TEXT-021.
PERFORM GET_MAX_TEXT_LENGTH USING TEXT-022.
PERFORM GET_MAX_TEXT_LENGTH USING TEXT-023.
PERFORM GET_MAX_TEXT_LENGTH USING TEXT-025.
G_OFFSET_HEADER = G_F_LENGTH_MAX + 3.
CLEAR G_F_LENGTH_MAX.
IF BWBST IS INITIAL.
*stocks and quantities only
MOVE TEXT-007 TO G_DATE_LINE_FROM-TEXT.
WRITE : DATUM-LOW TO G_DATE_LINE_FROM-DATUM DD/MM/YYYY.
CONDENSE G_DATE_LINE_FROM.
PERFORM GET_MAX_TEXT_LENGTH USING G_DATE_LINE_FROM.
MOVE TEXT-005 TO G_TEXT_LINE-TEXT.
PERFORM GET_MAX_TEXT_LENGTH USING G_TEXT_LINE.
MOVE TEXT-006 TO G_TEXT_LINE.
PERFORM GET_MAX_TEXT_LENGTH USING G_TEXT_LINE.
MOVE TEXT-007 TO G_DATE_LINE_TO-TEXT.
WRITE : DATUM-HIGH TO G_DATE_LINE_TO-DATUM DD/MM/YYYY.
CONDENSE G_DATE_LINE_TO.
ELSE.
*stocks, quantities, and values
MOVE TEXT-008 TO G_DATE_LINE_FROM-TEXT.
WRITE : DATUM-LOW TO G_DATE_LINE_FROM-DATUM DD/MM/YYYY.
CONDENSE G_DATE_LINE_FROM.
PERFORM GET_MAX_TEXT_LENGTH USING L_TEXT.
MOVE TEXT-030 TO G_TEXT_LINE-TEXT.
PERFORM GET_MAX_TEXT_LENGTH USING G_TEXT_LINE.
MOVE TEXT-031 TO G_TEXT_LINE-TEXT.
PERFORM GET_MAX_TEXT_LENGTH USING G_TEXT_LINE.
MOVE TEXT-008 TO G_DATE_LINE_TO-TEXT.
WRITE : DATUM-HIGH TO G_DATE_LINE_TO-DATUM DD/MM/YYYY.
CONDENSE G_DATE_LINE_TO.
ENDIF.
*calculate the offsets for the following columns
G_OFFSET_QTY = G_F_LENGTH_MAX + 2.
G_OFFSET_UNIT = G_OFFSET_QTY + 25.
G_OFFSET_VALUE = G_OFFSET_UNIT + 8.
G_OFFSET_CURR = G_OFFSET_VALUE + 25.
*contains FORM routines without preprocessor commands and "n547170
*no text elements "n547170
*INCLUDE zrm07mlbd_form_01.
*include RM07MLBD_FORM_01. "n547170
INCLUDE Y_AC_RM07MLBD_FORM1_01.
*INCLUDE zrm07mlbd_form_02.
INCLUDE Y_AC_RM07MLBD_FORM2_02.
*include RM07MLBD_FORM_02. "n547170
*---------------------------------------------------------------------
** Form CREATE_FIELD_CATALOG
*---------------------------------------------------------------------
ENDFORM. " CREATE_FIELD_CATALOG
*---------------------------------------------------------------------
** Form DISPLAY_OUTPUT
*---------------------------------------------------------------------
FORM DISPLAY_OUTPUT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS1'
*I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
*I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "see FORM
*i_grid_title = title "'Error Logs '
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
*it_special_groups = gd_tabgroup
*IT_EVENTS = GT_XEVENTS
I_SAVE = 'A'
*is_variant = z_template
TABLES
T_OUTTAB = BESTAND_QTR
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. " DISPLAY_OUTPUT
*---------------------------------------------------------------------
** Form STATUS1
*---------------------------------------------------------------------
*text
----------------------------------------------------------------------
*-->RT_EXPAB text
----------------------------------------------------------------------
FORM STATUS1 USING RT_EXPAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS1'.
ENDFORM. "STATUS1
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.