cancel
Showing results for 
Search instead for 
Did you mean: 

ITS file Upload / Download

Former Member
0 Kudos

Hello,

I have developed a file upload / download interface on ITS (Templates are built using Interent Services - Classic HTML in SE80). The problem is interemediary screens appear during file upload / download. I have the ~GENERATEDYNPRO paremeter value = 1 , meaning if my IAC does not have the relevant screen, an equivalent webgui screen would be generated. My questions are:

1. If I use mime-download, would I be able to select the file from the workstation? <b>is there any macro for file selector from workstation?</b>

2. I'm ok with the intermediary screen, <b>but is there an option not to show the menu bar, like open session etc.</b>

I have ~DONTSHOWACCESSIBILITYONLOGIN = 1, so it does not show the transaction command box.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Michael,

Will you please tell me how to prepare this INternal Table (Tab separated and with Carriage return). I tried it..but it is not working Fine..

I would appreciate if you can help me out.

Former Member
0 Kudos

Hi,

the data you get after mime-upload is in binary format. If you want to convert it into character string (unicode)

you have to write something like this:


data: data_tab type table of w3mime
data: i_xstring     type xstring.
data: i_string      type string.
data: wa_w3mime     type w3mime.
data: l_conv type ref to cl_abap_conv_in_ce.

loop at mime_info.
   mime-upload sy-tabix data_tab datalen.
   loop at data_tab into wa_w3mime.
        concatenate i_xstring wa_w3mime-line into i_xstring in byte mode.
   endloop.
endloop.

l_conv = cl_abap_conv_in_ce=>create( input = i_xstring ).
call method l_conv->read( importing data = i_string ).

* now you can read i_string

* you can use an additional try / catch block in case you want to prevent from 
* the file not being a text file.

Regards,

Houcine Bourquouquou

Former Member
0 Kudos

> Hi Michael,

> Will you please tell me how to prepare

> ow to prepare this INternal Table (Tab separated and

> with Carriage return). I tried it..but it is not

> working Fine..

> I would appreciate if you can help me out.

hi s t ,

sure, I will try.

My w_output structure simply looks like this:

DATA: BEGIN OF w_output OCCURS 0,
        string(300),
      END OF w_output.

My concatenate looks like this for the Excel header line:


            CONCATENATE 'Schedule'
                        'Material Number'
                        'Description'
                        'Plant'
                        'Receipt'
                        'Schedule Date'
                   INTO w_output-string
                   SEPARATED BY con_tab.

(it looks similar for the detail line, obviously)

after the concatenate, there are some more string manipulations to be done:


          PERFORM fill_spacer.

          CONCATENATE w_output-string con_lf INTO w_output-string.

          DO.
            REPLACE '|' WITH ' ' INTO w_output-string.
            IF sy-subrc <> 0.
              EXIT.
            ENDIF.
          ENDDO.

          APPEND w_output.

I use the '|' pipe symbol to force spaces between the texts, by the way.

Lastly, my fill_spacer subroutine looks like this:


FORM fill_spacer.

  len = strlen( w_output-string ).
  i   = len + 1.

  DO.
    IF i = 299.
      EXIT.
    ENDIF.
    w_output-string+i(1) = '|'.
    ADD 1 TO i.
  ENDDO.

ENDFORM.                    " fill_spacer

This prevents the texts from being squashed up.

Now, one more thing: it took me a while to find the correct codes for the tab and carriage return to make Excel start new lines - I'll save you some time. Here they are:


CONSTANTS: con_tab TYPE x VALUE '09',
           con_lf TYPE x VALUE '0D'.

use "con_tab" for a column seperator and use "con_lf" for a line feed.

Hope this helps!

Kind regards,

Michael

P.S.: Please don't forget to reward points if this is what you are looking for! Ta.

Former Member
0 Kudos

The mime-download call automatically associate program to the file extension. If you use for example "application/execel" the system open Microsoft Excel and display the data. After this, the user select to save the file with file name on the workstatio.

Gianluca

Former Member
0 Kudos

Thanks for your reply. Does it work the same for upload too? Can you post an example please. Thanks in advance.

Former Member
0 Kudos

s t,

I have used this solution before:

In your HTML code, simply trigger a new browser window (via window.open) with an ABAP Dummy-screen that only consists of a PBO event (like FORM mime-download).

This is the HTML for it:

<input class="button" type=submit value="Download" onclick="window.open('`wGateURL(~okcode="DOWN")`','','left=5, top=0, status=yes, menubar=yes, resizable=yes, scrollbars=yes')" >

And this is your business logic in your dummy-screen's PBO that's triggered when the button in your HTML was selected:

mime-download w_output '750000' 'application/vnd.ms-excel'.
LEAVE TO SCREEN 1000

.

w_output is simply a long text string that contains tab delimited column information for the Excel browser plugin - it also needs a CR at the end of the line to tell excel to start a new row. The LEAVE TO SCREEN 1000 automatically goes back to the calling screen (1000 in this example), as there is no PAI in the dummy screen.

However, I have never seen this working as an upload. though...

Hope this is of any help,m

Michael

Former Member
0 Kudos

MIME-UPLOAD

For the html:

<input type="FILE" name="LOCALFILE" size=30>

<input type="SUBMIT" name="~OkCode(FIUP)" value="File Upload">

The corresponding source abap is:

data: mime_info like savwmpmime occurs 0 with header line

mime-info mime_info.

loop at mime_info.

mime-upload sy-tabix data_tab datalen.

endloop.

where data_tab is the internat table that contain information; datalen is a variable type "i".

Gianluca

Former Member
0 Kudos

I tried the MIME-UPLOAD example but I can't get it to work. I use the Browse button to select a file from my workstation. I then click the File Upload button. In the corresponding abap I issue command mime-info but table mime_info does not contain any data.