09-10-2010 7:10 AM
Hi,
I have to upload file through LSMW (BAPI method).
File has the following structure:
HEADER1 ITEM1 ITEM2 ITEM3
HEADER2 ITEM1 ITEM2 ITEM3
HEADER3 ITEM1 ITEM2 ITEM3
and so on
So, number of items is constatnt for every header object.
I should get the next hierarchy of created object:
HEADER
- ITEM1
- ITEM2
- ITEM3
But now I can only get
HEADER
- ITEM1
Is it possible to do this task via LSMW?
09-10-2010 8:09 AM
Hi,
You can insert ABAP Code in your LSMW, so you can apply your logic.
Regards.
09-10-2010 8:09 AM
Hi,
You can insert ABAP Code in your LSMW, so you can apply your logic.
Regards.
09-10-2010 9:03 AM
Now I'm trying to do this, but still can't choose necessary event.
09-10-2010 10:30 AM
In general SAP reads only one line in the source, hence it creates only 1 item for the target.
better would be if you source structure would already be like this:
HEADER1
- ITEM1
- ITEM2
- ITEM3
HEADER2
- ITEM1
- ITEM2
- ITEM3
but it is even possible with the structure you have
at the __END_OF_RECORD__ section for your item
add a small coding to replace ITEM1 data with ITEM2 data
followed by TRANSFER_THIS_RECORD "..."
then replace ITEM2 data with ITEM3 data
and do again TRANSFER_THIS_RECORD "..."
09-10-2010 10:39 AM
Thank you for your answers.
I've made it slightly different.
Added some ABAP code at event __BEGIN_OF_TRANSACTION__ to fill some dummy substructure (that is not filled at reading file).
09-10-2010 11:03 AM
Hi Ilya,
You can do it very easily, one simple method Add a field at first position and assign records identifier to that.
To do that go to your Maintain Source Fields and create first filed with identifier like HEAD for Header record and ITEM for your Item records.
After that it will look like as follows :
| ZHEADER Task List header
| IDENTIFIER_HD C(004) Record Identifier
| Identifing Field Content: HEAD
| STTAG_HD C(010) Key Date (MM/DD/YYYY)
| KTEXT_HD C(999) Text
|
|----
ZOPERATION Task List Operation
-
IDENTIFIER_OP C(004) Record Identifier
-
Identifing Field Content: OPER
-
STTAG_OP C(010) Key Date (MM/DD/YYYY)
-
KTEXT_OP C(999) Text
Now maintain the same field order in the file and while reading the file choose the file type as sequential (among tabular or sequential file option ) and maintain the date file like this
HEAD <head value>
ITEM <Item value>
ITEM <Item value>
ITEM <Item value>
If you have any doubt you can revert me with you file layout details i'll explain it in detail.
Regards
Dhirendra
09-10-2010 11:26 AM
Hi dhirendra pandit,
Thanx for your detailed answer, but header data and item data are in one row and I can't change this requirement.