"CSAP_MAT_BOM_MAINTAIN" can read material which is created without commit?

hi:
  i want to create a material first with "BAPI_MATERIAL_SAVEDATA",then i want to add this material as a component
  to a existing BOM with "CSAP_MAT_BOM_MAINTAIN".
  1 I create the material using "BAPI_MATERIAL_SAVEDATA" without "BAPI_TRANSACTION_COMMIT".
  2 I use "CSAP_MAT_BOM_MAINTAIN" to add the material to a existing BOM.
  Before this test,i think "CSAP_MAT_BOM_MAINTAIN" will raise an exception:
  "The material XXX does not exist or is not activated"
  But the result is:Material is created successfully and the BOM is added a component with a commit implicitly.
  How can "CSAP_MAT_BOM_MAINTAIN" read the material which is not committed to the DB?
  BTW:Even if "CSAP_MAT_BOM_MAINTAIN" raise a exception,i can use "BAPI_TRANSACTION_COMMIT" to rollback both the
  created material and the changed BOM.
  I am confused!!
  Following is the sample code of this case:
*& Report  Z_TESTYM23
REPORT  z_testym23.
DATA mat LIKE bapimathead-material VALUE '000000000000002814'.   "created material no
DATA bom LIKE csap_mbom-matnr VALUE '000000000000002794'.
DATA change_no LIKE aenrb-aennr.
create ECN in sap
PERFORM ecn_create.
create material without commit
PERFORM mat_create.
*-- maintain BOM
PERFORM maintain_bom.
*&      Form  MAT_CREATE
      CREATE MATERIAL
FORM mat_create .
  DATA headdata LIKE bapimathead.
  DATA clientdata LIKE bapi_mara.
  DATA clientdatax LIKE bapi_marax.
  DATA itab_makt LIKE TABLE OF bapi_makt.
  DATA wa_makt LIKE bapi_makt.
  DATA return LIKE bapiret2.
  headdata-material = mat.
  headdata-ind_sector = 'A'.
  headdata-matl_type = 'ROH'.
  headdata-basic_view = 'X'.
  clientdata-base_uom = '2X'.
  clientdatax-base_uom = 'X'.
  wa_makt-langu = sy-langu.
  wa_makt-matl_desc = 'TEST'.
  APPEND wa_makt TO itab_makt.
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      headdata            = headdata
      clientdata          = clientdata
      clientdatax         = clientdatax
    IMPORTING
      return              = return
    TABLES
      materialdescription = itab_makt.
  CHECK return-type <> 'S'.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  MESSAGE  return-message TYPE 'E'.
ENDFORM.                    " MAT_CREATE
*&      Form  MAINTAIN_BOM
      Maintain BOM
FORM maintain_bom .
  DATA i_datum(10).
  DATA i_stko TYPE stko_api01.
  DATA t_stpo LIKE TABLE OF stpo_api03.
  DATA w_stpo LIKE stpo_api03..
  WRITE  sy-datum TO i_datum.
  w_stpo-item_categ = 'L'.
  w_stpo-component = mat.
  w_stpo-comp_qty = '2'.
  APPEND w_stpo TO t_stpo.
  CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
    EXPORTING
      material    = bom
      bom_usage   = '1'
      valid_from  = i_datum
      change_no   = change_no   "correct no:'500000000053';incorrect no:'500000000153'
      i_stko      = i_stko
      fl_complete = 'X'
    TABLES
      t_stpo      = t_stpo
    EXCEPTIONS
      error       = 1
      OTHERS      = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.   "Rollback BOM and material
  ELSE.
    CALL FUNCTION 'BUFFER_REFRESH_ALL'.          "Remained process of function:BAPI_TRANSACTION_COMMIT
    WRITE: / 'Everything is OK',
           / 'CHANGE_NO: ',change_no,
           / 'MATERIAL NO: ',mat,
           / 'BOM: ', bom.
  ENDIF.
ENDFORM.                    " MAINTAIN_BOM
*&      Form  ECN_CREATE
      Create ECN
