SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Отступ ALV при печати



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Александр I
Участник
Участник



Joined: 15 Aug 2008
Posts: 13

PostPosted: Fri Dec 19, 2008 10:06 am    Post subject: Отступ ALV при печати Reply with quote

Подскажите пожалуйста каким образом можно сделать так, чтобы при печати ALV, таблица печаталась с отступом от левого края? Это очень удобно для сшивания документов, но что-то никак не могу найти как это делается
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 170
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Fri Dec 19, 2008 10:39 am    Post subject: Reply with quote

Смотрите место с
SET MARGIN 7 5.

Code:
REPORT Z_ALVGRIDTESTCLICK.
TYPE-POOLS: SLIS.

DATA: FIELDCAT      TYPE    SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN   LIKE   LINE OF FIELDCAT,
SORTCAT       TYPE    SLIS_T_SORTINFO_ALV,
SORTCAT_LN   LIKE   LINE OF SORTCAT,
EVENTCAT     TYPE    SLIS_T_EVENT,
EVENTCAT_LN  LIKE   LINE OF EVENTCAT.
TABLES : MARA.

* Internal table for storing line item data per document number
data: begin of itab occurs 10,
         MATNR like MARA-MATNR,
         MTART LIKE MARA-MTART,
         BISMT LIKE MARA-BISMT,
      end of itab.

START-OF-SELECTION.
SELECTION-SCREEN BEGIN OF BLOCK BA WITH FRAME TITLE TTL1.
   SELECT-OPTIONS: P_MATNR FOR MARA-MATNR.
SELECTION-SCREEN END OF BLOCK BA.

*&--------------------------------------------------------------------*
* INITIALIZATION.
*&--------------------------------------------------------------------*
INITIALIZATION.
ttl1 = 'Input Condition'.

*&--------------------------------------------------------------------*
* AT SELECTION-SCREEN.
*&--------------------------------------------------------------------*
AT SELECTION-SCREEN.

*&--------------------------------------------------------------------*
* START-OF-SELECTION.
*&--------------------------------------------------------------------*

START-OF-SELECTION.

* DEFINE PAGE LEFT MARGIN AND TOP MARGIN
SET MARGIN 7 5.
* DEFINE PIRNT FORMATE
PRINT-CONTROL FUNCTION: 'SABLD' LINE 1,
                         'SAOFF' LINE 2,
                         'SAULN' LINE 3.
* The above sentence print-control function used to define print format
* Find document header data and line item data from given parameters.
PERform find_document .
PERform ALVDISPLAY.

*------------------------------------------------*
* GET DATA FROM SOME SYSTEM TABLE
* THEN ,PUT THESE DATA INTO INTERNAL TABLE.
*------------------------------------------------*
form find_document .
  SELECT MATNR
          MTART
          BISMT
    INTO CORRESPONDING FIELDS OF TABLE ITAB
    FROM MARA
   WHERE MATNR IN P_MATNR.
endform .
*---------------ALV Disply Function ---------------------*
form alvdisplay .
  DATA: COL_POS TYPE I.
  DATA:   PGM  LIKE   SY-REPID.
   PGM = SY-REPID.
*Add The 1th column :company code .
ADD  1  TO   COL_POS.
FIELDCAT_LN-REF_TABNAME   =  'MARA'.
FIELDCAT_LN-FIELDNAME      =  'MTART'.
FIELDCAT_LN-KEY              = SPACE.
FIELDCAT_LN-DO_SUM          = SPACE.
FIELDCAT_LN-COL_POS         = COL_POS.
FIELDCAT_LN-NO_OUT         = SPACE.
FIELDCAT_LN-QFIELDNAME    = SPACE.
FIELDCAT_LN-HOTSPOT        = SPACE.
APPEND   FIELDCAT_LN  TO FIELDCAT.

ADD  1  TO   COL_POS.
FIELDCAT_LN-REF_TABNAME = 'MARA'.
FIELDCAT_LN-FIELDNAME    = 'MATNR'.
FIELDCAT_LN-KEY           = SPACE.
FIELDCAT_LN-DO_SUM       = SPACE.
FIELDCAT_LN-COL_POS      = COL_POS.
FIELDCAT_LN-NO_OUT       = SPACE.
FIELDCAT_LN-QFIELDNAME   =   SPACE.
FIELDCAT_LN-HOTSPOT      = SPACE.
APPEND   FIELDCAT_LN  TO   FIELDCAT.

ADD 1 TO COL_POS.
FIELDCAT_LN-REF_TABNAME   =  'MARA'.
FIELDCAT_LN-FIELDNAME      =  'BISMT'.
FIELDCAT_LN-KEY             =   SPACE.
*DEFINE AN SUM
FIELDCAT_LN-DO_SUM         =  'X'.
FIELDCAT_LN-COL_POS         =   COL_POS.
FIELDCAT_LN-NO_OUT         =   SPACE.
FIELDCAT_LN-QFIELDNAME    =   SPACE.
FIELDCAT_LN-HOTSPOT        =   SPACE.
APPEND   FIELDCAT_LN  TO   FIELDCAT.


SORTCAT_LN-SPOS          =  '1'.
SORTCAT_LN-FIELDNAME   =  'MATNR'.
SORTCAT_LN-UP            =  'X'.
SORTCAT_LN-DOWN        =   SPACE.
SORTCAT_LN-SUBTOT       =  'X'.
APPEND   SORTCAT_LN  TO   SORTCAT.

**** Call Function to response user command event .
CALL  FUNCTION  'REUSE_ALV_GRID_DISPLAY'
EXPORTING
   I_CALLBACK_PROGRAM              =   PGM
   I_CALLBACK_USER_COMMAND         =  'USER_COMMAND'
   IT_FIELDCAT                     =   FIELDCAT
   IT_SORT                         =   SORTCAT
   I_SAVE                          =  'A'
  "IT_EVENT                        = EVENTCAT
TABLES
   T_OUTTAB   =   ITAB
EXCEPTIONS
   PROGRAM_ERROR   =  1
  OTHERS             =  2.
endform.

form USER_COMMAND USING UCOMM LIKE SY-UCOMM
   SELFIELD TYPE SLIS_SELFIELD.
  READ TABLE ITAB INDEX SELFIELD-TABINDEX.
  CHECK SY-SUBRC = 0.
  CASE UCOMM.
    WHEN '&IC1'.
       CASE SELFIELD-SEL_TAB_FIELD.
          WHEN  'ITAB-MATNR'.
            SET  PARAMETER  ID  'MAT'  FIELD   ITAB-MATNR.
            CALL  TRANSACTION  'MM43'  AND  SKIP  FIRST  SCREEN.
       ENDCASE.
  ENDCASE.
ENDform.
Back to top
View user's profile Send private message Blog Visit poster's website
Александр I
Участник
Участник



Joined: 15 Aug 2008
Posts: 13

PostPosted: Fri Dec 19, 2008 1:01 pm    Post subject: Reply with quote

Большое спасибо, действительно помогло!Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.