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

Attachment Functionality Required

Former Member
0 Likes
1,023

Hi!

I have the following requirement:-

- We have a Dialogue program in which we need to add a push button 'Attachment'.

- Clicking on that push button should allow me to browse through the screen and select the required file and attach it.

- After it is attached double clicking on that doc. should allow me to view that file.

Since I am very new in ABAP it would be great if someone could provide a helpful hand.Will be thankful to you.

Thanks and Regards

Sourabh Verma

9 REPLIES 9
Read only

Former Member
0 Likes
987

Hi Sourabh,

here a little report wich shows files.

when you click an the Filename it will be shown

with the application.

REPORT ZGRO_TESTT MESSAGE-ID ZZ.

*

DATA: DIR TYPE STRING.

DATA: FILE_TABLE TYPE FILETABLE.

DATA: COUNT TYPE I.

*

DATA: APPL TYPE STRING.

*

DATA: APP1(80).

DATA: WA_FILE_TABLE(80).

DATA: CURSORFIELD(20).

*

START-OF-SELECTION.

*

<b>DIR = 'D:\'.</b> "Here your DIR

*

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

EXPORTING

DIRECTORY = DIR

FILTER = '*.DOC' "update if you need

FILES_ONLY = 'X'

CHANGING

FILE_TABLE = FILE_TABLE

COUNT = COUNT.

*

LOOP AT FILE_TABLE INTO WA_FILE_TABLE.

*

CONCATENATE DIR WA_FILE_TABLE INTO APP1.

WRITE: / 'Datei:', APP1 COLOR COL_NEGATIVE HOTSPOT ON .

HIDE: APP1.

*

ENDLOOP.

*

END-OF-SELECTION.

*

AT LINE-SELECTION.

*

GET CURSOR FIELD CURSORFIELD.

*

CASE CURSORFIELD.

*

WHEN 'APP1'.

APPL = APP1.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

EXPORTING

APPLICATION = APPL.

*

ENDCASE.

*

Hope it helps.

Regards, Dieter

Read only

0 Likes
987

Hi Dieter!

I tried running this report.But no output is coming.

Read only

0 Likes
987

Hi Sourabh,

do you update the field DIR = 'D:\'?

look at your workstation and go

to your Directory where the .DOC-Files are stored.

This Directory must be the DIR-Field in Abap.

F. Exampl. C:\TEMP\DOCFILES.

DIR must be 'C:\TEMP\DOCFILES\'.

Regards, Dieter

Read only

0 Likes
987

Hi Dieter!

This is how i ran the code.

REPORT Z57340TEST9 .

*REPORT ZGRO_TESTT MESSAGE-ID ZZ.

*

DATA: DIR TYPE STRING.

DATA: FILE_TABLE TYPE FILETABLE.

DATA: COUNT TYPE I.

*

DATA: APPL TYPE STRING.

*

DATA: APP1(80).

DATA: WA_FILE_TABLE(80).

DATA: CURSORFIELD(20).

*

START-OF-SELECTION.

*

DIR = 'C:\YServer'. "Here your DIR

*

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

EXPORTING

DIRECTORY = DIR

FILTER = '*.DOC' "update if you need

FILES_ONLY = 'X'

CHANGING

FILE_TABLE = FILE_TABLE

COUNT = COUNT.

*

LOOP AT FILE_TABLE INTO WA_FILE_TABLE.

*

CONCATENATE DIR WA_FILE_TABLE INTO APP1.

WRITE: / 'Datei:', APP1 COLOR COL_NEGATIVE HOTSPOT ON .

HIDE: APP1.

*

ENDLOOP.

*

END-OF-SELECTION.

*

AT LINE-SELECTION.

*

GET CURSOR FIELD CURSORFIELD.

*

CASE CURSORFIELD.

*

WHEN 'APP1'.

APPL = APP1.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

EXPORTING

APPLICATION = APPL.

*

ENDCASE.

*

Regards

Sourabh

Read only

0 Likes
987

Sorry Dieter!

This is the corrrect code.

REPORT Z57340TEST9 .

*REPORT ZGRO_TESTT MESSAGE-ID ZZ.

*

DATA: DIR TYPE STRING.

DATA: FILE_TABLE TYPE FILETABLE.

DATA: COUNT TYPE I.

*

DATA: APPL TYPE STRING.

*

DATA: APP1(80).

DATA: WA_FILE_TABLE(80).

DATA: CURSORFIELD(20).

*

START-OF-SELECTION.

*

DIR = 'C:\YServer.txt'. "Here your DIR

*

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

EXPORTING

DIRECTORY = DIR

FILTER = '*.DOC' "update if you need

FILES_ONLY = 'X'

CHANGING

FILE_TABLE = FILE_TABLE

COUNT = COUNT.

*

LOOP AT FILE_TABLE INTO WA_FILE_TABLE.

*

CONCATENATE DIR WA_FILE_TABLE INTO APP1.

WRITE: / 'Datei:', APP1 COLOR COL_NEGATIVE HOTSPOT ON .

HIDE: APP1.

*

ENDLOOP.

*

END-OF-SELECTION.

*

AT LINE-SELECTION.

*

GET CURSOR FIELD CURSORFIELD.

*

CASE CURSORFIELD.

*

WHEN 'APP1'.

APPL = APP1.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

EXPORTING

APPLICATION = APPL.

*

ENDCASE.

Read only

0 Likes
987

Hi Sourabh,

First i think <b>'C:\YServer.txt' is not a directory</b>!

I think DIR = <b>'C:\'</b> ist ok.

But do you looking for txt or doc files.

You can change <b>FILTER = '*.DOC'</b>

To <b>FILTER = '.'</b>, than you see all files.

Try it.

Regards, Dieter

Read only

Former Member
0 Likes
987

Hi Sourabh,

do you have still any problems with

this topic?

Regards, Dieter

Read only

0 Likes
987

Hi Dieter!

Your help was indeed very helpful.Atleat I got some clue.But still my purpose is not excatly solved and I have to explore a lot.

Currently stuck up in some other issue.Will be requiring your help very shortly.

Thanks and Regards

Sourabh

Read only

0 Likes
987

Hi Dieter!

The code here gives me all the files that are in C:\.

Basically, I want the functionality through which i can browse through my desktop and select a particular file through C:\ or D:\ or Desktop ,depending on the requirement.

Secondly i should be able to save that file to my system and it should be visible to me as a icon.Clicking on that icon should open the file.

This is similar to attaching a file to a mail.

Thanks and regards

Sourabh