You are on page 1of 14

Generating WWI Reports from PLM

Web UI for Recipe Development

Applies to:
SAP ECC 6.0 EhP5. For more information, visit the Product Lifecycle Management homepage.

Summary
As of EhP5, it is not possible to generate WWI* report for a substance from the PLM Web UI. In this
document, we see how this can be overcome by creating a custom transaction and linking it to the ‘You Can
Also’ launchpad menu for specifications.

Author: Rajeev Deshpande, Sandhya Woody


Company: SAP
Created on: 24 January 2011

Author Bio
Rajeev Deshpande is part of the global Solution Experience team in the Solutions Go-to-Market
organization in SAP. Rajeev’s focus is on creating standard demo content for PLM and PPM
applications.
Sandhya Woody is an ABAP consultant with the SAaP Solution Package Build team in SAP Labs
India, Bangalore. In the past she has extensively worked on innovative demo content for SAP
Presales.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 1
Generating WWI Reports from PLM Web UI for Recipe Development

Table of Contents
Introduction ......................................................................................................................................................... 3
Create Custom Transaction ................................................................................................................................ 3
Create Report .................................................................................................................................................. 3
Sample Code ............................................................................................................................................................... 3
Create Transaction Code ................................................................................................................................ 9
Launchpad Customizing ................................................................................................................................... 10
Using the Transaction ....................................................................................................................................... 12
Related Content ................................................................................................................................................ 13
Copyright........................................................................................................................................................... 14

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 2
Generating WWI Reports from PLM Web UI for Recipe Development

Introduction
The Recipe Development application in EhP5 lets you open an EHS specification in web UI. While this offers
a great convenience and UI experience, some customers may miss the feature of generating WWI reports
for a substance that the WinGUI interface offered.
Since the underlying data structures are the same for both UI options, we can overcome the above limitation
by creating a custom transaction and then adding it to the You Can Also (YCA) menu options.

Create Custom Transaction


Create Report
First, we need to create an ABAP report that accepts a substance ID (SUBID) as input and then forwards it
to the function modules that generate the WWI report. Sample code is given below

Note: This is just a sample code created for demo purpose, and does not take into account such things as substance
validity, user authorization, etc. It is assumed that all applications and services required for WWI are available and
running.

Sample Code
1 *& *
2 *& Report ZTEMPLATE_GENERATE
3 *&
4 *& *
5 *&
6 *&
7 *& *
89
REPORT ZTEMPLATE_GENERATE.
10
11 Parameters i_subid like estrh-subid MATCHCODE OBJECT SPEC_SUBSTANCE_TREX_ADVANCED
OBLIGATORY.
12 parameters i_ldepid LIKE rcgbgsel-ldepid OBLIGATORY.
13
14 data: i_struct_tab type table of rcglsiot,
15 * i_subid LIKE estrh-subid value 'CP-FD1000',
16 * i_ldepid LIKE rcgbgsel-ldepid value 'CP_FACTPNL',
17 i_langu LIKE rcgbgsel-langu value 'E',
18 i_valdat LIKE rcgbgsel-valdat,
19 i_stcckflg LIKE rcgbgsel-stcckflg,
20 i_flg_print TYPE esp1_boolean,
21 i_flg_use_structtab TYPE esp1_boolean,
22 i_flg_report_no_auth_check TYPE esp1_boolean,
23 i_flg_wwi_debug TYPE esp1_boolean,
24 e_gen_probl TYPE esp1_boolean,
25 e_files_counter LIKE sy-tabix.
26
27
28
29 * local data
30 DATA : l_estlp_wa LIKE estlp.
31 DATA : l_rcglpiot LIKE rcglpiot.
32 DATA : l_dockey LIKE cvddockey.
33 DATA : l_draw_wa LIKE draw.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 3
Generating WWI Reports from PLM Web UI for Recipe Development

34 DATA : l_recntrh LIKE rcgstdrecn-recn.


