Create or Change number range for a object

Create or Change number range for a object
Change is used have consistent record in sap for a particular object.Here i have described about address number ,for Ex:-When we create a vendor using BAPI we need update the address in ADRC table,in order to maintain consistent record for sap it creates a internal number i.e address number in ADRC or other table.

Generate number for an object using NUMBER_GET_NEXT

 Generate number for an object using NUMBER_GET_NEXT

The  requirement was to generate a unique internal number for vendor address.

This is a function module to generate a  unique internal number in SAP system .
First of all FM NUMBER_RANGE_ENQUEUE
will lock the number range generator and then  
FM NUMBER_GET_NEXT will get the next available number 
FM NUMBER_RANGE_DEQUEUE will unlock the FM




How to create vendor master in SAP











  • Check for the vendor existence 
  
use function module BAPI_VENDOR_EXISTENCECHECK

       CALL FUNCTION 'BAPI_VENDOR_EXISTENCECHECK'

      EXPORTING

        vendorno    = l_f_lifnr "Vendor

        companycode = p_bukrs   "company code

      IMPORTING

        return      = g_r_return.   ( g_r_return TYPE bapiret1.)

      IF g_r_return-type CA 'AEX' .

      Vendor does not exist.

   ELSEIF  g_r_return-type IS INITIAL

    vendor alredy exits 

     MESSAGE I521(FN) WITH l_f_lifnr.

   endif. 

    Populate all the mandatory fields                       i_lfa1 "Vendor Master: General data address,country etc i_lfb1 "Vendor Master: Company data i_lfm1 "Vendor Master: Purchasing Data (Purchasing organization)   t_xlfbk "Bank details  
     Create vendor                   CALL FUNCTION 'VENDOR_INSERT' "in update task
        EXPORTING
          i_lfa1        = i_lfa1 "Vendor Master: General data
          i_lfb1        = i_lfb1 "Vendor Master: Company data
          i_lfm1        = i_lfm1 "Vendor Master: Purchasing Data (Purchasing organization)
        TABLES
          t_xlfas       = t_xlfas
          t_xlfb5       = t_xlfb5
          t_xlfbk       = t_xlfbk "Bank details
          t_xlfza       = t_xlfza
          T_XKNVK       = T_XKNVK
                .
      IF sy-subrc = 0.
        COMMIT WORK.
    *Vendor is created
      ELSE.
    *  Error while creating vendor
      ENDIF.  

 Protected by Copyscape Web Copyright Checker

Create vendor using BAPI

Create vendor using BAPI

  CALL FUNCTION 'VENDOR_INSERT' "in update task
    EXPORTING
      i_lfa1        = i_lfa1 "Vendor Master: General data:- address,country etc
      i_lfb1        = i_lfb1 "Vendor Master: Company data accounting information
      i_lfm1        = i_lfm1 "Vendor Master: Purchasing Data (Purchasing organization)
    TABLES
      t_xlfas       = t_xlfas
      t_xlfb5       = t_xlfb5
      t_xlfbk       = t_xlfbk "Bank details
      t_xlfza       = t_xlfza
      T_XKNVK       = T_XKNVK
            .
  IF sy-subrc = 0.
    COMMIT WORK.
*Vendor is created
  ELSE.
*  Error while creating vendor
  ENDIF.



Protected by Copyscape Web Copyright Checker

/*Newer Posts*/ Older Posts Home