Showing posts with label GS02. Show all posts
Showing posts with label GS02. Show all posts

Sunday, 1 September 2013

How to block MRP Controllers in SAP Material Master

Hi,
In my previous blog, I had explained how to block/unblock purchasing groups in material master. In this blog, I will explain how to do the same for MRP controllers.

Business scenario:  As you might be aware, planners in an organisation are assigned to a MRP controllers in SAP.  In due course, a planner may get transferred to another department or may leave the organisation. In such a scenario, the MRP controller assigned to him should not be used anywhere in SAP. For example, the particular MRP controller should not be assigned to any new/existing material in the material master. How to achieve this?

Solution & Implementation:
The requirement can be achieved using setids and a BADI enhancement.
1. Create a new setid with a suitable name for eg. "BLOCK_MRP_CTRLR_XXXX" using transaction GS01. Here XXXX is the name of the plant. Please note that MRP controllers are plant specific and therefore maintained separately for each plant.
Specify table = MARC, field = DISPO and "Basic set" radio option. In the details screen, give a suitable short text (description of the setid) and in the from-to fields, specify single values/ranges for MRP controllers to be blocked.
2. The next step is to write ABAP code to check the value of MRP controller in the MRP view of the material master. This validation can be performed  at the time of saving the material master. The badi "BADI_MATERIAL_CHECK" can be used to perform to perform this validation. Create a new implementation with a suitable name for eg. "ZBADI_MATERIAL_CHECK" under this BADI.  The necessary code to validate the MRP controller can be written in the method "CHECK_DATA". The code will basically check if the value of the MRP controller has been changed and whether the new value is in the  blocked list. If it is in the blocked list, then program should throw an error message.
3. To unblock an MRP controller, go to transaction GS02 and call the setid "BLOCK_MRP_CTRLR_XXXX" and delete the entry for the MRP controller. Unblocking would be required if the blocked code is to be released and reassigned to another planner.

Cheers !

Wednesday, 10 October 2012

Use of Set Ids in SAP


Dear SAP consultants,

Through this blog, I wish to share with you all, a very useful SAP concept called Sets and SetIds.

A set is a group of data objects in SAP, that can either be included or excluded in a selection.  The set is identified by a SetId, which is a unique name that is assigned by the SAP user.
For a example, if you always want to exclude a group of vendors from being printed in a report, this could be achieved by including those vendor codes in a set. Or if you want certain validations in a particular transaction to work only for a group of users, the same could be achieved by including those vendors in a set.
The number and type of such applications are endless.

Create Set Ids:  

SetIds are created in SAP using the transaction GS01.

In the initial screen, specify a name for SetId; for example, for a list of vendors who are to be included in Automatic Purchase order creation, you can give a name "AUTO-PO-VENDORS";
Then, specify the table and field name that will form the basis for inclusion/exclusion.
For example, for a setid of vendor codes, enter the value LFA1 for table LIFNR for field.

In the details screen, enter single values or ranges.
For example, you could either enter individual vendor codes like
A74512
B14324
F76581

or enter multiple ranges for vendor codes like
1AAAAA to 1ZZZZZ
5AAAAA to 5ZZZZZ

 as shown below and then save the set details.

Maintain set ids:

You can further add to / modify / delete information from an existing set using SAP transaction GS02.
For example, you could add individual vendor codes like 777111 & 777222 as shown below.

Display Set ids:
You can display a setid using SAP transaction GS03.

Implementation of a Set Id:

Set Ids are usually implemented using ABAP coding, typically with user exits.
For example, for implementing a logic for "Automatic creation of Purchase Order from Purchase Requisitions",  where only vendors who belong to the set id "AUTO-PO-VENDORS" are to be considered, the select statement that fetches the list of PRs for PO creation needs to be modified to allow only those PRs who have a vendor (source) assigned to them that belongs to the set id "AUTO-PO-VENDORS".

For example, you could have implement an user exit with an include that has code as below:
select single valfrom
into corresponding fields of wa_setleaf
from setleaf
where setclass = '0000'
and setname = 'AUTO-PO-VENDORS'
and valfrom = i_cekko_lifnr.

if sy_subrc = 0.
  po_auto_create = 'yes'
endif

This would mean only those vendors included in the setid mentioned will be considered for automatic PO creation.


Relevance of Set Id for functional and technical SAP consultants:

Set Ids in SAP are relevant for both functional and technical consultants alike.
In many cases, the functional consultant may create Set Ids to satisfy specific business requirements. They then tell the technical consultant to implement the business logic using the particular set id.
In other cases, technical consultants/ABAP resources may also create Set Ids in order to avoid unnecessary hard-coding of values for specific program variables.