35 DATA : l_doc_filesize TYPE i.
36
37 DATA : l_generation_ok TYPE esp1_boolean.
38 DATA : l_generation_warning TYPE esp1_boolean.
39
40 DATA : l_flg_label TYPE esp1_boolean.
41
42 DATA : l_sym_param_tab LIKE rcglsyval OCCURS 10 WITH HEADER LINE.
43 DATA : l_document_tab LIKE rcgrepfile OCCURS 10 WITH HEADER LINE.
44 DATA : l_value_tab LIKE tline OCCURS 100 WITH HEADER LINE.
45 DATA : l_msg_tab LIKE bapiret2 OCCURS 1 WITH HEADER LINE.
46 DATA : l_display_mode TYPE esp9_disp_mode_type.
47
48 DATA : l_msgv1 LIKE sy-msgv1.
49 DATA : l_msgv2 LIKE sy-msgv2.
50 DATA : l_msgv3 LIKE sy-msgv3.
51 DATA : l_msgv4 LIKE sy-msgv4.
52
53 DATA: lg_param_tab LIKE cvddp OCCURS 10 WITH HEADER LINE.
54 DATA: ls_flg_show TYPE boolean.
55
56
57 CONSTANTS:
58 BEGIN OF ic_msgid,
59 basis LIKE sy-msgid VALUE '00',
60 old$ LIKE sy-msgid VALUE 'C$',
61 old_para LIKE sy-msgid VALUE 'D9', "#EC *
62 standard LIKE sy-msgid VALUE 'CM_GENERAL',
63 phrase LIKE sy-msgid VALUE 'CM_PHRASE',
64 phr_data LIKE sy-msgid VALUE 'CM_PHRASE_DATA',
65 phr_set LIKE sy-msgid VALUE 'CM_PHRASE_SET',
66 sub_vali LIKE sy-msgid VALUE 'CM_SUB_VALUATION', "MCP20081999
67 re_templ LIKE sy-msgid VALUE 'CM_REPORT_TEMPLATE',
68 re_gen LIKE sy-msgid VALUE 'CM_REPORT_GEN',
69 re_gen_av LIKE sy-msgid VALUE 'CM_REPORT_GEN_AV',
70 re_api LIKE sy-msgid VALUE 'CM_REPORT_API',
71 re_defpara LIKE sy-msgid VALUE 'CM_REPORT_DEFPARA',
72 wwi LIKE sy-msgid VALUE 'CM_WWI',
73 END OF ic_msgid.
74
75
76 CONSTANTS:
77 BEGIN OF ic_msg,
78 * msgid like sy-msgid value 'C$',
79 abort LIKE sy-msgty VALUE 'A',
80 error LIKE sy-msgty VALUE 'E',
81 warning LIKE sy-msgty VALUE 'W',
82 info LIKE sy-msgty VALUE 'I',
83 success LIKE sy-msgty VALUE 'S',
84 blank LIKE sy-msgv1 VALUE ' ',
85 END OF ic_msg.
86
87 CONSTANTS: TRUE TYPE BOOLEAN VALUE ESP1_TRUE,
88 FALSE TYPE BOOLEAN VALUE ESP1_FALSE.
89

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 4
Generating WWI Reports from PLM Web UI for Recipe Development

90 DATA: lg_value_tab LIKE tline OCCURS 100 WITH HEADER LINE.


91
92
93
94
95 * function body
96 * init
97
98 i_valdat = sy-datum.
99 CLEAR: e_gen_probl, l_msg_tab.
100 REFRESH: l_msg_tab.
101
102 CLEAR: e_files_counter.
103
104 l_flg_label = esp1_false.
105
106 * read the variant-data
107 CALL FUNCTION 'C14L_VARIANT_GET_BY_LDEPID'
108 EXPORTING
109 i_ldepid = i_ldepid
110 i_valdat = i_valdat
111 IMPORTING
112 e_variant = l_estlp_wa
113 EXCEPTIONS
114 none_found = 1
115 OTHERS = 2.
116 MOVE-CORRESPONDING l_estlp_wa TO l_rcglpiot.
117 l_dockey-dokar = l_rcglpiot-dokar.
118 l_dockey-doknr = l_rcglpiot-doknr.
119 l_dockey-dokvr = l_rcglpiot-dokvr.
120 l_dockey-doktl = l_rcglpiot-doktl.
121
122 * get the substance-recn
123 CALL FUNCTION 'C1A0_TRANSLATE_SUBID_TO_RECN'
124 EXPORTING
125 i_subid = i_subid
126 i_valdat = i_valdat
127 IMPORTING
128 e_recn = l_recntrh
129 EXCEPTIONS
130 OTHERS = 1.
131
132 * change the flag of the SBGV, if User did in the popup
133 l_rcglpiot-stcckflg = i_stcckflg.
134
135 * Set the flag for adhoc display
136 CALL FUNCTION 'C14L_LAYOUT_INCLUDE_DISP_ADHOC'
137 EXPORTING
138 i_rep_display_adhoc = esp1_true.
139
140 * generate the value-file
141 CALL FUNCTION 'C125_VALUE_TABLE_GENERATE'
142 EXPORTING
143 i_rcglpiot = l_rcglpiot
144 i_recntrh = l_recntrh
145 i_val_date = i_valdat

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 5
Generating WWI Reports from PLM Web UI for Recipe Development

