Application Development 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: 

move in lsmw- very urgent

Former Member
0 Kudos

hi all,

i have to upload email addr using lsmw but only if its not present. if its already there than i need to either overwrite or skip.

using move stmt will it overwrite the existing contents or not.

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

It will overwrite. Instead of move, double click on the field mapping in change mode. It will open the editor for you. Do a database select and check if an email address exists. If so, do not move, otherwise, do the move.

4 REPLIES 4

Former Member
0 Kudos

It will overwrite. Instead of move, double click on the field mapping in change mode. It will open the editor for you. Do a database select and check if an email address exists. If so, do not move, otherwise, do the move.

0 Kudos

can u help me with the logic.

like how do i do tht

0 Kudos

hI,

IT CAN BE DONE....

IN THE FIELD MAPPING , WHERE EVER YOU MAPPED THE EMAIL ADDRESS YOU NEED LITTLE CODING.

DOUBLE CLICK IT. IT WILL SHOW THE SCRIPT EDITOR, HERE CHECK THE ADDRESS IS THERE ARE NOT , IF IT THERE THEN PASS THE '/' NO DATA SYMBOL , IF ADDRESS IS NOT THERE THEN PASS WHAT EVER YOU ARE SENDING..

REGARDS

VIJAY

0 Kudos

If you want to overwrite it, then just move the field from the source structure to the other structure as normal in your field mappings. If it already exists and you don't want to overwrite it, you will first check to see if it exists, if so, then you will not pass it from the source structure to the target. You your LSMW add the code as you see here. I am assuming that you are doing this for user ids? Right?



data: smtp_addr type adr6-smtp_addr.

select single  adr6~smtp_addr into  smtp_addr
                  from usr21
                    inner join adr6
                       on  usr21~addrnumber = adr6~addrnumber
                       and usr21~persnumber = adr6~persnumber
                                  where usr21~bname = source-user_id.


if sy-subrc = 0 and not smtp_addr is initial.
* then do not fill the target field in the LSMW routine
else.
target-email_address = source-email_address.
endif.



Regards,

Rich Heilman