Skip to Content
0
Former Member
Mar 31, 2011 at 08:24 AM

How to reset serial no according to financial year

70 Views

Hi,

I m new for abap. There is a report for challan gate pass, in which i hv to enter serial no for every material. i use following coding for this....

data:ld_tab type zseqno.
clear ld_tab.
loop at it_dtl2.
  select single seqno into it_dtl2-seqno from zseqno
    where mblnr = it_dtl2-mblnr
    and mjahr = it_dtl2-mjahr
    and werks = it_dtl2-werks.
    if sy-subrc ne 0.
      select count(*) into it_dtl2-seqno from zseqno
        where mjahr = it_dtl2-mjahr
        and werks = it_dtl2-werks.
        it_dtl2-seqno = it_dtl2-seqno + 1.
        clear ld_tab.
        ld_tab-mblnr = it_dtl2-mblnr.
        ld_tab-mjahr = it_dtl2-mjahr.
        ld_tab-werks = it_dtl2-werks.
        ld_tab-seqno = it_dtl2-seqno.
        modify zseqno from ld_tab.
    endif.
    clear ld_tab.
    modify it_dtl2.
    clear it_dtl2.
endloop.

In this coding , there is a table ZSEQNO which has MBLNR, MJAHR, WERKS, SEQNO fields.

How to reset serial no according to financial year? It means how to reset serial no in april of every year?

Thanks

Moderator message: code tages added, subject corrected, please choose a meaningful one next time.

Edited by: Thomas Zloch on Mar 31, 2011 10:31 AM