Layout Sets - ooxxvv/MySAPnotes GitHub Wiki
PageOutline {{{#!comment -------------------- 以上的部份是固定的,不要變動 ----- ---------------------------------------- 在建立連結時,請標明連結的頁面類型,例如:wiki:WikiStart,而不要只用 WikiStart ----- }}}
- 在 SAP 相關文件中也會用 SAPscript form 或 Layoutset 來稱呼。
- 管理 layoutset 是用 Tcode: SE71。
- 需用此 layout set 的原始語言登入,才能完全更改此 layout set ,否則可能會有些功能無法使用。
- 將 layoutset copy 到 local 電腦的 program
- RSTXSCRP
- 沒有內建 Currency & Unit 的處理函數,需自行處理。
- 除非是用 Tables 的方式,直接 Reference 到 Dictionary ,且有設定 Currency 或 Unit 的關連欄位,則此時 Layout set 會自動轉換。
- SE74 => 將現有文件檔案的樣式設定轉換成系統可使用的樣式。
- SE75 => 用來設定 SAPscript 、 Smart Form 會用到的相關功能
- 如果 Text 的畫面被改成 Word 的話,可用 RSCPSETEDITOR 這支程式來取消設定。
|| Offset || &symbol*+offset*& || || || Output Length || &symbol(length)& || || || Omitting the Leading Sign || &symbol*(S)& || || || Leading Sign to the Left || &symbol(<)& || The SET SIGN LEFT control command specifies that all subsequent symbols with a numeric value should have a left-justified leading sign. If you use this control command, you must no longer repeat the < option for each individual symbol. || || Leading Sign to the Right || &symbol(>)& || You can use the SET SIGN RIGHT control command to switch back to the default setting for the output of the leading sign. || || Omitting Leading Zeros || &symbol(Z)& || Primary formatting of system symbol/ &DAY&, &MONTH&, &YEAR&, &HOURS&, &MINUTES&, &SECONDS& || || Space Compression || &symbol(C)& || || || Number of Decimal Places || &symbol(.N)& || || || Omitting the Separator for ‘Thousands’ || &symbol(T)& || || || Specifying an Exponent for Floating Point Numbers || &symbol(EN)& || || || Right-Justified Output || &symbol(R)& || || || Fill Characters || &symbol(F** f )& f=fill character || Replace leading spaces in a value with a fill character. || || Suppressing Output of Initial Values || &symbol(I)& || || || Ignoring Conversion Routines || &symbol(K)& || || || Local Dates (Currently Only for Japan) || &symbol(L)& || || || Changing the Value of a Counter || &SAPSCRIPT-COUNTER_x(+)& || Increases by 1 the contents of the counter variable x (x=0.. 9) || || || &SAPSCRIPT-COUNTER_x(-)& || Decreases by 1 the contents of the counter variable x (x=0.. 9) || || Preceding and Subsequent Texts (Pre-Text / Post-Text) || &'pre-text*'symbol*'post-text*'& || In addition to using initial values for symbols, you can specify additional texts that are printed only when the value of the symbol is no longer the initial value. || || Country-Dependent Formatting || // SET COUNTRY country_key You can revert to the settings of the user master record by using the SET COUNTRY control command again with an empty country name. // SET COUNTRY ' ' Primary formatting of system symbol/ &DATE& || Certain fields are formatted specific to a particular country. These include fields for displaying a date and numeric fields containing either a decimal point or a ‘thousands’ separator character. The formatting applied is usually determined by the definitions contained in the user master record. || || Date Mask || // SET DATE MASK='date_mask' You can revert to the standard setting by using the SET DATE MASK command again with an empty string in place of the date mask/ // SET DATE MASK=' ' Primary formatting of system symbol/ &DATE& || || || Time Mask || // SET TIME MASK='time_mask' You can revert to the standard setting by using the SET TIME MASK command again with an empty string in place of the time mask/ // SET TIME MASK=' ' Primary formatting of system symbol/ &TIME& || ||
|| NEW-PAGE || Explicit Page Break || SAPscriptautomatically inserts a page break when the main window of a page (MAIN) is full. You can use the NEW-PAGE command to force a page break in the text at any point you want one. The text following this command then appears on a new page. The page break is always performed (it is an unconditional page break). || || PROTECT??ENDPROTECT || Preventing Page Breaks || If this page protect attribute is set, then the complete paragraph is always printed on one page. PROTECT.. ENDPROTECT command pairs cannot be nested. || || NEW-WINDOW \ || Next Main Window || You can use the NEW-WINDOW command to call the next main window explicitly, even if the current main window is not yet full. If you are in the last main window of the page, the command has the same effect as the NEW-PAGE command. || || DEFINE || Assigning a Value to a Text Symbol || // DEFINE &symbol1&='mail' \ // DEFINE &symbol2& /= 'SAP&symbol1&' \ // DEFINE &symbol1&='script' \ &symbol2& -> SAPmail || || SET DATE MASK || Formatting Date Fields || Executing this command causes all subsequent date fields to be printed using the specified format. || || SET TIME MASK || Formatting Time Fields || Executing this command causes all subsequent time fields to be printed using the specified format. || || SET COUNTRY || Country-Dependent Formatting || The formatting for certain field types depends on the country settings. These field types include, for example, date fields and number fields that include either a decimal point or the ?housands??separator character. The formatting options defined in the user master record are usually the ones used here. || || SET SIGN || Position of the Leading Sign || // SET SIGN LEFT The leading sign appears to the left of the number. // SET SIGN RIGHT The leading sign appears to the right of the number. || || RESET || Initializing Numbered Paragraphs || To reset the numbering of an outline paragraph to its initial value. || || INCLUDE || Including Other Texts || To include the contents of another text into the current text. || || STYLE || Changing the Style || The STYLE control command allows you to change the style within a text. // STYLE style [DOMINANT] *// STYLE ** || || ADDRESS?划NDADDRESS || Formatting Addresses || To formats an address according to the postal convention of the recipient country defined in the COUNTRY parameter. || || TOP?划NDTOP || Setting a Header Text in the Main Window || To specify lines of text that you want to print always at the top of the main window. || || BOTTOM?划NDBOTTOM || Setting a Footer Text in the Main Window || You can specify footer texts for the main window in a similar way to header texts. Footer texts are always printed at the bottom of the window. || || IF??ENDIF || Conditional Text || // IF condition\ / \ // ELSEIF condition\ / \ // ELSE \ / \ // ENDIF || || CASE || Finding a Match || // CASE symbol \ // WHEN value1 \ / \ // WHEN value2 \ / \ // WHEN valuen \ / \ // WHEN OTHERS. \ / \ // ENDCASE || || PERFORM || Calling ABAP Subroutines || You can use the PERFORM command to call an ABAP subroutine (form) from any program. Like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine. || || PRINT-CONTROL || Inserting Print Controls || You can use this command to call certain printer functions from a SAPscripttext. You can define a print control via the spool maintenance transaction SPAD that contains the printer commands you want. || || BOX, POSITION, SIZE || Boxes, Lines, Shading || for drawing boxes, lines, and shading to print particular windows within a form or passages of text within a window in a frame or with shading. *// BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY] * *// POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE] * // SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE] || || HEX, ENDHEX || Hexadecimal Data || Use this command to send printer commands in a printer language directly to a printer that supports that language. || || SUMMING || Summing a Program Symbol || The SUMMING command is used for accumulating a total value for a program symbol. The command should be specified just once. Then, each time the specified program symbol is formatted, its current value is added into the total symbol. Syntax/ // SUMMING program_symbol INTO total_symbol || || BOTTOM,ENDBOTTOM || Define footer text in a window || || || TOP,ENDTOP || Define header text in a window || ||
|| &DATE& || Current Date || || &DAY& || Current Day Number || || &MONTH& || Current Month Number || || &YEAR& || Current Year Number || || &LDATE& || Local Date (Currently Only for Japan) || || &NAME_OF_DAY& || Current Day Name (Long Form) || || &NAME_OF_MONTH& || Current Month Name (Long Form) || || &TIME& || Current Time Taken from the SY-UZEIT field || || &HOURS& || Hours Component of Current Time || || &MINUTES& || Minutes Component of Current Time || || &SECONDS& || Seconds Component of Current Time || || &PAGE& || Current Page Number You can specify the formatting option for the page number in the form for each page type || || &SAPSCRIPT-FORMPAGES& || Total page number based on the current output layout set || || &SAPSCRIPT-JOBPAGES& || Total page number based on all output layout sets created with the function modules OPEN_FORM, TART_FORM .. ENDFORM, START_FORM .. END_FORM, ..., CLOSE_FORM || || &NEXTPAGE& || Page Number of the Next Page Note that on the last page of the output, in each window that is not of type MAIN, &NEXTPAGE& has the value 0. || || &DEVICE& || Selected Device Type \ Possible values are/ \ PRINTER \ SCREEN \ TELEX \ TELEFAX \ ABAP (ABAP list display) || || &SPACE& || Spaces || || &ULINE& || Underline || || &VLINE& || Vertical Line ||
{{{#!abap
** 從 Report 中呼叫 Layoutset
*====================================================================== *================================================Global Date declear=== TABLES: mseg, mara, mkpf. DATA: BEGIN OF itab OCCURS 0, a LIKE mseg-mblnr, b LIKE mseg-zeile, END OF itab. *====================================================================== *=======================================================Initial Data=== *LOAD-OF-PROGRAM *INITIALIZATION. *====================================================================== *============================================Selection Screen Events=== *AT SELECTION-SCREEN OUTPUT. *AT SELECTION-SCREEN ON VALUE-REQUEST for <para/sel-opt>. *AT SELECTION-SCREEN. *AT SELECTION-SCREEN ON . *AT SELECTION-SCREEN ON BLOCK <>. *====================================================================== *======================================================Report Events=== START-OF-SELECTION. DO 30 TIMES. itab-a = '測試數據'. itab-b = sy-index. APPEND itab. ENDDO.
PERFORM print_itab TABLES itab.
END-OF-SELECTION.
*====================================================================== *========================================================List Events=== *TOP-OF-PAGE. *END-OF-PAGE. *AT LINE-SELECTION. *TOP-OF-PAGE DURING LINE-SELECTION. AT USER-COMMAND. CASE sy-ucomm. WHEN '%PRI'. WRITE:/ 'BUTTON CLIKCKED'. PERFORM open_form. PERFORM start_form. DO 50 TIMES. PERFORM write_form USING '' 'MAIN' 'SET'. ENDDO. PERFORM end_form. PERFORM close_form. ENDCASE.
*&---------------------------------------------------------------------- *& FORM : PRINT_ITAB *&----------------------------------------------------------------------
- <處理概要> *-----------------------------------------------------------------------
- <種別(入出力) <參數名> <類型> <調用類型參照,值>> *----------------------------------------------------------------------- FORM print_itab TABLES jtab STRUCTURE itab. LOOP AT jtab. WRITE:/ jtab-a , 10 jtab-b. ENDLOOP. ENDFORM. "PRINT_ITAB &-------------------------------------------------------------------- *& Form PRINT_PAGE &--------------------------------------------------------------------
-
text
--------------------------------------------------------------------- FORM print_page. ENDFORM. "PRINT_PAGE &-------------------------------------------------------------------- *& Form OPEN_FORM &--------------------------------------------------------------------
-
text
--------------------------------------------------------------------- FORM open_form. CALL FUNCTION 'OPEN_FORM' EXPORTING device = 'PRINTER' form = 'ZTEST904' language = sy-langu EXCEPTIONS canceled = 1 device = 2 form = 3 OPTIONS = 4 unclosed = 5 mail_options = 6 archive_error = 7 invalid_fax_number = 8 more_params_needed_in_batch = 9 spool_error = 10 OTHERS = 11. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. "OPEN_FORM &-------------------------------------------------------------------- *& Form CLOSE_FORM &--------------------------------------------------------------------
-
text
--------------------------------------------------------------------- FORM close_form. CALL FUNCTION 'CLOSE_FORM' EXCEPTIONS unopened = 1 bad_pageformat_for_print = 2 send_error = 3 spool_error = 4 OTHERS = 5. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. "CLOSE_FORM &-------------------------------------------------------------------- *& Form START_FORM &--------------------------------------------------------------------
-
text
--------------------------------------------------------------------- FORM start_form. CALL FUNCTION 'START_FORM' EXPORTING form = 'ZTEST904' startpage = 'FRIST' EXCEPTIONS form = 1 format = 2 unended = 3 unopened = 4 unused = 5 spool_error = 6 OTHERS = 7. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. "START_FORM &-------------------------------------------------------------------- *& Form END_FORM &--------------------------------------------------------------------
-
text
--------------------------------------------------------------------- FORM end_form. CALL FUNCTION 'END_FORM' EXCEPTIONS unopened = 1 bad_pageformat_for_print = 2 spool_error = 3 OTHERS = 4. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. "END_FORM &-------------------------------------------------------------------- *& Form WRITE_FORM &--------------------------------------------------------------------
-
text
--------------------------------------------------------------------- FORM write_form USING ele win func. CALL FUNCTION 'WRITE_FORM' EXPORTING element = ele function = func window = win EXCEPTIONS element = 1 function = 2 type = 3 unopened = 4 unstarted = 5 window = 6 bad_pageformat_for_print = 7 spool_error = 8 OTHERS = 9. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. "WRITE_FORM }}}