Sei sulla pagina 1di 16

Adding custom fields to CS01, CS02 and CS03 (Bill Of

Materials)
Requirement: Customer wanted to add two new fields Country and Vendor number to Bill of
materials header level.
Procedure: We need to add customer specific fields to BOM header level, first we need to add these
two fields to BOM header record table i.e. STKO, then create a sub screen two hold these two fields
and write the corresponding logic in the Functional exits provided.
The above steps are explained below in Detail.
STEP 1: reate an Append structure for tabIe STKO.
o to SE11 and provide table name STKO.
Click on button Append structure
ive name for Append structure "ZSTKO

Add new fieIds to Append structure. ZZLAND1 and ZZVENDOR

Check and Activate the append structure.
A list of tables adjusted will be displayed.
STEP 2: Find an Enhancement for BOM.
Bill of materials transaction CS01/02/03 is assigned to package "CS.
We can search for relevant Enhancements in CS package.
o to transaction SMOD then go to Utilities-> find.

n the search box provide Package name as "CS
Then Execute. You will get list of available Enhancements for the given package.

With the given short text or the enhancement we can use Enhancement PCSD0003.
To see the Enhancement components press display button.
You can see Functional Module Exits, Function codes, Screen Areas in the next screen.

Select the relevant Enhancement and you can test the enhancement from SMOD transaction main
screen.
STEP 3: reate a project for Enhancement.
o to CMOD(Project management of SAP Enhancements)
n the nitial Screen give any name (ZTEST) for Project.
Then press create

n the Next screen fill description for project and save as local object/ save to a package.

Then Click on the enhancement assignments button
Add the selected enhancement there and enter then save.

Go to back to Attributes of Enhancement project ZTEST screen

Use COMPONENTS button to see the components for the enhancement.

From the above screen you can see Project and enhancement mplementation are in red color and
other components also.
Double click on screen exit. t will take you to Screen painter.
Add customer fields to the screen.
o to screen properties and mark it as sub screen.


Now go back to components.
Click on the function exit then press enter.
n the next screen you can see Function Module EXT_SAPLCSD_004
n the function Module you can see a nclude ZXCSAU04.
Double click on the include
A warning message appears ignore it and press enter.

IncIude is ready to impIement your code Iogic.

Double click on the USERDATA structure and
Add an append structure.
Add two customer fields to the Append structure.

Then go back to incIude and write your code Iogic.

Save include. Check and activate.
Then go back to components list.
Add code to another function exit.

We have implemented function exits and screen exit.
Then activate project.
When we activate the project red button will turn into green. Components will turn into green.

For change and dispIay transactions change the screen parameters.
STEP 4: check the added fieIds in S03 DispIay BiII of materiaIs.
o to CS03 and give any material number, Plant and BOM usage press enter.
Select header button to navigate to header window.
There you can see a tab "Customer fields and two customer fields.



Screen Exit in C)01
By Tejaswini
This article details about the step-by-step procedure in implementing the Screen Exit Ior
CJ01 transaction:
First create a project in CMOD and attach the enhancement CNEX0006 to the project.
1 L se11 and ln Lhe 8C! Lable u wlll flnd cl_pr lnclude ln Lhls add Lhe requlred cusL
flelds
2 L se31 glve SALxCn1 ln Lhe prgra nae wlLh screen nuber 0600 creaLe Lhe
subscreen and ln Lhe layuL chse ulcLlnary/rgra flelds and drag and drp ln Lhe
screen
3 lf u wanL L wrlLe any lglc befre Lhe screen ls dlsplayed d lL ln 8C
4 nw ln Lhe funcLln exlL Lxl1_SALC!W8_002 g ln Lhe lnCLuuL ZxCn1u11 and wrlLe Lhls
lglc
vecrrespndlng sap_pr_lp L pr
3 nw ln Lhe funcLln exlL Lxl1_SALC!W8_003 g ln Lhe lnCLuuL ZxCn1u12 and wrlLe Lhls
lglc
vecrrespndlng pr L cncl_pr_exp

AcLlvaLe Lhe precL

