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

saving into Ztable and generate a number through coding

Former Member
0 Likes
1,292

Hi Friends,

I am very new to Module Pool.Here in my screen header i have vendor number,Vendor name,

bank Name, Branch, LC value and Due date fields.

and for item details i have to take table control.In the item details i have the fields Sl No, PO Number and Po Value.

and Two push buttons i need to put.SAVE and CANCEL.

When i click on SAVE all my screen details should be saved in a ZTABLE and should generate a LCDOCUMENT-Number from the system.

How can i proceed.Plz provide me with ur inputs.

Hi Friends,

I am very new to Module Pool.Here in my screen header i have vendor number,Vendor name,

bank Name, Branch, LC value and Due date fields.

and for item details i have to take table control.In the item details i have the fields Sl No, PO Number and Po Value.

and Two push buttons i need to put.SAVE and CANCEL.

When i click on SAVE all my screen details should be saved in a ZTABLE and should generate a LCDOCUMENT-Number from the system.

How can i proceed.Plz provide me with ur inputs.

5 REPLIES 5
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
783

Hi,

In ABAP number generation is generally done using Number range objects. Transaction SNRO.

You can use the function module NUMBER_GET_NEXT to generate a number once you create your number range object and interval.

For saving to the Ztable you should use INSERT or MODIFY statement.

Regards,

Sesh

Read only

Former Member
0 Likes
783

Hi Sameera,

Since you mentioned that you are new to module pool. i wanna add a few things to Sesh's answer.

Addition is that you need to write this code in the sy-ucomm of the save button.

The mentioned function module takes number range object as input.

you need to create this number range in SNRO transaction and set a from interval and to interval

Regards

Sajimon

Read only

0 Likes
783

Hi thanks for ur inputs and Any sample code for my requirement plz?

If u have any sample code for the above plz let me know.

Edited by: Sameera shaik on Apr 15, 2009 10:45 AM

Read only

Former Member
0 Likes
783

Hi Sameera,

Following link can help you for getting sample code.

Thanks,

Smita

Read only

Former Member
0 Likes
783

Hi Sameera,

see the below example to create and call ...


Tables used for ranges:

NRIV Number range intervals. Note: Field NRLEVEL Contains the last assigned
number.                                  

TNRO Definition of number range objects

Ranges are maintained in transaction SNRO




Q:

Just another chance to show my ignorance.  Isn't there a function for returning
a unique key and isn't there also a configuration method for describing the
range of those objects.  I know that there is something like that for EDI but I
can't identify it.  I need to retrieve a key for a user defined field in IS-U
CCS 1.2 for sap 4.0B.

A:

You can use a range object . You define ranges in transaction SNRO. The number in the ranges automatically increment ebvery time you use a new number.

Use the function NUMBER_GET_NEXT to get the next number in the range:

   call function 'NUMBER_GET_NEXT'                               
        exporting                                                
             nr_range_nr		= '01'                      
             object		= 'ZCOSTA'                  
             quantity		= '1'                       
        importing                                                
             number		= i_zcostafstm-zafstemnr    
*           quantity		= ' '                      
*           RETURNCODE              =                           
        exceptions                                               
             interval_not_found      = 1                         

             number_range_not_intern = 2                         
             object_not_found        = 3                         
             quantity_is_0           = 4                         
             quantity_is_not_1       = 5                         
             interval_overflow       = 6                         
             others                  = 7.                        

Regards,

Prabhudas