WebDynPro for Java Common Error v5

Preview:

Citation preview

WebDynPro for Java: Common Error Prevention and Fixes

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

Agenda

Jodi Johnson

Developer, CLOROX

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

SETUP Issues (Development Configuration and Multiple Tracks)

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

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

DC – Tips - Multiple Tracks

Make sure correct portal is selected

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

DC – Tips - Multiple Tracks

Ensure host matches selected portal host

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.

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

DC – Tip – Use correct prefix for DCs

Business Package (ESS)

No Business Package

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.

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

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.

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

DCs – Problem - Changing SAP vanilla DCs

Importing Vanilla SAP Configuration to make changes

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.

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.

CONTEXT (RFCs and Models)

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

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

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.

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

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) {

}

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.

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

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

RFC – Problem - Adding new fields to RFC

Must Reimport the RFC(Model)

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.

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

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

DEMO

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

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

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

THANK YOU FOR YOURATTENTION !

QUESTIONS – SUGGESTIONS – DISCUSSION

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 !