cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenate in Update Rules

Former Member
0 Kudos
82

Hi All,

I have to create an update rule for an infoobject "address". The data is coming from the attributes of a master data infoobject called 0vendor. The attributes are street, city, state and zip.

So I created an update routine which would Concatenate as follows:

Tables: Vendor.

Data: Begin of IT_VENDOR occurs 0,

street like Vendor-street,

city like Vendor-street,

state like Vendor-state,

Zip like Vendor-zip.

End of IT_Vendor.

Data: V_addr type c.

Clear V_ADDR.

Select * from Vendor(table) when Customer no. = comm_strcuture-Customer no. into corresponding fileds of table IT_Vendor.

Concatenate IT_vendor-street IT_vendor-City IT_vendor-State IT_Vendor-zip into V_addr.

Result = V_ADDR.

Now is there something wrong with the routine. Beacause it is not working. There is no data being updated into the cube.

Please help.

Thanks,

Ashmith Roy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

would be a great idea to check sy-subrc, and if it's 0 he concat's the empty haederline of his table, also not very succesful.

/manfred

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

The actual code that worked eventually looke dlike this:

Tables: Vendor.

Data: Begin of IT_VENDOR occurs 0,

street like Vendor-street,

city like Vendor-street,

state like Vendor-state,

Zip like Vendor-zip.

End of IT_Vendor.

Data: V_addr type c.

Clear V_ADDR.

Select * from Vendor(table) when Customer no. = comm_strcuture-Customer no. into corresponding fileds of table IT_Vendor.

If Sy-subrc eq 0

Read Table IT_vendor.

Concatenate IT_vendor-street IT_vendor-City IT_vendor-State IT_Vendor-zip into V_addr.

Endif.

Result = V_ADDR.

Message was edited by: Ashmith Roy

Former Member
0 Kudos

Hi,

The problem is with the length of v_Addr.

V_addr type c will take lenght of 1 character.

specify the lenght of the v_addr.

ex : data : v_addr(40) type c.

sudha

Former Member
0 Kudos

Hi Sudha,

Sorry I forgot to mention that in the previous post. Yes, I did change the length of V_ADDR to 60.

Thanks,

Ashmith Roy

Former Member
0 Kudos

Hi Ashmith,

I guess select is wrong.Try this

Select single street city state Zip into ( IT_VENDOR -street, it_vendor-city , it_vendor-state, it_vendor-zip )from Vendor(table) where Customer no. = comm_strcuture-Customer no

or

Tables: Vendor.

Data:IT_VENDOR like vendor occurs 0 with header line.

Data: V_addr(60) type c.

Clear V_ADDR.

Select single * from Vendor(table) into table it_vendor where Customer no. = comm_strcuture-Customer no.

if sy-subrc = 0.

Concatenate IT_vendor-street IT_vendor-City IT_vendor-State IT_Vendor-zip into V_addr.

endif.

Hope this will help.

Sudha

Result = V_ADDR.

Former Member
0 Kudos

add read statement before concatenate.

read table it_vendor with index 1.

Former Member
0 Kudos

More a curiousity question - is the code that's been posted the actual code? Don't see how it could be ....

Select single * from Vendor(table) into table it_vendor where Customer no<b>.</b> = comm_<b>strcuture</b>-Customer no.

edwin_harpino
Active Contributor
0 Kudos

hi Ashmith Roy,

CONCATENATE just work with Data Type 'Character', have no access to system, not sure the infoobject vendor-zip has other than Character type. i do suggest you use char in the internal table store the data, xx is the length.

For performance consideration you may select first for all related vendors in 'start routine' instead of accessing database each time.

Data: Begin of IT_VENDOR occurs 0,

street char(xx),

city char(xx),

state char(xx),

Zip char(xx),

End of IT_Vendor.

Former Member
0 Kudos

Check if your select work well; take a customer no anche chack in vendor master data if exist 1 record.

Your routine seems to be good.

Hope it helps.

Regards.

Former Member
0 Kudos

Hi Ashmit,

The routine looks good..may be some problem with data.

You can debug this routine if you are loading thru the PSA..

Let me know if you need details on how to debug update rules in the monitor..

Ashish..

Former Member
0 Kudos

Ashish,

I am guessing maybe there is a problem with the length of characteristic Address. It has the maximum possible length. I am trying to debug the update rules from the manage tab by simulating the update. If there is a better way to reach the routine directly, and if you could let me know how, that would be great.

Thanks once again for the prompt reply,

Ashmith Roy

former_member188975
Active Contributor
0 Kudos

Hi Ashmith,

Inthe debug screen try to serach for FORM ROUTINE 9998...that should be your routine. You can add a breakpoint here if you find it.

Hope this helps...

Former Member
0 Kudos

Hi Ashmit,

Go to the update rule and put a break-point there just before the code..

By this you can navigate directly to the code which you are trying to debug..Saves a lot of time..:-)

You might want to keep in mind that the fields you are concatenating don`t add up to more than 60 Chars..

Hope it helps

Ashish..