05-24-2013 9:25 AM
Hi experts
I know this question has been asked several times and I have read some of the treads.
Unfortunately I have not found THE answer.
I have a Z-table, without maintenance view! - We are operating in production system, and the update is a one-time shot. So it makes no sence to create a maintenance view which must be transported, otherwise I could as well create a small ABAP.
I would like to update this file using LSMW with direct update. Is it possible at all....???
How can I "define" the target structure which should be my Z-table?
One of the threads I have read says that I could use a dummy recording and then do the update using conversion rules. But I get stuck when it comes to fill the transfer record.
Here the full text: You're not using Direct Input - use Batch Input. Like I said, it doesn't matter what BDC recording you choose in the first screen because you're never going to get to that step anyway (if you don't have one just create a dummy one for any transaction, preferably a short one). In your conversion rules, choose any of your BDC fields and write code to update the table for each record in the file (Create Rule button -> ABAP code). You don't need to do anything with the other fields.
Read the data then Convert the data. The Convert step will update your Z-table, assuming you have set up your file structure and code correctly.
LSMW can do anything as long as you're creative enough
Pls help. It is getting a bit urgent.
Br
Jeanette
05-24-2013 4:52 PM
First I need to thank you so much for your time and help. Really appreciate it!!!!
Tried to declare the table in global data, but that resultet in syntax error (table already declared).
No, the converted data does not contain the fields.
That confuses me. When I check the relations it shows structure ZBRIK. When I click the structure it shows the total table with all its fields.
But the converted data looks like this.....
The data definition of the code:
* Target structure definitions
data:
begin of ZBRIK occurs 0,
TABNAME(000030) type C,
TCODE(000020) type C,
end of ZBRIK .
data:
init_ZBRIK like ZBRIK,
prev_ZBRIK like ZBRIK.
* Source structure definitions
data:
begin of LSMW_BRIK_INPUT,
BRIK_ID(010) type C,
CONTRACT(010) type C,
CONTRACT_ITEM(010) type C,
ZZSUPPLY_CODE(001) type C,
end of LSMW_BRIK_INPUT.
Need to somehow add the missing fields to the structure - a desperate try could be to add them to the code, but will it work, you think?
05-24-2013 12:20 PM
go into your LSMW
create a recording of SM30 for maintainance of your Z-table
Create source structure
define the source fields
assign source to target structure
go into field mapping and do your field mapping as usual
at __END_OF_RECORD__
add a little ABAP coding:
move source field to target field in a working structure .
. INSERT INTO your Z-table VALUES working structure .
transfer_record.
specify your file
Assign the file
Read the file
Convert the file
your are done, no need to do anything more, because the convert step has already updated your Z-table. you do not need to create a batch input session.
05-24-2013 1:40 PM
Hallo Jürgen
Thank you for your prompt reply!
I followod your guide, but still have a problem though.
You tell me to map the fields as usual. But I do not see the fields of my Ztable......
Is that correct or not?
My coding seems to be all right, but the ztable is not updated. Because of the missing mapping?
After the insert into ztable, the values are TABNAME = ZBRIK TCODE = SM30.
what am I missing?
Br
Jeanette
05-24-2013 1:56 PM
you missed to define the fields in step one of LSMW
when you are ready with the recording then you get an overview of all recorded content, here you have to double click each field and to give it a name and a description.
05-24-2013 2:10 PM
Sorry, don't understand. Step 1 - Do you mean the recording?
How?
As the table has no maintenance view I cannot "enter" the table from sm30, thus the fields are not show and copied to the recording.
I feel reaaaally stupid right now
05-24-2013 2:52 PM
forget about this step 1 . it should even work like it is.
can you add 2 screen shot of the step display read data, from the overview and after clicking a record line so that the detail is shown
05-24-2013 3:14 PM
05-24-2013 4:09 PM
Okay.
I dont see anything wrong.
you executed the conversion and you Display converted data looks similiar like that ?
if yes, then there must be something wrong with the INSERT command.
Add a declaration tables: zbrik . at __GLOBAL_DATA__
and try again.
05-24-2013 4:52 PM
First I need to thank you so much for your time and help. Really appreciate it!!!!
Tried to declare the table in global data, but that resultet in syntax error (table already declared).
No, the converted data does not contain the fields.
That confuses me. When I check the relations it shows structure ZBRIK. When I click the structure it shows the total table with all its fields.
But the converted data looks like this.....
The data definition of the code:
* Target structure definitions
data:
begin of ZBRIK occurs 0,
TABNAME(000030) type C,
TCODE(000020) type C,
end of ZBRIK .
data:
init_ZBRIK like ZBRIK,
prev_ZBRIK like ZBRIK.
* Source structure definitions
data:
begin of LSMW_BRIK_INPUT,
BRIK_ID(010) type C,
CONTRACT(010) type C,
CONTRACT_ITEM(010) type C,
ZZSUPPLY_CODE(001) type C,
end of LSMW_BRIK_INPUT.
Need to somehow add the missing fields to the structure - a desperate try could be to add them to the code, but will it work, you think?
05-24-2013 6:44 PM
Sorry, I am a kind of braindead. The converted data could not be different than you have. The fields do not play any game as we dont need those records.
But the schreen shot of your converted data proofs already that the program ran through this statement.
I have just a guess ( I am not a good ABAPer - just as much as I need for LSMW), it may be that SAP gets confused with the same name for the table and for your target structure (which is automatically coming from the recording) .
so the structure ZBRIK has just the 2 fields for TABNAME and TCODE
while the table ZBRIK has much more fields
Can you try another recording and name it ZZBRIK or ZBRIK2, which would make the structure name different from your table name.
05-26-2013 2:03 PM
Hi Jürgen
Yes I also noticed in my trials, that if I did not name the recording the same as the table, it would not have the structure,,,,,
I started all over again. Named the recording something different (brik_sm30)
Maintained step 2, 3 and 4.
In the mapping I declared the table under "global_data":
Selected the records from Ztable, moved new values to the fields and updated the table.
Now it seems to work.
The weird thing is that I did this in a previos try, the only difference was then that the recording was called the same as the Ztable and that the table was not declared under global_data.
So the lesson learned here must be do not name the recording the same as a database table.
Thank you for sparring with me.
/Jeanette
Message was edited by: Jeanette Baunsøe Would like to give point, but how do I do that?
05-26-2013 7:51 PM
Would like to give point, but how do I do that?
Seems you figured it out, marking replies as helpful and correct does it. Well deserved
That's why the security guys "love" it, you can inject any code in the production system if you have LSMW authorization...
Thomas
05-26-2013 10:25 PM
I do have LSMW authorization , and the status Toxic
Serious, not many have LSMW authorization in our system, not even in the development system. The authorization is only granted for the project time, we have to apply for the authorization with each new project, and get only the permission for the objects nominated in the scope.