Sei sulla pagina 1di 18

Transaction Code(s):

Below is a list of transaction codes which are relevant to this SAP report

MBVR - Management Program: Reservations


DESCRIPTION
Use this program to manage reservations.
You can process reservations with selected account assignments. Limit
the latter on the selection screen by entering an interval of
reservation numbers.
The base date exerts an influence on the selection. Only those reservations whose headers contain a
base date that is earlier than or equal to this date are taken into account.
Furthermore the computation of the NUMBER OF DAYS for 'deletion' or
'allow movement' is carried out using this base date. The values for
NUMBER OF DAYS are defined for each plant in table T159L.
You can make the following pre-settings for the start of this program by means of the appropriate
entries in table T159L:
Report name BatIn Log
RM07RVER X X
If you have placed a checkmark against the field "BatIn", the program starts in a test run. In each
case (regardless of the indicator 'Log'), the system will produce a list of all reservations having a base
date earlier than or equal to the selected base date. Those reservations that are to be changed can
then be selected using the select functions. You can then initiate the changes to the data base by
pressing F11.
The menu option 'Goto -> Reservation items' gives you a list of all
reservation items. You process this in the same way as the list of
reservations.
If the field 'BatIn'/'Test run' is initial, the data base changes are made immediately.
PRECONDITION
You can only carry out this program if you have authorization for the activities 65 (reorganize) and 70
(manage) in the authorization objects Reservations: movement type (M_MRES_BWA) and
Reservations: plant (M_MRES_WWA).
If all items for a reservation can be deleted, the system suggests the whole reservation for deletion.
If only individual reservation items can be changed, the system suggests only these items.
OUTPUT
Use the fields 'Log' and 'Issue log' to decide whether a log is to be issued in the event that the data
base is changed immediately ('BatIn'/ 'Test run' is initial).
If the system finds that the reservations to be changed are blocked from other transactions, it always
issues an error log with the reservations that are not to be blocked.
For the blocked reservations, you must start the report again.
EXAMPLE
Delete reservation:
------------------Select the parameter 'Set deletion indicator/delete'. The system will
check whether all the items of a reservation can be deleted. This is

the case if the requirement date of the reservation item is earlier than the date calculated from 'base
date - number of days'.
If the indicator 'Only closed items' has been set, the reservation item must, in addition, either have
been completely issued/withdrawn (quantity < = quantity withdrawn) or marked with the 'final issue'
indicator.
If all items of a reservation are marked as deleted, the entire reservation will be physically deleted. If
this is not the case, those items that have fulfilled the deletion criteria will be marked with a deletion
indicator. However, the reservation will remain in the system.
Allow goods movement:
--------------------Set the indicator 'Allow goods movement'.
Provided that the requirement date lies within the period 'base date +
number of days' the indicator 'Movement allowed' will be set in the

reservation item.
Lock mode:
-----------

You can decide which lock modus you want to choose.


The 'Block reservations individually' option is suggested, that is,
only the reservations that are actually changed are to be blocked. This

can result in a number of lock entries.


To avoid this, you can select the 'Block table of reservations' option.
This means, however, that the update can only be carried out when no
lock entries for reservations exist (regardless of whether these are suggested for change or not).
You should only choose the 'Do not block reservations' option if you
have ensured that no one can make changes to manual reservations when
the program is being run (using the function Change reservations or Goods movements with reference
to reservations).
<="">

ABAP code:
ABAP code listing snippet for SAP ABAP Report
RM07RVER
************************************************************************
*
REPORT RM07RVER
(Transaktionscode MBVR)
*
************************************************************************
*
Reservierungen verwalten
*
************************************************************************
INCLUDE:

RM07RVED,
MM07MABC,
MDVMRESE,
RM07MUSR,
RM07MEND,
RM07MAUT,
RM07RVEP.

" REPORTSPEZIFISCHE DATENDEFINITIONEN


" VARIABLEN ZUM ZEICHENSATZ
"
"
"
"

TASTENBELEGUNGEN UND TRANSKATIONEN


ANFORDERUNGSBILD UND ENDEROUTINE
BERECHTIGUNGSPRFUNG
REPORTEIGENE PARAMETER

