Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

LSMW File Upload from application server

Former Member
0 Likes
2,545

Hi all,

I am uploading a tab delimited text file from application server. After reading in display read data character '#' is appearing at the end of each recod in the last filed of source structure.

obiviously the same is getting passed in convert and appears in display convert data too.

When i do the same by uploading file from local desktop instaed of apps server, i dont have any such proble and evrything works fine.

I have done all the settings as suggested by SAP;

http://help.sap.com/saphelp_nw04/helpdata/en/10/6400c0ee3711d1b406006094b944c8/frameset.htm

Please suggest your suggestions.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,731

check your application server file in tcode AL11 is there any # in the file

or

use tcode CG3Y download the firl from application server to your system and check the file has contains # or not..

in lsmw SPECIFY files step click the file path its dispaly the one more window here in the last of the screen you find the CODE PAGE here Replacement char. there you can put # or any other character and check.

Hi all,

I am uploading a tab delimited text file from application server. After reading in display read data character '#' is appearing at the end of each recod in the last filed of source structure.

obiviously the same is getting passed in convert and appears in display convert data too.

When i do the same by uploading file from local desktop instaed of apps server, i dont have any such proble and evrything works fine.

I have done all the settings as suggested by SAP;

http://help.sap.com/saphelp_nw04/helpdata/en/10/6400c0ee3711d1b406006094b944c8/frameset.htm

Please suggest your suggestions.

8 REPLIES 8
Read only

Former Member
0 Likes
1,731

Hi,

There is an extra return character in the file after each record which is being displayed. Remove that character & it would work fine.

Regards,

Kritesh Shah

Read only

Former Member
0 Likes
1,732

check your application server file in tcode AL11 is there any # in the file

or

use tcode CG3Y download the firl from application server to your system and check the file has contains # or not..

in lsmw SPECIFY files step click the file path its dispaly the one more window here in the last of the screen you find the CODE PAGE here Replacement char. there you can put # or any other character and check.

Read only

0 Likes
1,731

No, file does not cintain any # at end of each record.

i checked at application server and evn as i told you , same file works fine when loaded from frontend.

Read only

0 Likes
1,731

Hi

Other than tab delimiter use other delimiters like comma or pipe and then test. Hope your problem will be solved.

Regards

sree

Read only

Former Member
0 Likes
1,731

Hi santosh,

Refer this sample code

*"Table declarations...................................................
TABLES:
  bkpf.

*"Selection screen elements............................................
SELECT-OPTIONS:
  p_bukrs  FOR   bkpf-bukrs,           " Company Code
  p_bldat  FOR   bkpf-bldat.           " Date

PARAMETERS:
  w_char TYPE c.                       " Delimiter

DATA:
  BEGIN OF fs_bkpf,
    bukrs LIKE bkpf-bukrs,             " Company Code
    gjahr LIKE bkpf-gjahr,             " Document Date in Document
    blart LIKE bkpf-blart,             " Document type
    bldat LIKE bkpf-bldat,             " Date
    budat LIKE bkpf-budat,             " Posting Date in the Document
    monat LIKE bkpf-monat,             " Fiscal Period
    cpudt LIKE bkpf-cpudt,             " Accounting Document Entry Date
  END OF fs_bkpf.

DATA:
  t_bkpf LIKE
STANDARD TABLE
      OF fs_bkpf.

*"--------------------------------------------------------------------*
*  Work Variables                                                     *
*"--------------------------------------------------------------------*

DATA:
  f_name  TYPE string,                 " File name
  w_lines TYPE i,                      " No. of records
  w_data  TYPE string,                 " Temporary Variable
  w_data1 TYPE string,                 " Temporary Variable
  w_index TYPE i,                      " Index Variable
  file_path TYPE ibipparms-path,       " File Path
  file_path1 TYPE string.              " File Path


*"--------------------------------------------------------------------*
*                       START-OF-SELECTION EVENT                      *
*"--------------------------------------------------------------------*
START-OF-SELECTION.

  SELECT bukrs                         " Company Code
         gjahr                         " Document Date in Document
         blart                         " Document type
         bldat                         " Date
         budat                         " Posting Date in the Document
         monat                         " Fiscal Period
         cpudt                         " Accounting Document Entry Date
    FROM bkpf
    INTO TABLE t_bkpf
   WHERE bukrs IN p_bukrs
     AND bldat IN p_bldat.


************************************************************************
******************Writing into Application Server***********************
************************************************************************

  f_name = '.\my_bkpf.txt'.

  OPEN DATASET f_name FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  DESCRIBE TABLE t_bkpf LINES w_lines.

  DO w_lines TIMES.
    READ TABLE t_bkpf INTO fs_bkpf INDEX w_index.
    CONCATENATE fs_bkpf-bukrs
                fs_bkpf-gjahr
                fs_bkpf-blart
                fs_bkpf-bldat
                fs_bkpf-budat
                fs_bkpf-monat
                fs_bkpf-cpudt
               INTO w_data
              SEPARATED BY w_char.

    TRANSFER w_data TO f_name.
    ADD 1 TO w_index.
  ENDDO.                               " DO w_lines TIMES.

  CLOSE DATASET f_name.

  CLEAR t_bkpf.

  OPEN DATASET f_name FOR INPUT IN TEXT MODE ENCODING DEFAULT.

  DO.
    READ DATASET f_name INTO w_data1.

    IF sy-subrc NE 0.
      EXIT.
    ENDIF.                             " IF sy-subrc NE 0.

    SPLIT w_data1 AT w_char INTO fs_bkpf-bukrs
                                 fs_bkpf-gjahr
                                 fs_bkpf-blart
                                 fs_bkpf-bldat
                                 fs_bkpf-budat
                                 fs_bkpf-monat
                                 fs_bkpf-cpudt.
    APPEND fs_bkpf TO t_bkpf.
  ENDDO.                               " DO.

  CLOSE DATASET f_name.

Regards,

Sravanthi

Read only

Former Member
0 Likes
1,731

Please do not post irrelevent answers like Srawanti. please read the question carefully and then post.

This question is about reading file from apps server using LSMW.

Read only

Former Member
0 Likes
1,731

Experts,

any clues on this one....

Read only

Former Member
0 Likes
1,731

Closing as Resolved on own