cancel
Showing results for 
Search instead for 
Did you mean: 

Document Number templates

Former Member
0 Kudos

How Gurus

I would like to have a document number that includes a fixed part and a changing part, for example PF/HCM/0001, i want PF/HCM/ to be fixed and then the number will always increase, how can i make this happen. I have tried checking on number assignements but i couldnt get anything meaningfull but i have a feeling that this is possible in SAP, pliz help me.

partson

Accepted Solutions (1)

Accepted Solutions (1)

roopa_ms
Participant
0 Kudos

Hi

You can have the number assignment 3 -Mixed Number assignment with Exit so that if you pass ABC as document number it appends a number to it . But while creation , document number field cannot be left blank.

If you want to automatically generate this number try implementing the BADI ,DOCUMENT_NUMBER01~DOCNUMBER_CHECK() .

make sure that the number assignment for the documenttype is either blank or 1 .

you can try something like this :

METHOD if_ex_document_number01~docnumber_check.

DATA : tdwa TYPE tdwa.

DATA: subrc TYPE inri-returncode,

number LIKE draw-doknr,

number1 LIKE draw-doknr,

new_number LIKE draw-doknr,

new_num TYPE string,

lv_docnum1 TYPE string.

CHECK sy-uname = 'MSRO'.

CHECK tcode = 'CV01'.

CHECK draw-doknr = '' OR draw-doknr = '*'.

CALL FUNCTION 'CV200_DB_TDWA_SELECT'

EXPORTING

pf_dokar = draw-dokar

IMPORTING

psx_tdwa = tdwa

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • Implement suitable error handling here

ELSE.

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = tdwa-inumnr

object = 'DOKUMENT'

IMPORTING

number = number

returncode = subrc

EXCEPTIONS

interval_not_found = 4

number_range_not_intern = 8

object_not_found = 12

quantity_is_0 = 16.

CONCATENATE 'ABC' '-' number INTO new_num.

WRITE new_num TO doc_number.

CONDENSE doc_number NO-GAPS.

ENDIF.

ENDMETHOD.

This should work .

Best Regards,

Roopa

Former Member
0 Kudos

HI roopa i did as u specify in the above. do i need to change the standar program also MCDOKZNR.

i done as u mention above and when i check in cv01n . it didnot concatenated.

plz help

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

I am trying to give some idea,

1. Define number ranges (intervals)

For external number ranges, set the Indicator: external number assignment.

More hints

If you maintain several number ranges for document management, the number ranges must not overlap.

If you assign an alphanumeric number, the system does not check the number against any number range, unless you are using a user exit.

You can configure a check route for number assignment programs using user exits.

Example:

You can enter a template (prefix) which defines a classifying component of the number. You can write a check routine (using a user exit) that checks your entry and completes it with a unique internal number.

External component: 2NG-

Internal component: XXXX (from a number range)

Template: 2NG-XXXX

Do not change the number range status of internal number range intervals.

Benakaraja

??

Former Member
0 Kudos

Hello,

You can achieve this using 'Z' number generation exit. Develop exit 'ZMCDOKZNR' by copying standard number generation exit and put necessary logic in it. Assign this exit in configurations of that specific document type in field "Number Exit". With help of good technical consultant you can achieve this easily.

Regards,

Milind Dumbre