Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Introduction

This document explains how to display a customer field in the BOM transactions CS01, CS02, CS03, CS11, CS12, and CS13 in ECC 6.0 EHP 5. The requirement is to display a custom field from the MARA table, ZZ_OLD_MATERIAL.

CS11

First, let's look at CS11. The program for CS11 is RCS11001. The ALV Grid is displayed in the output of CS11 by a call to FM REUSE_ALV_GRID_DISPLAY in Subroutine CS11_ALV of program RCS11001.

Note the t_outtab parameter in TABLES is assigned alv_stb. Also, the it_fieldcat parameter in EXPORTING is assigned stb_fields_tb.

In order to add ZZ_OLD_MATERIAL to CS11 we need to do three things:

  1. Add ZZ_OLD_MATERIAL to the output table alv_stb
  2. Populate ZZ_OLD_MATERIAL in alv_stb with values from MARA
  3. Add ZZ_OLD_MATERIAL to the field catalog table stb_fields_tb

1. Add ZZ_OLD_MATERIAL to the output table alv_stb

Internal table alv_stb is defined as follows:

Structure STPOX_ALV has a means of adding customer fields to it in Include structure CI_STPO.

Double-click CI_STPO to create the structure. Enter ZZ_OLD_MATERIAL as a Component.

Check and Activate Structure CI_STPO. This may take some time as CI_STPO is used in many tables.

Now ZZ_OLD_MATERIAL is a field in alv_stb.

2. Populate ZZ_OLD_MATERIAL in alv_stb with values from MARA

The alv_stb table is populated from internal table stb in the following lines of code from subroutine CS11_ALV:

If you check how stb is defined you will notice that ZZ_OLD_MATERIAL is available to us.

Click the Enhance icon, then select menu option Edit>Enhancement Operations>Show Implicit Enhancement Options.

Right click on the """"""" and select Enhancement Operations>Create Implementation.

Click Declaration for Type of Enhancement.

Click the Create Enhancement Implementation icon.

Enter a name for the Enhancement Implementation and Short Text. I entered Z_RCS11001_1.

Select your Enhancement Implementation

Enter the following code between ENHANCEMENT and ENDENHANCEMENT:

Save, Check, and Activate the Enhancement.

This will populate stb- ZZ_OLD_MATERIAL which will get passed to alv_stb- ZZ_OLD_MATERIAL in PERFORM alv_stb_prep.

3. Add ZZ_OLD_MATERIAL to the field catalog table stb_fields_tb

The field catalog, stb_fields_tb, is set in subroutine stb_fields_tb_prep. We need to enhance the subroutine so that CS11 will display ZZ_OLD_MATERIAL. The following screenshot shows the place for the Implicit Enhancement at the end of FORM stb_fields_tb_prep.

 

Right click on the """"""" and select Enhancement Operations>Create Implementation.

Click Declaration for Type of Enhancement.

You can use the same Implementation created earlier. This will be Enhancement 2. Enter the following code between ENHANCEMENT and ENDENHANCEMENT:

Save, Check, and Activate the Enhancement.

Now our custom field is in the field catalog to be displayed in column 5.

Execute CS11 to see the new field.

CS12 and CS13

You will need to do the same Enhancements for CS12 and CS13. CS12 uses program RCS12001. The FORMs to Enhance are called CS12_ALV and STB_FIELDS_TB_PREP. CS13 uses program RCS13001 and the FORMs are CS13_ALV and STB_FIELDS_TB_PREP. When you Enhance STB_FIELDS_TB_PREP in RCS12001 and RCS13001, make note of the fields that are displayed because they are different than RCS11001.

CS01, CS02, and CS03

After making the changes above for CS11, CS12, and CS13 I executed CS03 and noticed ZZ_OLD_MATERIAL on the standard screen of the Material tab (screen 0152) to the right of the Group (Grp) field. I thought I would have to use Enhancement PCSD0002 to display my custom field in CS03. PCSD0002 is the Enhancement to add your own BOM item fields. But I didn't like that PCSD002 would display my custom field on a new tab other than Material. This field was for display purposes only so I didn't need to worry about changing the field value. Now I just needed to populate it.

In Function Group CSDI, open Include LCSDIFFK. There you will see FORM STPOB_LESEN with a call to function module CS_BT_STOB_READ.

Note the FM returns structure STPOB. STOB already has ZZ_OLD_MATERIAL as a field.

Create an Implicit Enhancement at the end of the FORM. Enter the following code between ENHANCEMENT and ENDENHANCEMENT:

Save, Check, and Activate the Enhancement.

Still need to Activate Enhancement PCSD0002.

For some reason we still have to Activate PCSD0002. Actually, it's because of the line 85 below in FORM D0150_INIT_02 in Include LCSDIF3Z:

If PCSD0002 is not Active, the program will not fill field <D0152-FS1> (our custom field) from stpob-ZZ_OLD_MATERIAL in the subsequent lines of the form.

Activating PCSD0002

Go to CMOD and create a Project. Add Enhancement PCSD0002. We have to create screen 1000 so go to the Components.

Double click screen 1000. All that is needed is a Short Description and to change the Screen Type to Subscreen.

Save, Check, and Activate the screen.

Different original and logon languages

You may now get several pop-up messages regarding different original and logon languages.

At the 'Different original and logon languages' pop-up click Change orig. language.

Click Continue.

Click the green check.

Click the green check.

Finally, click Yes.

Activate the Project.

You do not need to place any code in the EXIT FMs. This custom field is for display only.

ExecuteCS01, CS02, CS03 and you should see your custom field populated on the standard screen of the Material tab.

3 Comments
Former Member
0 Kudos

I would like to ask you some following things.

Plz share your excellent knowledge~ :smile:

1. After "Activating PCSD0002", as you mentioned,

   Can't we still show customer tab for item?

2. We need to maintain some customer fields(CI_STPO), so we add customer tab for item

    via PCSD0002. and there is no problem using CS01,2,3.

    additionally we use some enh.spot to hide customer tab in some cases(ex. each plat).

    as you know, it has different screens for item between BDC(CS01) and CS01.

    How can we hide customer fields info when we execute BDC(CS01) in some cases?

    we can't find any enh.spot for this. :sad:

Thanks in advance.

JasonY
Explorer
0 Kudos

Is it possible to make field ZZ_OLD_MATERIAL editable in CS02?

many thanks

Jason

Labels in this area