ow to implement screen exit for a SAP standard
transaction
By Roshini
ntroduction
SAP provides standard transactions to enter data into database. But a client may want to
maintain some additional inIormation in SAP other than what is provided.
To make provisions Ior this, additional screens have to be provided and additional Iields must
be added into appropriate database table.
To pave way Ior this, SAP has provided the option Ior screen exits. Usually, SAP provides
the Iollowing:
1 An append sLrucLure ln Lhe daLabase Lable wlLh Lhe new flelds
2 A subscreen area lnL Lhe sLandard screen where Lhe prgraer can aLLach hls
subscreen f hls wn prgra wlLh Lhe new flelds
3 A funcLln grup under whlch Lhe new subscreen has L be creaLed wlLh Lhe new flelds
4 luncLln exlLs L synchrnlze Lhe 8C and Al f Lhe sLandard SA prgra wlLh Lhe 8C
and Al f Lhe subscreen s LhaL daLa can flw back and frLh beLween Lhe sLandard SA
prgra and Lhe prgra wrlLLen by Lhe develper fr Lhe subscreen 1hese funcLln
dules als exlsL ln Lhe sae funcLln grup under whlch Lhe subscreen wlll have L be
develped
Finally, a linkage has to be done between the subscreen area oI standard SAP screen with the
custom subscreen constructed by the developer.
Typically, SAP provides an enhancement in which the developer can create an append
structure, use the Iunction exits to synchronize the PBO and PAI oI the standard SAP
program and the custom subscreen program, and make the necessary linking( as mentioned
above in step 4. But, again, this is not a hard and Iast rule. Linking in some case, is also done
by conIigurations.) SAP also usually provides the name oI the Iunction group under which
the subscreen has to be developed.
Necessary guidance about implementing a screen exit development is usually available in the
Documentation section oI the enhancement ( can be availed by transaction SMOD).
re-Requisites
The developer to work on screen exit should have essential knowledge on the Iollowing:
O uulC cncepLs lncludlng Lhe knwledge f append sLrucLure
O CncepL f SA LnhanceenLs and lpleenLlng Lhe uslng recLs
O CncepL f funcLln exlLs
O nwledge n Mdule l lncludlng subscreens 1absLrlp cnLrls eLc
Steps
uidelines
So, a developer can Iollow the guidelines mentioned below to implement a screen exit to a
standard SAP transaction, as and when required:
FlnJ out the RequlreJ Fnhuncementx
1 L SMCu ress l4 ln Lhe LnhanceenL fleld ln Lhe nexL ppup wlndw cllck pushbuLLn
'SA AppllcaLlns' A llsL wlll appear LhaL cnLalns lnfraLln n all Lhe enhanceenLs
caLegrlzed under funcLlnal areas uevelper usL search fr Lhe enhanceenLs relevanL
L hls funcLlnal area f lnLeresL fr eg urchaslng AsseL AccunLlng eLc
2 nLe dwn Lhe enhanceenLs 1hen ce L Lhe lnlLlal screen f SMCu and vlew Lhe
dcuenLaLln f each enhanceenL L flnd uL whlch ne ls requlred fr yur
develpenL
tlllze the Fnhuncement ln u Project
AIter you have Iound one, do as directed in the documentation. Generally, the steps are as
Iollows:
1 CreaLe a precL uslng CMCu lncludlng yur enhanceenL
2 CreaLe Lhe append sLrucLure wlLh new flelds
3 L Lhe deslred funcLln grup and creaLe a subscreen wlLh Lhe new flelds WrlLe 8C and
Al fr Lhe subscreen lf requlred
4 use Lhe funcLln exlLs ln Lhe enhanceenL L llnk Lhe 8C and Al f Lhe subscreen wlLh
LhaL f Lhe aln SA prgra supprLlng Lhe SA LransacLln
3 MalnLaln necessary llnkage beLween Lhe subscreen area f sLandard SA prgra wlLh Lhe
cusL subscreen develped alng wlLh Lhe cusL prgra nae 1hls can be dne ln Lhe
precL (develped by CMCu lncludlng Lhe enhanceenL) r uLslde as a parL f
cnflguraLln
6 AcLlvaLe Lhe precL
7 1esL L ensure LhaL requlred funcLlnallLy are eL
Case Study
Add three new custom Iields Ior Asset master and maintain inIormation Ior them
Requlrement
Three Iields in the legacy system have to be maintained in Asset master. These Iields are:
1 Crlglnal AsseL nuber 20 characLers
2 LcaLln 2 13 CharacLers
3 Mdel n 20 characLers
Location 2 should start with L`.
Pre-Anulyxlx
Finuing out the Enhancement
As described above, the enhancement is determined. It was Iound, that enhancement
AIST0002 will serve the purpose. It contains the Iollowing components (can be viewed by
transaction SMOD):
Exit Type Description EXITSAPL1022001 Function Exit Check oI User-DeIined Fields
when Using Create and Change BAPI EXITSAPLAIST002 Function Exit TransIer Data
Ior User Subscreens in PBO. EXITSAPLAIST003 Function Exit TransIer oI User-DeIined
Fields to SAP Master Data Transactions CIANLU Customizing Include Include structure to
add new Iields
tuuying the Function Exits
The Iunction module level documentation Ior the Iunction exits are then viewed Irom
transaction SE37. The documentation clearly laid out Ior the purpose Ior their use:
EXITSAPLAIST002
Iunction moJule level Bocumentotion
This Iunction module is called by asset master data maintenance at the start oI the dialog.
(When changing, it is called aIter reading oI the data Irom the database; when creating it is
called aIter the transIer oI the deIault values Irom the asset class and reIerence asset.) The
purpose oI the Iunction module is to enable this Iunction group to recognize the master data.
For interpreting or controlling master data Iields that are important Ior user Iields, it is
possible to transIer to global variables at this point, so that they can be recognized when the
user subscreens are processed.
lmport Porometers
&nderstanding
This Iunction module is called at the PBO to pass the inIormation retrieved Irom the database
to pass them to the custom subscreen and its underlying program. Import parameter :
IANLU will be populated with the values Ior user-deIined Iields which will be passed to the
subscreen program. So, there must be some sort oI variable assignment Irom IANLU.
EXITSAPLAIST003
Function module Documentation: This Iunction module is called by SAP asset master data
maintenance aIter the screens are processed, but beIore saving. The purpose oI the Iunction
module is to transIer Iields entered on user sub-screens oI SAP asset data maintenance to the
database Ior updating. The export parameter Ior this Iunction module is:
&nderstanding
This Iunction module will be used to transIer the user entered data in the subscreen Iields to
the main SAP program, which will then be saved into the database.
tuuying the Bocumentation of the Enhancement
The enhancement documentation (as is viewed Irom the initial screen oI SMOD| also
supports the idea. Moreover, it inIorms that we need to develop a subscreen under Iunction
group XAIS. This is the Iunction group under which the two Iunction exit modules also exist.
So, iI the custom subscreen reIers to the global data oI the Iunction group XAIS, then those
values will also be available to these Iunction exits as well.
Going to SE80 and viewing the Iunction group XAIS helps us to inIorm that there are three
DDIC tables declared Ior it:
Beciuing the Final couise of Action
AIter making all the investigations, the Iinal course oI action was determined.
SrlNo Step JustiIication
1 A precL has L be creaLed uslng LransacLln CMCu where Lhe enhanceenL AlS10002 wlll
be lncluded
2 CusLlzlng lnclude Cl_AnLu has L be creaLed wlLh Lhe cusL flelds deanded When
Cl_AnLu wlll be develped Lhe cusL flelds wlll geL appended L Lhe daLabase Lable AnLu
Als Lhese flelds wlll be used L creaLe screen flelds ln Lhe new subscreen
3 A cusL subscreen say 9000 wlll be develped under funcLln grup xAlS 1he screen
grup fr Lhe screen wlll be 'CuS1' (r any nae) 1he Lhree cusL flelds added L Lable
AnLu (by creaLlng Cl_AnLu) wlll be used L creaLe new flelds ln Lhe screen
In the PAI oI the subscreen, validation Ior Location to start with L` will be added. The
subscreen with three new Iields has to be developed so that it can be attached to a subscreen
area oI the asset master screens.
1 ln Lhe cusL lnclude f Lhe funcLln exlL dule 'Lxl1_SALAlS1_002' Lhe fllwlng cde
wlll be wrlLLen
ANLU IANLU. IANLU is the import parameter oI this FM. The value is assigned to the
global variable ANLU, reIerring which the three new subscreen Iields are developed. So, data
retrieved Irom database table ANLU will be passed to this FM as IANLU by the standard
SAP main program. The value will be taken and passed to the global variable oI the Iunction
group XAIS, so that the three custom Iields (reIerring to ANLU oI XAIS) get populated.
1 ln Lhe cusL lnclude f Lhe funcLln exlL dule 'Lxl1_SALAlS1_003' Lhe fllwlng cde
wlll be wrlLLen
EANLU ANLU. The changed values in the subscreen Iields exist in global variable
ANLU Ior the Iunction group XAIS. This Iunction exit module will pass the data back to the
SAP main program as EANLU.
1 rper llnkage/cnflguraLln has L be dne s LhaL Lhe new subscreens geL llnked L Lhe
apprprlaLe subscreen area f Lhe AsseL asLer screen 1hls has L be dne Lherwlse Lhe
new cusL subscreen wlll nL be dlsplayed ln Lhe AsseL asLer screens
evelopment
ieating a Pioject to incluue the enhancement
1 L LransacLln CMCu and creaLe a precL
2 LnLer a descrlpLln fr Lhe precL 1hen cllck n Lhe pushbuLLn 'LnhanceenL
AsslgnenLs' ln Lhe AppllcaLln 1lbar
3 LnLer Lhe nae f Lhe enhanceenL and Save
4 L 'CpnenLs'
ieating ustom Incluue foi ANL0
The screen shown below will appear, showing all the enhancement components under the
assignment AIST0002. Double-click on the name oI the Include Structure to create it.
Create the include structure with three new Iields, as required. Then, save and activate it.
Bevelop the subscieen anu the piogiam
Go to transaction SE80. For the Iunction group XAIS, create a new subscreen 9000.
Create it as subscreen.
Then, go to the Layout oI the screen and create three new Iields Irom Database table ANLU.
Drag the Iields in the screen body and place them.
Then, save and activate the screen and come back to screen Ilow editor.
Create the PAI module to add validation Ior Iield 'Location 2, as required .
Activate the whole Iunction group and come out.
Wiite coue in the Function Exits to synchionize the piogiams
Now, code has to be written in the Iunction modules EXITSAPLAIST002 and
EXITSAPLAIST003 so that data Ilows to and Iro between the main SAP program and
custom subscreen program. For that, go back to transaction CMOD and change the Iunction
exits.
Write code in the Iunction module EXITSAPLAIST002 called once at the beginning oI the
transaction:
Write code in EXITSAPLAIST003 to pass the data Irom the subscreen to SAP main
program.
Then, activate everything the whole project and come out.
omplete the conflgurutlon to llnk the xubxcreen
The development portion is complete. Now, linking oI the subscreen has to be done with the
subscreen area oI the main program. In most oI the cases, this linking can be done in the
enhancement itselI. But, here, requirement is a bit diIIerent. It is done by conIiguration using
SPRO.
Assets are created under Asset class. And Ior each asset class, there is a layout assigned to it.
For a layout, there are multiple tab pages assigned to it. And, Ior each tab page, there are
multiple screen groups/Iield groups assigned.
Here, the requirement is to create these three custom Iields in the tab page General` oI asset
master screen ( AS01/AS02/AS03/AS91).
Beteimine the Layout
To achieve this, Iirst oI all, we need to Iind out which layout is assigned to asset class
1000.For that, go to transaction AOLK( inIormation has to be obtained Irom Iunctional
consultant).Select the Asset Class 1000` and click on Iolder General Assignment oI
Layout`.
Here, Ior Asset class 1000, Ior all the user groups, tab layout SAP is assigned. Since layout
SAP` cannot be changed, it has to be copied and manipulated to include our screen group.
Later, the new layout has to be assigned over here.
ieate new tab layout
Go to transaction AOLA. Copy the tab layout SAP` to create another layout, say, YSUB.
System will copy all the settings and will inIorm you about that.
Select your newly created layout and double-click on the Iolder Tab page titles`.
You want to put your custom Iields in the tab page 'General. So, select this tab page entry
and double-click on the Iolder "Position oI Groups".
Here, all the Iield groups currently residing in the tab-page 'General are shown. Add an
entry Ior your newly created Iields.
Select the group box Irom the list. An entry will come with 'U padded with the custom
subscreen prepared by you.
Then, save and come out.
Assign the new Layout to Asset lass
Now, go to tcode AOLK and assign tab layout YSUB Ior asset class 1000.
Save and come out.
Test the Exit
Everything is over. Now, go to transaction code AS01/02/03 or AS91 to deal with an asset oI
asset class 1000. You will see your new Iields added to the screen. Add values to
them.save. Then, enter into the tcodes again to see whether the values entered by you are
being displayed or not.

Potrebbero piacerti anche