‎2011 Apr 20 1:27 PM
Hi friends.
I'd like to create a number range object with subobjects, each one with its own range.
E.g.: Create a number range object to HKONT, where I can store up to 10 accounts, each one has its onw range.:
account 0000000001 - from 1 to 4999;
account 0000000002 - from 5000 to 9999;
account 0000000003 - from 10000 to 14999;
(...)
account 0000000010 - from 45000 to 49999;
Is it possible ? Or I must forget it and go to creating a transparent Ztable to store those ?
thanks.
Glauco
‎2011 Apr 20 1:31 PM
you can proceed with the Standard number range procedure, i.e you can create number range object ,subobject etc in SNRO transaction. it is possible with the standard number range objects.
‎2011 Apr 20 1:31 PM
you can proceed with the Standard number range procedure, i.e you can create number range object ,subobject etc in SNRO transaction. it is possible with the standard number range objects.
‎2011 Apr 20 1:34 PM
Hi Vijay.
Thanks. I know how to create a basic range and use it by FM number_get_next.
But now, if it's possibgle, how to configure it to work correctly with my issue ?
How do I create subranges ?
thanks.
Glauco
‎2011 Apr 20 2:00 PM
Hi Glauco,
in SNRO -> Number Ranges -> Intervals
you can create N intervals : ex. 01 -> 1000 -4999
02 -> 5000 -9999
in Abap function NUMBER_GET_NEXT , you can fill interval number in NR_RANGE_NR parameter.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZRANGE_ID'
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '02'
object = 'ZRANGE_ID'Edited by: alessandro spadoni on Apr 20, 2011 3:01 PM
Edited by: alessandro spadoni on Apr 20, 2011 3:02 PM
‎2011 Apr 20 2:12 PM
Hi Alessandro.
On this way, I must use hardcode im my code to choose which nr_range_nr to use.
E.g.:
CASE HKONT.
WHEN '0000000001':
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZRANGE_ID'
WHEN '0000000002':
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '02'
object = 'ZRANGE_ID'
WHEN '0000000003':
(...)
WHEN '0000000010':
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '10'
object = 'ZRANGE_ID'
ENDCASE.Do you know if is it the best way to do that ?
I saw some standard objects which have subobjects and use transparente tables. e.g.: for Materials.
thanks.
Glauco
‎2011 Apr 20 2:21 PM
you need to play with the number range configuration. the subobjects will be configured in SNRO only the way you want. But which one you want to choose it is up to you. Assume that for company code 1000 you want one sub object, for other company code you need some other HKONT. in the coding side you decide which subobject you want to pass to number_get_next function module.
‎2011 Apr 20 2:31 PM
the coding what you did is not correct, since you are doing the number range for HKNOT, so you need to introduce another parameter which decides what number range subobject to use.
Example: Based on company code
1000 company code HKONT will be 0000001 to 0000999 ( Subobject 01, object is same all case )
2000 company code HKONT will be 0001000to 0009999( Subobject 02 , .....)
This can be done effectively using another customizing table ( Z table) where you maintain relation between company code and Number range Subobject
in that case flow will be like this...
Read the customizing for company code and get the subobject
with that subobject proceed and create the new account
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = lv_subobj
object = 'ZRANGE_ID'
‎2011 Apr 20 2:51 PM
Hi Vijay.
In your example...
1- How do I create Ztable fields ?
Will be the fields like this ?
- MANDT - (KEY)
- BUKRS - (KEY)
- HKONT
1.1- Does this table must have values registered, to it work ? IF YES, HOW? Do I need this Ztable linked to a domain ?
2- How do I call FM linkecd to each company code ?
Thank you.
Glauco
Edited by: Glauco Kubrusly on Apr 20, 2011 10:51 AM
‎2011 Apr 20 3:07 PM
>
> 1- How do I create Ztable fields ?
> Will be the fields like this ?
> - MANDT - (KEY)
> - BUKRS - (KEY)
> - NUMBER RANGE OBJECT
> - SUBOBJECT
> 1.1- Does this table must have values registered, to it work ? IF YES, HOW? Do I need this Ztable linked to a domain ?
Yes you configure the data before proceeding further. using the maintenance view using SM30, or creating the tcode for maintaing the entries. No not required to link it to a domain.
> 2- How do I call FM linkecd to each company code ?
Assume that you are doing it for a company code, first read the data for the company code from custom table and get the number range object and subobject. then call the function with the parameters. and generate the HKONT with in the range you want.
>
‎2011 Apr 20 3:20 PM
Hi Vijay.
> 1- How do I create Ztable fields ?
> Will be the fields like this ?
> - MANDT - (KEY) - OK
> - BUKRS - (KEY) - OK
> - NUMBER RANGE OBJECT - OK
> - SUBOBJECT - questions bellow:
Do I put the subobject name here ?
Must it have one SUBobject to each subrange I need ?
I have seen a standard object which has its data element linked to a table. It's MATERIALNR, which has data element MTART. Is it different the way I need ?
‎2011 Apr 20 3:29 PM
Do I put the subobject name here ?
Must it have one SUBobject to each subrange I need ?
yes you need it , as you are having different subobjects, so which ever you need you have to configure to company code.
Yes you need to link it the way you explained in your above question.
‎2011 Apr 21 1:36 AM
i think you should make 10 object in SNRO
and you need to call this object for each HKONT
for example
CASE HKONT.
WHEN '0000000001':
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZRANGE_ID1'
WHEN '0000000002':
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZRANGE_ID2'
(...)
WHEN '0000000010':
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZRANGE_ID10'
ENDCASE.Edited by: indrajale on Apr 21, 2011 2:37 AM
‎2011 Apr 23 4:21 PM
Hi Vijay.
I haven't got it. I can't understand how to do that, step by step.
HKONT I mentioned here is a fake hkont. It's from legacy and I just need to get a number range to ench one, from bank TXT file to generate CNAB240 TXT (SAP ECC will read my generated file in FF.5 transaction).
Process:
1st-Receive file from bank --->
---> 2nd-My program process this file (replace each fake hkont to a NEW number) --->
---> Generate a TXT CNAB240 file.
---> This file will be read by SAP ECC FF.5 transaction.
I'll do this way:
- Create one objetct to each hkont;
- Create a Ztable with aqnd fill it with each name of Zobjects and fake hkont;
- From program, I read this Ztable with key fake hkont and give the object name;
- With correct object name, I call FM NUMBER_GET_NEXT and get the next number.
It isn't the correct way but solves my problem for now. After that, if I learn how to do your solution/tip, I'll do that.
So please, if you can explain it step by step, I apreciate your help.
-
My problem is on how to get a number range to each "fake" hkont, and get next correct number to each one. I don't need to separate is by company code, because here we have only one.
Each fake hkong will have one number in each processing time. Each fake hkont will have a "new" number in each processing.
E.g.:
Day one processing : hkont 0000000001 -> get number 000001.
Day two processing : hkont 0000000001 -> get number 000002.
Day three processing : hkont 0000000001 -> get number 000003.
Day one processing : hkont 0000000002 -> get number 5001.
Day two processing : hkont 0000000002 -> get number 5002.
Day three processing : hkont 0000000002 -> get number 5003.
thanks.
Glauco
Edited by: Glauco Kubrusly on Apr 25, 2011 9:13 AM