REPORT YUPLOAD LINE-SIZE 255 NO STANDARD PAGE HEADING.

DATA: BEGIN OF ITAB OCCURS 20,
    LINE(1) TYPE X,
END OF ITAB.
DATA: BEGIN OF BTAB OCCURS 20,
    LENGTH TYPE I,
    LINE(100) TYPE X,
END OF BTAB.
DATA: BEGIN OF IREC OCCURS 10,
    LINE(100) TYPE X,
END OF IREC.
DATA: LAST, DSPSTR(100), MODE, A TYPE I, POINTER TYPE I, SUM TYPE I.

CALL FUNCTION 'WS_UPLOAD'
     EXPORTING
          FILENAME = 'c:\sapgui\sapgui\rectrans'
          FILETYPE = 'BIN'
     TABLES
          DATA_TAB = ITAB.
********************************************************
LAST = 'B'.POINTER = 0.
LOOP AT ITAB.
  A = ITAB-LINE.
  IF A >= 32 AND A <= 124.
    IF LAST = 'B'.
      BTAB-LENGTH = POINTER.
      APPEND BTAB.CLEAR BTAB.
      BTAB-LINE = ITAB-LINE.
      LAST = 'A'.POINTER = 1.
    ELSE.
      BTAB-LINE+POINTER(1) = ITAB-LINE.
      POINTER = POINTER + 1.
    ENDIF.
  ELSE.
    IF LAST = 'B'.
      BTAB-LINE+POINTER(1) = ITAB-LINE.POINTER = POINTER + 1.
    ELSE.
      BTAB-LENGTH = POINTER.
      APPEND BTAB.CLEAR BTAB.
      BTAB-LINE = ITAB-LINE.
      LAST = 'B'.POINTER = 1.
    ENDIF.
  ENDIF.
ENDLOOP.
BTAB-LENGTH = POINTER.
APPEND BTAB.CLEAR BTAB.

LOOP AT BTAB.
  POINTER = BTAB-LENGTH.
  DSPSTR = BTAB+4(POINTER).
  WRITE: / SY-TABIX, SUM, POINTER, DSPSTR.
  SUM = SUM + POINTER.
ENDLOOP.

READ TABLE BTAB INDEX 30.
BTAB+4(12) = 'testuser    '.
WRITE BTAB TO BTAB INDEX 30.

READ TABLE BTAB INDEX 34.
BTAB+4(8) = 'qwertyui'.
WRITE BTAB TO BTAB INDEX 34.

WRITE: / '***********************************************************'.

LOOP AT BTAB.
  POINTER = BTAB-LENGTH.
  DSPSTR = BTAB+4(POINTER).
  WRITE: / SY-TABIX, SUM, POINTER, DSPSTR.
  SUM = SUM + POINTER.
ENDLOOP.

********************************************************
MODE = ''.
LOOP AT BTAB.
  CLEAR IREC. REFRESH IREC.
  IREC = BTAB+4(100).
  APPEND IREC.
  POINTER = BTAB-LENGTH.
  CALL FUNCTION 'WS_DOWNLOAD'
       EXPORTING
            BIN_FILESIZE = POINTER
            FILENAME     = 'c:\sapgui\sapgui\tttttttt'
            FILETYPE     = 'BIN'
            MODE         = MODE
       TABLES
            DATA_TAB     = IREC.
  MODE = 'A'.
ENDLOOP.