POSTING FI DOCUMENTS USING FLAT FILE INTERFACE – SAP FI-CO
Posting FI Account documents is a vital step for any Company to manage business flow. SAP provided different ways to post FI documents. One of the way is using FLAT FILE to upload and post FI documents.
Interfacing is one of the techniques used in SAP and of course in other technologies as well for uploading and then updating/Inserting data to the database. The data loaded must have some validation checks to make sure that the correct data is passed to the application , and saved to the database.
There are many interfacing techniques available with in the SAP Environment such as IDOCS, XI/PI , BDC AND LSMW. In this blog i am explaining the process of uploading data using the flat file for financial postings.
Below are the Steps to setup flat file and Object development step.
(1) For demonstration purposes, i am taking single record for 26 fields coming into the system. Below is the screen capture of the flat file.
(2)Next step is the development of file upload program. I leveraged the file upload program and changed it based on my requirement. Below is the screen capture for creating file upload program.
(3) Run the program and see how the screen for the file upload program looks like. This one has an option to upload file from the application server or Flat file.
(4) Now let us put a break point in the program to see how the file upload program is handling the flat tile data.
(a) Initially the data is loaded from flat file into the it_data1 internal table using file upload program.
(b) Data with in the internal table from flat file.
(5) Now lets move to the next step where we are arranging data in a separate internal table it_data2 for further processing for the interface. I have used SPLIT command to arrange data into the desired fields as shown below.
(6)The data is setup in the second internal table for further processing as shown in the above screen capture.
(7) data setup for gl account, currency amount and tax in their tables are shown in the below screen capture.
(8)Now we call BAPI BAPI_ACC_DOCUMENT_CHECK to see if there are any errors in the postings we are doing.
as you can see the Lt_return table has no entries , indicating there are no errors in the document.
Now lets move to function module BAPI_ACC_DOCUMENT_POST to post financial entries.
Return table indicates success message, the document is successfully posted.
Thanks for reading.
https://wiki.scn.sap.com/wiki/display/ABAP/F4+Help+for+Application+Server+and+GUI+Files+using+CL_RSAN_UT_FILES
F4 Help for Application Server and GUI Files using CL_RSAN_UT_FILES
Skip to end of metadata
Created by Vinod Kumar, last modified by Former Member on Oct 14, 2013
Go to start of metadata
F4 Help for Appl.Server and GUI Files using Class : CL_RSAN_UT_FILES
Summary
This Post narrates usage of Class CL_RSAN_UT_FILES for F4 help in selecting files from Application Server and GUI.
Company: Vinod Kumar T
Created on: 08.09.2010
Author(s) Bio
Vinod Kumar is an ABAP Consultant working with NIIT Technologies Limited.
Class and Methods used in the Sample Code
Parameters in Method: F4
Process flow of Method
If Option application server is selected, user can select the Logical file name or Physical file name based on the Options available while executing the method. These options are available through the Popup with options "AL11 Files" (For Physical File Name) and "Log. File Name"(For Logical File Name).
If the user selects the Option "AL11 Files", List of Physical Files will be displayed. After selecting the required file from the list, another Popup will be displayed for further action. This popup will have the options "Disp.Cont"(Display the contents of the selected file) and "Copy Name"(Move the selected file name for further processing). * If the user selected the Option "Log.File Name", List of logical Files will be displayed. After selecting the file name, the same can be used for further processing.
If Option presentation server is selected, User can select the File name from the presentation server and the file name can be used for further processing.
Sample Code
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
*&---------------------------------------------------------------------*
*& Report ZVK_CL_RSAN_UT_FILES
*&---------------------------------------------------------------------*
*& Purpose : Use of Class CL_RSAN_UT_FILES for F4 Help for Presentation &
*& Application Server Files
*&---------------------------------------------------------------------*
** Text Elements
• p_f4pres - Select file from GUI
• p_f4appl -Select file from App.Server
• p_filenm - File Name
REPORT ZVK_CL_RSAN_UT_FILES.DATA : LV_APPLSERV TYPE CHAR01,
LV_TITLE TYPE STRING,
LV_GUI_EXTENSION TYPE STRING,
LV_GUI_EXT_FILTER TYPE STRING,
LV_CANCELED TYPE AS4FLAG,
LV_APPLSERV_LOGICAL TYPE AS4FLAG,
LV_APPLSERV_AL11 TYPE AS4FLAG,
LV_LOGICAL_FILE TYPE AS4FLAG,
LV_FILE_NAME TYPE STRING.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.PARAMETERS : P_F4PRES RADIOBUTTON GROUP G1 DEFAULT 'X' USER-COMMAND RADIO.
PARAMETERS : P_F4APPL RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B1.SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.PARAMETERS : P_FILENM LIKE IBIPPARMS-PATH.
SELECTION-SCREEN END OF BLOCK B2.AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILENM.
CLEAR : LV_CANCELED , LV_FILE_NAME, LV_LOGICAL_FILE.
IF P_F4APPL EQ 'X'.MOVE 'X' TO LV_APPLSERV.
MOVE 'Select File from Application Server' TO LV_TITLE.
MOVE 'X' TO LV_APPLSERV_LOGICAL.
MOVE 'X' TO LV_APPLSERV_AL11.
ELSE.
MOVE ' ' TO LV_APPLSERV.
MOVE 'Select File from Presentation Server' TO LV_TITLE.
MOVE ' ' TO LV_APPLSERV_LOGICAL.
MOVE ' ' TO LV_APPLSERV_AL11.
ENDIF.CALL METHOD CL_RSAN_UT_FILES=>F4EXPORTING
I_APPLSERV = LV_APPLSERV
I_TITLE = LV_TITLE
I_GUI_EXTENSION = LV_GUI_EXTENSION
I_GUI_EXT_FILTER = LV_GUI_EXT_FILTER
• i_gui_initial_directory =
I_APPLSERV_LOGICAL = LV_APPLSERV_LOGICAL
I_APPLSERV_AL11 = LV_APPLSERV_AL11
IMPORTING
E_CANCELED = LV_CANCELED
E_LOGICAL_FILE = LV_LOGICAL_FILE
• e_al11_chosen =
CHANGING
C_FILE_NAME = LV_FILE_NAME
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF LV_CANCELED EQ 'X'.MESSAGE 'File Not Selected' TYPE 'I'.
ELSE.
IF LV_LOGICAL_FILE EQ 'X'.MESSAGE 'Logical File Name Selected' TYPE 'I'.
ELSE.
MESSAGE 'Physical File Name (AL11) Selected' TYPE 'I'.
ENDIF.MOVE LV_FILE_NAME TO P_FILENM.
ENDIF.ENDIF.Class | Method | Description
CL_RSAN_UTIL_FILES | F4 | To Display F4 help for files in Application/Presentation Server |
Parameter | Input/Output | Description
I_APPLSERV | Input(Mandatory) | Pass 'X' if the file is to be selected from Application Server,
pass ' ' if file is to selected from GUI (Presentation Server)
I_TITLE | Input(Mandatory) | Popup Window Title
I_GUI_EXTENSION | Input(Mandatory) | Default Value Space
I_GUI_EXT_FILTER | Input(Mandatory) | Default Value Space. File Extension filter in File Selection Popup.
Applicable if file is to be selected from GUI
I_GUI_INITIAL_DIRECTORY | Input | Initial Directory to be displayed in File Selection Popup.
Applicable if file is to be selected from GUI
I_APPLSERV_LOGICAL | Input | Default 'X'. Enable The Option to Select logical File name from Application Server
I_APPLSERV_AL11 | Input | Default 'X'. Enable The Option to Select physical File name from Application Server
E_CANCELED | Output | Value 'X' if File is not selected.
E_LOGICAL_FILE | Output | File Selected from Logical File Names
E_AL11_CHOSEN | Output | Indicates That User Selected First to Choose from AL11 Files
C_FILE_NAME | Output | Selected File Name