cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Location ID name in SAP BI routine

Former Member
0 Kudos

Hi

I've requirement where two columns Location ID  - ( having assigned 1,2,3 coming from source system) and job type 0 and 1.

Now In Location ID column I've to assign location A to 1, B to 2 AND C to 3

In job type columns

0 to D

and 1 to N

Please can you example code how I can do in routine... should it be done in start/end or field level routine---

Pleaase give example code.

Thanks,

P

This is not ABAP training forum

Message was edited by: Pravender Kumar

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Pawan

if i understand correctly,

you want to replace the values with new value..

eg. if location ID = 1, then location ID = A and so on.

if so, you can write it in field routine. and make sure the target data type holds the charcater.

in field routine,

if source-fields -location = 1,

result = A.

elseif source-fields -location = 2,

result = B.

endif.

Please let us know if this is what you want.

Regards,
Sakthi.

Former Member
0 Kudos

Hi

Thanks for reply. i'm getting attached error. Please can you look into this and correct the code.

Former Member
0 Kudos

Pawan,

Remove the SPACE

this is correct

SOURCE_FIELDS-LOCATIONID

You have given space between SOURCE_FIELDS , - and LOCATIONID. Remove the space.

-Suvesh

Former Member
0 Kudos

Hi Pawan,

Try this code at field level instead of if-endif, case end-case performance is better.

CASE SOURCE_FIELDS-LOACTIONID.

  WHEN '1'

RESULT = BROXBOURNE.

  WHEN '2'.

RESULT = EUROCENTER.

  WHEN '3'.

RESULT = KNOWSLEY.

ENDCASE.

Thanks.

Somesh.

Former Member
0 Kudos

Hi Somesh,

I'm getting attached error. please can you look into this which should be corrected. Do I need to declare in start routine?

Former Member
0 Kudos

Hi Sakthi,

I'm getting attached error. Please can you suggest what should be declare here. Please give example.

Former Member
0 Kudos

Hi Pawan,

teh case endcase will work properly

the dot is missing after when '1' . plz try once and check for the syntax error.

Regards,

Sakthi

Former Member
0 Kudos

Hi Sakthi,

It didn't work -- giving same error- Statement not accessible.

Former Member
0 Kudos

Hi Pawan,

i noticed oen thing..you had placed the code in wrong place.

you write the code after method compute _ZP_PLANT.

by default you will see the RESULT = . tehre instead of this line, paste your code.then this iwll work

Regards,
Sakthi

Former Member
0 Kudos

Hi Pawan,

I have missed to add <>.

Loop at source_package assigning <source_fields>.

CASE <SOURCE_FIELDS>-LOACTIONID.

  WHEN '1'

RESULT = BROXBOURNE.

  WHEN '2'.

RESULT = EUROCENTER.

  WHEN '3'.

RESULT = KNOWSLEY.

ENDCASE.

endloop.

Thanks,

Somesh.

Former Member
0 Kudos

Hi Pawan,

Once you moved to code to right place(ie, inside of Method compute section).

you also need to put the values in quotes like 'BROXBOURNE'. without quotes, it will give error.

Regards,

Sakthi.

Former Member
0 Kudos

Hi Somesh,

I'm getting attached error - SOURCE_PACKAGE IS UNKNOWN.....

Former Member
0 Kudos

Please see below location where is code -- I put the location in quotes but same error.

Former Member
0 Kudos

Hi Pawan,

the loop at  statement not required. that will be for start routine..since you are in field routine.. starting from CASE is fine here. remvoe that line and check

Former Member
0 Kudos

you have to remove both Loop at source_package line

and <> used in source_fields in next line.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

OK,,,pfb:

CASE SOURCE_FIELDS-LOCATIONID.

  WHEN '1'.

RESULT = 'BROXBOURNE'.

  WHEN '2'.

RESULT = 'EUROCENTER'.

  WHEN '3'.

RESULT = 'KNOWSLEY'.

ENDCASE.

use this.

Former Member
0 Kudos

Please see below- getting new error.

Former Member
0 Kudos

the end quote afte eurocentre is  missing..

Former Member
0 Kudos

Thanks for your help. It worked fine.

RamanKorrapati
Active Contributor
0 Kudos

What information is helpful  in your reply?

Former Member
0 Kudos

Hi Ram,

Most of the information were useful but last one solved the issue.

Thanks,

pawan

Former Member
0 Kudos

Can you please reply on below if you know:

thanks in advance.

How to derive week commencing date using print date in SAP BI Routine