Application Development and Automation 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: 
Read only

concatenation problem

Former Member
0 Likes
967

Hi

I have four fields related with Documennt info record.

document type 3 char value "OSM"

document number 25 char value "G2345-1234"

document version 2 char "01"

docuemnt part 3 char "000"

I have to concatenate all these four field including space into another field (objkey) as follow.

objkey = "OSMG2345-1234 01000"

9 REPLIES 9
Read only

Former Member
0 Likes
938

<b>

concatenate document_type document_number version document_part into objkey.</b>

Read only

Former Member
0 Likes
938

concatenate document_type document_number into objkey1.

concatenate version document_part into objkey2.

concatenate objkey1 objkey2 into objkey separated by space.

Read only

Former Member
0 Likes
938

concatenate field1(document type) field2(document number) to fieldA.

Concatenate fieldA field3(docuemnt part ) into fieldB separeated by space.

Read only

0 Likes
938

I want the output like

objkey = "OSMG2345-1234<15 spaces>01000"

because the width of Object number is 25 char

Read only

0 Likes
938

use write statement :

Write: variable( document type) to fieldA.

Write: varible (document number) to fieldA+3(25).

Write: Variable (document version) to fieldA+28(2)

write :varible (docuemnt part) to FieldA+30(3).

Read only

Former Member
0 Likes
938

Hi,

Try this code.

Concatenate document type document number document version docuemnt part INTO objkey.

The main point is when you declaring you document number, please dont use documentnumber(25) TYPE c, but rather declare it as documentnumber TYPE (refer to the relevant table field name which contain 25 char).

Hopes it helps.

Thanks.

Read only

Former Member
0 Likes
938

Hi Amandeep,

Store it in a structure gs_dir (for Document Info Record).

begin of gs_dir,

doc_type ...

doc_number ..

version ...

part ...

end of gs_dir.

now store the value in this gs_dir, and wherever u want the concatenated value refer to gs_dir, which will have the value with sufficient number of spaces.

Pls award points and close the thread, if your Question is answered.

Rgds,

Prash >

Read only

Former Member
0 Likes
938

WRITE: doc_type TO objkey+0(3),

doc_nbr TO objkey+3(25),

doc_ver TO objkey+28(2),

doc_part TO objkey+30(3).

Otherwise, defining a structure with the 4 fields, as described above will be the best option.

Srinivas

Read only

0 Likes
938

if you want to preserve the whitspaces in concatenation dont use single quotes use `

for example.

data: output type string .

concatenate ' 1 2 ' '34 56 78 ' '9 .' into output .

clear output .

concatenate ` 1 2 ` `34 56 78 ` `9 .` into output .

Try this code and see the difference .

Regards

Raja