Bapi to create cusomer accounting

Hi all,
can anyonre tel me the bapi to Create Customer (Accounting)
Thanks

<b>BAPI_CUSTOMER_CREATE</b>
Create Customer Master Online
With this method, you can create or extend a customer.
<b>BAPI_CUSTOMER_CREATEFROMDATA</b>
  Note: In SAP R/3 4.5A, this BAPI is replaced by BAPI
"<b><i>BAPI_CUSTOMER_CREATEFROMDATA1</i></b>", which takes full account of the
integration of customer address data in Central Address Management
(CAM). As this BAPI ("BAPI_CUSTOMER_CREATEFROMDATA") is being replaced,
it will only be supported for 2 releases after SAP R/3 4.5A.
This method of the "Customer" business object can be used to create a
customer in SAP R/3 on the basis of entered address data (import
parameter PI_ADDRESS).
The entered address data has a direct influence on the master data,
company code data and contact person data. One contact person record is
created for the customer to be created.
All the master data, company code data, sales area data, and tax code
data that is not entered is adopted from a reference customer, and from
sales area data (sales organization, distribution channel and division -
import parameter PI_COPYREFERENCE).
(Exception: Currency field of the sales area data. This field can be
transferred to the BAPI via structure PI_ADDRESS via the currency fields
(in R/3 or in ISO format).
If both currency fields are transferred to the BAPI, the currency field
in R/3 format has priority.
If both currency fields are blank when transferred to the BAPI, the
currency field is determined using table T005, on the basis of the
country that is specified.
Message was edited by:
        Chandrasekhar Jagarlamudi

Similar Messages

  • What is the BAPI for creating BP account / contact ?

    Hello experts,
    what is the BAPI for creating BP account / contact ?
    Please replay me as erarly as possible. Urgent requirment.
    Thanks,
    HP

    Hi,
    I think it is for bua1.
    Below are other bapi's which migt be useful:-
    BAPI_BPCONTACT_ADD_TO_ASGN BAPI Partner Sales Activity AddToAssigned
    BAPI_BPCONTACT_CHANGE BAPI Change Partner Sales Activity
    BAPI_BPCONTACT_CREATEFROMDATA BAPI Partner Sales Activity Create from Data
    BAPI_BPCONTACT_CREATEWITHDIA BAPI Partner Sales Activity - Create from Data Dialog
    regards
    Sandipan

  • BAPI to create an account in SAP Banking

    I'm trying to create an account in SAP Banking using BAPI BAPI_BCA_ACCOUNT_CREATE.
    The path for account creation is given below for reference.....
    SAP Menu->Financial Services->Account Management->Account->Account Master Data->Create Account (Transaction BCA_CN_ACCT_01)
            The execution of BAPI is successful and it's generating an internal id. How to get the Account number from this internal id?
            May be, internally it's reserving an account number. For example, If last created account was IN/969696/0000000122/, after running the BAPI, if I try to create an account manually again, then it's creating an account with number IN/969696/0000000124/. But I'm unable to view A/c IN/969696/0000000123/ created by the BAPI in BCA_CN_ACCT_03 as it says the account number doen't exist.
           The same process is working fine when i'm using BDC for transaction BCA_CN_ACCT_01 and I'm able to see the account number in BCA_CN_ACCT_03.
    I'm calling BAPI_BCA_ACCOUNTAM_SAVE_ALL and BAPI_TRANSACTION_COMMIT after calling the BAPI as well.
    Is there any other process involved? Do I have to call any other BAPI to get the account no in external format?
    Kindly help.........

    Hello Keshav,
                           Thanks a lot for your reply......
    The BAPI BAPI_CREATE_ACPOOL is not available in SAP Banking. Currently, I've done it with BDC, to provide a temporary solution.
    KIndly share sample code or documentations for this BAPI, if someone has worked on it.

  • BAPI to create customer records (XD03)

    Hi
    I've seen some similar threads to this but I'm not sure the question is fully answered yet.
    Is there a single, or are there multiple BAPI's available that will fully create a customer master record, by which I mean all the company code data as well as te Sales area data?  I am aware of the BAPI_CUSTOMER_CREATEFROMDATA1, but this doesn't appear to meet the full requirement.  Also I'm slightly alarmed by the 'Only for ONLINE Store!!!' comment in the documentation.
    Previous posts on this forum and on others suggest that to fully create a customer record people have had to resort to writing their own BDC programs.  Is there anyone who can confirm that this is the case?
    Thanks for your help.
    Dominic

    Hi
    Thanks for the welcome and the advice.
    While researching this further I came across SAP note 390045 which is directing me away from using the BAPI route.  I realise now that I didn't mention in the original post that the idea we're investigating is having the data for the customer accounts created externally to SAP and then call a BAPI to create the account in SAP.
    I suspect we could achieve this but it's getting a bit messy so ALE might be the better option.
    Thanks,
    Dominic.

  • How to create an Accounting Document by calling BAPI

    Hai friends ,
    please tell me how to call this BAPI and fulfill all the parameters .. Please help me , I dont know the head and tail of it ...
    create an Accounting Document by calling BAPI  BAPI_ACC_DOCUMENT_POST
    Below is the step to fill the parameters for BAPI:
    Enter company code, invoice no, invoice date, document type, header text into DOCUMENTHEADER
    Enter customer, item text, company code, payment term into ACCOUNTRECEIVABLE
    Enter offset account, company code, document type, item text into ACCOUNTGL
    Enter currency type u201800u2019, currency, exchange rate, amount into CURRENCYAMOUNT. Please note there will be two rows in this table, one positive amount and one negative amount
    Call the BAPI to create the AR document. If p_check is checked, call the BAPI only without COMMIT and then do the message processing
    If p_check is initial, COMMIT the data to the database tables.
    Check the RETURN table after each BAPI, if no u2018Eu2019 message type found, output the document no. Otherwise, output the error messge to the screen with the message type u2018Eu2019.
    thanks in advance ...

    Hi,
    Check the link
    http://www.sapbrainsonline.com/sapinfo/tutorial.php?artid=617
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_acc_document_post-error-1973720
    http://delaynomore.spaces.live.com/blog/cns!D2BFFB84EDFE4189!528.entry
    http://sap4.com/wiki/index.php?title=BAPI_ACC_DOCUMENT_POST
    http://www.sapfans.com
    Anurodh

  • Reg : BAPI create GL account

    Hi ,
    I need to create the GL (Company code data thro FSS1 transaction) .Data is available in Excel file . Is there any BAPI to create GL for this transaction?....
    Regards,
    Krishna.

    Hi
    This is a small BDC program which is enough to upload this GL accounts
    see the sample code
    ABAP Name   :   ZFI_GL_FSS0
    Description :   This Program is used to Upload the
                     GL Account Master using Transaction FSS0.
    REPORT zfi_gl_fss0
           NO STANDARD PAGE HEADING
           LINE-SIZE 255.
    Standard Include for Selection Screen
    INCLUDE bdcrecx1.
    Internal Table for Upload Data
    DATA: BEGIN OF i_gl OCCURS 0,
            saknr(010),            " GL Account
            bukrs(004),            " Company Code
            waers(005),            " Currency
            xsalh(001),            " BAl Local Curr Ind
            mwskz(002),            " Tax Category
           xopvw(001),            " Open Item Ind
           xkres(001),            " Line Item Ind
            zuawa(003),            " Sort Key
            fstag(004),            " Field Category
          END OF i_gl.
    Data Variables & Constants
    CONSTANTS : c_x             VALUE 'X',  " Flag
                c_tax           VALUE '0'.  " Tax Category
    Parameters
    PARAMETERS: p_file LIKE ibipparms-path.  " Filename
    At selection-screen on Value Request for file Name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Get the F4 Values for the File
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
    Start of Selection
    START-OF-SELECTION.
    Open the BDC Session
      PERFORM open_group.
    Upload the File into internal Table
      CALL FUNCTION 'UPLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'
        TABLES
          data_tab                = i_gl
        EXCEPTIONS
          conversion_error        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          OTHERS                  = 7.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Upload the Data from Internal Table
      LOOP AT i_gl.
    Initial Screen
        PERFORM bdc_dynpro      USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN'
                                         '2001'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=ACC_CRE'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'GLACCOUNT_SCREEN_KEY-SAKNR'.
        PERFORM bdc_field       USING 'GLACCOUNT_SCREEN_KEY-SAKNR'
                                      i_gl-saknr.
        PERFORM bdc_field       USING 'GLACCOUNT_SCREEN_KEY-BUKRS'
                                      i_gl-bukrs.
        perform bdc_dynpro      using
                           'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=TAB02'.
        perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-WAERS'
                                      i_gl-WAERS.
        perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XSALH'
                                      i_gl-XSALH.
        perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-MWSKZ'
                                      i_gl-MWSKZ.
        perform bdc_field       using 'BDC_CURSOR'
                                      'GLACCOUNT_SCREEN_CCODE-ZUAWA'.
       perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XOPVW'
                                     i_gl-XOPVW.
        perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XKRES'
                                      c_x."i_gl-XKRES.
        perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'
                                      i_gl-ZUAWA.
        perform bdc_dynpro      using
                             'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=SAVE'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'GLACCOUNT_SCREEN_CCODE-FSTAG'.
        perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-FSTAG'
                                      i_gl-FSTAG.
    Call The Transaction
        PERFORM bdc_transaction USING 'FSS0'.
      ENDLOOP.
    Close the BDC Session
      PERFORM close_group.
    Regards
    Anji

  • BAPI Create Contract Account in Module PSCD

    Hi all,
    I have a requirement create Contract Account (TCode CAA1) in module PSCD by BAPI.
    I use BAPI : BAPI_CTRACCONTRACTACCOUNT_CR1.
    I set value for some required parameters and Perform BAPI, i receive 2 error messages in RETURN parameter :
    - Enter a value in field Account Determ. ID
    - Enter a value in field Payment Terms
    I don't know where to set value for Account Determ.ID and Payment Terms in BAPI.
    I searched description of BAPI parameters but there is no BAPI parameter suitable.
    I also searched on this forum but no topic found.
    Pls help,
    Thank.
    nvsinh.

    Hi all,
    The problem is solved.
    The proplem comes from release version of ECC6.
    Thanks all,
    Sinhto

  • BAPI to create Steel Surch Debit (From VA01 Transaction)

    Hi,
    I need a bapi to create steel surch debit,if we give order type zdr1 in va01 it will create a steel surch debit memo,I tried with BAPI
    1.BAPI_SALESDOCU_CREATEFROMDATA1
    2.BAPI_SALESDOCU_CREATEFROMDATA2
    3.BAPI_SALESDOCU_CREATEFROMDATA
    1st  and 2nd  bapi will not work for zdr1 order type (or document type L).
    3rd bapi i am using is generating error 'Enter sold to party' ,But i am not finding any field of kunnr or solod to party,Importing parameter it is there but nothing is work out

    Hi Thomas,
    The case which is missing for me is when I should update an account corresponding to an alternative chart of account (which is normally done via FSP0).
    I'm pretty sure that I could not call directly transaction FSP0 (as I did with FS00) according to documentation of rfbisa00. The response could be 'FSP0 not supported'.
    Do you think that we could deal with this issue also with RFBISA00 for Tx FSP0?
    Or is there another standard code for FSP0?
    Best Regards,
    Moez.

  • Bapi for create po

    I want to run bapi to create  purchase order for that  I had checked the function module "BAPI_PO_CREATE" in that I had filled all the required fields  to run the function module although  it is showing two errors
    1  E 06026 " Please enter material number or account assignment category"
    2  E 06010 " Document contains no items"
    I had entered the appropriate material but still it is showing the error and PO number is not generating.

    1st Pass the header data
      CONSTANTS : c_x VALUE 'X'.
          header-comp_code  = xxx.
          header-doc_type   = xxx.
          header-creat_date = sy-datum.
          header-item_intvl = '10'.
          header-vendor     = xxxx.
          header-langu      = ws_langu   .
          header-purch_org  = xx.
          header-pur_group  = xxx.
          header-currency   = 'INR'.
          headerx-comp_code  = c_x.
          headerx-doc_type   = c_x.
          headerx-creat_date = c_x.
          headerx-item_intvl = c_x .
          headerx-vendor     = c_x.
          headerx-langu      = c_x.
          headerx-pmnttrms   = c_x   .
          headerx-purch_org  = c_x.
          headerx-pur_group  = c_x.
    loop.
        p_int = p_int + 10.
        wa_item-po_item  = p_int.
        wa_item-material = xxxxx.
        wa_item-plant    = xxxx.
        wa_item-quantity = xxxx.
        wa_item-tax_code = 'V0'.
        wa_item-no_more_gr = 'x'.
        APPEND wa_item TO it_item.
        wa_itemx-po_item    = p_int.
        wa_itemx-material   = c_x.
        wa_itemx-plant      = c_x .
        wa_itemx-quantity   = c_x .
        wa_itemx-tax_code   = c_x .
        wa_itemx-no_more_gr = c_x .
        APPEND wa_itemx TO it_itemx.
    endloop.
          p_pono = ' '.
    *AUTO Po Creation
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader         = header
              poheaderx        = headerx
            IMPORTING
              exppurchaseorder = p_pono
            TABLES
              return           = return
              poitem           = it_item
              poitemx          = it_itemx.
    try using this code

  • How to use BAPI_REQUISTION_CREATE to create pr account cat is space

    Hi expert !
      I try to use BAPI_REQUISTION_CREATE to create PR which account cat is space (Inventory PR) but I found error commitment check that it seem I don't pass FUNDS and FUND_CENTER data but I pass it to table PRACCOUNTASSIGNMENT. IF I use BAPI_PR_CREATE, I can pass FUNDS and FUND_CENTER in Table PR_ITEMS and it can create PR but not commitment documents in FM Module. So I try to use BAPI_REQUISTION_CREATE instad because this BAPI can create PR and create commintment documents in FM Module.
    Thanks ...

    Hi... Here is sample code that I found error commitment check...
    report z_req_create.
    DATA : T_REQUISITION_ITEMS LIKE BAPIEBANC OCCURS 0 WITH HEADER LINE,
    T_RETURN LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE .
    DATA : E_NUMBER LIKE BAPIEBANC-PREQ_NO.
    T_REQUISITION_ITEMS-DOC_TYPE = 'NB'.
    T_REQUISITION_ITEMS-DEL_DATCAT = '1'.
    T_REQUISITION_ITEMS-DELIV_DATE = '20020626'.
    T_REQUISITION_ITEMS-PLANT = 'P1'.
    T_REQUISITION_ITEMS-STORE_LOC = '01'.
    T_REQUISITION_ITEMS-PUR_GROUP = 'P01'.
    T_REQUISITION_ITEMS-MAT_GRP = '01'.
    T_REQUISITION_ITEMS-PREQ_ITEM = 1.
    T_REQUISITION_ITEMS-MATERIAL = '1MAT1'.
    T_REQUISITION_ITEMS-QUANTITY = 10.
    T_REQUISITION_ITEMS-PREQ_NAME = '123456'.
    T_REQUISITION_ITEMS-PURCH_ORG = '1000'.
    T_REQUISITION_ITEMS-ACCTASSCAT = ' ' .   =====> Account Cat is space
    T_REQUISITION_ITEMS-VEND_MAT = 'G'.
    APPEND T_REQUISITION_ITEMS.
    T_REQ_ACCOUNT_ASSIGNMENT-PREQ_ITEM = 1.
    T_REQ_ACCOUNT_ASSIGNMENT-SERIAL_NO = 1
    T_REQ_ACCOUNT_ASSIGNMENT-FUNDS_CTR = 'FUNDCENTER001'.
    T_REQ_ACCOUNT_ASSIGNMENT-FUND = 'FUND001'.
    APPEND T_REQ_ACCOUNT_ASSIGNMENT.
    CALL FUNCTION 'BAPI_REQUISITION_CREATE'
    EXPORTING
    SKIP_ITEMS_WITH_ERROR =
    IMPORTING
    NUMBER = E_NUMBER
    TABLES
    REQUISITION_ITEMS = T_REQUISITION_ITEMS
    REQUISITION_ACCOUNT_ASSIGNMENT = T_REQ_ACCOUNT_ASSIGNMENT
    REQUISITION_ITEM_TEXT =
    REQUISITION_LIMITS =
    REQUISITION_CONTRACT_LIMITS =
    REQUISITION_SERVICES =
    REQUISITION_SRV_ACCASS_VALUES =
    RETURN = T_RETURN
    REQUISITION_SERVICES_TEXT =
    EXTENSIONIN =
    REQUISITION_ADDRDELIVERY =
    IF NOT E_NUMBER IS INITIAL .
    WRITE:/ 'REQ NO:' , E_NUMBER , 'CREATED'.
    ELSE.
    LOOP AT T_RETURN.
    WRITE T_RETURN-MESSAGE.
    ENDLOOP.
    ENDIF.

  • Problem in creating an account document using BAPI_ACC_DOCUMENT_POST

    Hi Experts,
    I have a porblem while creating an account document from BAPI_ACC_DOCUMENT_POST.
    The problem is acc document is geeting posted and I am getting an document number for that bapi, but its not getting saved to data base and I am getting the following error message
    "Document 1900004327 3000 does not exist in fiscal year 2005
    Message no. F5A397
    System Response
    The required document either does not exist in the fiscal year or is still being posted.
    When the document is read, archived documents are also considered."
    Please sugggest...
    We are using ECC 6.0
    Thanks,
    Suma.

    Hi,
    this means that the posting is not open...
    try with 2008...
    or else ask ur financial consultatto check, whether the 2005 is open or not.
    u also try posting manually using FB01 with same entries u r using for this BAPI...so that u can track the error.
    Also use BAPI_TRAACTION_COMMIT after bapi post.
    check ur subsystem which u r passing for the BAPI..
    wa_general-assetsubno = '0000'. Is it 3000 or 0000
    Try using 0...
    Edited by: Sumi Vasu on May 14, 2008 8:13 AM

  • BAPI for create material master (SAP version 40b)

    Hi,
    Anyone know BAPI for create material master for SAP version 40b?
    There's no BAPI_MATERIAL_SAVEDATA.
    I try to use BAPI_MATERIAL_MAINTAINDATA_RT,
    but seems that BAPI only for retail.
    Kindly advice!
    Thanks,
    Victor.

    Hi,
        this one works pretty good.
    call function 'MATERIAL_MAINTAIN_DARK'
             exporting
                  sperrmodus                = ' '
                  kz_prf                    = 'W'
                  max_errors                = ' '
                  p_kz_no_warn              = 'X'
                  kz_verw                   = 'X'
                  kz_aend                   = 'X'
                  kz_dispo                  = 'X'
                  kz_test                   = ' '
                  flag_muss_pruefen         = ' '
                  call_mode                 = 'ACT'
             importing
                  number_errors_transaction = numerror
                  matnr_last     = last_matnr
             tables
                 amara_ueb      = i_mara    "Basic Data
                amakt_ueb      = i_makt    "Descriptions
                 amarc_ueb      = i_marc    "Plant
                amard_ueb      = i_mard    "Storage Location
               AMFHM_UEB      = I_MFHM    "Production Tools
                amarm_ueb      = i_marm    "Units of Measure
               AMEA1_UEB      = I_MEA1    "Internal Mangagement -  EANs
                ambew_ueb      = i_mbew    "Accounting/Costing
                asteu_ueb      = i_steu    "Tax Data
                astmm_ueb      = i_steumm  "Tax Data
               AMLGN_UEB      = I_MLGN    "Warehouse Data
               AMLGT_UEB      = I_MLGT    "Storage Type Data
               AMPGD_UEB      = I_MPGD    "Change Documents
               AMPOP_UEB      = I_MPOP    "Forcast Parameters
               AMVEG_UEB      = I_MVEG    "Total Consumption Data
               AMVEU_UEB      = I_MVEU    "Unplanned Consumption Data
                amvke_ueb      = i_mvke    "Sales Data
                altx1_ueb      = i_ltx1    "Sales Text
               AMPRW_UEB      = I_MPRW    "Forcast Values
                 amfieldres     = i_delfields
                 amerrdat       = i_errors
             exceptions
                  kstatus_empty             = 01
                  tkstatus_empty            = 02
                  t130m_error               = 03
                  internal_error            = 04
                  update_error              = 05
                  too_many_errors           = 06.
    Otherwise try BAPI_RETAILMATERIAL_CREATE
    BAPI_STANDARDMATERIAL_CREATE
    <b>Reward points</b>
    Regards

  • Is there any BAPI for creating Debit memo request

    Hi all,
    I used BAPI_ACC_BILLING_POST ,but it does not seems to help me.Is there any other BAPI for creating Debit memo request which takes.
    Thanks and regards,
    Meena.

    hi,
    I could find the following
    Exit Name           Description
    J_3RSINV
    SDVFX001            User exit header line in delivery to accounting
    SDVFX002            User exit for A/R line in transfer to accounting
    SDVFX003            User exit cash clearing in transfer to accounting
    SDVFX004            User exit G/L line in transfer to accounting
    SDVFX005            User exit reserves in transfer to accounting
    SDVFX006            User exit tax line in transfer to accounting
    SDVFX007            User exit: Billing plan during transfer to Accounting
    SDVFX008            User exit: Processing of transfer structures SD-FI
    SDVFX009            Billing doc. processing KIDONO (payment reference number)
    SDVFX010            User exit item table for the customer lines
    SDVFX011            Userexit for the komkcv- and kompcv-structures
    V05I0001            User exits for billing index
    V05N0001            User Exits for Printing Billing Docs. using POR Procedure
    V60A0001            Customer functions in the billing document
    V60P0001            Data provision for additional fields for display in lists
    V61A0001            Customer enhancement: Pricing
    Regards,
    Manish

  • BAPI for create meterial component

    Hi experts
       Which bapi can create meterial componet for an Activity, the same  as use TCODE cj20n create a network->create activity->create meterial componet
    BR
    Chris

    Hi,
    *& Report ZKAR_MATMAS_BAPI
    *& This program demonstrates how easy it is to create Material master
    *& data using BAPI_MATERIAL_SAVEDATA
    *& The program also generates a report post-execution displaying errors
    *& as well as successful uploads
    REPORT ZKAR_MATMAS_BAPI.
    * TABLES
    * FLAGS *
    DATA: F_STOP. " Flag used to stop processing
    * DATA DECLARATIONS *
    DATA : V_EMPTY TYPE I, " No. of empty records
    V_TOTAL TYPE I. " Total no. of records.
    * STRUCTURES & INTERNAL TABLES
    *BAPI structures
    DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information
    BAPI_MAKT LIKE BAPI_MAKT, " Material Description
    BAPI_MARA1 LIKE BAPI_MARA, " Client Data
    BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
    BAPI_MARC1 LIKE BAPI_MARC, " Plant View
    BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
    BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
    BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
    BAPI_RETURN LIKE BAPIRET2. " Return Parameter
    *--- Internal table to hold excel file data
    DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    *--- Internal table to hold Matetrial descriptions
    DATA: BEGIN OF IT_MAKT OCCURS 100.
            INCLUDE STRUCTURE BAPI_MAKT.
    DATA: END OF IT_MAKT.
    *--- Internal to hold the records in the text file
    DATA : BEGIN OF IT_DATA OCCURS 100,
                WERKS(4), " Plant
                MTART(4), " Material type
                MATNR(18), " Material number
                MATKL(9) , " Material group
                MBRSH(1), " Industry sector
                MEINS(3), " Base unit of measure
                GEWEI(3), " Weight Unit
                SPART(2), " Division
                EKGRP(3), " Purchasing group
                VPRSV(1), " Price control indicator
                STPRS(12), " Standard price
                PEINH(3), " Price unit
                SPRAS(2), " Language key
                MAKTX(40), " Material description
                END OF IT_DATA.
    * SELECTION SCREEN. *
    SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
    PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT " Input File
    'C:\Material_master.XLS'.
    PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
    PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
    PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
    P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
    P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
    P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK SCR1.
    * AT SELECTION-SCREEN *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    *--- Validating file
      PERFORM VALIDATE_FILE USING P_FILE.
    * START-OF-SELECTION
    START-OF-SELECTION.
    *--- Perform to convert the Excel data into an internal table
      PERFORM CONVERT_XLS_ITAB.
      IF NOT IT_DATA[] IS INITIAL.
    *--- Perform to delete Header lines
        PERFORM DELETE_HEADER_EMPTY_RECS.
      ENDIF.
    * END OF SELECTION. *
    END-OF-SELECTION.
    *--- Perform to upload Material Master data
      PERFORM UPLOAD_MATMAS.
    * Form : validate_input_file
    * Description : To provide F4 help for file if read from PC
    FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          FILE_NAME     = F_FILE
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
      IF SY-SUBRC <> 0.
        MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
      ENDIF.
    ENDFORM. " validate_input_file
    *& Form CONVER_XLS_ITAB
    * text
    FORM CONVERT_XLS_ITAB.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME    = P_FILE
          I_BEGIN_COL = P_BEGCOL
          I_BEGIN_ROW = P_BEGROW
          I_END_COL   = P_ENDCOL
          I_END_ROW   = P_ENDROW
        TABLES
          INTERN      = IT_INTERN.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *--- Perform to move the data into an internal data
      PERFORM MOVE_DATA.
    ENDFORM. " CONVERT_XLS_ITAB
    *& Form MOVE_DATA
    * text
    FORM MOVE_DATA.
      DATA : LV_INDEX TYPE I.
      FIELD-SYMBOLS <FS>.
    *--- Sorting the internal table
      SORT IT_INTERN BY ROW COL.
      CLEAR IT_INTERN.
      LOOP AT IT_INTERN.
        MOVE IT_INTERN-COL TO LV_INDEX.
    *--- Assigning the each record to an internal table row
        ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS>.
    *--- Asigning the field value to a field symbol
        MOVE IT_INTERN-VALUE TO <FS>.
        AT END OF ROW.
          APPEND IT_DATA.
          CLEAR IT_DATA.
        ENDAT.
      ENDLOOP.
    ENDFORM. " MOVE_DATA
    *& Form DELETE_HEADER_EMPTY_RECS
    * To delete the Header and empty records
    FORM DELETE_HEADER_EMPTY_RECS.
      DATA: LV_TABIX LIKE SY-TABIX.
      IF NOT P_HEADER IS INITIAL.
        LOOP AT IT_DATA.
          IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
            DELETE IT_DATA FROM 1 TO P_HEADER.
    * P_HEADER = 0.
            EXIT.
          ENDIF.
        ENDLOOP.
      ENDIF.
      CLEAR IT_DATA.
    *--- To delete the empty lines from internal table
      LOOP AT IT_DATA.
        LV_TABIX = SY-TABIX.
        IF IT_DATA IS INITIAL.
          V_EMPTY = V_EMPTY + 1.
          DELETE IT_DATA INDEX LV_TABIX..
        ENDIF.
      ENDLOOP.
      CLEAR IT_DATA.
    *--- Total no of recs in file
      DESCRIBE TABLE IT_DATA LINES V_TOTAL.
      IF V_TOTAL = 0.
        MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
        F_STOP = 'X'.
        STOP.
      ENDIF.
    ENDFORM. " DELETE_HEADER_EMPTY_RECS
    *& Form UPLOAD_MATMAS
    * to upload Material Master data
    FORM UPLOAD_MATMAS .
      LOOP AT IT_DATA.
    * Header
        UNPACK IT_DATA-MATNR TO IT_DATA-MATNR.
        BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
        BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
        BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
        BAPI_HEAD-BASIC_VIEW = 'X'.
        BAPI_HEAD-PURCHASE_VIEW = 'X'.
        BAPI_HEAD-ACCOUNT_VIEW = 'X'.
    * Material Description
        REFRESH IT_MAKT.
        IT_MAKT-LANGU = IT_DATA-SPRAS.
        IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
        APPEND IT_MAKT.
    * Client Data - Basic
        BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
        BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
        BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.
        BAPI_MARA1-DIVISION = IT_DATA-SPART.
        BAPI_MARAX-MATL_GROUP = 'X'.
        BAPI_MARAX-BASE_UOM = 'X'.
        BAPI_MARAX-UNIT_OF_WT = 'X'.
        BAPI_MARAX-DIVISION = 'X'.
    * Plant - Purchasing
        BAPI_MARC1-PLANT = IT_DATA-WERKS.
        BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
        BAPI_MARCX-PLANT = IT_DATA-WERKS.
        BAPI_MARCX-PUR_GROUP = 'X'.
    * Accounting
        BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
        BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
        BAPI_MBEW1-STD_PRICE = IT_DATA-STPRS.
        BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
        BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
        BAPI_MBEWX-PRICE_CTRL = 'X'.
        BAPI_MBEWX-STD_PRICE = 'X'.
        BAPI_MBEWX-PRICE_UNIT = 'X'.
    *--- BAPI to create material
        CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
        HEADDATA = BAPI_HEAD
        CLIENTDATA = BAPI_MARA1
        CLIENTDATAX = BAPI_MARAX
        PLANTDATA = BAPI_MARC1
        PLANTDATAX = BAPI_MARCX
    * FORECASTPARAMETERS =
    * FORECASTPARAMETERSX =
    * PLANNINGDATA =
    * PLANNINGDATAX =
    * STORAGELOCATIONDATA =
    * STORAGELOCATIONDATAX =
    * VALUATIONDATA = BAPI_MBEW1
    * VALUATIONDATAX = BAPI_MBEWX
    * WAREHOUSENUMBERDATA =
    * WAREHOUSENUMBERDATAX =
    * SALESDATA = BAPI_MVKE1
    * SALESDATAX = BAPI_MVKEX
    * STORAGETYPEDATA =
    * STORAGETYPEDATAX =
        IMPORTING
        RETURN = BAPI_RETURN
        TABLES
        MATERIALDESCRIPTION = IT_MAKT
    * UNITSOFMEASURE =
    * UNITSOFMEASUREX =
    * INTERNATIONALARTNOS =
    * MATERIALLONGTEXT =
    * TAXCLASSIFICATIONS =
    * RETURNMESSAGES =
    * PRTDATA =
    * PRTDATAX =
    * EXTENSIONIN =
    * EXTENSIONINX =
        IF BAPI_RETURN-TYPE = 'E'.
          WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-MATNR.
        ELSEIF BAPI_RETURN-TYPE = 'S'.
          WRITE: 'Successfully created material' ,IT_DATA-MATNR.
        ENDIF.
      ENDLOOP.
    ENDFORM. " UPLOAD_MATMAS
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Apr 11, 2008 5:49 PM

  • Auto Script which creates SAP Account when AD gets created.

    Hello Experts - Requirement is "Create SAP User account automatically when AD account gets created", can I acheive this through ECATT scripts?
    If this is possible, idea is to create an ECATT script and schedule it to run every night to find all new users on AD and create their account on SAP and lock their accounts.
    Do you think this can be acheived thru ECATT's?
    If not ECATT, is there any way out to acheive my objective. We are planning to reduce overhead for SAP User admins, I was thinking on following steps:
    1) New User request for AD
    2) After approval create AD account
    3) Design a scrip, which will look for all new users on AD and will create & lock them on SAP (Nightly Job or something)
    Your thoughts?
    Your suggestions are much appreciated.
    Thanks.

    Hi Martin,
    I have a customer with 16 million users in SU01. They don't use IdM and don't need it either at the moment.
    I have another customer with 700 users and they are implementing IdM because it makes sense. They need it to reduce complexity.
    There are no IdM license costs, unless you provision non-SAP systems.
    You can skip GRC by using a well designed concept for report RSUSR008_009_NEW if it meets your requirements - particularly the number of systems. It does however have it's limits (per ABAP client) and is not user friendly at first. Also no nice pie-charts for managers, etc.
    Emergency User Access comes in many shapes and sizes... SAP declined a development suggestion from me to improve the "FireFighter" tool so I developed it on my own for my customers using BAPIs and they are happy. The main requiremenent not fullfilled is that the user context changes so that you loose access to HR data, queries, variants, workflow items, purchase orders, etc. The FireFighter users also become obvious targets of attacks and the application users (dialog) need authority to change the FireFighter's passwords to use the application  - which means that they can use RFC to do the same without using the FireFighter transactions / logs / etc.
    Regarding other IdMs, I have experience with some, but documented here on SDN is only the password syncronization problems which Novell suffers from. These "problems" are intentional - or better said --> their own fault for using "hacks"...
    If you search for "Novell" you will find them.
    Cheers,
    Julius

