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

Breaking a Document Number.

Former Member
0 Likes
1,169

Dear gurus.

A document number is of 10 digits.

Example

14 0000 3933.

I want this number to break and saved as 143933.

how to do it ?

Regards

Saad Nisar.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,138

replace all occurences of '0' in var with space.

9 REPLIES 9
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,139

replace all occurences of '0' in var with space.

Read only

0 Likes
1,138

This statement fails when i have the document number

14 0000 3020

don't want to omit the zeros in last 4 digits.

regards

Saad Nisar.

Read only

0 Likes
1,138

okie i just want to know whether the zeros are constant at that position for all doc numbers ?

then.



data:begin of wa_doc,
        pos1(2) type c,
        pos2(4) type c,
        pos3(4) type c,
        end of wa_doc.

wa_doc = doc_number.

clear doc_number.

concatenate wa_doc-pos1 wa_doc-pos3 into doc_number.

or


data:length type i,
     offs type i,
     doc_number type mblnr value '1400001004'.

FIND '0000' IN doc_number MATCH OFFSET offs
                          MATCH LENGTH length.

REPLACE SECTION OFFSET offs LENGTH length of
                doc_number WITH space.


write doc_number.

Edited by: Keshu Thekkillam on Aug 6, 2009 2:59 PM

Edited by: Keshu Thekkillam on Aug 6, 2009 3:05 PM

Read only

0 Likes
1,138

Thanks Keshu Thekkillam it helped.

can this thing be done in customer name

like the customer name is H. NAZIR TRADING COMPANY

i just want to use H. NAZIR.

can it be done with the same code.

regards

Saad Nisar

Read only

0 Likes
1,138

Jus try

Read only

0 Likes
1,138

Thanks Bro...

My query is solved.

Read only

Former Member
0 Likes
1,138

Hi,

If all the numbers are of the same format, you can use offset and concatenate. Note that you have to declare the variable as char to do this.


data: temp(12) type c,
         temp1(2) type c,
        temp2(4) type c,
        temp3(8) type c.

temp = '14 0000 3933'.
temp1 = temp+0(2).
temp2 = temp+8(4).

concatenate temp1 temp2 into temp3.

Now temp3 will have the value '143933'.

Regards,

Vik

Read only

Former Member
0 Likes
1,138
concatenate docno(2) docno+8(4) into docno.

Regards,

Sumit Nene.

Read only

former_member404244
Active Contributor
0 Likes
1,138

HI,

Please tell clearly do you want to delete 3,4,5,6 digits(in ur case 0,0,0,0) or only zeros....For ur example u can do like this

number = 1400003933.

var1 = number+0(2).

var2 = number+6(4).

concatenate var1 var2 into number.

Now ur number is 143933.

Regards,

Nagaraj