




已阅读5页,还剩11页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Exercise 1. Create a SAP Script print program and Layout Set to print an invoice. A sample invoice and the data mapping for the fields are given below. Develop a print program with a selection-screen having the field Invoice number (VBRK-VBELN). Once the user enters the invoice number on the selection screen and executes, the SAP Script should be printed for the invoice.Sample invoice:Data Mapping:Print itemExtraction logicIBM logoUpload the bitmap IBM logo as a GRAPHICS object and display it on the top left cornerDatePrint the label and current date on the top right hand cornerInvoice printHard coded textInvoice numberField VBRK-VBELN (Value should be extracted in print program)Printed byThe user name (SY-UNAME) should be printed against the labelItem no.The invoice item level details should be extracted in print program and printed in the given format. The Item no. is the field VBRP-POSNRMaterial NumThe Material number of the Billing item can be got from the field VBRP-MATNRBilled qtyBilling Item level field VBRP-FKIMGUoMUnit of Measure of Billed Qty field VBRP-VRKMEUnit priceCalculate this field as Unit price = Amount/Billed QtyAmountBilling Item level field VBRP-NETWRIBM ConfidentialHard coded text at the footerPagePrint the page number as Page X of YX SAP Script symbol &PAGE&Y Symbol &SAPSCRIPT-FORMPAGES&Footer text This is.Hard coded text to be printed immediately below IBM ConfidentialSolution of Exercise Output Program name - YSPXXOUTPROG_1SAPScript Form Name YSPXXFORM_1Steps To Create the SAPScript Form: Go to Transaction SE71. Type the Form name and press the create button. The Header Section of the SAPScript Form will appear. Give a Description of the program and click the save button to save the program in the appropriate package and CTS. Now click on the Pages button and go to the Pages section of the form. Use the menu path Edit - Create element to create a new page (PAGE1 in this case). Specify the next page as PAGE1 itself because we will use only one page. Leave rest of the fields to their default values. Now click on the Paragraph formats button and create the necessary paragraph formats. In our case, we will use 3 paragraph formats P1, P2, P3 for the Header, Footer and Main windows respectively. The windows will be created later. Use the menu path Edit - Create Element to create the paragraph formats. Give appropriate values to the attributes of the paragraph formats like Font family, Font size, Bold/Italic/Underline, Tab positions etc. The main window is required to output the line items of a table, so you have to specify Tab positions for the paragraph P3 which is the default paragraph for the main window. For the other two paragraph formats, you need not specify the Tab positions. Now save the SAPScript Form once again and go to the header section. Click on the icon with a picture of a Hat or press F5 to go to Header Section. Click on the Basic Settings button and give the value PAGE1 for First Page and give P3 as Default paragraph. Keep rest of the fields to their default values. Now Click on the Character formats button to create the Character formats needed for this program. We are using 3 Character Formats in our program. The Character format A is Bold and Large size which is used to print the text “Invoice Print”, Character format B will be used for bold texts with small font size and Character format C is used for the page no. part of the footer window. Give appropriate font size and Bold/Italic/Underline as needed. Now we will create the windows necessary to the SAPScript Form. We will create 3 windows HDR (Header Window), MAIN (Main Window) and FTR (Footer Window). To create the windows and give them appropriate sizes, we will use the Graphical Form Painter. Use the menu path Settings - Form Painter. On clicking the menu, you will get one popup screen in which you have to check the Graphical Form Painter Checkbox and uncheck the Graphical PC Editor checkbox and press Enter. Now you will get the Graphical Form Painter. First we have to create one Graphics object for the IBM logo. To create this, use transaction SE78. After creating the Graphics object, right click on the Layout Editor and select the menu “Create graphic”. A screen will appear, where you have to choose the Graphics object you need. After choosing the Graphic object, press “Enter”. On the Layout you can see one blue rectangle representing the graphic object. Now move or resize that rectangle as per your requirement on the layout set. Now we will create 3 windows on the layout. Right click on the layout and select “Create window” menu. A white rectangle will appear on the top left hand corner of the layout. Now Drag the window to appropriate position and give it appropriate shape. You can change the name, description, type, size, and position etc of the window from the left hand side of the screen. A screenshot is shown below with all the windows created. Now come back to the Graphical PC Editor using the menu path Settings - Form painter. You will see that all the windows for the page PAGE1 are shown in the Page Windows section. Now double click on HDR window and click on the Text elements button or press F9. You will land up on the basic editor where we have to add the code for the window. Use the menu path Goto - Change editor to get the second form of editor which is easy to use. The screen shot above shows the code added to the HDR window. The hard coded text “Date:” is enclosed within character format B. We have to show the date, thats why we have used the SAP system field &SY-DATUM&. The text “Invoice Print” is embedded within character format A. Follow the same path for the rest of the windows to go to their corresponding editors and add code there. In the MAIN window, we have printed the invoice number which is coming from the selection screen of the output program. We are using &SY-UNAME& system field for printing the name of the person. We have used , separated hard coded texts for the column names of the tables. , represents tab separation. The corresponding tab positions have been specified in the paragraph format P3. We have used one Text Element TEXT_ELE which is repeatedly called from the output program to print the contents of the internal table. In the FTR window, we have added some hard coded texts. The page number in Page x of x format is printed using two SAPScript Form symbols &PAGE& and &SAPSCRIPT-FORMPAGES&.The Output Program: The output program first gets the value of invoice number from the user through a selection screen. Now it uses that value to retrieve data from the database and stores it in an internal table. The code snippet is given below-TYPES: BEGIN OF TAB, POSNR LIKE VBRP-POSNR, MATNR LIKE VBRP-MATNR, FKIMG LIKE VBRP-FKIMG, VRKME LIKE VBRP-VRKME, NETWR LIKE VBRP-NETWR, END OF TAB.PARAMETERS: INVOICE LIKE VBRP-VBELN.DATA: I_TAB TYPE STANDARD TABLE OF TAB INITIAL SIZE 0 WITH HEADER LINE, UP TYPE P DECIMALS 2 VALUE 0.SELECT POSNR MATNR FKIMG VRKME NETWR FROM VBRP INTO TABLE I_TAB WHEREVBELN = INVOICE.IF SY-SUBRC 0.MESSAGE I000 (YTRABAPMSG) WITH INVOICE NO. DOES NOT EXIST.LEAVE LIST-PROCESSING.ENDIF. Now the function module OPEN_FORM is called. Form name is specified in the EXPORTING parameter FORM.CALL FUNCTION OPEN_FORM EXPORTING* APPLICATION = TX* ARCHIVE_INDEX =* ARCHIVE_PARAMS =* DEVICE = PRINTER* DIALOG = X FORM = YSPXXFORM_1* LANGUAGE = SY-LANGU* OPTIONS =* MAIL_SENDER =* MAIL_RECIPIENT =* MAIL_APPL_OBJECT =* RAW_DATA_INTERFACE = * SPONUMIV =* IMPORTING* LANGUAGE =* NEW_ARCHIVE_PARAMS =* RESULT = 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 CODEPAGE = 11 OTHERS = 12 .IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF. Then, while looping at I_TAB, Unit Price is calculated and WRITE_FORM is called in each iteration.LOOP A
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 能源项目转让合同范本
- 吊装工作合同范本
- 单方房屋赠与合同范本
- 山地土方回填合同范本
- 农场瓦房出售合同范本
- 购租赁材料合同范本
- 沙发工厂员工合同范本
- 舞台广告制作合同范本
- 水利堤坝施工合同范本
- 劳务搬运协议合同范本
- 大气监测培训课件
- 中国高熔体强度聚丙烯行业市场调查报告
- 2025年河南省中考历史试卷真题(含答案)
- 广告与设计专业介绍
- 标准预防与手卫生
- 工程量计算培训课件
- 20G361预制混凝土方桩
- 2025-2030中国烧结碳化硅行业营销渠道及未来竞争战略规划研究报告
- MR/T 0001-2025自然人网店管理规范
- 浙江省9+1联盟2024-2025学年高二下学期4月期中考试语文试题(图片版含答案)
- 菜鸟驿站合伙合同协议
评论
0/150
提交评论