************************ HAUPTPROGRAMM *********************************


*---------------- F4-Hilfe fr Reportvariante -------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
....See full code listing within your SAP system using transactions such as SE80 and SE38

Includes used within report:


INCLUDE: RM07RVED, " REPORTSPEZIFISCHE DATENDEFINITIONEN
MM07MABC, " VARIABLEN ZUM ZEICHENSATZ
MDVMRESE,
RM07MUSR, " TASTENBELEGUNGEN UND TRANSKATIONEN
RM07MEND, " ANFORDERUNGSBILD UND ENDEROUTINE
RM07MAUT, " BERECHTIGUNGSPRFUNG

Tables used within report and the associated select


statement:
VRSLI
SELECT count(*) FROM vrsli WHERE rsnum = LRKPF-RSNUM. "2152419
REUL
SELECT * FROM REUL APPENDING TABLE XREUL.
T159B
SELECT SINGLE * FROM T159B WHERE REPID = SY-REPID.
RESB
SELECT * FROM RESB APPENDING TABLE YRESB WHERE RSNUM IN IRSNUM.
RESB
SELECT * FROM RESB APPENDING TABLE YRESB WHERE RSNUM IN IRSNUM.
T159L
SELECT * FROM T159L APPENDING TABLE X159L ORDER BY WERKS. "N1063799
T001W

SELECT SINGLE * FROM T001W WHERE WERKS = X159L-WERKS.


RKPF
SELECT * FROM RKPF INTO CORRESPONDING FIELDS OF TABLE LRKPF
WHERE RSNUM IN RSNUM
AND

RSDAT LE RSDAT

AND

KZVER EQ SPACE.

RKPF
SELECT * FROM RKPF INTO CORRESPONDING FIELDS OF TABLE LRKPF
WHERE RSNUM IN RSNUM
AND

RSDAT LE RSDAT

AND

KZVER EQ SPACE

AND

KOSTL EQ SPACE

AND

AUFNR EQ SPACE

AND

PS_PSP_PNR EQ SPACE

AND

NPLNR EQ SPACE

AND

KDAUF EQ SPACE

AND

ANLN1 EQ SPACE

AND

UMLGO EQ SPACE

AND

UMWRK EQ SPACE

ORDER BY PRIMARY KEY.


RKPF
SELECT * FROM RKPF INTO CORRESPONDING FIELDS OF TABLE LRKPF
WHERE RSNUM IN RSNUM
AND

RSDAT LE RSDAT

AND

KZVER EQ SPACE

AND

KOSTL IN KOSTL

AND

AUFNR IN AUFNR

AND

PS_PSP_PNR IN PROJN

AND

NPLNR IN NPLNR

AND

KDAUF IN KDAUF

AND

ANLN1 IN ANLN1

AND

UMLGO IN UMLGO

AND

UMWRK IN UMWRK

ORDER BY PRIMARY KEY.


RKPF
SELECT * FROM RKPF INTO CORRESPONDING FIELDS OF TABLE LRKPF
WHERE RSNUM IN RSNUM
AND

KZVER EQ SPACE.

RKPF
SELECT * FROM RKPF INTO CORRESPONDING FIELDS OF TABLE LRKPF
WHERE RSNUM IN RSNUM
AND

KZVER EQ SPACE

AND

KOSTL EQ SPACE

AND

AUFNR EQ SPACE

AND

PS_PSP_PNR EQ SPACE

AND

NPLNR EQ SPACE

AND

KDAUF EQ SPACE

AND

ANLN1 EQ SPACE

AND

UMLGO EQ SPACE

AND

UMWRK EQ SPACE

ORDER BY PRIMARY KEY.


RKPF

SELECT * FROM RKPF INTO CORRESPONDING FIELDS OF TABLE LRKPF


WHERE RSNUM IN RSNUM
AND

KZVER EQ SPACE

AND

KOSTL IN KOSTL

AND

AUFNR IN AUFNR

AND

PS_PSP_PNR IN PROJN

AND

NPLNR IN NPLNR

AND

KDAUF IN KDAUF

AND

ANLN1 IN ANLN1

AND

UMLGO IN UMLGO

AND

UMWRK IN UMWRK

