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

Idea for useful Z function module / report

former_member246634
Active Participant
0 Likes
866

Hi experts,

I want to create a "package" of useful function modules or programs that can be used in many places. For example, not every clinect can use /cockpit/message_append but I find it very useful. I was also thinking about FM which name could be z_clear_vars_and_tabs which clears all variables in program (or other FM, especially here when FM is used in loop and programmer forgets to clear some vars and they still have some values).

What other function fodules to implement can you think of or what did you create by yourself that you find useful and you're proud of?

Thanks for all your answers

Greetings,

Bartłomiej

1 ACCEPTED SOLUTION
Read only

suresh_kutam
Participant
0 Likes
785

Hello Bartlomiej,

I am working on similar tool, I will share once I am done.

fyi ..CALL FUNCTION 'RS_PROGRAM_INDEX' will give you all the variables declared as global.

u just need to pass the report name

to this FM.


Thanks,

SK

5 REPLIES 5
Read only

suresh_kutam
Participant
0 Likes
786

Hello Bartlomiej,

I am working on similar tool, I will share once I am done.

fyi ..CALL FUNCTION 'RS_PROGRAM_INDEX' will give you all the variables declared as global.

u just need to pass the report name

to this FM.


Thanks,

SK

Read only

0 Likes
785

Now I can think of just simple FM's like date validation (8 chars and 10 chars, with " . " and " - "), but what about something more complex?

Read only

former_member246634
Active Participant
0 Likes
785

I also thought about something like "attachment manager" - deleting, copying and statisctics (file extensions and their percentage).

I'd be thankful for all ideas.

Greetings,

Bartłomiej

Read only

Former Member
0 Likes
785

Clearing vars and tabs....

That sounds as though you are programming with all of your variables as Global variables.  If that is the case I would suggest changing your programming practice to make use of local variables which are cleared each time the procedure or method is called.

If you have to use global variables because ABAP requires them,  do not access them directly but pass them as parameters to your procedures or methods.  If you have data that is reused then consider making the table static.


In other words don't use global variables unless ABAP forces you too as they cause more problems than they help.

One useful function group I have written is 'Themed ALV'.  It handles all the various flavours of the ALV Grid or Tree,  with it's layout,  headers (types - Standard or HTML for example),  footers etc all defined by a Theme in the same way that you can Theme windows.  The headers and footers have standard contents also defined by the Theme entry

Default drill downs are added for columns that can be drilled into such as P/O's,  Sales Orders,  Materials etc etc.  All the routines can also have user define processing in the same way that REUSE_ALV_GRID_DISPLAY provides it's various call back routines so for example custom detail can be added to the header,  custom programming at user commands,. custom toolbars etc etc

In this way a programmer can provide a standard look and feel for all the ALV style reports in a project with minimum programming in the actual application itself.

Read only

Former Member
0 Likes
785

Hi Bartłomiej,

Nice Idea,, I have also created a similar utility in my system but I have done it using OOPS.

I created an Interface, let's name is ZBC_UTILITIES, again I have various classes inherited like, ZSD_UTIL, ZMM_UTIL and so on..!!

ZBC_UTILITIES have global constants and methods like clear, display, GOS Set and so on.

Again ZSD_UTIL have SD specific constants and various useful methods.

We are efficiently utilizing this model and its very much convenient for developers too, it makes code management easier and avoids rework.

Kindly share your approach too, we may copy some thing from your design.

Thanking You All..!!