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

print parameter

Former Member
0 Likes
470

hi

i want print anything, so i write program for that. But i give the destination printer at the function, i becam the error message, the character is too long. when i look in the transaction spad,

the printer is called more than four character, destination has type from SYPDEST.

here is the code

*----------------------------------------------------------------------*
*       CLASS get_print DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS get_print DEFINITION.
  PUBLIC SECTION.
    METHODS: document.
  PRIVATE SECTION.
    CONSTANTS: pritername TYPE sypdest VALUE 'B_INFORMATI2'.
    DATA: mara_wa TYPE mara,
      pripars    TYPE pri_params,
      valid_flag TYPE c LENGTH 1.
ENDCLASS.                    "get_print DEFINITION

*----------------------------------------------------------------------*
*       CLASS get_print IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS get_print IMPLEMENTATION.
  METHOD document.

    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        destination          = 'B_INFORMATI2'
        immediately          = ' '
        no_dialog            = 'X'
      IMPORTING
        out_parameters       = pripars
        valid                = valid_flag
      EXCEPTIONS
        invalid_print_params = 2
        OTHERS               = 4.

    IF sy-subrc <> 0 OR valid_flag <> 'X'.
      RETURN.
    ENDIF.

    NEW-PAGE PRINT ON
      NO DIALOG PARAMETERS pripars.
    SELECT matnr FROM mara INTO CORRESPONDING FIELDS OF mara_wa.
      WRITE:/ mara_wa-matnr.
      ULINE.
      NEW-PAGE PRINT OFF.
    ENDSELECT.
  ENDMETHOD.                    "document
ENDCLASS.                    "get_print IMPLEMENTATION

thx for help

anujit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
426

use the Short Name in the table SH_PRIN .

2 REPLIES 2
Read only

Former Member
0 Likes
427

use the Short Name in the table SH_PRIN .

Read only

Former Member
0 Likes
426

wonderful..........great

thx anujit