Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Design Method's

Former Member
0 Likes
965

HI,

I had to build two method's

1. Method that bring user name for specific ID and one that bring .

2. Method that bring all the user when it execute.

I want to build it in OO ,any tips for good design will be helpful.

Best Regards

Nina

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
942

As described above, you can only achieve this by creating a single method.

Create method, GET_USER_INFO

Signature

Importing R_USERID (Range of User ID)

Exporting IT_USER_INFO (Table to hold the user Info)

When you call this method, pass I EQ user_name in the range to get only one User Info. Leave it blank when you want all user info.

Regards,

Naimesh Patel

8 REPLIES 8
Read only

amit_khare
Active Contributor
0 Likes
942

Check Forum & Google for Code optimizations, Performace Tuning and similar words. You will get lots of helpful replie.

Always search the forum before posting the query.

Read only

0 Likes
942

HI

I don't want help with the code i want help to do code design,

For that i need something specific not generic.

Read only

Former Member
0 Likes
942

Hi Nina,

I think, there is no need to use two methods for your requirement.

You should use one method instead of two.

Design that in this way.

If you pass User ID parameter value -


> displays corresponding user only.

If you won't pass any User ID value -


> displays all users.

it should work with minor changes to your logic in the same method.

by

Prasad gvk.

Read only

Former Member
0 Likes
942

Hi Nina,

You need to create only one method.

with 4 parameters

First parameter = single user id

second par = low range

third par = high range

fourth par = 'X' (Note: mark it X to work with single id and leave it blank for range of ids.)

hope this will solve your problem.

Read only

naimesh_patel
Active Contributor
0 Likes
943

As described above, you can only achieve this by creating a single method.

Create method, GET_USER_INFO

Signature

Importing R_USERID (Range of User ID)

Exporting IT_USER_INFO (Table to hold the user Info)

When you call this method, pass I EQ user_name in the range to get only one User Info. Leave it blank when you want all user info.

Regards,

Naimesh Patel

Read only

0 Likes
942

HI Naimesh,

U think for this I need to build interface or just use class ?

BR

Nina

Read only

Ramneek
Product and Topic Expert
Product and Topic Expert
0 Likes
942

Hello Nina,

If you require this method to be redefined in different classes, then it makes sense to define an interface for it. So you could add your interface in the different classes and this would enable you to have a generic calling method for the different implementations of the same method.

However if you have only one implementation then I would suggest you define it in your class only.

Thank you,

Ramneek

Read only

prasannakrishna_mynam
Contributor
0 Likes
942

Hello Nina,

You can achive this in one method, though you need two methods for this just follow as below.

GET_USER_RECORD

with parameters as below.

IMPORTING

ID and TYPE <DataelementType>

EXPORTING

DETAILS_REC TYPE <StructureType Of USER RECORD>

and implement this method by retriving from table.

GET_USER_RECORDS

EXPORTING

USER_DETAILS TYPE <Table Type Of USER RECORD>

and implement the menthod where you need to assign the records to this intername table USER_DETAILS

Thats it..and use it as per your requirement.

Regards,

Prasanna