146 i_langu = i_langu


147 i_no_dialog = 'X'
148 i_flg_write_protocol = esp1_true
149 i_flg_use_structtab = i_flg_use_structtab
150 i_flg_report_no_auth_check = i_flg_report_no_auth_check
151 IMPORTING
152 e_generation_ok = l_generation_ok
153 e_generation_warning = l_generation_warning
154 e_flg_label = l_flg_label
155 TABLES
156 e_value_tab = l_value_tab
157 e_msg_tab = l_msg_tab
158 i_param_values_tab = lg_param_tab
159 i_struct_tab = i_struct_tab
160 EXCEPTIONS
161 generation_error = 1
162 status_error = 2
163 if_error = 3
164 OTHERS = 4.
165
166 IF sy-subrc <> 0 OR l_generation_ok = esp1_false.
167
168 * bad error within generation quits process immediately
169 e_gen_probl = esp1_true.
170
171 IF sy-subrc = 2.
172 * Fehler beim Stoffstatus
173 l_msgv1 = i_subid.
174 l_msgv2 = l_rcglpiot-ldepid.
175 l_msgv3 = i_valdat.
176 l_msgv4 = i_langu.
177 * Der Bericht konnte aufgrund eines Statusfehlers nicht generiert werden
178 PERFORM l_message_write
179 USING
180 ls_flg_show
181 ic_msg-error
182 ic_msgid-re_gen_av
183 '100'
184 l_msgv1
185 l_msgv2
186 l_msgv3
187 l_msgv4.
188 ELSEIF sy-subrc <> 2 OR l_generation_ok = esp1_false.
189 * Begin Correction 1065257 28.06.2007 *********************************
190 * SY-SUBRC: 1, 3, 4
191 * Fehler bei der Generierung der Wertedatei
192 PERFORM l_message_write
193 USING
194 ls_flg_show
195 ic_msg-error
196 ic_msgid-old$
197 '554'
198 ''
199 ''
200 ''
201 ''.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 6
Generating WWI Reports from PLM Web UI for Recipe Development

202 * End Correction 1065257 28.06.2007 ***********************************


203 ENDIF.
204
205 ELSE.
206
207 IF i_flg_use_structtab EQ false.
208
209
210 READ TABLE l_msg_tab with key type = ic_msg-error.
211
212 IF sy-subrc <> 0.
213
214 * get document-data of the report-layout
215 CALL FUNCTION 'C14S_DOCUMENT_DATA_GET'
216 EXPORTING
217 i_dockey = l_dockey
218 IMPORTING
219 e_drawdata = l_draw_wa
220 EXCEPTIONS
221 doc_not_found = 1
222 OTHERS = 2.
223
224 CALL FUNCTION 'C14S_DOCUMENT_ORIGINAL_COPY'
225 EXPORTING
226 i_dockey = l_dockey
227 i_appno = '1'
228 IMPORTING
229 e_filesize = l_doc_filesize
230 TABLES
231 e_repfile = l_document_tab
232 EXCEPTIONS
233 checkout_orig_failed = 1
234 OTHERS = 2.
235
236 * display (or print) the ad-hoc report
237 IF i_flg_print = true.
238 l_display_mode = esp9_disp_mode-print.
239 ELSE.
240 l_display_mode = esp9_disp_mode-show.
241 ENDIF.
242
243 CALL FUNCTION 'C12H_WWI_DISPLAY_DIRECT'
244 EXPORTING
245 i_wsappl = l_draw_wa-dappl
246 i_doc_filesize = l_doc_filesize
247 i_display_mode = l_display_mode
248 i_flg_label = l_flg_label
249 i_flg_wwi_debug = i_flg_wwi_debug
250 IMPORTING
251 e_files_counter = e_files_counter
252 TABLES
253 i_value_data_tab = l_value_tab
254 i_document_data_tab = l_document_tab
255 * Begin Correction 1175558 04.06.2008 *********************************
256 e_msg_tab = l_msg_tab
257 * End Correction 1175558 04.06.2008 ***********************************

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 7
Generating WWI Reports from PLM Web UI for Recipe Development

