×

Loading...
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!

ABAP question, please help !

The request is to generate fancy Excel report (font, border, color, lock production, logo image…) from SAP. I used SAP OLE and met all of the requests. The report worked fine.

I got problem recently: In order to load logo image to Excel, I stored the image to a public access folder. When building the excel report via SAP OLE, ABAP program load the image into excel from the folder. I was told that not every one in my company has the access to that folder, therefore, when these people run the report, the excel output was stuck due to the logo image file could not be accessed.

Is there any way to import the image to SAP repository first and download the image into excel when generating OLE EXCL output? How?
Report

Replies, comments and Discussions:

  • ABAP question, please help !
    The request is to generate fancy Excel report (font, border, color, lock production, logo image…) from SAP. I used SAP OLE and met all of the requests. The report worked fine.

    I got problem recently: In order to load logo image to Excel, I stored the image to a public access folder. When building the excel report via SAP OLE, ABAP program load the image into excel from the folder. I was told that not every one in my company has the access to that folder, therefore, when these people run the report, the excel output was stuck due to the logo image file could not be accessed.

    Is there any way to import the image to SAP repository first and download the image into excel when generating OLE EXCL output? How?
    • UP! ED or other 大侠, 请出手。
      I don't know answer.
    • Maybe a solution
      This is Frank, Jim.

      How about create a new folder, and only your ABAP program can access that folder, and store your logo image there?
      • Hi Frank, your solution does not work.
        When users logon R3 and run ABAP report, if it need read or write file (here, it's image file) from / to a folder, user's account (domain/NT account, not SAP account) must pass authentication checking by the OS (W2000, XP, Visa) first. If user's account does not have access to that folder, then, the access to that file fail and excel out will be stuck.
        • Why not?
          I think for that new folder, we need assign everyone who can access that report "read" authorization. Then everything will be OK.

          From performance point, if we store logo in SAP, and retrive it everytime, the performance will be not very good.
          • You can check if the logo exists in the directory from previous execution of the reports before downloading the logo. This can solve the performance issue.
          • In the some business case (for example, school), it's really hard to build a public folder that everyone have the access to .
            Because users are in different NT domains, it's not possible to have IT department to redesign their network structure due to a excel report.

            Considering the time of retrieving the report data(our data is huge), downloading image template time can be ignored. So, performance is not the case in my report.
            • I see, thanks!
    • You can load your logo via tcode smw0. Not sure how to download it to Excel
      I wrote some program to creat an Excel sheet before by cloning SAP program rsdemo01. No logo involved.
      • Yes, Shaw1236, I was using the same way (EXCEL OLE) for the excel output.
        If you need
        • If you need insert the image into the excel, you will see the problem when users who run the report does not have the access to that image file or file folder.
          • Can you do this?
            1. use smw0 to load your logo to the system repository.
            2. In Load-of-Program or Initializationp event, pre-downloading the logo to the user's gui working directory or any other place where the program can access before the program runs. You can also skip the download by checking the existence of a local copy. You will find how to download the logo in download function of smw0.
            • Thanks Shaw1236, I will study your solution also. I have tested ED's solution, it worked. I believe SAP always has different solutions to reach the same goal.
    • call me please
    • 不知道,你是怎么去读取的logo,是ftp么,还是通过excel的宏?还是别的什么函数?
      我以前做过类似的程序,但我是直接做的excel的template,logo就在里面,然后把excel的文件上载到的服务器上,在程序中用C13Z_FILE_DOWNLOAD_BINARY,下载到本地文件的,但似乎这个function也要check读取权限的,我当初根本没注意,客户也没反映有问题。
      你可以试试看,有结果,回复一下。
      • My previous solution is very similar than yours, except I upload the excel template to a custom table to avoid the authorization check. I use C13Z_DOWNLOAD to download the file to local.
        • 我会研究 C13Z_FILE_UPLOAD_BINARY 方法, 谢谢 ED
        • Good Idea,能问一下,如何将excel 模板文件上传到custom table么?哪个函数?
          • I use GUI_UPLOAD.
            • GUI_UPLOAD,不是用来上载文件内容的么?你的意思excel文件本身也作为一种内容,上载到custom table?那字段的类型是用LRAW么?
              因为没这么做过,多问了几句。ED别嫌烦。
              • 是的。你已经自己找到答案了。:)
                • Hi ED and 月牙五更, I did testing, it works.
                  I used C13Z_UPLOAD to upload the excel template to a Z table and used C13Z_DOWNLOAD to download the template to local file. Z table data filed is LRAW. The template field must have a preceding length field of type INT4. When using INSERT ABAP/4 programs, the preceding length field must be filled with the length which is actually required.

                  This solution has totally solved my issue. Many thanks ED and all. I LOVE Rolia SAP FORUM.
                  • Saving the template is a great idea.
                    I've never thought of it. I guess like BW Workbook, you are able to save an Excel template to a data cluster of database(EXPORT ... to DATABASE..). Of course, a "Z" table can do the same.
      • 不是FTP, 看一看Shaw1236 的例子, 就是把EXCEL 的宏嵌入到SAP ABAP 程序中, 当运行程序时候,就好象打开EXCEL文件一样,EXCEL 数据和复杂的格式就会显示在屏幕上.
        我会仔细研究 C13Z_FILE_DOWNLOAD_BINARY 工作方法, 有问题再问.