Вы находитесь на странице: 1из 5

Automatic Creation of a

Product Catalog Layout in SAP

through ABAP report
created by Amrita Datta Gupta on Jul 31, 2013 9:20 AM, last modified by Amrita Datta Gupta on Jul 31, 2013
10:26 AM
Version 1
Product Catalogs in SAP can be created / changed manually via the transactions
WWM1/WWM2 and displayed through WWM3.
However there is no direct function module or BAPI available in SAP to create /change the
layout of an existing product catalog.

Just to give an idea about what a product catalog looks like I am posting some screenshots of
both the header information and the layout information of a catalog.
The first screenshot shows the header/basic data of a product catalog which primarily consists of
the customer, sales area information, currency and variants (which again consists of id, language
and currency ).

The second screenshot dispalys the layout area which has several nodes in a hierarchical fashion
and the last node in a hierarchy contains the actual material information.

Here the two nodes refer to a particular brand and product line of that brand .The last node
(product line) actually contains the material information.

The Texts checkbox is ticked which indicates that the layout area item has texts maintains which
again can be seen from the Texts tab (second tab to the left on the upper echelon).

Automatic creation/change of a product catalog layout through an ABAP report involves the use
of several function modules clubbed together . The ABAP report can have the customer number
and the reference catalog id(whose layout needs to be changed, here it is TEST_CAT1 in the
example screenshot shown above) as selection screen parameters. The process of layout
creation/change is a repetitive one once you get hold of the basic principle.
There are primarily five database tables involved in the layout creation :TWGV(Layout) ,
TWGLV(Layout Area) , TWGLVT(Layout Description) , WLBM (Layout Area Item) and
WLMT (Texts for Layout Area Item).

In order to create a layout of an empty catalog (which only has the basic information but no
layout area nodes) or to change an existing layout of a catalog (there are nodes in the layout but
they need to be changed) the process that needs to be followed consists of the following simple
1. Read the catalog information (stored in database table WWMI) through a function module which
will take as input the catalog id and return the entire catalog header information. We need the
catalog information to determine the layout number (each catalog has a unique layout number) as
all successive operations will be done on the layout having this layout number.
2. For each database table that will be affected, create an internal table(lt_table_new) with the data
that needs to be populated in the layout and also an internal table(lt_table_old) with the data
which at present exists in the layout (this may be blank , incase if the layout is empty) .
3. Check if the new entries need to be inserted/updated /deleted in/to/from the existing layout via a
function module which will then return three tables (lt_table_ins/lt_table/upd/lt_table_del) based
on the action required.
4. Save the entries in the database by calling another function module which takes as input the three
internal tables created in step 2.
5. Make the database changes reflect in the product catalog layout by calling another function
module which takes as input the three internal tables and also a flag (indicator) which tells it the
name of the database table whose changes it needs to pick up.

This principle needs to be followed for all the five database tables that will be impacted:

Now comes the list of the function modules (a simple debugging of transaction WWM2 will lead
you to these )

The function module needed to achieve step 1 above is :

Step 2 above needs the main population logic as it is used to create the internal table containing
the layout data that we need to see in our layout ultimately. The old layout data can obviously be
retrieved from the base by simple select statements.

The function modules needed to achieve step 3 above are as follows:
The function modules needed to achieve step 4 above are as follows:
The function module needed to achieve step 5 above is :
Following is a screenshot of code snippet showing the sequence of application of these function
modules for table WLMT:

A similar process needs to be followed for all the other relevant database tables as well.
The PRODCAT_CHANGE_DATA_PICK_UP function module can to be used only once at the
end to pick up all the data changes from all the various database tables and make them reflect in
the product catalog.
These steps if followed will get you a nice looking catalog layout creation once your report is
Attached is a sample code illustrating the process . Thanks for reading