FORM ecn_create .
  DATA change_header LIKE aenr_api01.
  DATA object_bom LIKE aenv_api01.
  change_header-status = '01'.
  change_header-valid_from = '2007/06/01'.
  change_header-descript = 'test'.
  object_bom-active = 'X'.
  CALL FUNCTION 'CCAP_ECN_CREATE'
    EXPORTING
      change_header            = change_header
      object_bom               = object_bom
      FL_COMMIT_AND_WAIT        = 'X'
     FL_NO_COMMIT_WORK        = 'X'
    IMPORTING
      change_no                = change_no
    EXCEPTIONS
      change_no_already_exists = 1
      error                    = 2
      OTHERS                   = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " ECN_CREATE 
  Regards
  Ming

I did another test as following:
*& Report  Z_TESTYM23
REPORT  z_testym23.
DATA mat LIKE bapimathead-material VALUE '000000000000002816'.   "created material no
create material without commit
PERFORM mat_create.
*&      Form  MAT_CREATE
      CREATE MATERIAL
FORM mat_create .
  DATA headdata LIKE bapimathead.
  DATA clientdata LIKE bapi_mara.
  DATA clientdatax LIKE bapi_marax.
  DATA itab_makt LIKE TABLE OF bapi_makt.
  DATA wa_makt LIKE bapi_makt.
  DATA return LIKE bapiret2.
  headdata-material = mat.
  headdata-ind_sector = 'A'.
  headdata-matl_type = 'ROH'.
  headdata-basic_view = 'X'.
  clientdata-base_uom = '2X'.
  clientdatax-base_uom = 'X'.
  wa_makt-langu = sy-langu.
  wa_makt-matl_desc = 'TEST'.
  APPEND wa_makt TO itab_makt.
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      headdata            = headdata
      clientdata          = clientdata
      clientdatax         = clientdatax
    IMPORTING
      return              = return
    TABLES
      materialdescription = itab_makt.
CALL FUNCTION 'MARA_SINGLE_READ'
   EXPORTING
    KZRFB                   = ''
    MAXTZ                   = 0
     matnr                   = mat
    SPERRMODUS              = ' '
    STD_SPERRMODUS          = ' '
    OUTPUT_NO_MESSAGE       =
  EXCEPTIONS
    lock_on_material        = 1
    lock_system_error       = 2
    wrong_call              = 3
    not_found               = 4
    OTHERS                  = 5.
IF sy-subrc <> 0.
   CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
   MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
  SELECT COUNT(*) FROM MARA WHERE MATNR = MAT.
  WRITE SY-DBCNT.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  WRITE return-message.
ENDFORM.                    " MAT_CREATE
SY-DBCNT = 1 and i can alse rollback the material