Maybe you are looking for

  • New Mac user: Is it possible to move more than one file at a time on a Mac?

    I'm a new Mac user. Something so simple in Windows doesn't seem possible in Mac OS and AppleCare doesn't have a clue either. I have edited video files as well as the master footage video file in individual folders created by FCP. I need to transfer 6

  • Using a Infoobject (fiscweek) in columns and rows

    Hi SDN, We have a requirement where Zfiscweek of type NUMC to be shown in columns so I have restricted it with a char variable (user entry, and gave a offset value range as 52 weeks) i.e, if a user enters particular week then the O/P must have 52 wee

  • Video not working in itunes 9.2

    Hi I hope anyone can help please. I upgraded my iTunes on Windows 7 to iTunes 9.2. Then upgraded my iPhone 3G to iOS 4. Since then I have been unable to play my purchased videos. Just a black screen appears and nothing happens.Even when I try to play

  • After ntrans-j2ee, matching ppath objects are ignored

    Aa of WS7.0u2, I'm seeing that ppath objects that should match are being ignored whenever an explicit JSP file is specified, but not for any other type. This is different from WS7.0u1 and earlier. In earlier versions, the ppath object always matched,

  • How to load java applet to java-enabled card

    I have downlaoded the sdk n run some samples. but when i connect the card as through pcsc reader, and tried to install some ready applet in the card explorer,it fail n give me 6a80. How can i load a java card applet into a java-card?