Skip to Content
author's profile photo Former Member
Former Member

mat do with seq number

HI

my logic is like this with material document number i need to increse the sequence number. my doc will be having same mat number as well different mat numbers.

i did the coding like this below

data: wcount(6) type n.

data: wrecord(6) type n VALUE '000000'.

describe table t_z4b2 lines wrecord.

clear t_z4b2.

read table t_z4b2 index wrecord.

write t_z4b2-wseqno+5(6) to wrecord.

wrecord = wrecord + 1.

describe table 4b2tbl lines wcount.

if wcount > 0.

loop at 4b2tbl.

at new wmblnr. wrecord = wrecord + 1. endat.

concatenate preatsg wrecord into 4b2tbl-wseqno.

modify 4b2tbl.

move-corresponding 4b2tbl to t_z4b2.

append t_z4b2.

endloop.

modify z4b2 from table t_z4b2.

endif.

endform. "GetSeqNo

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 08:07 AM

    hi Nihi,

    Check

     loop at 4b2tbl.
    at new wmblnr. 
    <b>Read table statement </b>
    wrecord = wrecord + 1. endat.
    
    concatenate preatsg wrecord into 4b2tbl-wseqno.
    modify 4b2tbl.
    
    move-corresponding 4b2tbl to t_z4b2.
    append t_z4b2.
    endloop.

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 08:11 AM

    Ur requirement is not so clear hence difficult to comment on the logic but as per the interpretation of your code it would try and do the below.

    1. It counts the records from t_z4b2 table.

    2. Increment the counter to total records in t_z4b2 by 1.

    3. Loops at 4b2tbl and at each new wmblnr increments the counter by 1 and uses the same to update.

    Here, U dont need wcount check as loop would not execute if the table 4b2tbl has no records. Secondly, the counter is incremented twice before the first document.(Since you increment it after the describe table t_z4b2 and also in at new event.)

    Regards

    Anurag

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.