cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP code help for 0PROFIT_CTR (in Update rules)

Former Member
0 Kudos

Hi

Can you please give me the update rules code that would do the following in BW 3.5:

If Profit Center is 10 digits long, its ok but if Profit Center is 5 digits long, concatenate with 5 zeros.

Thanks

Jimi

Edited by: jimi ogun on Dec 1, 2011 1:44 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jimi,

Instead of doing manual conversion I think it's better if you use FM based conversion.

CONVERSION_EXIT_ALPHA_INPUT

Simply pass your input and get the output in required format.

Regards,

Durgesh.

Former Member
0 Kudos

Hi Jimi,

you can try the following logic.


data : len type i,
      v1(10) TYPE c value 'abcde'.
len = strlen( v1 ).

if len = 5.
CONCATENATE v1 '00000' into v1.

endif.

the above code will check the length of the variable (in this case profit center).

If length is 5 concatenate '00000'.

hope this resolves your issue.

cheers:)

Former Member
0 Kudos

Hi Soorej

I tried teh code in my transfer rules but the result was blank. I guess it was because i didnt insert anything in the RESULT line... This is what i tried to do but i get a syntax error:

$$ begin of routine - insert your code only below this line -

  • DATA: l_s_errorlog TYPE rssm_s_errorlog_int.

data : len type i,

v1(10) TYPE c value 'abcde'.

len = strlen( v1 ).

if len = 5.

CONCATENATE v1 '00000' into v1.

endif.

RESULT = /BI0/OIPROFIT_CTR.

  • returncode <> 0 means skip this record

RETURNCODE = 0.

  • abort <> 0 means skip whole data package !!!

ABORT = 0.

The syntax error i get is below:

E:Field "/BI0/OIPROFIT_CTR" is unknown. It is neither in one of the

specified tables nor defined by a "DATA" statement. "DATA" statement.

Former Member
0 Kudos

Hi,

variable v1 is not the part of your logic,

replace the variable with profit center.

Rewarding points is the best way to say thanks

cheers

Ryan-Crosby
Active Contributor
0 Kudos

Hi Jimi,

This piece of would solve your problem for the trailing zeroes (note the source field name might be different but this is an example):


DATA: lv_len TYPE i.
CONSTANTS: lc_0(10) TYPE c VALUE '00000000000'.

lv_len = strlen( source_fields-prctr ).
IF lv_len = 5.
  OVERLAY source_fields-prctr WITH lc_0.
ENDIF.

RESULT = source_fields-prctr.

Regards,

Ryan Crosby