简体   繁体   English

如何从内容存储库中读取文本文件

[英]how to read text files from content repository

My requirement is read text files from content repository in sap abap.I used SCMS_DOC_READ FM to read image file and creating url DP_CREATE_URL for creating image url but SCMS_DOC_READ not working for text.我的要求是从 sap abap 中的内容存储库读取文本文件。我使用SCMS_DOC_READ FM 读取图像文件并创建 url DP_CREATE_URL来创建图像 url 但SCMS_DOC_READ不适用于文本。

Can any one suggest some code, FM or class .任何人都可以建议一些代码,FM 或 class 。

You can easily find the answer there: http://scn.sap.com/thread/525075您可以在那里轻松找到答案: http : //scn.sap.com/thread/525075

If you want the short answer, you should use this(Note: I am not the author of this part):如果你想要简短的答案,你应该使用这个(注意:我不是这部分的作者):

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                     = "File path"
    FILETYPE                     = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'

TABLES
    DATA_TAB                     = IT.

Note : Internal table structure should be same as text File.注意:内部表结构应与文本文件相同。

There are two options based on your requirement:根据您的要求,有两种选择:

Option 1: Use READ DATASET to read file.选项 1:使用 READ DATASET 读取文件。

DATA : FNAME(60) type c VALUE 'myfile.txt',
       TEXT2(5) type c.

       OPEN DATASET FNAME FOR INPUT IN TEXT MODE.

       DO.
        READ DATASET FNAME INTO TEXT2 LENGTH LENG.
        WRITE: / SY-SUBRC, TEXT2.
         IF SY-SUBRC <> 0.
             EXIT.
         ENDIF.
      ENDDO.

     CLOSE DATASET FNAME.

Option 2: Use Class CL_ABAP_CONV_IN_CE to read file.选项 2:使用类 CL_ABAP_CONV_IN_CE 读取文件。

Refer this tutorial page to get more information on this class.请参阅本教程页面以获取有关此类的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OpenCms:如何从多个架构文件访问xml元素内容 - OpenCms : How to access xml element content from multiple schema files 如何知道露天仓库中存储的物品的内容类型? - How to know content type of an item stored in alfresco repository? 如何在Liferay中设计内容存储库以供远程应用程序访问? - How to design content repository in Liferay for access by remote application? 内容存储库,文档存储库,有什么区别? - Content Repository , Document Repository , whats the difference if any? 在基于git的CMS中,如何唯一标识git存储库中的文件? - In a git-based CMS, how to uniquely identify files in git repository? 如何将数据库字段的内容与文本文件的内容同步? - How to sync a database field's content with a text file's content? 从富文本字段中获取内容 - Fetch content from rich text field Sitecore作为公共和私人营销内容的内容存储库 - Sitecore as a content repository for public and private marketing content 如何获取露天内容管理系统中存储的文件的元数据? - how to get the metadata of files stored in alfresco content management system? JCR(Java内容存储库)是否存储视频? - Does JCR (java content repository) store videos?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM