Sie sind auf Seite 1von 10

Sel ec t i on Met hod Usage Cook book

Applies to:
This document applies to Student Lifecycle Management EHP 3. For more information, visit the Higher
Education & Research homepage.
Summary
This cookbook describes the process for the most effective use of Selection Methods in Student Lifecycle
Management.
Selection Methods are used within Student Lifecycle Management to generate a list of objects (such as
Students or Modules) that should be processed. Most SAP-delivered processes and reports already allow for
the use of Selection Methods. It is also possible to use Selection Methods in customer-defined processes
and reports.
Author: Michael Fan
Company: SAP AG
Created on: 25 J uly 2007
Author Bio
Michael Fan is Solution Architect at the IBU for Higher Education and Research, SAP AG.
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 1
Selection Method Usage Cookbook
Table of Contents
Creation and Maintenance of Selection Method Groups....................................................................................3
Specifying a list of Students via a File Upload....................................................................................................4
Usage of Selection Methods in FI-CA Mass Transactions.................................................................................5
Usage of Selection Methods in custom reports and processes .........................................................................5
Related Content..................................................................................................................................................9
Copyright...........................................................................................................................................................10

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 2
Selection Method Usage Cookbook
Creation and Maintenance of Selection Method Groups
Selection Methods are organized into Selection Method Groups. Each report or process may only make use
of a single Selection Method Group, so it is important to include all relevant Selection Methods in the proper
groups. In addition to the Selection Method Groups offered by SAP, customers may create their own. This is
done in the IMG:
IMG Path: Student Lifecycle Management Student Lifecycle Management Processes General
Settings Selection Methods Assign Selection Methods to Selection Method Group
Create the Selection Method Group(s).
Assign Selection Methods to Selection Method Groups.
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 3
Selection Method Usage Cookbook
Specifying a list of Students via a File Upload
Many times it is useful to use the output of one process as the input for another report or process. In order to
do this easily, SAP offers the ability to use a file of Student Numbers as the input for any Selection Method
enabled process. In this way, a file of Student Numbers could be produced from an external application, and
the students indicated in the file could be used for a Student Lifecycle Management process.

The Selection Method STNR provides the capability to upload a list of student numbers via a file. The
uploaded Text File should have one Student Number per line.
In the Selection Method Variant creation screen, press the button for Multiple Selection:


Next, press the icon for Import from Text File, or select Shift+F11:

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 4
Selection Method Usage Cookbook
Usage of Selection Methods in FI-CA Mass Transactions
The delivered FI-CA transactions generally process based upon selections of Business Partners. However, it
is generally more useful to select the student records to be processed based upon Student Numbers.
Therefore, it is necessary to adapt certain FI-CA transactions in order to use Selection Methods. The process
for doing so is clearly described in the IMG:
IMG Path: Student Lifecycle Management Student Accounting Basic Settings Using
Selection Methods in Mass FI-CA Activities
OSS Note 1076567 contains an important correction to these instructions.
Usage of Selection Methods in custom reports and processes
Selection Methods can easily be included in custom-developed ABAP reports and mass processing functions
in Student Lifecycle Management. Furthermore, the list of objects returned by a Selection Method can easily
be further filtered using additional report selection parameters. The following ABAP code excerpt is a fully-
functional example of how a Selection Method is properly combined with report parameters. This sample
program is not delivered; however, it can be easily copied as text and pasted into the ABAP editor (SE38):

*&---------------------------------------------------------------------*
*& Report Z_HRIQ_SELMETHOD_EXAMPLE
*&
*&---------------------------------------------------------------------*
*& This sample report gives an example of how to use a Selection Method
*& to generate a list of Student Objects for processing. Those objects
*& can be further filtered with other report parameters.
*&---------------------------------------------------------------------*

REPORT Z_HRIQ_SELMETHOD_EXAMPLE.

