ALV default printing values

Hi,
i'm using FM REUSE_ALV_GRID_DISPLAY and i'd like to change the default format (print format) of a report. Therefore, when the user presses the print button and the print alv list appears, the print format by default that the user would see, would be the one forced by code. Is this possible?
Thanks

Hi,
Add this piece of code in ur program...
CALL FUNCTION 'SET_PRINT_PARAMETERS'
  EXPORTING
    LAYOUT                      = 'X_65_1024/4' "Format u need
    DESTINATION                 = 'TEST'.       "Output device
and in Ur ALV
data wa_print type slis_print_alv.
wa_print-NO_CHANGE_PRINT_PARAMS = 'X'.
call function 'reuse_alv..........
Exporting
IS_PRINT = wa_print
Cheers,
jose.

Similar Messages

  • Standard ALV Report default  print parameters

    Hi,
    We recently upgraded to ECC6. In some of the ALV reports for example F.35  (Credit Master Sheet) default print parameter has wider column specifications (X_65_255) as against earlier version (X_65_132). It might be due to flexibility in increasing additional columns but for our purpose X_65_132 was sufficient.  
    Now when we print with the standard settings the fonts are small. Individual users can change that default settings but due to large user base we want to default it at a global level but only for transaction F.35.
    Also we want to turn off ALV Statistics at this global level. We dont want to add a task for end users.
    Can this be achieved just for a specific report ? If not then for all reports? Please advise.
    Thanks,
    Vikram

    The no shading as well as many "extended print parameter" are no part of the OLD structures used by the OLD reuse FM, they are stored in memory (MEMORY ID 'EXTPAR')
    Check if 1703403 - Missing interface for extended print parameter can be applied in your system ?
    Nevertheless, could you try a single call like
    call function 'GET_PRINT_PARAMETERS'
       exporting
         mode                   = 'CURRENT'
         suppress_shading       = 'X'
         no_dialog              = 'X'
         report                 = sy-repid
       importing
         out_parameters         = w_params
       exceptions
         archive_info_not_found = 1
         invalid_print_params   = 2
         invalid_archive_params = 3
         others                 = 4.
    Regards,
    Raymond

  • Urgent..getting default & changed values in ALV editable....have ur point.s

    Hi all,
    I m using interactive ALV grid with 1 column editable with some default values, When i m clicking on SAVE button, only the values which are changed by the user in that column are coming in the internal table, & the default values are automatically deleted by the following code....
    But my requirement is to save all the default & changed values of the ALV column....
    <b>Help me out & have ur points.</b>
    DATA ref1 TYPE REF TO cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    importing
                   e_grid                           = ref1
    CALL METHOD ref1->check_changed_data
    IMPORTING
       e_valid   =
    CHANGING
       c_refresh = 'X'

    Pradeep,
    When ur doing the CHECK_CHANGED_DATA, u ll get the edited values inside this callback sub -routine only. so here u trap the values those are changed ( thats after editing).
    Once the control goes back to the original program ( calling prog ) , u ll end up with ur old data ( before editing).
    you ll have to handle that explictly in your code, or shift to OO alv grid like this -
    REPORT ZSKC_GRID.
    TABLES : EQUI.
    DATA   : BEGIN OF T_EQUI OCCURS 0,
              EQUNR TYPE EQUI-EQUNR,
              AENAM TYPE EQUI-AENAM,
             END   OF T_EQUI.
    DATA : T_FCAT  TYPE LVC_T_FCAT,
           G_FCODE TYPE SY-UCOMM.
    DATA : G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    SELECT-OPTIONS: S_EQUNR FOR EQUI-EQUNR.
    START-OF-SELECTION.
    * get data.
      PERFORM SUB_GET_DATA.
    * Populate catalog.
      PERFORM SUB_BUILD_CATALOG CHANGING T_FCAT.
    * Display the grid.
      PERFORM SUB_SHOW_GRID.
      CALL SCREEN 9001.
    *&      Form  SUB_GET_DATA
    *       Get data
    FORM SUB_GET_DATA .
      SELECT EQUNR AENAM
      FROM   EQUI
      INTO   TABLE T_EQUI
      WHERE  EQUNR IN S_EQUNR.
      IF SY-SUBRC NE 0.
    *  Give some message if needed
      ENDIF.
    ENDFORM.                    " SUB_GET_DATA
    *&      Form  SUB_BUILD_CATALOG
    *       text
    *      <--P_T_FCAT  text
    FORM SUB_BUILD_CATALOG  CHANGING PT_FCAT TYPE LVC_T_FCAT.
      DATA : WA_CAT TYPE LVC_S_FCAT.
      CLEAR WA_CAT.
      WA_CAT-FIELDNAME = 'EQUNR'.
      WA_CAT-TABNAME   = 'T_EQUI'.
      WA_CAT-REF_FIELD = 'EQUNR'.
      WA_CAT-REF_TABLE = 'EQUI'.
      APPEND WA_CAT TO PT_FCAT.
      CLEAR WA_CAT.
      WA_CAT-FIELDNAME = 'AENAM'.
      WA_CAT-TABNAME   = 'T_EQUI'.
      WA_CAT-REF_FIELD = 'AENAM'.
      WA_CAT-REF_TABLE = 'EQUI'.
      WA_CAT-EDIT      = 'X'.
      APPEND WA_CAT TO PT_FCAT.
    ENDFORM.                    " SUB_BUILD_CATALOG
    *&      Form  SUB_SHOW_GRID
    *       Show grid
    FORM SUB_SHOW_GRID .
    * create the Grid Object.
      CREATE OBJECT G_GRID
        EXPORTING
           I_PARENT          = CL_GUI_CONTAINER=>SCREEN0
        EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CHECK SY-SUBRC EQ 0.
    * Display contents,
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        CHANGING
          IT_OUTTAB                     = t_equi[]
          IT_FIELDCATALOG               = t_fcat
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          others                        = 4.
    ENDFORM.                    " SUB_SHOW_GRID
    *&      Module  STATUS_9001  OUTPUT
    *       text
    MODULE STATUS_9001 OUTPUT.
       SET PF-STATUS 'PF_9001'.
       SET TITLEBAR 'TITLE_9001'.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  USER_COMMAND_9001  INPUT
    *       text
    MODULE USER_COMMAND_9001 INPUT.
      CASE G_FCODE.
        WHEN 'BACK' OR 'CANC' OR 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'HAVE'.
    *    After editing everything user presses this button.
         PERFORM SUB_GET_EDITED_DATA.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&      Form  SUB_GET_EDITED_DATA
    *       Read the ALV grid and get current internal table.
    FORM SUB_GET_EDITED_DATA .
    DATA : T_OLD_DATA LIKE T_EQUI OCCURS 0.
    * hold the old values if u need them.
      t_old_data[] = t_equi[].
    * This will update the global internal table.
      CALL METHOD G_GRID->CHECK_CHANGED_DATA.
    * Now t_equi have changed here. u have the old data in the T_OLD_DATA.
      BREAK-POINT.
    ENDFORM.                    " SUB_GET_EDITED_DATA
    Create a blank screen called 9001. and Pf-staus has a buton with fcode "HAVE". ( alongwith BACK canc exit).

  • Override default printer when printing ALV

    Hi,
    I have built an ALV OO report.  When I click 'Print', the popup with the print parameters is defaulted according to my default user profile.
    I'd like to change the default printer.  I tried to use the parameter 'IS_PRINT' of the method 'SET_TABLE_FOR_FIRST_DISPLAY'.  It does not work.  I tried to use the function module 'SET_PRINT_PARAMETERS'.  It does not work.
    Is it possible to change those parameters at all?  Any idea what I am doing wrong?
    Thanks.

    I found out that there is an ALV print version that is considered.  It is by default V04 in our system (abap 7.02).  I can change that version in transaction SALV_PARAMS.  When I change it to V03, it considers the print parameters that I pass to the ALV class.  When it it V04, it doesn't.
    I am not sure what the impact of changing the version will be.
    Any idea?

  • ALV List  printing correction

    Hi
    I am trying to print a ALV list that contains Subtotals and Grand Total. I want subtotals and grand total to be bold while printing. i can see the subtotal and grand total are bold in list display but only grand total is printed bold.
    can anybody help me where to do the setting to print subtotals in bold.
    Thanks
    hem

    hi
    ABAP Certification, Smartform, Sapscripts, BAPI, JAVA, Visual Basic Programming Books
    A Simple ABAP ALV LIST VIEWER Example
    This ALV program have all the basic report requirements such as page heading, page no, sub-total and a grand total.
    This is a basic ALV with the followings:-
    - Page Heading
    - Page No
    - Sub-Total
    - Grand Total
    REPORT ZALV.
    TYPE-POOLS: SLIS.
    DATA: G_REPID LIKE SY-REPID,
    GS_PRINT            TYPE SLIS_PRINT_ALV,
    GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
    GT_EVENTS           TYPE SLIS_T_EVENT,
    GT_SORT             TYPE SLIS_T_SORTINFO_ALV,
    GS_LAYOUT           TYPE SLIS_LAYOUT_ALV,
    GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
    FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
    COL_POS TYPE I.
    DATA: BEGIN OF ITAB,
      FIELD1(5) TYPE C,
      FIELD2(5) TYPE C,
      FIELD3(5) TYPE P DECIMALS 2,
    END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB1.
    DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB_FIELDCAT.
    Print Parameters
    PARAMETERS:
                P_PRINT  AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
                P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
                P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
                P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
                P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
                P_RESERV TYPE I.                  "NO OF FOOTER LINE
    INITIALIZATION.
    G_REPID = SY-REPID.
    PERFORM PRINT_BUILD    USING GS_PRINT.      "Print PARAMETERS
    START-OF-SELECTION.
    TEST DATA
    MOVE 'TEST1' TO ITAB1-FIELD1.
    MOVE 'TEST1' TO ITAB1-FIELD2.
    MOVE '10.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    MOVE 'TEST2' TO ITAB1-FIELD1.
    MOVE 'TEST2' TO ITAB1-FIELD2.
    MOVE '20.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    DO 50 TIMES.
      APPEND ITAB1.
    ENDDO.
    END-OF-SELECTION.
    PERFORM BUILD.
    PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
    PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
    PERFORM CALL_ALV.
    FORM BUILD.
    DATA FIELD CATALOG
    Explain Field Description to ALV
    DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD1'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
    FIELDCAT_LN-KEY       = ' '.   "SUBTOTAL KEY
    FIELDCAT_LN-NO_OUT    = ' '.
    FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD2'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    FIELDCAT_LN-NO_OUT    = 'X'.
    FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME     = 'FIELD3'.
    FIELDCAT_LN-TABNAME       = 'ITAB1'.
    FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
    FIELDCAT_LN-REF_TABNAME   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
    FIELDCAT_LN-NO_OUT        = ' '.
    FIELDCAT_LN-DO_SUM        = 'X'.   "SUM UPON DISPLAY
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    DATA SORTING AND SUBTOTAL
    DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD1'.
    GS_SORT-SPOS      = 1.
    GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD2'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    ENDFORM.
    FORM CALL_ALV.
    ABAP List Viewer
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
    IS_LAYOUT =  GS_LAYOUT
    IT_FIELDCAT = GT_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
      IT_SORT = GT_SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
      IT_EVENTS = GT_EVENTS[]
    IT_EVENT_EXIT =
      IS_PRINT = GS_PRINT
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = ITAB1
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    ENDFORM.
    HEADER FORM
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    *GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    define END_OF_PAGE event
    READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_PAGE
                             INTO LS_EVENT.
    IF SY-SUBRC = 0.
      MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
      APPEND LS_EVENT TO LT_EVENTS.
    ENDIF.
    ENDFORM.
    FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'H'.
      GS_LINE-INFO = 'HEADER 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      GS_LINE-KEY  = 'STATUS 1'.
      GS_LINE-INFO = 'INFO 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      GS_LINE-KEY  = 'STATUS 2'.
      GS_LINE-INFO = 'INFO 2'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
    CLEAR GS_LINE.
    GS_LINE-TYP  = 'A'.
    GS_LINE-INFO = 'ACTION'.
    APPEND GS_LINE TO  GT_TOP_OF_PAGE.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
    ENDFORM.
    FORM END_OF_PAGE.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.
    PRINT SETTINGS
    FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
      LS_PRINT-PRINT              = P_PRINT.  "PRINT IMMEDIATE
      LS_PRINT-NO_PRINT_SELINFOS  = P_NOSINF. "NO SELECTION INFO
      LS_PRINT-NO_COVERPAGE       = P_NOCOVE. "NO COVER PAGE
      LS_PRINT-NO_NEW_PAGE        = P_NONEWP.
      LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
      LS_PRINT-RESERVE_LINES      = P_RESERV.
    ENDFORM.
    *END OF ZALV PROGRAM
    i copied the program from the below link
    http://www.sap-basis-abap.com/sapalv.htm
    hope it will help you
    Regards
    Sreelatha Gullapalli

  • OO  ALV  displaying  without  Values  despite Internal  table contains

    My   below  OO  ALV  displaying  without  Values  despite Internal  table contains  the values ...
    Help  please ...
    REPORT zsd_concession1  NO STANDARD PAGE HEADING
                            LINE-SIZE 285
                            LINE-COUNT 64
                            MESSAGE-ID zz.
    Program Description ******************************
    This report is to Calculate consession against Quotations
    complying  standards for enhanced Performance, Readability &
    Maintenance.
    Change Log *********************************
    Remedy # /       Who       When        Why / What
    Transport #
    CLASS lcl_event_handler DEFINITION DEFERRED.
    *&      Data Definitions .
    DATA: BEGIN OF vbap_wa,
                vbeln               TYPE  vbak-vbeln,           "Quotation#
                erdat               TYPE  vbak-erdat,           "Quot date
                knumv               TYPE  vbak-knumv,           "Cond Rec#
                posnr               TYPE  vbap-posnr,           "Line Item
                matnr               TYPE  vbap-matnr,           "Mat#
                zansicat            TYPE  zmarall-zansicat,     "AnsiCat#
                zansigrd            TYPE  zmarall-zansigrd,     "Grade
                zcurrvaltnarea      TYPE  zco002-zcurrvaltnarea,"Val Area
                zcurrcstusd         TYPE  zco002-zcurrcstusd,   "Cost$
                zzbrndnm            TYPE  mara-zzbrndnm,        "Brand
                zqedscgrp           TYPE  zglbprc-zqedscgrp, "QE Disc Grp
                mstav               TYPE  mara-mstav,        "Status
                kwmeng              TYPE  vbap-kwmeng,       "Qty
                lprc                TYPE  konv-kbetr,  "List Price ZBP1
                sprc                TYPE  konv-kbetr,  "Std Pric ZNAA,ZNAX
                netpr               TYPE  vbap-netpr,  "Quot price
                mrgn                TYPE  konv-kbetr,  "margin%
           END   OF vbap_wa,
           BEGIN OF konv_wa,
                knumv               TYPE  konv-knumv,  "Cond#
                kposn               TYPE  konv-kposn,  "Cond Item#
                kappl               TYPE  konv-kappl,  "Applic
                kschl               TYPE  konv-kschl,  "Cond Typ
                kbetr               TYPE  konv-kbetr,  "Price ZBP1,ZNAA,ZNAX
           END   OF  konv_wa,
           BEGIN OF vbpa_wa,
                vbeln               TYPE  vbpa-vbeln,  "Quot#
                posnr               TYPE  vbpa-posnr,  "Item#
                parvw               TYPE  vbpa-parvw,  "Prt Fn
                kunnr               TYPE  vbpa-kunnr,  "Cust#
           END   OF  vbpa_wa,
           BEGIN OF result_wa,
                posnr               TYPE  vbap-posnr,           "Line Item
                matnr               TYPE  vbap-matnr,           "Mat#
                zansicat            TYPE  zmarall-zansicat,     "AnsiCat#
                zansigrd            TYPE  zmarall-zansigrd,     "Grade
                zcurrvaltnarea      TYPE  zco002-zcurrvaltnarea,"Val Area
                zcurrcstusd         TYPE  zco002-zcurrcstusd,   "Cost$
                zzbrndnm            TYPE  mara-zzbrndnm,        "Brand
                zqedscgrp           TYPE  zglbprc-zqedscgrp, "QE Disc Grp
                mstav               TYPE  mara-mstav,        "Status
                kwmeng              TYPE  vbap-kwmeng,       "Qty
                lprc                TYPE  konv-kbetr,  "List Price ZBP1
                sprc                TYPE  konv-kbetr,  "Std Pric ZNAA,ZNAX
                netpr               TYPE  vbap-netpr,  "Quot price
                mrgn                TYPE  konv-kbetr,  "margin%
           END   OF result_wa.
    DATA: ikonv      LIKE  STANDARD TABLE OF konv_wa,
          ivbap      LIKE  STANDARD TABLE OF vbap_wa,
          ivbpa      LIKE  STANDARD TABLE OF vbpa_wa,
          iresult    LIKE  STANDARD TABLE OF result_wa.
    *Work storage
    DATA: BEGIN OF ws,
             vbeln       TYPE vbak-vbeln,
             ok_code     TYPE sy-ucomm,
             alv_save    TYPE c,   "ALV save
             alv_variant TYPE disvariant, "ALV Variant
             alv_sort    TYPE lvc_t_sort, "Sort table
          END  OF ws.
    *Data declarations for ALV Main list
    DATA : ty_lay1        TYPE        lvc_s_layo,
           it_fieldcat    TYPE        lvc_t_fcat ,
           ty_fieldcat    TYPE        lvc_s_fcat ,
           l_smenu        TYPE REF TO cl_ctmenu,
           c_alv1         TYPE REF TO cl_gui_alv_grid,
           c_cont1        TYPE REF TO cl_gui_custom_container,
           e_dclick       TYPE REF TO lcl_event_handler.
    *Data declarations for ALV Interactive list
    DATA : ty_lay2        TYPE        lvc_s_layo,
           it_fcat        TYPE        lvc_t_fcat ,
           ty_fcat        TYPE        lvc_s_fcat ,
           c_alv2         TYPE REF TO cl_gui_alv_grid,
           c_cont2        TYPE REF TO cl_gui_custom_container.
    *Field-Symbols
    FIELD-SYMBOLS:
          <konv>  LIKE   konv_wa,
          <vbap> LIKE   vbap_wa.
    *Constants
    CONSTANTS:
          c_end_row    TYPE  i  VALUE  65000.
    *CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
         handle_double_click
         FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
    ENDCLASS. "lcl_event_handler DEFINITION
    *CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_double_click.
        DATA: sec_wa LIKE LINE OF iresult.
    *Reading the selected data into a variable
        READ TABLE iresult INDEX e_row-index INTO sec_wa.
    *Select the field details of the selected table
    SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
    WHERE tabname EQ ls_dd02l-tabname.
    *Calling the ALV containing the field values
        CALL SCREEN 101.
      ENDMETHOD. "handle_double_click
    ENDCLASS. "lcl_event_handler IMPLEMENTATION
    *&      SELECTION-SCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE  text-001.
    SELECT-OPTIONS:
        s_vbeln  FOR  ws-vbeln DEFAULT '2002354788' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK a.
    INITIALIZATION.
      PERFORM setup_screen_defaults.
    START-OF-SELECTION.
      PERFORM gather_report_data.
    END-OF-SELECTION.
      PERFORM create_output.
    *&      Form  initialization
    FORM setup_screen_defaults.
      CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
      REFRESH: ivbpa, ikonv, ivbap, iresult.
    ENDFORM.                    " setup_screen_defaults
    *&      Form  gather_report_data
    FORM  gather_report_data.
      SELECT  vbeln posnr parvw kunnr
               INTO TABLE ivbpa
               FROM vbpa
               WHERE vbeln IN s_vbeln
               AND ( parvw = 'SP' OR "SoldTO
                     parvw = 'WE' OR "ShipTo
                     parvw = 'ZT' ). "Top Parent
      SELECT  vkvbeln vkerdat vkknumv vpposnr vp~matnr
              z1zansicat z1zansigrd z2~zcurrvaltnarea
              z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
              m1mstav  vpkwmeng  vp~netpr
        INTO CORRESPONDING FIELDS OF TABLE ivbap
        FROM  vbak  AS vk
        INNER JOIN vbap AS vp
           ON vpvbeln = vkvbeln
        INNER JOIN zmarall AS z1
           ON z1matnr = vpmatnr
        INNER JOIN zco002 AS z2
           ON z2matnr = vpmatnr
        INNER JOIN zglbprc AS zg
           ON zgmatnr = vpmatnr
        INNER JOIN mara AS m1
           ON m1matnr = vpmatnr
        WHERE  vk~vbeln IN s_vbeln
        AND    vk~auart = 'AG'."AG = Quot
      SORT ivbap BY posnr matnr.
      SELECT  kvknumv kvkposn kvkappl kvkschl kv~kbetr
              INTO TABLE ikonv
              FROM  konv AS kv
              FOR ALL ENTRIES IN ivbap
              WHERE  kv~knumv = ivbap-knumv
              AND    kv~kposn = ivbap-posnr
              AND    kv~kappl EQ 'V'
              AND    ( kv~kschl EQ 'ZBP1'
                   OR kv~kschl EQ 'ZNAX'
                   OR kv~kschl EQ 'ZNAA' ).
      SORT ikonv BY knumv kposn.
      LOOP AT  ivbap  ASSIGNING  <vbap>.
        CLEAR konv_wa.
        READ TABLE ikonv INTO  konv_wa WITH KEY
                                   knumv = <vbap>-knumv
                                   kposn = <vbap>-posnr
                                   kschl = 'ZBP1'
                                   BINARY  SEARCH.
        IF sy-subrc EQ 0.
          <vbap>-lprc = konv_wa-kbetr.
        ENDIF.
        READ TABLE ikonv INTO  konv_wa WITH KEY
                                   knumv = <vbap>-knumv
                                   kposn = <vbap>-posnr
                                   kschl = 'ZNAX'
                                   BINARY  SEARCH.
        IF sy-subrc EQ 0.
          <vbap>-sprc = konv_wa-kbetr.
        ENDIF.
        READ TABLE ikonv INTO  konv_wa WITH KEY
                                   knumv = <vbap>-knumv
                                   kposn = <vbap>-posnr
                                   kschl = 'ZNAA'
                                   BINARY  SEARCH.
        IF sy-subrc EQ 0.
          <vbap>-sprc = konv_wa-kbetr.
        ENDIF.
      ENDLOOP.
      SORT ivbap BY posnr matnr.
      LOOP AT ivbap INTO vbap_wa.
        MOVE-CORRESPONDING  vbap_wa TO result_wa.
        APPEND  result_wa TO iresult.
        CLEAR:  vbap_wa, result_wa.
      ENDLOOP.
    ENDFORM.                    " gather_report_data
    *&      Form  create_output
    FORM create_output.
      CALL SCREEN 100.
    FREE: iresult.
    ENDFORM.                    " create_output
    *&      Module  PBO_0100  OUTPUT
          text
    MODULE pbo_0100 OUTPUT.
      SET PF-STATUS '0100'.
      SET TITLEBAR '0100'.
      IF c_cont1 IS INITIAL.
    *Creating object of container
        CREATE OBJECT c_cont1
         EXPORTING
           container_name = 'CCONT1'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *Creating object of alv
        CREATE OBJECT c_alv1
           EXPORTING
            i_parent = c_cont1.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *Alv layout
        PERFORM alv_100_layout.
        PERFORM save_alv_layout.
    *Alv field catalogue
        PERFORM alv_100_fieldcat.
    *Displaying the ALV grid
        CALL METHOD c_alv1->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay1
            i_save          = ws-alv_save
            is_variant      = ws-alv_variant
          CHANGING
            it_outtab       = iresult[]
            it_sort         = ws-alv_sort
            it_fieldcatalog = it_fieldcat[].
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *Create object of the event class
    *and setting handler for double click
        CREATE OBJECT e_dclick.
        SET HANDLER e_dclick->handle_double_click FOR c_alv1.
      ENDIF.
    ENDMODULE.                 " PBO_0100  OUTPUT
    *&      Module  PAI_0100  INPUT
          text
    MODULE pai_0100 INPUT.
      ws-ok_code = sy-ucomm.
      CASE ws-ok_code.
        WHEN 'BACK'.
          CALL  SELECTION-SCREEN  1000.
          CLEAR ws-ok_code.
        WHEN 'EXIT'.
          LEAVE TO  SCREEN  0.
          CLEAR ws-ok_code.
          EXIT.
        WHEN 'CANCEL'.
          LEAVE TO  SCREEN  0.
          CLEAR ws-ok_code.
          EXIT.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.                 " PAI_0100  INPUT
    *&      Form  alv_100_layout
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_layout.
      ty_lay1-numc_total = 'X'. " Numc total line
    ty_lay1-cwidth_opt = 'X'. " Optimal column width
      ty_lay1-detailinit = 'X'. " Show values that are initial in
      ty_lay1-sel_mode = 'A'. " Column selection mode
      ty_lay1-no_merging = 'X'. " No merging while sorting columns
      ty_lay1-keyhot     = 'X'.
      ty_lay1-grid_title = 'SD Concessions'.
      ty_lay1-zebra      = 'X'.
      ty_lay1-no_toolbar = ' '.
    ENDFORM.                    " alv_100_layout
    *&      Form  alv_100_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 1.
      ty_fieldcat-fieldname = 'posnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Item#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 2.
      ty_fieldcat-fieldname = 'matnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Mat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 3.
      ty_fieldcat-fieldname = 'zansicat'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'AnsiCat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 4.
      ty_fieldcat-fieldname = 'zansigrd'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Grade'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 5.
      ty_fieldcat-fieldname = 'zcurrvaltnarea'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Val Area'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 6.
      ty_fieldcat-fieldname = 'zcurrcstusd'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Cost $'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 7.
      ty_fieldcat-fieldname = 'zzbrndnm'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Brand'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 8.
      ty_fieldcat-fieldname = 'zqedscgrp'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'QE'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 9.
      ty_fieldcat-fieldname = 'mstav'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Status'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 9.
      ty_fieldcat-fieldname = 'kwmeng'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Qty'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 10.
      ty_fieldcat-fieldname = 'lprc'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'List Price'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 11.
      ty_fieldcat-fieldname = 'sprc'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Discount'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 12.
      ty_fieldcat-fieldname = 'netpr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Quot Price'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 13.
      ty_fieldcat-fieldname = 'mrgn'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Margin%'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
    ENDFORM.                    " alv_100_fieldcat
    *&      Module  PBO_0101  OUTPUT
          text
    MODULE pbo_0101 OUTPUT.
    *Check if the Custom container exists.
      IF c_cont2 IS INITIAL.
    *Creating container object
        CREATE OBJECT c_cont2
          EXPORTING
            container_name = 'CCONT2'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *creating ALV grid for interactive list
        CREATE OBJECT c_alv2
          EXPORTING
           i_parent = c_cont2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *ALV layout
        PERFORM alv_101_layout.
    *ALV fieldcatalogue
        PERFORM alv_101_fieldcat.
    *Sorting the output by field position
        SORT iresult BY posnr.
    *ALV for display field details
        CALL METHOD c_alv2->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay2
          CHANGING
            it_outtab       = iresult[]
            it_fieldcatalog = it_fieldcat.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " PBO_0101  OUTPUT
    *&      Module  PAI_0101  INPUT
          text
    MODULE pai_0101 INPUT.
    ENDMODULE.                 " PAI_0101  INPUT
    *&      Form  alv_101_layout
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_layout.
      ty_lay2-grid_title = 'Line Details'.
      ty_lay2-zebra = 'X'.
      ty_lay2-no_toolbar = 'X'.
    ENDFORM.                    " alv_101_layout
    *&      Form  alv_101_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_fieldcat.
      REFRESH it_fieldcat.
    REFRESH it_fcat.
    CLEAR ty_fcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 1.
      ty_fieldcat-fieldname = 'posnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Item#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 2.
      ty_fieldcat-fieldname = 'matnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Mat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 3.
      ty_fieldcat-fieldname = 'zansicat'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'AnsiCat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 4.
      ty_fieldcat-fieldname = 'zansigrd'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Grade'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 5.
      ty_fieldcat-fieldname = 'zcurrvaltnarea'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Val Area'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
    ENDFORM.                    " alv_101_fieldcat
    *&      Form  save_alv_layout
          text
    -->  p1        text
    <--  p2        text
    form save_alv_layout.
    ws-alv_save = 'A'.
    ws-alv_variant-report = sy-repid.
    endform.                    " save_alv_layout

    Hello
    Creating fieldcatalogs manually is one of the major error sources in ALV programming.
    There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
    If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
    Regards
      Uwe

  • Default printer in SAp ECC 6.0 version

    I want to print by windows default printer, my device is F type, but in before versions i use
    SAPWIN: Rel 4.x 4.09 + ONLY and i execute in my computer and it works, but now it gives me an error, what value do you select for this version please?
    Thanks in advance.
    regards

    Sorry, i am talking about SPAd transaction

  • Preview Default Print Setting "Fit to Page" Problem

    Preview.app in Snow Leopard has removed the option to print without scaling, and recreating this behaviour with the remaining options is quite complex and requires 4 extra steps.
    Steps to Reproduce:
    1. Open a document in Preview.app, such as a PDF, of a known paper size.
    2. Select 'File' > 'Print…'
    3. Change the paper size to one where the default scale value with the default 'Scale to Fit:' 'Print Entire Image' is not 100%. This step is often unnecessary, as many documents will require reduction to include margins, even if the paper sizes match.
    4. Select 'Scale:'
    5. Select the scale % value.
    6. Delete the scale value.
    7. Input '100' in the scale value box using the keyboard.
    8. Press tab to avoid radar #7256827.
    9. Click 'Print'
    Expected Results:
    Click on a single option to print at 100%, if by chance that wasn't the default option. This would have been one step.
    Actual Results:
    Does what it says. Steps 4 through 8 are necessary to print at 100% in most cases.
    Regression:
    This behaviour was as expected in OS X 10.5.x and previous versions, or we wouldn't be having this discussion.
    Notes:
    Printing at 100% is the only scaling that is common enough to warrant a button to make it an easy one to get to. Preview.app itself even has an 'Actual Size' toolbar button, but has removed this function for printing.
    Graphic designers (and other professionals) or specific applications (such as printing on pre-cut or pre-printed paper, labels, or DVDs) can commonly require printing at 100%, and using PDF to distribute documents makes Preview.app the most logical choice for many printing jobs.
    Having something other than 100% as a default can cause expensive media to be ruined by a mis-scaled printout, unless these 4 (+1) steps are followed every time.
    Most other apps, including Safari, Mail.app and TextEdit default to no scaling, making Preview.app an exception.
    I am an architect and this is really annoying!
    Does anyone know a workaround?

    Sorry no workaround as yet...
    I too am now sick of the amount of expensive paper I have wasted due to the Preview app default print setting of 'Scale to fit'.
    - No option to print at 100%, you have to manually input this information.
    - No way to change this default in preferences, you can change the opening viewing size of a doc to 100% though.
    - Doesn't remember the previous settings if you decide to reopen the doc and print another copy.
    I also found that if I attempted to print an A4 doc with bleed and crop marks, it would set the default paper size to A4 and the annoying scale to fit would be set to 83%. If I then changed the scale by typing in 100% but don't hit enter for fear of the print starting and then simply use the drop down to change the paper to A3 and then change the orientation and then hit enter it ignores that you have changed the scale and prints your doc at 83% on A3 - Brilliant!
    It's a shame to say that I will be going back to acrobat for pdfs!
    If you can't put a 100% scale radio button on the print dialogue box either allow people to change the default in prefs or even better allow the presets to control paper size and scale of printing!

  • Mapping default printer based on AD attribute

    Hi all ! 
    Sorry for my english, i'll try to be clear... :)
    I need to run a VBscript on TSE 2008 R2 servers to set computer's
    default printer (not user). For this, I need to use the ClientName var. 
    The default printer name is written in the computer's description attribute in Active Directory. 
    I'm a beginner in VBscripting. I have parts of scripts working, but not everything.
    Here is my script (my comments are written with ''''''''''''''''''''''''''''''''''''''''''''): 
    'find clientname
    strComputer = "."
    Const ForAppending = 8
    Set oNetwork = wscript.CreateObject("wscript.network") 'Create network object
    Set objShell = Wscript.CreateObject("Wscript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    strUserName  = oNetwork.userName
    strComputerName  = oNetwork.computerName
    strClientName = objShell.ExpandEnvironmentStrings("%clientname%")
    ExecuteSearch = SearchDistinguishedName(strClientName)
    Public Function SearchDistinguishedName(ByVal vSAN)
    Const ADS_SCOPE_SUBTREE = 2
        Dim oRootDSE, oConnection, oCommand, oRecordSet
        Set oRootDSE = GetObject("LDAP://rootDSE")
        Set oConnection = CreateObject("ADODB.Connection")
        oConnection.Open "Provider=ADsDSOObject;"
        Set objCommand = CreateObject("ADODB.Command")
        objCommand.ActiveConnection = oConnection
    ldstring = "'LDAP://" & oRootDSE.get("defaultNamingContext") & "'" 
    objCommand.CommandText = "Select Name, distinguishedName from "& ldstring & " where objectClass='computer'"  
    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Timeout") = 30 
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
    objCommand.Properties("Cache Results") = False 
    Set objRecordSet = objCommand.Execute
    objRecordSet.MoveFirst
    Do Until objRecordSet.EOF
    If lcase(objRecordSet.Fields("Name").Value) = lcase(vSan) Then
        Wscript.Echo "Client Name: " & objRecordSet.Fields("Name").Value & vbCrLf _ 
        & "Location: " & objRecordSet.Fields("distinguishedName").Value
        'Wscript.Quit
    End If
        objRecordSet.MoveNext
    Loop
    End Function
    ' find canonical name
    On Error Resume Next
    ADSRoot = "DC=domain,DC=fr"
    Const ADS_SCOPE_SUBTREE = 2
    Set objConnection2 = CreateObject("ADODB.Connection")
    Set objCommand2 = CreateObject("ADODB.Command")
    objConnection2.Provider = "ADsDSOObject"
    objConnection2.Open "Active Directory Provider"
    Set objCommand2.ActiveConnection = objConnection2
    objCommand2.Properties("Page Size") = 1000
    objCommand2.Properties("Searchscope") = ADS_SCOPE_SUBTREE
    objCommand2.CommandText = _
    "SELECT * FROM 'LDAP://" & ADSRoot & "' WHERE objectCategory='user' OR objectCategory='computer'"
    ''''''''''''''''''''''''''''''''''''Here, I use a input box to enter the clientname, cause I don't know how to re-use the clientname found in the lasts vars.
    srchTrm = LCase(InputBox("Please enter your search term.", "Active Directory Search"))
    WScript.Echo srchTrm
    i = 0
    If Len(srchTrm) < 4 or Instr(srchTrm, "=") Then
    WScript.Echo "Please enter a search term in excess of 3 characters. Don't use ""="""
    WScript.Quit
    End If
    Set objRecordSet2 = objCommand2.Execute
    objRecordSet2.MoveFirst
    Do Until objRecordSet2.EOF
    strADPath = LCase(objRecordSet2.Fields("adsPath").Value)
    If InStr(strADPath, srchTrm) Then
    Set objUser = GetObject(objRecordSet2.Fields("adsPath").Value)
    Select Case objUser.Class
    Case "user"
    strMsg = "Type: Person" & VbCrLf
    strMsg = strMsg & "Name: " & objUser.DisplayName & VbCrLf
    strMsg = strMsg & "Email: " & objUser.mail & VbCrLf
    strMsg = strMsg & "Telephone: " & objUser.telephoneNumber & VbCrLf
    strMsg = strMsg & "Department: " & objUser.department & VbCrLf
    strMsg = strMsg & "Title: " & objUser.title & VbCrLf
    Case "computer"
    strMsg = "Type: Computer" & VbCrLf
    strMsg = strMsg & "Name: " & objUser.Get("name") & VbCrLf
    strMsg = strMsg & "OS: " & objUser.operatingSystem & VbCrLf
    Case Else
    strMsg = "Unidentified" & VbCrLf
    End Select
    'strMsg = strMsg & "LDAP: " & objUser.adsPath & VbCrLf
    objUser.GetInfoEx Array("canonicalName"), 0
    strMsg = strMsg & "AD Path: " & objUser.canonicalName & VbCrLf
    objUser.GetInfoEx Array("description"), 0
    strMsg = strMsg & "Imprimante: " & objUser.description
    WScript.Echo strMsg & VbCrLf
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Here I want to use the "objuser.description" to set default printer
    Dim WshNetwork
    Set WshNetwork = CreateObject("WScript.Network")
    WshNetwork.SetDefaultPrinter "\\SRV-PRINT.domain.fr\" & objUser.description
    i = i + 1
    End If
    objRecordSet2.MoveNext
    Loop
    If Not i > 0 Then
    WScript.Echo "No results found."
    End If
    I think there's a most simple way to do this, but for the moment, I Don't know how to do. 
    Any help would be grateful. 

    Hello. 
    We need to do this because each computer in the office as a network printer (or nearly each computer). I can't do a Group Policy for each computer in my domain. We cannot work with users accounts, only computers . 
    My problem is that if the user1 is connected on Comp1, he must have the printer near computer 1 as default printer.
    If user1 is connected on computer 2, at the other side of the office, he must have the printer near computer 2. So I cannot imagine a group policy to do this :). 
    We had the idea to use the descprition attribute in Active Directory to indicate the default printer to map.
    We must now make a script to get clientname on the TSE session, look for the computer account in Active Directory, read its description's attibute and map the default printer. 
    For example, my computer is COMP01. I use a TSE environment on SRVTSE01. 
    The script need to determine which computer (COMP01) is connected to the SRVTSE01 server (clientname var), search Active Directory computer account of COMP01, read the account's description attribute (for example PRINT01) and set \\SRV-PRINT\PRINT01 as the
    default printer on COMP01.
    Hope it's better with this example... 

  • Mass-Update Default Print Properties for Spool Authorization (S_SPO_ACT)

    Dear Experts
    To protect HR spool requests it is possible to use the print-authorization in combination with the authorization object S_SPO_ACT.
    In case a HR user prints a form the the print-popup will default the user-parameter SAU for print-authorization. When printed like this the value of the SAU-parameter will be added to the spool request.
    In case the HR user prints a ABAP-list the value of the user-parameter SAU is not defaulted in the print popup. Instead seperatly saved defaults print properties (see print popup -> properties) are taken.
    How can I mass-change these default print properties? How can I set these default print properties for other users?
    Thanks in advance

    Please note that with SAP BASIS release later than 620, parameter id 'SAU' is either no longer used or only used in a limit fashion. The default spool authorization is now stored in cluster 'UV' instead of at 'USR05' / parid 'SAU' .
    If your users already have 'SAU' parameter populated with proper spool authorization, SAP has an ABAP util 'RSTRANSPARAMSAU' to store this in the cluster. Once you run this util, default spool authorization will
    be populated properly each time spool files are created.

  • Default printer resetting after reboot in Windows 7 x64

    I'm managing a domain with roughly 450 clients, all running Windows 7 Ent x64, and about 50 printers. All clients have the same desktop image with the exception of a few desktops need special additional software. I push out printers via GPO and it was
    running fine until recently. The client pc would reset it default printer every time the pc reboot or log off. First, there was only a handful and now it spreads to almost half the number of pc are being effect with this problem. I've tried different
    approaches, even completely rewrite the GPOs with no success. The pc would reset to either PDFCreator or OneNote or XPS or Fax. I found that if I re-image the client desktop the default printer would remain default but I'm keeping that as the
    last option since it involves with data migrating and probably consumes a whole lot of time (200+ effected pc). Any leads or suggestions are much appreciated, my clients are not happy and they are chewing me alive :)
     I must add that setting default printer via GPO is not an option for me since people with different groups or branches are sharing the same building/floor.

    Hi,
    I’m not able to get security clearance to send these files to public, I apologize for that, is there a particular section/part that
    I should pay attention to from that report? I went through a report just now and I’m not sure what to look for. Would you mind to give me some direction? Thanks again
    >> Please try to review the promon log. The Device value in the following Registry path contains the user's default printer:
    HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device.
    We can use process monitor to view what issue cause the registry key reset.
    There is a scenarios for your reference:
    One or more network printer connection under
    HKCU\Printers\Connections\<NetworkPrinterSubkey>
    are missing the "Server" registry key.
    Resolution:
    Start Regedit.exe
    Export HKCU\Printers\Connections to have a backup of the key
      View the network printer registry subkeys under HKCU\Printers\Connections if on the right hand side it is missing the registry value "Server" then delete the Network Printer subkey under HKCU\Printers\Connections
    Longer Term Solution: Remove the bad Network Printer Share from the server and/or update the print driver on the print server.
    >>GPMC.log is just to evaluate if there are some policy cause the Default Printer reset.
    >>Event Viewer is a User Interface to find the possible problem convenient.
    If the issue persist, as the present situation, we cannot get more information for further analysis, please try to contact
    directly with a Microsoft Support Professional to analyze the problem.
    To obtain the phone numbers for specific technology request please take a look at the web site listed below.
    http://support.microsoft.com/default.aspx?scid=fh;EN-US;PHONENUMBERS
    If you are outside the US please see
    http://support.microsoft.com/directory/overview.asp for regional support phone numbers.
    Thank you for your understanding and I hope this will be resolved soon.
    Best Regards
    Elytis Cheng

  • Adobe PDF installed and set as default printer causes incorrect pagination in Excel

    I have come across an interesting bug. When Adobe PDF is installed and set as the default printer, Excel produces incorrect and inconsistent pagination--in my case one of the sheets is printed to two pages wide rather than three it should be (when Adobe PDF is not installed), resulting in 9 printed pages instead of 11. I have created a test case to reproduce it.
    The sample file is located here: goo.gl/ZBiWj
    The test case is here: goo.gl/6KbrO
    Instructions are given on how to reproduce the error. The same error occurs when printing the sample file to Adobe PDF as a printer. Any ideas on how to resolve this?

    Actually, the problem isn't really Acrobat or the Adobe PDF PostScript printer driver instance at all. The problem is that Microsoft Excel as well as other Microsoft Office applications adjust their printed output based on the characteristics of whatever is chosen as the current printer. This has been an issue since the earliest days of Windows.
    Each printer driver instance contains information about the specific printer including but not limited to page size, duplex capability, paper types, page orientation, output trays, imageable area (i.e., page size less unprintable margin areas), and device resolution. Based upon what Excel finds as values for a number of these characteristics, Excel will format the page differently. Excel is particularly sensitive to not only page size, but also imageable area and device resolution. Imageable area is important because Excel is attempting to avoid printing at all on parts of the page that your printer cannot possibly image; this is typically about one quarter inch around for most laser printers, a bit less for inkjet printers unless you have a printer that claims edge-to-edge print capability.
    The Adobe PDF PostScript printer driver instance has imageable areas that exactly match page size for all available page sizes. Thus, Excel formats on the basis that it can print all the way to edge of the page unless you set margins otherwise. It also defaults to 1200dpi. Change the device resolution to another setting via printer properties and you will likely see relayout. These same issues occur with Word and to some degree with PowerPoint.
    There is absolutely nothing that Adobe can do about this. The same problem is exhibited if you have access to multiple different printer models with different characteristics on your computer and you change from one to another, even if you don't have any Adobe software loaded on your system. Users have complained to Microsoft for years about this issue, but they typically have not considered this an important issue to tackle (ribbon user interfaces are obviously much more important).
    Sorry, but not anything we can really do to help you here other than to advise you to always compose your Microsoft documents with the current printer being the Adobe PDF PostScript printer driver instance, create a PDF file, and then print that from Reader/Acrobat to your real target printer. Alternatively, if you are very careful to setup the print characteristics of a spreadsheet to have large enough margins and headers/footers outside what would be the target devices non-printing area, you might get a bit better device independence - but don't count on it.
              - Dov

  • Retrieving default printer without saving it in user profile default

    I need to retrieve the default printer. If I save it in the user profile, I can retrieve it with FM SUSR_USER_LOGONDATA_GET.
    I want to avoid having to set default parameter for large user base. Is there a function module that can read default printer when it is not saved in user profile.
    Thanks

    Method:
    CL_GUI_FRONTEND_SERVICES->REGISTRY_GET_VALUE(
    ROOT = 1
    KEY = Software\Microsoft\Windows NT\CurrentVersion\Windows
    VALUE = Device

  • Work Order printer selection through dialog still picking default printer

    Hi,
      When i'm printing Work Order (trx: IW32) programs picks up default printer assigned to the user.
    in my case this also happening when user selects different printer though dilog.
    was trying to get it from NAST-LDEST but in my case NAST is empty and ITCPO pointing to LP01(Local Printer of user).
    can anyone please help how to get printer name which is selected by user.
    Thanks in advance,
    Kian

    Hi,
    Below code show you the way to assign any printer to form. (Pls find the code in you print prog )
    DATA: output_options        TYPE ssfcompop.
    DATA: control_parameters TYPE ssfctrlop.
      output_options-tdimmed       = 'X'.
      output_options-tddest         =  'PR01'. --- > here we can hard code the printer name and pass to FM
      control_parameters-no_dialog = 'X'. 
    CALL FUNCTION fm_name
        EXPORTING
          control_parameters = control_parameters
          output_options       = output_options
          user_settings        = ''
          nota_fiscal            = i_nota_fis
        EXCEPTIONS
          formatting_error   = 1
          internal_error       = 2
          send_error           = 3
          user_canceled     = 4
          OTHERS               = 5.
      IF sy-subrc <> 0.
      ENDIF.
    As you need to know form where the value of output_options-tddest is coming then you can debug the flow and try to find the value of output_options-tddest ...
    Pls tell me if you need to know anything else.
    Regs,
    Lokesh.

  • [SOLVED] LSDP changes Start Page and default printer

    Hi!
    If I install LSDP two things happen:
    1) My Start Page in Internet Explorer gets reset to some old value
    2) The setting to change the default printer when I change network is switch off and a fixed printer is set as the default.
    Is it possible to disable these annoying features?
    Solved!
    Go to Solution.

    Ok , this is silly. The Lenovo Settings Dependency Package is basis for Lenovo Settings, a Modern style application.
    Lenovo Settings includes Location Awareness, with that you can change the default printer, the start page and VPN settings as well as security settings (printer and file sharing, firewall). This excellent feature was availbable under a different name on Windows 7 as well and is just the best thing since sliced bread.
    Mystery solved. Ignore W8 location aware default printers and use Lenovo Settings exclusively.
    Two remarks though.
    1) Documentation of these Lenovo software products is less than ideal. It probably is a chinees thîng. Just look at the sheer number of posts in these forums on this theme. Better documenation would lead to less confusion and irritation and most of all less posts all asking the same question. By the way the new interface of Windows 8 is called Modern not Metro.
    2) Yet another app to change settings. Since W8 we have PC Settings and good old Control Panel. Now comes a thrid settings application wich removes settings done with the first two without notice. Why not tie in with the existing applications and include them, for instance, with PC settings? Or at least use the information?
    But more important: Document, document. document. All the Readme's are in fact release notes. Release notes are not documentation.

Maybe you are looking for