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

Create inline functions

Former Member
0 Likes
876

Hello,

I am new to ABAP, I am used to program in VB. Is it possible to create an inline function ourself just like Lines( ) or Condense( ).

For instance IsSalesOrder( vbak-vbeln ) or IsProtocol( vbak-vbeln ) ? It does read easier then refering to fieldnames which makes no sense of understanding lol. I know I can create a class with a method which I can call without creating an object like EF=>IsSalesOrder( vbak-vbeln ) but I want to get rid of the EF=> part, I want to expand the group of inline functions in ABAP.

4 REPLIES 4
Read only

laurent_fournier2
Contributor
0 Likes
714

What about routines ?

Perform isSalesOrder using vbak-vbeln

                                 changing success.

Or definitions.

define is_order.

select ... where field = &1

if ...

&2 = 'X'.

endif.

end-of-definition.

is order vbak-vbeln success.

Do this cover your requirement ?

Read only

0 Likes
714

But I want to use it in every program not only in current program. Creating a form needs a return variable and writing a lot more code. I mean reading somthing like this:

If IsSalesOrder( vbak-vbeln) Or IsProtocol( vbak-vbeln)

'Execute some code

Endif

Reads a lot easier

Read only

0 Likes
714

I understand your needs but I don't have any other thing in mind to propose.

You can create a common program with the required definitions and include it in any new program that you create. But this is a bit risky since if something happens to the include by mistake, all related programs will produce a dump.

Kind regards.

Read only

0 Likes
714

hmm. But where is the code located for the other inline functions like Lines( ), Condense( ), ToUpper( ), ToLower( ), BoolC( ) , ...

When I debug it doesnt show me the code behind these function.

I think if I include my own inline function in there it will be ok, no?