* Here you will usually want a local structure for processing the objects
* found by the Selection Method. It is also helpful to have a target table
* of objects that you decide to keep after your report-specific filtering.
Data: ls_selobject type hrobject.
data: lt_selobjects type table of hrobject.

* Here we declare any local variables needed for the report. This section
* will always be report-specific.
DATA: ls_address type BAPIBUS1006_ADDRESS.
data: lv_bpnumber type BU_PARTNER.
DATA: lv_student12 type piqstudent12.
data: ls_p1702 type p1702.
data: ls_namedata type BAPISTUDENTNAME.
data: lt_namedata type table of BAPISTUDENTNAME.

* Declare a constant which indicates which Selection Method Group your
* report should use.
CONSTANTS:
CO_SELMETHSCEN TYPE PIQSELSCENARIO VALUE '/US1'.

* Simply include this report to handle the bulk of the Selection Method
* initial declarations. This creates a report selection frame with the
* Selection Method fields on the report.
INCLUDE RHIQSELMETHODS_REPINCLUDE.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 5
Selection Method Usage Cookbook
* Here you can declare additional report parameters that you want to use.
* The title of the screen frame is defined as a Text Symbol. Use the
* menu option Goto->Text Elements->Text Symbols to define it. In order
* to use the Dictionary label for the actual selection parameter, use the
* menu option Goto->Text Elements->Selection Texts. You will only be able
* to do that once the report is activated.
SELECTION-SCREEN BEGIN OF BLOCK ADDRESSDATA WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS P_REGION FOR ls_address-region.
SELECTION-SCREEN END OF BLOCK ADDRESSDATA.

* Leave this section intact until comment '%%%%%%%%%%%%%%%%'.
* EVENT PBO-----------------------------------------------------------
AT SELECTION-SCREEN OUTPUT.

CALL METHOD g_selmethods_ref->before_pbo.

* EVENT: END OF PAI---------------------------------------------------
AT SELECTION-SCREEN.

CALL METHOD g_selmethods_ref->after_pai.

* EVENT SELECT---------------------------------------------------------
START-OF-SELECTION.

CALL METHOD g_selmethods_ref->get_objects
EXPORTING
im_base_authority_check = 'X'
im_stru_authority_check = 'X'
im_fcode = 'DISP'
im_period = g_selperiod
IMPORTING
ex_object_tab = g_selobject_tab
ex_stru_auth_failed_count = g_selfailed_count
EXCEPTIONS
selmethscen_not_found = 1
otype_not_supported = 2
selmeth_not_found = 3
invalid_otype = 4
selscen_not_found = 5
selmeth_not_active = 6
selvari_not_found = 7
objects_not_found = 8
no_stru_authority = 9
no_base_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


* EVENT END-OF-SELECTION-----------------------------------------------
END-OF-SELECTION.
* %%%%%%%%%%%%%%%%%%%%%%%%%%%

* Now the objects selected via the Selection Method are contained in
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 6
Selection Method Usage Cookbook
* internal table g_selobject_tab. You should now loop through this table
* to decide which entries to keep/discard, based upon your other parameters.
Loop at g_selobject_tab into ls_selobject.

* For each item in the loop, call some appropriate function module to determine
* whether the object should be kept. In this example, we take the student object
* number and determine the BP number. Then, we call the FM to read the address
* details. Then, we see if the returned address data matches the report parameters.
* In this example, only the standard address is considered.