Similar Messages

  • Can a 1099 be manually created without reference to an AP Document ?

    Our AP department cut a cheque against a vendor id which included the names of two vendors in the description. They added the second name to the existing vendor in order to meet a requirement that the settlement cheque be made out to both parties.
    E.G.:> Vendor 100 = John Dow & Jane Smith. The tax-id/SSN for vendor 100 belongs to John Dow.
    A seperate vendor code exists for attorney Jane Smith.  E.G.> Vendor 200 = Jane Smith. And the tax-id/SSN for vendor 200 belongs to Jane Smith.
    We can generate the 1099 for this payment document which references vendor 100 and John Dow's tax-id. Can another 1099 be created against the same payment for vendor 200?  And/or is there a manual way to create a 1099 without reference to an AP document?

    The solution we used to create a second 1099 was as follows:
    1: Post an AP item to the 2nd Vendor for the amount that you want to report - FB60.
    -Credit Vendor Account
    -Debit Any account to clear with - We used petty cash
    2: Use the F-51 to Clear
    -Doc type ZV
    -Credit: The account you used to clear with
    -Debit: Select the open item for the vendor
    This will give you a payment document for the vendor for the amount you wish, but nothing paid to the vendor.

  • I purchased a book on my iPad 1 on iBooks. I also have the kindle app, and I have a kindle. Can I read the book on the kindle (transfer it and/or share)? So that another family member can read it on the kindle without having to borrow my iPad?

    Can I read a book I bought on iBooks in ipad1 on my kindle? I have the kindle all, want to read the book there and on the actual kindle so I can let a family member read it on the kindle and not have to lend them my ipad

    No, purchased iBooks can only be read on the iPad. Of course, purchased Kindle books can be read in both places.
    Matt

  • How to obtain row number when a new row is created (without commit)?

    I have this:
    <NamedData NDName="LineaNro"
    NDValue="#{bindings.VOIpmDistribucionManualEBS1.currentRowIndex}"
    NDType="oracle.jbo.domain.Number"/>
    When I push the New button, the value shows -1. If I push again, the value shows 0... but for third time an error occur:
    Too many objects match the primary key oracle.jbo.Key[0 0 2011-12-01 ID del comprobante 0 ]
    The problem is the last 0, it's the same 0 returned for the second button push.
    The commit must be do it at the end.
    Any suggestions?
    Thanks in advance.

    Can you elaborate a bit on what you are trying to do?
    And which jdev version you are using?
    If you try to use the current row index a a primary key for a new row this won't work. The first time you hit the new button you get -1 as the current row is not set. Then the new row get the current row and get the index 0. So, then you hit new again you get 0 back.
    It's never a good idea to use a row index as primary key as this won't work in multi user environments (which adf web apps are).
    You should use a db sequence as PK as this will work in all scenarios and guarantees that one number is only use once.
    Timo

  • When I import my Sony video, which is in m2ts format, the file size is a few times larger.  This affects the volume of clips for creating the blu-ray or DVD discs.  How can I squeeze the file size without sacrificing the quality of output?

    When I import my Sony video, which is in m2ts format, the file size is a few times larger.  This affects the volume of clips for creating the blu-ray or DVD discs.  How can I squeeze the file size without sacrificing the quality of output?  Is there any other ways of achieving this?

    wongrayd wrote:
    Thanks.  I do not have the experience on burning discs from iMovie for the movie after editing (ie for video discs players).  It seems that i cannot find the relevant command in the tool bar for this purpsoe.  Would you please show me the way?
    The command is gone because iDVD has been discontinued by Apple. After Apple discontinued iDVD they removed the iDVD burning link from iMovie. I still use iDVD sometimes, only because I have an old copy.
    wongrayd wrote:
    You have mentioned about Handbrake as a converter.  What is the RF no. (under Constant Quality) meant?  It seems that the smaller the no. is, the better quality will be.  What is the optimal no.? or should we use the Average Bitrate? Again, what is the best rate?  Furthermore, which format is more suitable or the best: H264 or mpeg 2/4?
    I don't know what RF means. When I have used HandBrake, I've used presets that apply to what I want to do, so I don't know the meaning of each individual setting. However, it appears that many of them are listed in the HandBrake User's Guide that is linked from the Help menu in the program:
    https://trac.handbrake.fr/wiki/HandBrakeGuide
    wongrayd wrote:
    For iMac, except iMovie, what other software is the best for the amateur?  I have read Photoshop.  Can this support m2ts files and user friendly?
    Photoshop is not amateur-level software, and although it can edit a video, it cannot burn a DVD. Unfortunately, because I still use iMovie, I haven't tried anything else. You might want to read the reviews of various DVD-burning applications in the Mac App Store.
    And maybe another forum member will jump in and help us here!

  • I have Reader ver 9.0. If I receive a file which is created in ver 8.00, how can I open it ver 9.0 ?

    I have Reader ver 9.0. If I receive a file which is created in ver 8.00, how can I open it ver 9.0 ?

    All Adobe Reader versions are backwards compatible, so you should be able to open Acrobat 8 and earlier documents with Reader 9.
    Do you have a specific problem with a document and Reader 9?  If so, please give more details.

  • Can't create free PO with the material which material type is UNBW

    When I create a free PO with the material which material type is UNBW , error happens as below:
    Account assignment mandatory for material *** (enter acc. ***. cat.)
    There is no provision for value-based inventory management for this material type in this plant. Account assignment is thus necessary.
    But I use UNBW material type just because it's only QTY updating, and no value update.
    So this PO should has no relationship to FI document and any GL account or cost center.
    How can I create PO and GR for UNBW material in SAP system?
    Please tell me the solution in detail, thanks!

    Dear,
           Same scenario i have done in SAP. when we create free P.O then condition tab is automatically remove from the item level.
          But Cost Center and G/L account will compulsory. May be because of inventory. Inventory should affect the cost center and G/L account.
    Regards,
    Sandip

  • How to create a material which can be used in T-Codes VAO1 & MB1C create

    Hello Experts,
    How can I create a material which can be used to create a sales order and can be used to create inventory using VAO1 and MB1C T-Codes respectively.
    What are the configurations that I need to take care of, while creating it?
    I need to create a material which can be used in the whole sales cycle(sales order,goods issue,billing and etc).
    Please Help,
    Thanks in Advance,
    Suma

    Hi
    Thanks for your fast replies.. I have created a new material and was able to create inventory thru MB1C. But I was not able to generate a goods delivery(VL01N) and billing document(VF01)  for the sales order.
    Error: No schedule lines due for delivery up to the selected date
    Message no. VL248
    Diagnosis
    There are no schedule lines due for the given order item up to the date chosen.
    System Response
    The system does not create a delivery item for this order item.
    Procedure
    Check whether the order item to be delivered contains confirmed schedule lines.
    If this is the case, set the selection date further into the future if you still want to create a delivery for this item.
    Please suggest,
    Tanks,
    Suma
    Edited by: Suma B on Sep 23, 2008 3:55 PM

  • Is there an hd video camera which iMovie can read without format conversion

    Is there an hd video camera which imovie can read without format conversion

    iMovie 11 - cameras supported:
    http://help.apple.com/imovie/cameras/en/index.html?lang=en_US
    iMovie 9 - cameras supported:
    http://support.apple.com/kb/HT3290?viewlocale=en_US
    iMovie 8 Camcorders supported:
    http://support.apple.com/kb/HT1014
    Digital camera RAW formats supported by OS X Lion:
    http://support.apple.com/kb/HT4757?viewlocale=en_US
    Digital camera RAW formats supported by OS X Snow Leopard:
    http://support.apple.com/kb/HT3825?viewlocale=en_US
    iMovie tutorials:
    http://www.apple.com/ilife/tutorials/#imovie
    and also this:
    http://www.kenstone.net/fcp_homepage/imovie_09_stone.html

  • My CD has photos with info which I can read. On 'Import to library', photos are imported without the info. How can I fix it?

    My CD has photos with info which I can read off the CD. On 'Import to Library' the photos are imported to my iPhoto but info is not. How can I import photos including info?

    When you say "info", what do you mean exactly? What kind of info and where is it being stored? Is it in a separate file(s), or is it metadata in the file itself? All EXIF data is retained (that's a standard for camera image files) such as date taken, camera model, exposure, location, etc, when you import into iPhoto. If you've added data in some non-standard way, it won't be retained.
    Matt

  • Can a quote be created without defining a Customer?

    We wish to activate the Quotations process in SAP, but one of our business requirements (and I'm sure it is the same of many companies), is that the Quote can be created without having to create a Customer Master before hand.
    Our company receives hundreds of Quote requests from potential customers, but not always make the sale.
    We do not want to have to create a new customer master, just in order to create a Quotation for a potential customer.  If we had to do this, we would have hundreds of "Customers" on the master that we never made a sale to for example ... and we don't want to clog up the Customer master file with this information.
    Is there a way that we could just type in the potential customer's name and address information into the Quote and send it out to the customer for approval.
    If they accept the quote and it is time to create a sales order, then at that time we would create the Sold-To Customer Master.
    Any insight into this delima would be appreciated.
    Scott.

    "Since it is not posible to enter a order type without a customer, what you can do is to create a dummy customer master(along with ship-to).
    When the customer asks for a quote, enter the dummy customer & create the quotation.
    Pls note that in a quotation you specify for what price you guve the materials to the customers & other applicable discounts. It has a validity period.
    If you are sure that you are going to quote the same price & other details to all the customers, then you can use this dummy customer master.
    Regards,
    Sivanand"
    I was thinking of something along those lines, something like a customer number OTUS (One Time US), or OTDE (One time Germany), with minimal information assigned to Customer Account Group "CPD".  Then the person entering in the information could go to the Sold-To partner and change the name and address info.
    Since the products we sell usually start in the $10,000 range on up, each potential customer can have any sort of specialize pricing.  For these "One Time" customers we would have the regular Material price automatically default in (PR00) at just the material level, then any discounts would be applied manually.
    I'm going to give this a shot and see what happens.
    Thanks for the info.

  • I created a slide show in imovie for my daughters 21st with voice overs from friends and family which was all working fine but now the voice recordings are not playing at all.  Obviously some setting has changed but I can't find which one.

    I created a slide show in imovie for my daughters 21st with voice overs from friends and family which was all working fine but now the voice recordings are not playing at all.  Obviously some setting has changed but I can't find which one.

    I created a slide show in imovie for my daughters 21st with voice overs from friends and family which was all working fine but now the voice recordings are not playing at all.  Obviously some setting has changed but I can't find which one.

  • My old email address was hacked and I am no longer able to access it. How can i reset my icloud ID without losing all of my pictures and more inportantly contacts? I have created a new ID but i cannot seem to use it until I delete the old account

    my old email address was hacked and I am no longer able to access it. How can i reset my icloud ID without losing all of my pictures and more importantly contacts? I have created a new ID but i cannot seem to use it until I delete the old account

    You need to use the old ID and password to delete the iCloud account. After you delete the old account, you can sign in with the new ID in iCloud.
    Have you seen this.
    http://support.apple.com/kb/HT5796
    iCloud
    iOS 6 and later: Go to Settings > iCloud.
    If you signed out before changing your Apple ID, enter your current Apple ID to sign in. The data from your iCloud account will download to your device.
    If you're still signed in with your previous Apple ID:
    Scroll down and tap Delete Account. Depending on what iCloud options are turned on, you'll be asked to confirm that you want to delete data from your device. To confirm, tap Delete. (If you're using iOS 7 and have Find My iPhone turned on, you'll be asked to enter the password for your previous Apple ID. Enter the password, then tap Turn Off.) The data will be deleted from your device, but not from iCloud.
    Enter your current Apple ID to sign in. The data from your iCloud account will download again to your device.

  • Somebody has created an apple id using my gmail id. So I gave forgot password option and reset the password of the id. But for resetting the security questions, link is going to some other email id which is created by the other guy.How can I resolve this?

    When I tried to create and apple id using my gmail account i found that somebody has already created an apple id using my gmail id. So I gave forgot password option and reset the password of the id. But for resetting the security questions, link is going to some other email id which is created by the other guy. Now the problem is that the other guy also can reset my password and access my account.
    I contacted apple customer care and they are not ready to help me saying that I need to give information about the last device I logged in using this id. How can I give it when I did not create it?:) Also they are saying this account has been verified and that could happen only if someone has hacked my gmail account and verified the id using the link sent by apple.
    Later I did some experiments and found that this is a security flaw from apple. Somebody has created the id and never used it(I tried to loggin to icloud and it was saying this account was not used it any apple device). The account became verified when I reset the password.(This is a bug, account should be verified only when we click on the verification link sent by apple).
    The other mistake apple did is that they allotted my gmail account to someone before it's verified eventhough it cannot be used unless verified. Actually apple should allot the account id only after verifying the email address.
    Apple customer care is not ready to help and I am tired of fighting with them. Can any of you guys suggest any means of getting back my gmail id to use it as apple id?

    I don't think you're going to be able to. I would guess the other person used your address by accident, and when he found he couldn't access the account (because you'd changed the password) he abandoned it. Your GMail address is now locked to that account and even if it was changed you can't use it to create another.
    You already have an Apple ID, which you use to log in here; you can use that to create an iCloud account if that's what you are trying to do. If you want to create a different Apple ID just get another free address such as a Yahoo one.

  • How can we delete the composition which is created by AEGP_CreateComp()?

    Hi,
    I have created a composition using AEGP_CreateComp( ) method under PF_Cmd_SEQUENCE_SETUP command. The composition is displaying in project folder. I have to delete the same composition from project folder under PF_Cmd_SEQUENCE_SETDOWN command.
    we can delete the layer using AEGP_DeleteLayer( ), but how can we delete a composition from project folder which is created by AEGP_CreateComp( )?

    Im getting the crash on 10th line when I delete the composition
         PF_Err err = PF_Err_NONE;
        AEGP_ItemH    item = NULL;
        AEGP_ItemType itemType;
        AEGP_SuiteHandler suites(in_data->pica_basicP);
        err = suites.CompSuite6()->AEGP_GetItemFromComp(compPH, &item);   
        if (item != NULL)
            err = suites.ItemSuite6()->AEGP_GetItemType(item, &itemType);
            if (itemType == AEGP_ItemType_COMP)
               err = suites.ItemSuite6()->AEGP_DeleteItem(item);
    What could be the reason?

Maybe you are looking for