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

BAPI ISSUE

Former Member
0 Likes
303

Hi friends,

i have 3 different excel files to be uploaded into SAP by 3 BAPIs IN FICO module.

Requirement is 3 document types assigned to 3 excel files say Y1,Y2,Y3.

according to document types selected in selection screen ,it should pick up the related BAPI.

selection-screen is companycode

file path

so question is how to populate the document types into file path so that after selecting F4 it should show

the above 3 doc types and after selecting the corresponding doc types ,related BAPI should be tiggered.

i know that for file path the code is: at selection-screen on value request for p_file.

parameters: p_file type rlgrap-filename.

call fun modules kd_get_file_name or f4_filename.

please solve the issue and give some sample code.

regards

sk

1 REPLY 1
Read only

Former Member
0 Likes
271

DATA
     : FILE_TABLE TYPE FILETABLE,
       WA_FILE    LIKE LINE OF FILE_TABLE,
       RC         TYPE I.
 
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
  EXPORTING
    WINDOW_TITLE            = 'Pick Excel File'
    DEFAULT_EXTENSION       = 'xls'
*    DEFAULT_FILENAME        =
    FILE_FILTER             = '*.*|*.XLS'
*    WITH_ENCODING           =
*    INITIAL_DIRECTORY       =
*    MULTISELECTION          =
  CHANGING
    FILE_TABLE              = FILE_TABLE
    RC                      = RC
*    USER_ACTION             =
*    FILE_ENCODING           =
*  EXCEPTIONS
*    FILE_OPEN_DIALOG_FAILED = 1
*    CNTL_ERROR              = 2
*    ERROR_NO_GUI            = 3
*    NOT_SUPPORTED_BY_GUI    = 4
*    others                  = 5
        .
IF SY-SUBRC EQ 0.
 
  READ TABLE FILE_TABLE INTO WA_FILE INDEX 1.
 
  WRITE WA_FILE.
 
ENDIF.

You can do it on basis of File name, say if File name is F1.xls call first BAPI and likewise.