CALL FUNCTION 'HRIQ_STUDENT_NUMBERS_GET'
EXPORTING
* IV_STUDENT12 =
IV_PLVAR = ls_selobject-plvar
IV_OBJID = ls_selobject-objid
* IV_PARTNER =
* IV_XREAD_BUFFER = 'X'
IMPORTING
* EV_STUDENT12 =
* EV_PLVAR =
* EV_OBJID =
EV_PARTNER = lv_bpnumber
* EXCEPTIONS
* NO_NUMBER = 1
* NO_PLVAR = 2
* NO_STUDENT12_FOR_OBJID = 3
* NO_OBJID_FOR_PARTNER = 4
* NO_OBJID_FOR_STUDENT12 = 5
* NO_PARTNER_FOR_OBJID = 6
* NO_STUDENT12_FOR_PARTNER = 7
* OTHERS = 8
IF SY-SUBRC <> 0.
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'
EXPORTING
BUSINESSPARTNER = lv_bpnumber
* ADDRESSGUID =
VALID_DATE = SY-DATUM
IMPORTING
ADDRESSDATA = ls_address
* TABLES
* BAPIADTEL =
* BAPIADFAX =
* BAPIADTTX =
* BAPIADTLX =
* BAPIADSMTP =
* BAPIADRML =
* BAPIADX400 =
* BAPIADRFC =
* BAPIADPRT =
* BAPIADSSF =
* BAPIADURI =
* BAPIADPAG =
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 7
Selection Method Usage Cookbook
* BAPIAD_REM =
* BAPICOMREM =
* ADDRESSUSAGE =
* BAPIADVERSORG =
* BAPIADVERSPERS =
* BAPIADUSE =
* RETURN =
.

* Here we finally compare the loop objects data values to the ones
* we are looking for. If we find a match, we append the object to
* the final result list.

if ls_address-region in P_REGION.
append ls_selobject to lt_selobjects.
endif.
endloop.

* Now the internal table lt_selobjects contains the objects you want to
* process. The table contains Object IDs, which is useful for mass
* processing, but not particularly useful for a report. This commented
* out section is for displaying a list of object IDs.
* Display objects
* CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
* EXPORTING
* i_structure_name = 'HROBJECT'
* TABLES
* t_outtab = lt_selobjects.

* Here, we show an example of using the object list to show a Grid view
* of the Student numbers, names, and personal data.
loop at lt_selobjects into ls_selobject.
clear ls_namedata.
CALL FUNCTION 'HRIQ_STUDENT_GET_NAME'
EXPORTING
* OBJID =
OBJECT = ls_selobject
DATE = SY-DATUM
* READ_DB = ' '
* READ_FROM_OM_BUFFER = ' '
IMPORTING
STUDENT12 = lv_student12
* NAME =
* VORNA =
* NACHN =
EXP_P1702 = ls_p1702
* EXCEPTIONS
* NOTHING_FOUND = 1
* INTERNAL_ERROR = 2
* MISSING_PARAMETER = 3
* OTHERS = 4
.

IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 8
Selection Method Usage Cookbook
ENDIF.

ls_namedata-studentno = lv_student12.
ls_namedata-LAST_NAME = ls_p1702-nachn.
ls_namedata-FIRST_NAME = ls_p1702-vorna.
ls_namedata-MIDDLE_NAME = ls_p1702-midnm.
append ls_namedata to lt_namedata.

endloop.

call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'BAPISTUDENTNAME'
TABLES
t_outtab = lt_namedata.
Related Content
For more information, visit the Higher Education & Research homepage.
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 9
Selection Method Usage Cookbook
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
2008 SAP AG 10
Copyright
2008 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries,
zSeries, System i, System i5, System p, System p5, System x, System z, System z9, z/OS, AFP, Intelligent Miner, WebSphere,
Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, POWER5+, OpenPower and PowerPC are trademarks or registered trademarks of
IBM Corporation.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of
Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts
Institute of Technology.
J ava is a registered trademark of Sun Microsystems, Inc.
J avaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by
Netscape.
MaxDB is a trademark of MySQL AB, Sweden.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their
respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All
other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves
informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP
Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the
express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty.
These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied
warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may
result from the use of these materials.
SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these
materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and
does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages.
Any software coding and/or code lines/strings (Code) included in this documentation are only examples and are not intended to be
used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of
certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors
or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.

Das könnte Ihnen auch gefallen