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

file attachment

Former Member
0 Likes
913

hello friends,

i have a scenario, where in

i file has to get attached to a screen, as soon as a button on the screen is pressed,

does any one have an idea, how to go ahead with this.

thank you.

6 REPLIES 6
Read only

Former Member
0 Likes
875

hi Saritha,

You can fetch the filepath ...

for that do this way


* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      field_name = 'P_FILE'
    IMPORTING
      file_name  = p_file.

Read only

Former Member
0 Likes
875

Requiremnt is not clear ?

you could do like

parameters : p_file like rlgrap-filename obligatory.

at selection-screen on value-reques for p_file.

call F4_filename function module..

if it is dialog program,then you need to write the code under PBO ,use GUI_UPLOAD Function module - use default file ,it will get into the Screen.

Message was edited by:

Seshu Maramreddy

Read only

Former Member
0 Likes
875

santhosh, thank you for the reply,

but i am very confused of your reply.

do i use this FM in PAI.

it has to import, p_file is the path,

and do i need to give export , because it is just attaching to the screen.

thank you.

Read only

0 Likes
875

See the below example code ,i did otherway like i have data at table control and need to download the data when user preess on button.

&----


*& Module pool ZLWMI151_BAT1

*& Transaction: ZBAT1

*& Programmer: Seshu Maramreddy

*& Date : 05/17/2005

  • Transport : DV3K919574

*& Description: This program Will Displays the Batch Conversion

*& data in Display mode. Batch conversion

*& table (ZBATCH_CROSS_REF)

*&

*&

&----


PROGRAM ZLWMI151_BAT1 .

INCLUDE ZLWMI151_BAT1_TOP.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case ok_code.

when 'BACK'.

leave to screen 0.

when 'EXIT'.

leave to screen 0.

when 'CANC'.

leave to screen 0.

when 'EXCE'.

perform down_load.

WHEN '%SC'.

perform find_field using ok_code.

endcase.

clear ok_code.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module STATUS_0100 OUTPUT

&----


  • GUI Status

----


MODULE

STATUS_0100 OUTPUT.

SET PF-STATUS 'STLI'.

DESCRIBE TABLE T_zbatch LINES G_LINE.

TC1-LINES = TC1-LINES + 18.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Form down_load

&----


  • text

----


FORM down_load.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

FILENAME = ' '

FILETYPE = 'DAT'

TABLES

DATA_TAB = t_zbatch

EXCEPTIONS

INVALID_FILESIZE = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

CUSTOMER_ERROR = 7

OTHERS = 8.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " down_load

&----


*& Module modify OUTPUT

&----


  • text

----


MODULE modify OUTPUT.

select * from zbatch_cross_ref into corresponding fields of table

t_zbatch.

sort t_zbatch by werks werks cmatnr srlno.

ENDMODULE. " modify OUTPUT

&----


*& Form find_field

&----


  • text

----


  • -->P_OK_CODE text

----


FORM find_field USING command.

data: position like sy-tabix.

data: found(1).

data: find_pos like sy-tabix,

loop_curr like sy-tabix.

select * from zbatch_cross_ref into table t_find.

sort t_find by werks cmatnr srlno.

if command = '%SC'. "Suchen

position = 1.

perform popup_get_value using 'FSTR' ''

changing rsdxx-findstr.

else. "FIWE "Suchen wiederholen

position = loop_first + 1.

if rsdxx-findstr = space.

perform popup_get_value using 'FSTR' ''

changing rsdxx-findstr.

endif.

endif.

if ok_code = 'ABR'.

clear ok_code.

leave screen.

else.

clear found.

loop at t_find from position.

if t_find cs rsdxx-findstr

or t_find cp rsdxx-findstr.

found = 'X'.

find_pos = sy-tabix.

exit.

endif.

endloop.

if found = 'X'.

loop_curr = 1.

tabpos = loop_first = find_pos.

if use_old is initial.

tc1-top_line = find_pos.

  • set cursor field tc1-top_line.

endif.

else.

message s042(e2) with rsdxx-findstr.

endif.

endif.

ENDFORM. " find_field

FORM POPUP_GET_VALUE USING FCT MODE

CHANGING VALUE.

DATA: ANSWER,

popup_title(35),

TITLE LIKE POPUP_TITLE,

FIELDS LIKE SVAL OCCURS 1 WITH HEADER LINE.

CASE FCT.

WHEN 'FIND'. "Suchen Feld

TITLE = TEXT-TFI.

FIELDS-TABNAME = 'RSEDD0'.

FIELDS-FIELDNAME = 'FIELDNAME'.

FIELDS-NOVALUEHLP = 'X'.

FIELDS-VALUE = VALUE.

APPEND FIELDS.

WHEN 'FSTR'. "Suchen String

TITLE = TEXT-TFS.

FIELDS-TABNAME = 'RSDXX'.

FIELDS-FIELDNAME = 'FINDSTR'.

FIELDS-NOVALUEHLP = 'X'.

FIELDS-VALUE = VALUE.

APPEND FIELDS.

WHEN 'ACCL'. "Aktivierungsart

TITLE = TEXT-TAC.

FIELDS-TABNAME = 'DD02D'.

FIELDS-FIELDNAME = 'AUTHCLASS'.

FIELDS-VALUE = VALUE.

IF MODE = 'S'.

FIELDS-FIELD_ATTR = '02'.

ENDIF.

APPEND FIELDS.

WHEN 'DELC'. "Auslieferungsklasse

TITLE = TEXT-TDC.

FIELDS-TABNAME = 'DD25D'.

FIELDS-FIELDNAME = 'CUSTOMAUTH'.

FIELDS-VALUE = VALUE.

IF MODE = 'S'.

FIELDS-FIELD_ATTR = '02'.

ENDIF.

APPEND FIELDS.

ENDCASE.

CALL FUNCTION 'POPUP_GET_VALUES'

EXPORTING

POPUP_TITLE = TITLE

IMPORTING

RETURNCODE = ANSWER

TABLES

FIELDS = FIELDS

EXCEPTIONS

ERROR_IN_FIELDS = 1

OTHERS = 2.

IF SY-SUBRC = 0

AND ANSWER = SPACE.

VALUE = FIELDS-VALUE.

ENDIF.

ENDFORM.

----


  • INCLUDE ZLWMI151_BAT1_TOP *

----


tables : zbatch_cross_ref,

rsdxx.

data t_zbatch like zbatch_cross_ref occurs 0 with header line.

data :ok_code(4) type c,

g_line type sy-index,

loop_first like sy-tabix,

tabpos like sy-tabix,

USE_OLD type char1.

controls tc1 type tableview using screen 0100.

data : begin of t_find occurs 0.

include structure zbatch_cross_ref.

data : end of t_find.

Message was edited by:

Seshu Maramreddy

Read only

Former Member
0 Likes
875

hi seshu,

thanks for the reply.

but my scenario is, just to attach a file,

like in yahoo mail,

when we press attachement, it should give us a browser to browser to locate for the file.

and after selecting like yahoo mial only it should attach to the screen.

thank you

Read only

0 Likes
875

then it is possible by using F4 Value , look at threads in SDN..