ORDER BY PRIMARY KEY.


RKPF
SELECT * FROM RKPF APPENDING TABLE YRKPF WHERE RSNUM IN LRSNUM.
RKPF
SELECT * FROM RKPF APPENDING TABLE YRKPF WHERE RSNUM IN LRSNUM.
RESB
SELECT * FROM RESB APPENDING TABLE YRESB WHERE RSNUM IN IRSNUM.
RESB
SELECT * FROM RESB APPENDING TABLE YRESB WHERE RSNUM IN IRSNUM.
T159L
SELECT * FROM T159L APPENDING TABLE X159L ORDER BY WERKS. "N1063799
T001W
SELECT SINGLE * FROM T001W WHERE WERKS = X159L-WERKS.
VRSLI
SELECT COUNT( * ) FROM vrsli WHERE rsnum = lr_rsnum

AND rspos = lr_rspos.

Function Modules used within report and the


associated call statement:
DATE_CONVERT_TO_FACTORYDATE
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
FACTORY_CALENDAR_ID = KALENDER-FABKL
DATE

= YRESB-BDTER

IMPORTING
FACTORYDATE

= FDAYF1

EXCEPTIONS DATE_AFTER_RANGE
DATE_BEFORE_RANGE
DATE_INVALID

= 01
= 02

= 03

FACTORY_CALENDAR_NOT_FOUND
CORRECT_OPTION_INVALID

= 04

= 05

CALENDAR_BUFFER_NOT_LOADABLE = 06.
DATE_CONVERT_TO_FACTORYDATE
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
FACTORY_CALENDAR_ID = KALENDER-FABKL
DATE

= C_RSDAT

IMPORTING
FACTORYDATE

= FDAYF2

EXCEPTIONS DATE_AFTER_RANGE
DATE_BEFORE_RANGE

= 01
= 02

DATE_INVALID

= 03

FACTORY_CALENDAR_NOT_FOUND
CORRECT_OPTION_INVALID

= 04

= 05

CALENDAR_BUFFER_NOT_LOADABLE = 06.
DATE_CONVERT_TO_FACTORYDATE
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
FACTORY_CALENDAR_ID = KALENDER-FABKL
DATE

= C_RSDAT

IMPORTING
FACTORYDATE

= FDAYF2

EXCEPTIONS DATE_AFTER_RANGE
DATE_BEFORE_RANGE
DATE_INVALID

= 01
= 02

= 03

FACTORY_CALENDAR_NOT_FOUND
CORRECT_OPTION_INVALID

= 04

= 05

CALENDAR_BUFFER_NOT_LOADABLE = 06.
ENQUEUE_EMRKPF
CALL FUNCTION 'ENQUEUE_EMRKPF'
EXPORTING
RSNUM

= DRKPF-RSNUM

EXCEPTIONS
FOREIGN_LOCK

=2

SYSTEM_FAILURE = 3.
ENQUEUE_EMRKPF
CALL FUNCTION 'ENQUEUE_EMRKPF'

EXCEPTIONS
FOREIGN_LOCK

=4

SYSTEM_FAILURE = 8.
ENQUEUE_EMRKPF
CALL FUNCTION 'ENQUEUE_EMRKPF'
EXPORTING
RSNUM

= XRESB-RSNUM

EXCEPTIONS
FOREIGN_LOCK

=2

SYSTEM_FAILURE = 3.
MATERIAL_PRE_READ_MBERE
CALL FUNCTION 'MATERIAL_PRE_READ_MBERE'
EXPORTING
KZSPR = SPACE
TABLES
IPRE02 = PREFETCH02.
MATERIAL_READ
CALL FUNCTION 'MATERIAL_READ'
EXPORTING
SCHLUESSEL = MTCOM
IMPORTING
MATDATEN

= MBERE

TABLES
SEQMAT01

= DUMMY.

MATERIAL_READ
CALL FUNCTION 'MATERIAL_READ'

EXPORTING
SCHLUESSEL = MTCOM
IMPORTING
MATDATEN

= MBERE

TABLES
SEQMAT01

= DUMMY.

