cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Routine and formula in Transformation: TOUPPER + routine in one. How?

Former Member
0 Kudos

Good day

I am not an ABAP'er, but I am trying to successfully write an ABAP routine where I want to change the lowercases to UPPER and split the description field (100) into two fields, one with (6) and the second to +60(40).

Routine1 on the first description is as follows:

"

RESULT = SOURCE_FIELDS-meta_package_des(60).

"

Routine2 on the second description is as follows:

"

RESULT = SOURCE_FIELDS-meta_package_des+60(40).

"

If I do only the above, the routine has no syntax error and the data will be split successfully from (100) to (60) and (40).

Now...I want to change (translate) the descriptions to UPPER as well, as I am receiving it from the source in lower cases.

How do I incorporate theTOUPPER formula and routine into 1 routine.

Seems as if you cannot use a formulae and a routine on a field in transformations.

I have done the following routine on description field 1:

" DATA meta_package_des TYPE string.

TRANSLATE meta_package_des TO UPPER CASE.

RESULT = SOURCE_FIELDS-meta_package_des(60)."

There are no syntax errors but DTP will not be successful.

Please assist

Thanks in advance>

Cj

Accepted Solutions (0)

Answers (2)

Answers (2)

bryan_koetting2
Active Participant
0 Kudos

Cornelius, you are correct that you cannot perform both a formula and a routine on the same infoobject in a transformation, but this is no problem since you can do anything within a routine.

The code shown in the previous post should work fine.

former_member184494
Active Contributor
0 Kudos

Instead - do it like this...

Routine1 on the first description is as follows:

"

RESULT = SOURCE_FIELDS-meta_package_des(60).

translate RESULT to UPPER CASE.

"

Routine2 on the second description is as follows:

"

RESULT = SOURCE_FIELDS-meta_package_des+60(40).

TRANSLATE RESULT to UPPER CASE.

the correct syntax for your previous code would be :

TRANSLATE SOURCE_FIELDS-meta_package_des TO UPPER CASE.

RESULT = SOURCE_FIELDS-meta_package_des(60)."

Edited by: Arun Varadarajan on Dec 21, 2009 10:17 PM

Former Member
0 Kudos

Thanks to you both...

unfortunately I am getting the following error:

"E:The field "SOURCE_FIELDS-META_PACKAGE_DES" cannot be changed. -"

This is my latest code

"

TRANSLATE source_fields-meta_package_des TO UPPER CASE.

result = source_fields-meta_package_des(60).

"

This is more info on this routine

METHOD compute_ZSMETDES1.

  • IMPORTING

  • request type rsrequest

  • datapackid type rsdatapid

  • SOURCE_FIELDS-META_PACKAGE_DES TYPE C LENGTH 000100

  • EXPORTING

  • RESULT type tys_TG_1-/BIC/ZSMETDES1

DATA:

MONITOR_REC TYPE rsmonitor.

Please help again?

Thanks in advance

Cj

Former Member
0 Kudos

Hi

I have solved this problem. Ths correct ABAP routine for the two individual fields are:

"result = source_fields-meta_package_des(60).

translate result to upper case.

result = source_fields-meta_package_des+60(40).

translate result to upper case."

Problem solved.

thanks

CJ