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

ABAP CODE TO GET VALUE

Former Member
0 Likes
2,742

Hello All.

We have requirements to get max value.

EG.:

DaysABC1ABC2ABC3ABC4ABC5ABC6Winner1Winner2Winner3
Black12525453027
Blue
Mismatch

Here,I give some output.

I am Using Module-Pool-Table Wizard..

I fill data manually in abc1, abc2, abc3, abc4, abc5 and abc6. when i enter at abc6 value then automatically insert maximum 3 value in winner1, winner2, winner3 fields of current raw.

Please Advise and Needful.

Thanx in Advance.

17 REPLIES 17
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
2,456

There's a built-in function nmax. But since you need three values, put them into an array (internal table), sort it descending and get the first three elements.

Horst

Read only

0 Likes
2,456

Hi,

Sorting an internal table for a simple max query sound like an overkill to me.

Read only

0 Likes
2,456

How would you do it?

Chintan needs the first three max values.

And itabs are fast and simple. I use them for such tasks very often.

Read only

0 Likes
2,456

My fault

I missed the three max values thing.

Using itab would be a good option then.

Read only

0 Likes
2,456

Yes. You are right Mr. Horst. max value is imp to tk it.

Got max 3 value with sorting.

thanx for d suggestions. its very halpful for me.

thank you so much.

Read only

Former Member
0 Likes
2,456

Hi Chintan,

You should take a look at DEMO_DYNPRO_TABLE_CONTROL_1.

That demo program will show you how to read a input line and then just write a loop that compares the itab structure to find the max value for each line that was changed and set the winner field to what ever value you want.

Hope this helps,

Geoffery

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
2,456

That's my program

Read only

0 Likes
2,456

Hi Horst,

how it is you program  and it is created by SAP?

it was created in 1998.

Tahnk you

Regards

Ebrahim

Read only

0 Likes
2,456

Hi,

It seems that SAP programs are actually created by real people, like Horst.

He is a famous SAP employee

cheers

Paul

Read only

0 Likes
2,456

Hi Paul,

thank you for this Info.

I did not know that, it is really interesting

Respect Dr Horst

Regards

Ebrahim

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
2,456

Its part of my package SABAPDEMOS that contains the executable examples of the ABAP documentation's example library.

Read only

0 Likes
2,456

<chuckles>

Ever read 'Abap Objects' ???

Read only

0 Likes
2,456

Hi Horst., 

I have just read about it, The examples in SABAPDEMOS  are very useful and interesting.

Thank you.

Regards

Ebrahim

Read only

0 Likes
2,456

Hi Richard,

when I was started to learn ABAP, I have started with BC400, BC401 ( ABAP Object) BC430 etc.

I have done this to get the certificate.

Read only

0 Likes
2,456

Hi Ebrahim,

I was not doubting your education,  I was (in an English way) pointing out Horst Keller's background.

I think we can put this one down to 'Lost In Translation'....

Rich

Read only

0 Likes
2,456

Hi Richard,

you are right, Lost In Translation

Ibo

Read only

Former Member
0 Likes
2,456

Problem Resolved.

Its really helpful for me.

Thank you so much.