MB_DELETE_RESERVATION_ARRAY
CALL FUNCTION 'MB_DELETE_RESERVATION_ARRAY' IN UPDATE TASK
TABLES
DRKPF = DRKPF
DRESB = DRESB
DREUL = DREUL.
MB_CREATE_MRPRECORD
CALL FUNCTION 'MB_CREATE_MRPRECORD' IN UPDATE TASK
TABLES
DIS = DISP.
PK_REPLENISHMENT_REVERSAL
CALL FUNCTION 'PK_REPLENISHMENT_REVERSAL'
EXPORTING
POST_ON_COMMIT
RSNUM

= 'X'

= -RSNUM

EXCEPTIONS
NO_KANBAN
SEE_MESSAGE
OTHERS

=1
=2
= 3.

MB_CHANGE_RESERVATION_ARRAY

CALL FUNCTION 'MB_CHANGE_RESERVATION_ARRAY' IN UPDATE TASK


EXPORTING
XMBVR = x

"2031446

TABLES
DIS

= DIS

XRESB = XRESB
ZRESB = YRESB_HELP.

"621291

PK_REPLENISHMENT_REVERSAL
CALL FUNCTION 'PK_REPLENISHMENT_REVERSAL'
EXPORTING
POST_ON_COMMIT
RSNUM

= 'X'

= -RSNUM

EXCEPTIONS
NO_KANBAN

=1

SEE_MESSAGE
OTHERS

=2
= 3.

REUSE_ALV_VARIANT_F4
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT
I_SAVE
*

= VARIANTE
= VARIANT_SAVE

it_default_fieldcat =
IMPORTING
E_EXIT
ES_VARIANT
EXCEPTIONS

= VARIANT_EXIT
= DEF_VARIANTE

NOT_FOUND = 2.
REUSE_ALV_VARIANT_DEFAULT_GET
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE

= VARIANT_SAVE

CHANGING
CS_VARIANT = DEF_VARIANTE
EXCEPTIONS
NOT_FOUND = 2.
REUSE_ALV_LIST_DISPLAY
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
*

I_INTERFACE_CHECK

=''

I_CALLBACK_PROGRAM

= REPID

I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
*

I_STRUCTURE_NAME

IS_LAYOUT

= LAYOUT

IT_FIELDCAT

= FIELDCAT[]

IT_EXCLUDING

IT_SPECIAL_GROUPS

IT_SORT

IT_FILTER

IS_SEL_HIDE
I_DEFAULT
I_SAVE

=
=

=
= 'X'
= 'A'

IS_VARIANT

= VARIANTE

IT_EVENTS

IT_EVENT_EXIT
IS_PRINT

=
= PRINT

I_SCREEN_START_COLUMN

I_SCREEN_START_LINE

I_SCREEN_END_COLUMN

I_SCREEN_END_LINE

=0
=0
=0

=0

IMPORTING

E_EXIT_CAUSED_BY_CALLER =

ES_EXIT_CAUSED_BY_USER

TABLES
T_OUTTAB

= BELEGE.

REUSE_ALV_VARIANT_EXISTENCE
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE

= VARIANT_SAVE

CHANGING
CS_VARIANT = DEF_VARIANTE.
REUSE_ALV_LIST_DISPLAY
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
*

I_INTERFACE_CHECK
I_CALLBACK_PROGRAM

=''
= REPID

I_CALLBACK_PF_STATUS_SET = 'OVERVIEW'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_STRUCTURE_NAME

IS_LAYOUT

= LAYOUT

IT_FIELDCAT

= FIELDCAT[]

IT_EXCLUDING

IT_SPECIAL_GROUPS

IT_SORT

IT_FILTER

IS_SEL_HIDE
I_DEFAULT
I_SAVE

=
=

=
= 'X'
= 'A'

IS_VARIANT

= VARIANTE

IT_EVENTS

IT_EVENT_EXIT
IS_PRINT

=
= PRINT

I_SCREEN_START_COLUMN

I_SCREEN_START_LINE

I_SCREEN_END_COLUMN

I_SCREEN_END_LINE

=0
=0
=0

=0

IMPORTING

E_EXIT_CAUSED_BY_CALLER =

ES_EXIT_CAUSED_BY_USER

TABLES
T_OUTTAB

= DETAIL.

