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: 

Call Printing process

Former Member
0 Kudos

Dear All,

I've created a new button (using PF-STATUS), then I want to make it has the same functionality like print button.

It means :

When a user click the button = When a user click print button.

Please help me...

Thank you in advance,

Sandi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try to set your data before pushing icon print:

The function code for print is &RNT, so:

- active an exit event for it (perameter IT_EVENT_EXIT):

DATA: GT_EVENT_EXIT TYPE SLIS_T_EVENT_EXIT,

LT_EVENT_EXIT TYPE slis_event_exit.

LT_EVENT_EXIT-ucomm = '&RNT'.

LT_EVENT_EXIT-before = 'X'.

append LT_EVENT_EXIT to GT_EVENT_EXIT.

Now transfer it to fm ALV.

- Create a your routine for user-command:

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE R_UCOMM.

WHEN '&RNT'.

if rs_selfield-before_action = 'X'.

  • Here insert the code to set your data for print

endif.

WHEN OTHERS.

ENDCASE.

5 REPLIES 5

Former Member
0 Kudos

Try to set your data before pushing icon print:

The function code for print is &RNT, so:

- active an exit event for it (perameter IT_EVENT_EXIT):

DATA: GT_EVENT_EXIT TYPE SLIS_T_EVENT_EXIT,

LT_EVENT_EXIT TYPE slis_event_exit.

LT_EVENT_EXIT-ucomm = '&RNT'.

LT_EVENT_EXIT-before = 'X'.

append LT_EVENT_EXIT to GT_EVENT_EXIT.

Now transfer it to fm ALV.

- Create a your routine for user-command:

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE R_UCOMM.

WHEN '&RNT'.

if rs_selfield-before_action = 'X'.

  • Here insert the code to set your data for print

endif.

WHEN OTHERS.

ENDCASE.

0 Kudos

Dear All,

Thank you for all your help especially Kishan Negi.

Best regards,

Sandi

0 Kudos

Hi Kishan,

Thank you for your reply, the code works very smooth.

But I found one problem, how do we know if user click cancel in the printing window.

I dont want to execute the code when user click cancel button in the printing window.

Please I need help on this...

Thank you in advance.

Sandi

ferry_lianto
Active Contributor
0 Kudos

Hi Sandi,

Welcome to SDN.

You can call this FM <b>RS_COVERPAGE_SELECTIONS</b> for your custom print button.

Please check this sample code.


DATA: BEGIN OF MTAB_SEL_OPTIONS OCCURS 0,
        FLAG(1) TYPE C,
        OLENGTH TYPE X,
        LINE  LIKE RSVAR-INFOLINE,
      END OF MTAB_SEL_OPTIONS.

CALL FUNCTION 'RS_COVERPAGE_SELECTIONS'
  EXPORTING
    REPORT            = 'ZREPORT1' ' Name of current report
    VARIANT           = ''
    NO_IMPORT         = 'X'
  TABLES
    INFOTAB           = MTAB_SEL_OPTIONS
  EXCEPTIONS
    ERROR_MESSAGE     = 1
    VARIANT_NOT_FOUND = 2
    OTHERS            = 3.
 
 LOOP AT MTAB_SEL_OPTIONS.
   WRITE: / MTAB_SEL_OPTIONS-LINE.
 ENDLOOP.

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

Make use of the Print option given in the 'Standard Toolbar' (Function keys of STATUS) by passing the value as 'APRI'.