cancel
Showing results for 
Search instead for 
Did you mean: 

field name modification with update command

Former Member
0 Kudos

Hi Gurus

I have selected the customer list from sap with operating system mmsql , but I want to update or used the select statement in such a way that if there is street already in the list then relaced with postbox(pfach) and the field must replace or change the street field as in eg P.O.BOX:+pfach

if the pobox is not there then address must not change or update

Can anyone send me the sql statement toupdate please

SELECT KUNNR, NAME1, STRAS,PFACH, MCOD3, PSTL2,TELF1

FROM wg4.KNA1

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Gurus

Thanks for your help , the problem is solved

regards

Piroz

Former Member
0 Kudos

You probably want to do this via LSMW or some other SAP delivered solution and not a straight update to the database, but if you really need the SQL I included it below.

I dont know which field you are trying to update, but if would be something like:

update wg4.KNA1 set Field = case when Isnull(PFACH, '') = '' then Field else 'P.O.Box:' + PFACH end

The update will work if your PFACH is set to '' or null, if it can have other values that you don't want you would have to add those to the clause.

For a select (and to check if the update will work) it would be:

select case when PFACH = '' then Field else 'P.O.Box:' + PFACH end as NewPFACH from wg4.KNA1