In the ABAP Forum, there are couple of unanswered questions related to LSMW using standard program RFBIBL00 to post FI documents. That inspired me to write this wiki.
Step 1: Maintain Object Attributes
For creating the FI document with the RFBIBL00 using LSMW, we have to select the object 0100, method 0000 and program RFBIBL00.
Step 2: Maintain Source Structures
We will create total two structures: One for header and another for item. We could have at least two line items in the FI document. So, we need to upload at least 2 records per document. To upload 2 records, we should able to pass those two records in the mapping as well as in the conversion.
Create a structure with name ZFI_HEAD for the Header (BKPF).
Under the ZFI_HEAD, create another structure ZFI_ITEM for items (BSEG). Put cursor on the ZFI_HEAD and press the create button to create lower level structure ZFI_ITEM.
Step 3: Maintain Source Fields
We need to have one link field which will link the Header record with the Item record which system will use later to link the records from both different files.
These are the fields for the ZFI_HEAD structure
These are the fields for the ZFI_ITEM structure
Step 4: Maintain Structure Relations
Here we will define the structure relationship between source structure (BGR00, BBKPF, BBSEG, etc) and target structure (ZFI_HEAD, ZFI_ITEM, etc).
Step 5: Maintain Field Mapping and Conversion Rules
Assign all the fields from the ZFI_HEAD to respective fields from BBKPF and ZFI_ITEM to respective fields from BBSEG. Don't assign the CNT field to any of the field.
Make sure we pass correct formatted date (YYYMMDD) to the BBKPF.
Step 6: Maintain Fixed Values, Translations, User-Defined Routines
We don't to maintain anything in field.
Create a header file.
Create another file for the Items in the same fashion.
You can change the names of the Read and Conversion files.
Step 8: Assign Files
Assign the files to the structures.
Step 9: Read data
Read the files specified in the Step 7
Step 10: Display read data
Displaying read data
Step 11: Convert Data
Run the convert data report to convert the input data to .conv file
Step 12: Display Converted Data
Step 13: Run program
Run program RFBIBL00 to create a session.
- To use the BBTAX structure also in the RFBIBL00, we need to create another structure (e.g. FI_TAX) under the ZFI_HEADER and same level of ZFI_ITEM.
- As ZFI_ITEM (BBSEG) and FI_TAX (BBTAX) are at the same level so, we can use the same CNT field to link them.
- Create a Separate file as we have created for the header and item.
- BWITH is the subitem level data for the FI document. With-holding tax data is attached to the line item. So, we need to create a child structure under the ZFI_ITEM.
- Since we have created the structure at child level, we need another field to link the item data to the withholding tax data.
- Create a separate field as we have created for the header and item.