How to Upload Long Text into SAP Using Excel Sheet and Save_text Function Module

Source: Internet
Author: User

https://wiki.scn.sap.com/wiki/display/ABAP/How+to+Upload+Long+Text+into+SAP+Using+Excel+Sheet+and+SAVE_TEXT+ Function+module

Created by Smruti Ranjan Mohanty, last modified on Oct, from Go to start of metadata

Reference Link:
Note 933420-alsm_excel_to_internal_table

http://scn.sap.com/docs/DOC-45423

ERROR rendering Macro ' code ': Invalid value specified for parameter ' lang '
TYPES:&NBSP;BEGIN&NBSP;OF&NBSP;TY_ITAB&NBSP;,&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;MATNR ()    &NBSP;&NBSP;TYPE&NBSP;C,&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;LMAKTX (2112)  TYPE C,        row type i,       tsize type  i,   end of ty_itab.*  data declarations - internal  tablesdata: i_tab  type standard table of ty_itab  initial  SIZE 0,      WA TYPE TY_ITAB ,       it_exload like zalsmex_tabline  occurs 0 with header line. Data: it_lines       like standard table of tline  with header line,      it_text_header like standard  table of  thead with header line,      p_error type   sy-lisel ,      len type i .*     Selection screenselection-screen begin of block b1 with frame title  text-002. parameters:pfile type rlgrap-filename obligatory,            W_BEGIN TYPE I OBLIGATORY,            w_end type i obligatory. Selection-screen end of block b1. at selection-screen.  if pfile is initial.    message  S368 (XX)  WITH  ' Please input filename '.  stop.  endif. Start-of-selection.  refresh:i_tab.  perform excel_data_int_table.  perform  excel_to_int.  perfoRm contol_parameter. At selection-screen on value-request for pfile.  perform f4_filename.* &---------------------------------------------------------------------**&       Form  F4_FILENAME*&----------------------------------------------------------------- ----**       text*--------------------------------------------------------- -------------**  -->  p1        text*   <--  p2        text*------------------------------- ---------------------------------------*form f4_filename .  call function  ' f4_ FILENAME '   EXPORTING    PROGRAM_NAME         = syst-cprog    dynpro_number       =  syst-dynnr*   field_name          =  '   '   IMPORTING    FILE_NAME            = pfile           . endform.                      " F4_FILENAME*&-------------------------------------------------------------------- -**&      form  excel_data_int_table*&------------------------ ---------------------------------------------**       text*---------------- ------------------------------------------------------**  -->  p1         text*  <--  p2         text*----------------------------------------------------------------------*form excel_data_int_table .  call  function  ' yalsm_excel_to_internal_table '     EXPORTING       FILENAME    = PFILE      I_BEGIN_COL =  ' 0001 '       i_begin_row = w_begin      i _end_col   =  ' 0100 '       i_end_row   = w _end                                     " 65536    tables      intern       = it_exload. Endform.                     " EXCEL_DATA_INT_TABLE*&-------------------------------------------------------- -------------**&      form  excel_to_int*&-------------------- -------------------------------------------------**       text*------------ ----------------------------------------------------------**  -->  p1         text*  <--  p2         text*----------------------------------------------------------------------*form excel_to_int  .  loop at it_exload .    case  it_exload-col1.       WHEN  ' 0001 ' .        wa-matnr    = IT_EXLOAD-VALUE.      WHEN  ' 0002 ' .         WA-LMAKTX   = IT_EXLOAD-VALUE.    ENDCASE.     at end of row1.      wa-tsize = strlen (  WA-LMAKTX )  .      wa-row = it_exload-row1 .       APPEND WA TO I_TAB.       Clear wa .    endat.  endloop. endform.                      " EXCEL_TO_INT*&------------------------------------------------------------------- --**&      form  contol_parameter*&--------------------------- ------------------------------------------**       text*------------------- ---------------------------------------------------**  -->  p1        text*  <--  p2         text*--------------------------------------------------------------- -------*form contol_parameter .  data off type i value  ' 1 ' .   LOOP AT I_TAB INTO WA.*    * Create Header     IT_TEXT_HEADER-TDID     =  ' best '.     it_text_ header-tdspras  = sy-langu .    it_text_header-tdname    = WA-MATNR.    IT_TEXT_HEADER-TDOBJECT =  ' MATERIAL ' .     move wa-tsize to len .    len =  len /  53  + 1.    DO LEN TIMES .       MOVE  ' * ' &NBSp To it_lines-tdformat.      move  wa-lmaktx+off ( TO ) it_lines-tdline.      shift it_lines-tdline left deleting  leading  '   ' .      off = off + 53 .       append it_lines.      clear it_lines  .    ENDDO.    AT END OF ROW.       CALL FUNCTION  ' Save_text '         exporting           CLIENT           = SY-MANDT          HEADER           = IT_TEXT_HEADER           insert          =  '   '            SAVEMODE_DIRECT =  ' X '          tables          lines            = IT_LINES        EXCEPTIONS           ID               = 1          language         = 2           NAME            = 3           object          =  4           others          =  5.* Check the Return Code      IF SY-SUBRC  <> 0.        MESSAGE ID SY-MSGID TYPE  sy-msgty            number sy-msgno               with sy-msgv1 sy-msgv2  sy-msgv3 sy-msgv4 into p_error.        exit.       endif.      clear: wa ,len ,  OFF.      REFRESH IT_LINES .    ENDAT.   endloop. endform.                      " contol_parameter 

Upload Excel File Format:

Output in SAP Using MM03 T-code


http://scn.sap.com/docs/DOC-45423

How to Upload Long Text into SAP Using Excel Sheet and Save_text Function Module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.