31
WebDynPro for Java: Common Error Prevention and Fixes

WebDynPro for Java Common Error v5

Embed Size (px)

Citation preview

Page 1: WebDynPro for Java  Common Error v5

WebDynPro for Java: Common Error Prevention and Fixes

Page 2: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

Agenda

Jodi Johnson

Developer, CLOROX

Page 3: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

Learning Objectives

As a result of this workshop, you will be able to:

Avoid some common but nasty errors in WebDynPro

Correct the errors you couldn’t avoid

Understand the impact of the errors

Use practical tips to create an easier to maintain and more robust application

Page 4: WebDynPro for Java  Common Error v5

SETUP Issues (Development Configuration and Multiple Tracks)

Page 5: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

Glossary

Development Configuration (DC):

the framework of a WebDynPro application

TRACK:

individual instance of WebDynPro

BUSINESS PACKAGE:

grouping of DCs that are treated as a unit(SCA)

SCA:

Software Deployment Archives, used by BASIS to import WebDynPro Code between portals

SYSTEM:

HR ESS/MSS ECC5.0 PORTAL 6.2 SP 13

Page 6: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DC – Tips - Multiple Tracks

Make sure correct portal is selected

Page 7: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DC – Tips - Multiple Tracks

Ensure host matches selected portal host

Page 8: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DC – Tips - Multiple Tracks

REASON: Can use separate tracks and portals to support

Production, code for a project and

check Service Packs.

Page 9: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DC – Tip – Use correct prefix for DCs

Business Package (ESS)

No Business Package

Page 10: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DC – Tip – Use correct prefix for DCs

REASON: All DCs are grouped by business package and

transported to portals as a SCA.

Page 11: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DCs - Problem – Creating DC on server

Wrong place to add dc

Right place to add dc

Page 12: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DCs - Problem – Creating DC on server

EFFECT: Cannot remove DC from server.

The SCA will not build correctly, BASIS must manually

exclude the bad DC before the build will succeed

SOLUTION: Only upgrading to the next Service Pack

will remove the DC from the server.

Page 13: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DCs – Problem - Changing SAP vanilla DCs

Importing Vanilla SAP Configuration to make changes

Page 14: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DCs – Problem - Changing SAP vanilla DCs

EFFECT: Everything works until a Service Pack is applied.

SAP DC will revert back to vanilla.

SOLUTIONS: Rewrite any changes made to SAP DC.

OR

Copy the SAP DC and make changes to

that DC.

Page 15: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DCs – Tip – Service Packs

PROBLEM: Service Packs will revert any SAP DCs to vanilla

and drop any new NON-SAP DCs.

EFFECT: Only vanilla SAP DCs will exist.

SOLUTION: Keep a list of all DCs created for a project,

BASIS can load them on the track after the

Service Pack is applied.

Page 16: WebDynPro for Java  Common Error v5

CONTEXT (RFCs and Models)

Page 17: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

CONTEXT Overview

RFC - Remote Function Calls(passes data from backend to WebDynPro)

ModelOne to one relationship with RFC

Used ModelAllows access to Model by Custom Controller and Views

Custom Controller(Value Nodes and Attributes)

Views

Page 18: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

CONTEXT Inheritance from Custom Controller to View

Views can inherit context Value Node and Attributes from Custom Controllerbut Custom Controller cannot inherit from Views

Page 19: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFCs – Tip – Maximize coding in backend

REASON: Code runs quicker. Backend (ECC 5.0) is where data is

maintained and validated. WebDynPro should

be used for display, parsing and enforcing field

requirements.

Page 20: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFC/Models – Tips – Use Input and Rename Output

Use the RFC Input

Rename the output in theRFC input

Page 21: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFC/Model – Tip – Coding for reading models

try{

Z_Rfc_Read_Sample_Input readInput = new

Z_Rfc_Read_Sample_Input ();

wdContext.nodeSampleReadModel().bind(readInput);

wdContext.nodeReadOutput().invalidate();

}

catch (Exception e) {

}

Page 22: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFC/Model – Tip – Coding for reading models

TIP: Use a try {} when reading the model

REASON: Sometimes a null record is returned as the first record.

If this happens then the framework will go fetch the

correct record only if a try{} is coded.

Page 23: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFC/Model – Tip – Coding for reading models

TIP: Always read the input

TIP: Always invalidate the output

REASON: Won’t work properly otherwise.

NOTE: Same rules apply to saving models

- move data to input

- invalidate the output

- save input

Page 24: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFC – Problem - Adding new fields to RFC

Must Reimport the RFC(Model)

Page 25: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFC – Problem - Adding new fields to RFC

EFFECT: Need to reimport model and restart Portal

whenever the RFC structure is changed.

SOLUTION: Upfront analysis, put all fields that will likely

be needed for future upgrades in the RFC.

Better too many fields than too few.

Page 26: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

RFC/Model – Problem - Data structure differences

PROBLEM: WebDYnPro contains different data types than ABAP

Specifically, WebDynPro can translate a char(1)

as Boolean. If a Boolean field is changed to a

different data type, reimporting the RFC will not remove

the reference to the Boolean field in the context.

SOLUTION: Delete the context by hand and reattach

Page 27: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

DEMO

Page 28: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

Summary

Do the analysis/design upfront

Don’t modify SAP DCs – create new ones

Work on only one track at a time

Code data verification on the backend

Include all possible fields in the RFCs

Page 29: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

Further Information

Public Web:www.sap.com

www.sdn.sap.com

Related Workshops/Lectures at SAP TechEd ’05Session ID, Title, Session Type

Americas’ SAP Users’ Group (ASUG)www.asug.com

Page 30: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

THANK YOU FOR YOURATTENTION !

QUESTIONS – SUGGESTIONS – DISCUSSION

Page 31: WebDynPro for Java  Common Error v5

SAP AG 2006, SAP TechEd ’06 / Session ID / CD110

Please complete your session evaluation.

Be courteous — deposit your trash, and do not take the handouts for the following session.

Feedback

Thank You !