Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Routine in transfer structure

Former Member
0 Kudos

i created the following transfer routine for infoObject Zcomments. when i load the data is is give me an error.

Error:

ZCOMMENT : Data record 4 ('000060000228 '): Version 't Inspected By ' is not valid

Routine:

   If TRAN_STRUCTURE-QMART = 'TP'.
    if TRAN_STRUCTURE-ZZQMTXT co 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
      RESULT = TRAN_STRUCTURE-ZZQMTXT.
    elseif TRAN_STRUCTURE-ZZQMTXT co '123456789'.
      RESULT = ' '.
    else.
      RESULT = TRAN_STRUCTURE-ZZQMTXT+3.
    ENDIF.
  Else.
    RESULT = ' '.

Please help me to fix this error.

Thanks

16 REPLIES 16

Former Member
0 Kudos

i think

RESULT = TRAN_STRUCTURE-ZZQMTXT+3.

must be

RESULT = TRAN_STRUCTURE-ZZQMTXT+0(3).


arindam_m
Active Contributor
0 Kudos

Hi,

The Operator CO is case sensitive so may be your comparison to check the content as alphabetic is failing as entry is in small case and compare string is all capital case.

Cheers,

Arindam

raymond_giuseppi
Active Contributor
0 Kudos

I suppose you are converting a free input text (lowercase enabled, space allowed between letters) to an infoobject, so 't Inspected By ' is not a valid value to identify an infoobject.

Try at least, to convert to uppercase, you could also use the tool of My BW Headaches: Invalid Characters.

Regards,

Raymond

0 Kudos

Hi,

Thanks for your reply,

is co allow space between letters?

if not then how do i fix this..... i'm not good in ABAP, please help me to fix this code.

Thanks

0 Kudos

Hi,

You can just include space in the string value of 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. Also as convert yout input string to UPPER CASE (As also suggested by Raymond )using TRANSLATE keyword .

Cheers,

Arindam

0 Kudos

thanks for your reply again.

should i use A B C D E F G H I J K L........ this is dev system, in production, it  has upper case.

is this ok if i use above string value?

0 Kudos

Hi,

You can use the string as

'ABCDEFGHIJKLMNOPQRSTUVWXYZ '

Notice the last space after Z.

Although it is production its upper case would advice to use TRANSLATE <var> TO UPPER CASE. This should help you get things checked in Dev and Quality before its send to production and the statement would not affect anything in production as its already UPPER CASE as per you.

Cheers,

Arindam

0 Kudos

please reply me.

thanks

0 Kudos

hi,

using 'A B C D E F G H I J K L........ ' is also correct,and using at least ' ' is also correct

0 Kudos

Hi Pria,


Do as suggested by Arindam, should work.

Thanks,

Ankit.

0 Kudos

Don't worry to much on space characters, read those two blogs

For more information on CO operator, read log_exp - Comparison Operators for Character-Like Data Types, only one space character is required, Abap check for each character of the first operand if it exists in the seond operand, don't bother with multiple characters.

Regards,

Raymond

0 Kudos

Hi,

Thanks Arindarn,

can you please give me code and where should i put in my routine as you know i'm not good in ABAp

Thanks

0 Kudos

Hi Raymond,

For String Operators like CA, CN,CO, etc. space character matters for Comparison amongst the operands. I have experienced the same during pre-validating some character like fields.

Regards,

Ankit.

0 Kudos

Hi Ankit

can you please explain more?

Thanks

0 Kudos

Hi Pria,

Just see this code snippet,

IF  lv_ekorg CN '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ' .

        IF lv_msg IS INITIAL.

          CONCATENATE 'Invalid Characters - Purchasing Org' space INTO lv_msg RESPECTING BLANKS.

          CONDENSE lv_msg.

        ELSE.

          CONCATENATE lv_msg lc_comma 'Invalid Characters - Purchasing Org' space INTO lv_msg RESPECTING BLANKS.

          CONDENSE lv_msg.

        ENDIF.

      ENDIF.

-> Here i am comparing valid characters in Purchasing Org/EKORG. Now in my case Purchasing Org can be alpha numeric so i have put digits [0-9],[lower case alphabets],[uppercase alphabets] & Space.

This code works fine and checks for all Alphanumeric characters.

Please ask if anything is still unclear.

Regards,

Ankit.

0 Kudos

Hi,

You can do the following:

If TRAN_STRUCTURE-QMART = 'TP'.
    if TRAN_STRUCTURE-ZZQMTXT co 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '.
      RESULT = TRAN_STRUCTURE-ZZQMTXT.
    elseif TRAN_STRUCTURE-ZZQMTXT co '123456789'.
      RESULT = ' '.
    else.
      RESULT = TRAN_STRUCTURE-ZZQMTXT+3.
    ENDIF.
  Else.
    RESULT = ' '.

Check the statement if TRAN_STRUCTURE-ZZQMTXT co 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '. Now it has a space after Z in the string  'ABCDEFGHIJKLMNOPQRSTUVWXYZ '  that should solve your issue.

Cheers,

Arindam