258 EXCEPTIONS
259 no_temp_path = 1
260 max_downloads_reached = 2
261 download_val_failed = 3
262 download_doc_failed = 4
263 start_appl_failed = 5
264 no_frontend_wwi = 6
265 only_frontend_wwi = 7
266 OTHERS = 8.
267
268 ENDIF. "SY-SUBRC <> 0.
269
270 ENDIF. "I_FLG_USE_STRUCTTAB EQ FALSE
271
272 ENDIF. "SY-SUBRC <> 0 OR L_GENERATION_OK = ESP1_FALSE.
273
274 * Begin Correction 1065257 28.06.2007 *********************************
275 * Begin Correction 1152703 17.03.2008 *********************************
276 IF NOT l_msg_tab[] IS INITIAL.
277 * End Correction 1152703 17.03.2008 ***********************************
278
279 SORT l_msg_tab.
280 DELETE ADJACENT DUPLICATES FROM l_msg_tab COMPARING ALL FIELDS.
281
282 LOOP AT l_msg_tab.
283 * create a message for each entry
284 PERFORM l_message_write
285 USING
286 esp1_false
287 l_msg_tab-type
288 l_msg_tab-id
289 l_msg_tab-number
290 l_msg_tab-message_v1
291 l_msg_tab-message_v2
292 l_msg_tab-message_v3
293 l_msg_tab-message_v4.
294
295 e_gen_probl = esp1_true.
296
297 ENDLOOP.
298 ENDIF.
299 * End Correction 1065257 28.06.2007 ***********************************
300
301
302 * save the VALUE_TAB into global var for the WWI and C12J_preview_entry
303 IF i_flg_use_structtab EQ true.
304 lg_value_tab[] = l_value_tab[].
305 ENDIF.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 8
Generating WWI Reports from PLM Web UI for Recipe Development

Create Transaction Code


We now add the above report to a transaction

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 9
Generating WWI Reports from PLM Web UI for Recipe Development

Launchpad Customizing
In order to make this transaction available in PLM Web UI for the specification object, we need to create an
entry in the Launchpad Customizing transaction (t-code LPD_CUST). In this transaction, you will first locate
the entry for instance YCA_SPC as shown below.

Select the pencil icon to make changes to the entry. Now add a new menu option as shown below.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 10
Generating WWI Reports from PLM Web UI for Recipe Development

Click on Show Advanced Parameters and then ensure the entries are as shown here. Next, click on the
Parameter Mapping button

Parameter mapping should be as shown below.

Save the entry. Now you are ready to use the transaction in PLM Web UI.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 11
Generating WWI Reports from PLM Web UI for Recipe Development

Using the Transaction


In PLM Web UI, when you open any specification, you can access the YCA menu and then select the entry
that you created in the previous section.

In the next screen, you can select a report variant and execute!

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 12
Generating WWI Reports from PLM Web UI for Recipe Development

Related Content
A Guide to the Newest Developments in SAP PLM 7.0
Innovative Product Development: New SAP Functionalities Promote Consumer-Driven, Sustainable
Innovation
SAP PLM Recipe Management Product Labeling in ERP 6.0 EhP4
For more information, visit the Product Lifecycle Management homepage.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 13
Generating WWI Reports from PLM Web UI for Recipe Development

Copyright
© Copyright 2011 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, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9,
iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,
BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX,
Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
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.
Java is a registered trademark of Oracle Corporation.
JavaScript is a registered trademark of Oracle Corporation, used under license for technology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, 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 other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.
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.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 14

You might also like