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

lsmw FB01 loading text file question

Former Member
0 Likes
2,078

i have done a search on this and many other web sites concerning the following problem, and have not got a concrete answer, so i will ask if someone can give an answer to the quesions below.

- i have a project to extract the BSID table and use the contents of that table to create Open A/R items in a new company code.

- i have used lsmw for many data loads in the past and had few problems loading data, but when using lsmw to load the fb01 data, there is no place to maintain field mappings for the second half of the transaction.

questions

1) hows does the program RFBIBL00 know that there is another line item to load when using lsmw?

2) i am assuming that the file needs an additional record for everyone i extract from BSID. i can add this record to the file manually, but when i do this, the program thinks there are two seperate FB01 transactions. do i add the records manually to the text file?

3) do i need to change the structure of BBSEG?

4) is there a std program in sap to do this addition of records for a text file.

thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,865

The file into RFBIBL00 is delimtted by the header record. If the first record is a header record and the next two are detail records and the fourth one a header record, the program will attempt to create a single document for the first three records before processing the fourth.

So, presumably, your header data will come partlly from BSID with additional data supplied by you; the second (first detail) record from BSID and the third (second detail) depends on your requirements.

Rob

13 REPLIES 13
Read only

Former Member
0 Likes
1,865

Hi,

I have done posting of AR / AP items using the standard program RFBIBL00 in LSMW.

I too have faced same issues as the no. of line items were more than 999 per record.

As per my understanding I will try to answer ur questions.

1. In LSMW we have standard functions like TRANSFER_RECORD and ON_CHANGE_TRANSFER_RECORD etc. By default, after every structure the LSMW uses transfer_record function. so that after every record in the file the record is transfered to output.

The solution for this is, You can have ON_CHANGE_TRANSFER_RECORD function instead of TRANSFER_RECORD after the header structures.But keep in mind that in the text file that you are uploading the header fields SHOULD BE SAME for all the line items. The program RFBIBL00 takes the same header record for all the line items and transfer the record only after all the line items are processed.

2. There is no need to add an extra field in the structure. Only thing you need to do is to maintain same header fields for all the line items.

3. There is no need to change the structure of RFBIBL00 as the above solution will solve the issue.

4. RFBIBL00 is the standard program. In case u feel that the program is not meeting ur requirements, you may as well choose BAPI method in LSMW for posting.

Hope this solves ur problem.

Regards,

Asif Ali Khan

Read only

0 Likes
1,865

thanks, your explanation is good but i need a little more clarity.

in your #1 response, where do you change function for this?

and, what is the structure of the file? do i need to have specfic fields at the beginning of every row? can you give an detailed example please?

thanks in advance.

Read only

Former Member
0 Likes
1,866

The file into RFBIBL00 is delimtted by the header record. If the first record is a header record and the next two are detail records and the fourth one a header record, the program will attempt to create a single document for the first three records before processing the fourth.

So, presumably, your header data will come partlly from BSID with additional data supplied by you; the second (first detail) record from BSID and the third (second detail) depends on your requirements.

Rob

Read only

0 Likes
1,865

thanks rob,

i understand there needs to be header and detail rows in my text file, but what makes them header or detail rows? do i need a field to denote that in the file?

this is my exact issue. how do i make a row in the text file a header or detail row?

thanks in advance.

Read only

0 Likes
1,865

Have you seen the program documentation? It's quite good.

Rob

Read only

0 Likes
1,865

actually, i have. it does not explain this process very well.

thanks.

Read only

0 Likes
1,865

The first record of the file will have the structure BGR00; each document header structure BBKPF; and within each document, the items will have the structure BBSEG. Fill each as appropriate.

Rob

Read only

0 Likes
1,865

to be clear, you are saying that the file cannot be dynamic? all other times i have used lsmw, it allows you to create a text file that is dynamic. any fields can be used. for example, if i want to create a vendor, i can pass an address if i want, but if i do not want to, i have the option of not passing any data.

thanks for the clarity.

Read only

0 Likes
1,865

I'm not sure about "dynamic". I seem to recall that you could create some Z structures (ZBSEG or something like that) where you create only the fields that you will use. However, In these SAP structures, you normally pass "/" in empty fields.

Rob

Read only

0 Likes
1,865

thanks for your patience rob.

i am not talking about adding a z structure. when you load data, you do not need all the data in the text file, just the data you need to load. then you create your source structures and your source fields that are the same as the file. then you map your source fields to the data structures in "maintain field mapping and conversion rules". you don't need to have all the data in the text file, just the data you need to load, right?

so therefore, if i use this structure, i need to have all of the header and item structure is my text file? and also need to create all the fields in the "maintain source structures" and "maintain source fields"?

thanks again for your input.

Read only

0 Likes
1,865

I don't use LSMW, so I can't comment on that. Yes, you have to fill the fields you don't use with '/' (or some other empty field indicator). There are routines that do this for you.

A typical skeleton might look something like:

*&---------------------------------------------------------------------*
*&      Form  POP_DATASET
*&---------------------------------------------------------------------*
form pop_dataset.
  perform init_strukturen_erzeugen(rfbibli0) using c_nodata.
  perform bgr00_data.
  loop at zzfth_int.
    perform bbkpf_data_fb01.
    loop at zzfti_int
    where zzfbukrs = zzfth_int-zzfbukrs
    and   zzfdocno = zzfth_int-zzfdocno.
      perform bbseg_data.
    endloop.
  endloop.
endform.                               " POP_DATASET

(You might want to get rid of the nested loops though

Rob

Edited by: Rob Burbank on Aug 14, 2008 2:26 PM

Read only

0 Likes
1,865

thanks rob for your help.

if anyone else that uses lsmw with FB01 can answer my questions i would appreciate it.

Read only

0 Likes
1,865

I thought it would be easy to explain by creating the Blog.

Follow this link for blog:

Regards,

Naimesh Patel