REUSE_ALV_LIST_DISPLAY
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING

I_INTERFACE_CHECK

=''

I_CALLBACK_PROGRAM

= REPID

I_CALLBACK_PF_STATUS_SET = 'POSITION'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
*

I_STRUCTURE_NAME

IS_LAYOUT

= LAYOUT

IT_FIELDCAT

= FIELDCAT_P[]

IT_EXCLUDING

IT_SPECIAL_GROUPS

IT_SORT

IT_FILTER

IS_SEL_HIDE
I_DEFAULT
I_SAVE

=
=

=
= 'X'
= 'A'

IS_VARIANT

= VARIANTE

IT_EVENTS

IT_EVENT_EXIT
IS_PRINT

=
= PRINT

I_SCREEN_START_COLUMN

I_SCREEN_START_LINE

I_SCREEN_END_COLUMN

I_SCREEN_END_LINE

=0
=0
=0

=0

IMPORTING

E_EXIT_CAUSED_BY_CALLER =

ES_EXIT_CAUSED_BY_USER
TABLES

T_OUTTAB

= POSITION.

REUSE_ALV_LIST_DISPLAY
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
*

I_INTERFACE_CHECK

=''

I_CALLBACK_PROGRAM

= REPID

I_CALLBACK_PF_STATUS_SET = 'OVERVIEW'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
*

I_STRUCTURE_NAME

IS_LAYOUT

= LAYOUT

IT_FIELDCAT

= FIELDCAT_P[]

IT_EXCLUDING

IT_SPECIAL_GROUPS

IT_SORT

IT_FILTER

IS_SEL_HIDE
I_DEFAULT
I_SAVE

=
=

=
= 'X'
= 'A'

IS_VARIANT

= VARIANTE

IT_EVENTS

IT_EVENT_EXIT
IS_PRINT

=
= PRINT

I_SCREEN_START_COLUMN

I_SCREEN_START_LINE

I_SCREEN_END_COLUMN

I_SCREEN_END_LINE

=0
=0
=0

=0

IMPORTING

E_EXIT_CAUSED_BY_CALLER =

ES_EXIT_CAUSED_BY_USER

TABLES
T_OUTTAB

= DETAIL.

Text pool values


Selection Text: XWAOK = Allow Goods Movement
Selection Text: XTEST = Test Run
Selection Text: XPROT = Issue Log
Selection Text: XLOEK = Set Deletion Indicator/Delete
Selection Text: XKONT = Without Account Assignment
Selection Text: XFERT = Closed Items Only
Selection Text: UMWRK = Receiving Plant
Selection Text: UMLGO = Receiving Storage Location
Selection Text: RSNUM = Reservation
Selection Text: RSDAT = Base Date
Selection Text: P_VARI = Layout
Selection Text: PROJN = Project
Selection Text: NPLNR = Network
Selection Text: KOSTL = Cost Center
Selection Text: KDAUF = Sales Order
Selection Text: AUFNR = Order
Selection Text: ANLN1 = Asset
Title: Manage Reservations
Text Symbol: 112 = Following reservations could not be blocked:
Text Symbol: 111 = Following reservation items have been changed:
Text Symbol: 110 = Following reservations have been deleted:
Text Symbol: 105 = Reservation
Text Symbol: 061 = To Delete
Text Symbol: 044 = DelNe
Text Symbol: 043 = DelOl
Text Symbol: 042 = MvtNew
Text Symbol: 041 = MvtOld
Text Symbol: 030 = Lock Mode
Text Symbol: 026 = Display Options
Text Symbol: 020 = Actions to be Performed
Text Symbol: 015 = Database Selections
Text Symbol: 014 = Do Not Block Reservations
Text Symbol: 013 = Block Reservns Individually
Text Symbol: 012 = Block Table of Reservations
Text Symbol: 010 = Account Assignment
Text Symbol: 007 = A Reservation Number
Text Symbol: 006 = No

Text
Text
Text
Text
Text

Symbol:
Symbol:
Symbol:
Symbol:
Symbol:

005
004
003
002
001

=
=
=
=
=

Test Run
Issue Log
Closed Items Only
Set Goods Movement to Allowed
Delete/Set Deletion Indicator