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

f4-filename

Former Member
0 Likes
1,744

I am using the function F4_filename to give the user the option to

select the download path. Can it happen that as the dialog box for

path selection appears the user should just choose the path but the

file should be downloaded with the specific name(that the programmer wants)

Like I click for F4 help. the dialog box for path selection appears.

User selects the path but does not has to mention the filename. It

should appear automatically in the space where file name is to be provided.

Press save and file is downloaded.

In other words the user should be able to choose the path but not the filename.

5 REPLIES 5
Read only

Former Member
0 Likes
1,272

Hi Laldinliana Sailo,

Please try this

 DATA:
    L_TITLE TYPE STRING,
    L_PATH1 TYPE STRING.

    L_TITLE = 'Select Directory Path'(015).

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
      EXPORTING
        WINDOW_TITLE         = L_TITLE
      CHANGING
        SELECTED_FOLDER      = L_PATH1
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        NOT_SUPPORTED_BY_GUI = 3
        OTHERS               = 4.

IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
      PA_PFILE = L_PATH1.
    ENDIF.

W_LINES = STRLEN( PA_PFILE ).
    W_LINES = W_LINES - 1.
    IF PA_PFILE+W_LINES NE '\'.
      CONCATENATE PA_PFILE
                  '\'(048)
                  'file_name'(035)      " Give ur own file name
                  C_CSV
             INTO WA_PFILE.

Hope this helps...

Best regards,

raam

Read only

Former Member
0 Likes
1,272

function module 'download'

will help u out..

it asks u path and file name...

Read only

Former Member
0 Likes
1,272

Use the class: CL_GUI_FRONTEND_SERVICES

and method : DIRECTORY_BROWSE

you can use the tcode SE24 to browse the class.

Hope this helps.

Read only

Former Member
0 Likes
1,272

hi check this..

http://sapprograms.blogspot.com/2008/04/simple-list-box.html

and check this program...

TYPE-POOLS : vrm.

TABLES:vbak,vbap.

DATA : v(80) TYPE c.

DATA: wa_vbak TYPE vbak,

it_vbak TYPE vbak OCCURS 0 WITH HEADER LINE,

wa_vbap TYPE vbap,

it_vbap TYPE vbap OCCURS 0 WITH HEADER LINE.

DATA: l_name TYPE vrm_id,

li_list TYPE vrm_values ,

v_count TYPE i,

l_value LIKE LINE OF li_list.

PARAMETERS: p_test(20) AS LISTBOX VISIBLE LENGTH 60 MODIF ID DAT.

INITIALIZATION.

AT SELECTION-SCREEN OUTPUT.

PERFORM get_data.

LOOP AT it_vbak.

l_value-key = it_vbak-vbeln .

l_value-text = it_vbak-vbeln .

APPEND l_value TO li_list.

ENDLOOP.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_TEST'

values = li_list

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

AT SELECTION-SCREEN ON P_TEST.

clear : li_list , li_list[].

SELECT vbeln

matnr

meins

FROM vbap

INTO CORRESPONDING FIELDS OF TABLE it_vbap

WHERE vbeln = p_test.

START-OF-SELECTION.

SELECT vbeln

matnr

meins

FROM vbap

INTO CORRESPONDING FIELDS OF TABLE it_vbap

WHERE vbeln = p_test.

LOOP AT it_vbap.

WRITE 😕 it_vbap-vbeln, it_vbap-matnr,it_vbap-meins.

ENDLOOP.

&----


*& Form get_Data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data .

SELECT vbeln

FROM vbak

INTO CORRESPONDING FIELDS OF TABLE it_vbak.

ENDFORM. " get_Data

regards,

venkat

Read only

Former Member
0 Likes
1,272

Hi,

Try this:

  • Build default filename

CONCATENATE 'C:\' sy-sysid sy-mandt '_product.xls' INTO lv_filename_2000.

  • Get filename

CALL METHOD cl_gui_frontend_services=>file_save_dialog

EXPORTING

window_title = 'Please enter a filename' "Not bothering with a translation...

default_extension = 'xls'

default_file_name = lv_filename_2000 "e.g. C:\ECD040_product.xls

file_filter = 'Excel Files (*.xls) .xls All Files (.*) . '"#EC NOTEXT

initial_directory = 'C:\'

CHANGING

fullpath = lv_filename_2000

filename = lv_filename_fend_2000

path = lv_path_2000

user_action = lv_action_2000.

Reward if helpfull...

Cheers,

Rakesh.