Application Development 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: 

sy-ucomm 'SPOS' on dynpro for saving variant

Former Member
0 Kudos

hi,

i have a module pool, which calls a dynpro-screen 100, which calls a pf-status 100, which features the save-icon. during pai i request the case sy-ucomm.

i need the coding for the case:

WHEN 'SPOS'. (which represents the click of the save button)

... save variant ...

unfortunately this does not seem to work automatically like on a report.

any ideas very welcome.

matthias kasig

ps: i am on a was 6.40

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

To save a variant use FM 'RS_VARIANT_ADD'.

Other related FMs: RS_VARIANT_CONTENTS, RS_VARIANT_CHANGE

Svetlin

9 REPLIES 9

former_member181962
Active Contributor
0 Kudos

Hi Matthias,

Are you sure the function code is indeed the same 'SPOS'. The functions codes will be changing from program to program, even for the same functionality.

Try to find the correct function code for save, by getting the cursor on to the save button, (Use tab key to move the cursor, and press f1 .

Regards,

Ravi

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, the saving of the variant only works for REPORT programs. Not for module pool programs. If you need this functionality, I would suggest having a separate report program and in your module pool program just submmit that REPORT program.

Submit your_program via selection-screen and return.

This way the transistion is invisible to the user and you still get the functionality of the variant.

Regards,

Rich Heilman

0 Kudos

Hi Rich,

Could you explain this little bit in detail?

How can submit from Dynpro program to Report program bring variants option?

Thank you,

Jagadish

Former Member
0 Kudos

Hi,

To save a variant use FM 'RS_VARIANT_ADD'.

Other related FMs: RS_VARIANT_CONTENTS, RS_VARIANT_CHANGE

Svetlin

0 Kudos

hi all,

i follow a complete different approach now, which in turn brings about different difficulties.

I am still in a module pool. I am able to save screen-variants via TA SHDS.

Now the problem is, to call the appropriate variant.

I inserted a new dynpro which resembles in fact the ordinary alv-popup screen in reports when chosing a variant (I perform my own select to fill this kind of F4 help screen). Now I use a doubleclick event of cl_gui_alv_grid to select a certain row and with this I call the FM:

CALL FUNCTION 'RS_HDSYS_SET_SC_VARIANT'
        EXPORTING
          progname            = 'SAPMZBC00003'
          dynpro              = '100'
          scvariant           = wg_var-tcvariant
          overwrite_scvariant = 'X'
          batch_input         = 'X'
          set_immediately     = 'X'.

works nicely - the problem is - how to close the F4-popup-dynpro which I call with:

CALL SCREEN 120 STARTING AT 5 1.

The doubleclick event, which is triggered on this dynpro does not cause pai, and i can't address a 'leave to screen 0' or similar...

instead i call an abap oo method... in which i also put the FM above. It does not work to insert a 'leave screen' after the FM...

any ideas welcome!

Matthias

0 Kudos

Hi matthias !!

Can you explain more about create variant for module pool ??

What are you trying to say with "via TA SHDS" ?.

thanks !

0 Kudos

You have to make use of fucntions

RS_VARIANT_SAVE_FROM_SELSCREEN

RS_RWSET_SAVE_VARIANT to save a variant.

You can go through this good blog link:[Save a variant from a Dynpro screen|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6618] [original link is broken] [original link is broken] [original link is broken];

0 Kudos

Thank you, Keshav. I saw that blog and I am currently using that and it works great.

But, I think Rich was trying to explain some other trick.

Regards,

Jagadish

Former Member
0 Kudos

Hi

I can't know your requirements, but you should use a selection-screen dynpro in your module poole.

You can define it in your top-inlcude:

SELECTION-SCREEN BEGIN OF SCREEN 101.

PARAMETERS: P1 LIKE ....,

SELECT-OPTIONS: SO_1 FOR .....

SELECTION-SCREEN END OF SCREEN 101.

Now you can call it in your screen 100.

PROCESS PBO.

MODULE CALL_SCREEN_101.

PROCESS PAI.

MODULE CALL_SCREEN_101.

CALL SELECTION-SCREEN 101.

IF SY-SUBRC = 0. "User has pressed F8

.......

ELSE.

ENDIF.

ENDMODULE.

Now you have created a selection-screen in your module pool and you can have the same gui of a selection screen of a report.

Max

Message was edited by: max bianchi