Update the x plant material status and plant speific material status

HI Experts,
I am new to abap. In my requriment i want to update the status of x-plant material status (MSTAE) in MARA  and
plant specific material status (MMSTA) in MARC. In master data the status of those fields is blank. Insted of balnk i have to upload '01' or '02'.
using BAPI_MATERIAL_SAVEDATA  i am unable to upload. its not working.
is there any another way to upload that two plants status.
thanks in advance
sravan

Hi martin,
i think insted of it_*** (internal table) we have to use work area. please make sure conform this one.
i am giving my logic wat i have written and my requirement also...
The process to update material master data status is described in 'xxxxx' Mark and Release Cost Estimates and BAPu201D.
u2022     As a result of releasing a standard cost, certain master data elements need to be updated by the Cost accountant in order to enable further activities within SAP.
u2022     All material codes for which Cost Accounting has released a new standard cost, need to have their Material Status indicators changed from 02 (reviewed) to 03 (released).  This removes the system blocks on certain activities within SAP like purchasing, production and Sales.  The status will be needed to change in two views of the Material Master. 
u2022     The u201CX-plant matl statusu201D field on the Basic Data 1 view
u2022     The u201CPlant-sp. matl statusu201C field on the Costing 1 view
This update should be automated
Select materials for which a price change document was posted based on selection parameters.
Select price change documents for company code defined in selection screen since last run date
u2022     Reference procedure = PRCHG (MLHD-AWTYP)
u2022     Entered on MLHD-CPUDT u2013 verify against last run date to include in selection
u2022     Entered at MLHD-CPUTM u2013 verify against last run date to include in selection
u2022     Store last run date and time by company code, so that it can be picked up in the next run. (store in table TVARVC?)
Select only the documents of plants which belong to the company code in table MLIT. The link between company code and plant can be found in table T001K.
u2022     Valuation area = Plant MLIT-BWKEY
u2022     Create a list of all materials MLIT-MATNR
The next 2 updates should happen independently;
u2022     Update the u201CPlant-sp. matl statusu201C field (MARC-MMSTA) on all plant views belonging to the company on the Costing 1 view to status 3 with as prerequisite;
u2022     The current plant material status is 02
u2022     This action must be done on all plants belonging to the company code
u2022     Update the u201CX-plant matl statusu201D field (MARA-MSTAE) on the Basic Data 1 view to status 3 with as prerequisite;
u2022     The current X-plant material status is 02.
in pt_final1 i get the data corresponing to given tables.
LOOP AT PT_FINAL1 INTO GS_FINAL1.
*HEADER DATA
  GS_HEAD-MATERIAL = GS_FINAL1-MATNR.
  GS_HEAD-IND_SECTOR = GS_FINAL1-MBRSH.
  GS_HEAD-MATL_TYPE = GS_FINAL1-MTART.
  GS_HEAD-BASIC_VIEW = 'X'.
  GS_HEAD-COST_VIEW = 'X'.
APPEND GS_FINAL1 TO IT_FINAL1.
*CLIENTDATA
  GS_CLNT-PUR_STATUS = GS_FINAL1-MSTAE.
  GS_CLNTX-PUR_STATUS = 'X'.
*PLANT DATA
  GS_PLNT-PLANT      = GS_FINAL1-WERKS.
  GS_PLNT-PUR_STATUS = GS_FINAL1-MMSTA.
  GS_PLNTX-PUR_STATUS = 'X'.
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      HEADDATA    = GS_HEAD
      CLIENTDATA  = GS_CLNT
      CLIENTDATAX = GS_CLNTX
      PLANTDATA   = GS_PLNT
      PLANTDATAX  = GS_PLNTX
    IMPORTING
      RETURN      = GS_RET.
    Commit to release the locks
   RETURN-TYPE is 'E' in case of error, else 'S'.
  IF GS_RET-TYPE = 'E'.
    LOOP AT IT_RET.
      WRITE: / RETURNMES-MESSAGE.
    ENDLOOP.
  ELSEIF GS_RET-TYPE = 'S'..
    WRITE: / 'PLANT MATERIAL STATUS '.
  ENDIF.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDLOOP.

Similar Messages

  • How can i get the open sale orders for given material no and plant

    Hi,
    I have to retrieve the open sale orders depending on the material number and plant.
    For only open sale orders at header level and item level.
    I want to use VBUK-GBSTK to find open sale order at header level and
                          VBUP-GBSTA at item level.
    Can any one suggest me the best logic as performance is concerned?           
    Thanks,
    Kumar.

    hi Prasanth,
    select werks matnr from ZVSCHDRUN into table it_plant.
    sort it_plant by matnr werks.
    select
            vbeln
            posnr
            matnr
            werks
            erdat
            kbmeng
            vrkme
            from vbap
            into table it_vbap
            for all entries in it_plant
            where matnr = it_plant-matnr and
                  werks = it_plant-werks.
    and again i have to write one more select query for vbup.
    am i right?

  • Material num and Plant is not displaying in Output

    hi
    i have written this code to get all inspection types...
    while compiling im getting the correct output...
    it is displaying only inspection types ....
    Material num and Plants are not displaying..
    form PROCESS_DATA .
    CLEAR: WA_FINAL,
           WA_QMAT.
    MOVE IT_FINAL TO I_FINAL.
    REFRESH IT_FINAL.
    LOOP AT I_FINAL assigning <fs_fin>.
    LOOP AT IT_QMAT INTO WA_QMAT where MATNR = <fs_fin>-MATNR.
                                       P_werks = <fs_fin>-werks.
    IF SY-SUBRC EQ 0.
    <fs_fin>-ART = WA_QMAT-ART.
    APPEND <fs_fin>-ART TO it_final.
      CLEAR WA_QMAT.
    CLEAR wa_final.
    ENDIF.
      ENDLOOP.
    ENDLOOP.

    Hi
    ya im getting correct values to <fs_fin>
    now its displaying correct values bt in improper format
    Mat num                  Plant                       insp type
      100001                   1210                         05
      100002                    1320                         01
                                                                     02
                                                                     03
                                                                     05
    bt i want the output as below
    Mat num                  Plant                       insp type
      100001                   1210                         05
                                                                    02
                                                                    03
      100002                    1320                         01

  • Where can I find the relation between company code and plant?

    where can I find the relation between company code and plant?
    I need to the list of plants under a company code.
    Which table?

    yes,wayne weng   .What you said is right.
    Thank you very much!
    My MSN:[email protected]

  • How to restric the use of Business Area and Plant in PTC module

    Hi Expert,
    I am facing a problem with restricting the use of Business Area and Plant in PTC module.
    In this project we are trying to controle the user access or transaction as per the Business Area and Plant.
    We have applied same authorisation in the PTF module.
    Please help me if there is any authorisation object which give Plant and business area restrictions for all the transactions.
    Note: We have already inserted two authorisations object manually -
    1) F_BKPF_GSB
    2) A_IMPR_GSB
    but it's not working, is there any other way to restrict all the trasactions as per the Business Area and Plant.
    Regards,
    Venkatesh

    Hi,
    have you done OMJ7?
    Anyway you can assign plant to Branch and restrict by Validation rules (GGB4)
    Regards

  • My mac is the OS X 10.8.3.  I tried to update the latest Adobe flash player and kept getting 'Actionlist not found.'  I have uninstalled, enabled and disabled plug-ins and am still unable to download the update and now have no flashplayer at all.  Help!

    My mac is the OS X 10.8.3.  I tried to update the latest Adobe flash player and kept getting 'Actionlist not found.'  I have uninstalled, enabled and disabled plug-ins and am still unable to download the update and now have no flashplayer at all.  Help!
    PS I'm still new to Macs so the more broken down the better.

    Adobe Flash Player 11.8.800.42 is the most recent version from Adobe. It is a pre-release version. I am using it without any noticeable problems.
    The current stable version is Download 11.7.700.169.

  • Trying to update the software for my iphone and it keeps saying download has been corrupted. an same for imac update. help?

    trying to update the software for my iphone and it keeps saying download has been corrupted. an same for imac update. help?

    Hi NWL1,
    Thanks for the question. If I understand correctly, the iPhone won't update and is stuck. I would recommend that you read this article, it may be able to help you resolve or isolate the issue.
    If you can't update or restore your iPhone, iPad, or iPod touch - Apple Support
    Thanks for using Apple Support Communities.
    Have a great day,
    Mario

  • Getting error when updating the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1

    Hi,
    I`m getting error message like "None of the apps in your project can be activated in the target. The manifest file of one or more apps contain API sets or Office applications that are not supported by
    the target Office client. To debug those apps, update manifest files to exclude any unsupported API sets or Office applications, and then start the project again. Alternatively, you can debug your apps by using Office 365 as a target." when when
    updating the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1 in manifest file though i have added host elements.
    any help in this regard is highly appreciated
    Thanks,
    Santosh Sutar  

    Hi Satosh Sutar,
    Based on the description, you got the error message when you update the apps from version 1.0 to 1.1.
    From the error message, it seems the menifest include some settings no allowed in the new version. Would you mind sharing more detail about how you update the project?
    And here is an article about updating apps for Office and menifest schema files in the project for your reference:
    How to: Update the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I updated the software on my iPad and now have none of the apps I purchased

    I updated the software on my iPad and now have none of the apps I purchased

    If for some reason you failed to transfer any purchases made on the ipad to your computer before updating, then you will have to redownload:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • HT1414 I have just tried to update the software on my iPad and it is now asking me to connect to iTunes. The last time I did this it did not tell me to do this. I'm currently travelling and do not have my MacBook with my iTunes.Can it be resolved without

    I have just tried to update the software on my iPad and it is now asking me to connect to iTunes. The last time I did this it did not tell me to do this. I'm currently travelling and do not have my MacBook with my iTunes.Can it be resolved without iTunes

    I hope that you can see this response. The forum software is acting quite bizarre today.
    You really do want to restore with your own computer. There is an off chance that you might be able to backup first, but I really think it is a very slight chance now since you got the connect to iTunes screen. But on the chance that when you connect, it sees the iPad and allows a backup, I would to not have you wait to use your own Mac.
    If you cannot create a backup, you will lose everything that you have put on since the date to the last backup. So of your last backup was three weeks ago, you will restore the iPad to the condition that it was in three weeks ago.
    If you do a lot of traveling, using iCloud for backups might be a very good idea. I use iTunes primarily and I backup my MacBook Pro with Time Capsule, but I still use iCloud as a secondary backup. I don't have enough data that I have exceeded the free 5 GB that you get with iCloud, so I do use it just in case.
    I can't explain what happened with the update, I can only tell you that it does happen to other users. I have never had a problem when I updated and I having been updating over WiFi since iOS 5 came out. Taking a guess, maybe an interruption in the connection - especially of you tried updating using a hotel's WiFi network, or a power surge maybe. Whatever the cause, it is most likely a one time thing. That doesn't help your situation I know, but hopefully it won't happen again.

  • When my macbook asks for update the apple id is incorrect and doesn't allow me to modify it

    when my macbook asks for update the apple ID is incorrect and doesnt allow me to modify it. what can i do

    Is this a second hand Mac?
    Have you tried signing out of the App Store then signing back in?
    From the App Store menu bar click Store > Sign Out
    Quit and relaunch the App Store then click Store > Sign In with the correct Apple ID.

  • Update the stastics of tables BKPF and GLFUNCA

    Hello All,
    update the stastics of tables BKPF and GLFUNCA not updataing
    I have execute via Brtools
    7 - Database statistics  >>  1 = Update database statistics  >>  9 ~ Tables for update (table) ......... [BKPF]
    same for table GLFUNCA
    7 - Database statistics  >>  1 = Update database statistics  >>  9 ~ Tables for update (table) ......... [GLFUNCA]
    But in .sta file it is not collected
    <DB20>
    Table                 GLFUNCA
         Statistics are current (|Changes| < 50 %)
    New Method           E
    New Sample Size      P1
    Old Method           E                       Date                 17.08.2008
    Old Sample Size      P1                      Time                 19:52:15
    It is one year old , so please help me how to update this table
    Is this table causing performance problem for job RSUVM007
    Regards
    Mohsin M

    Before all,
    Why do you wnat to calculate statistics on those tables?
    Do you have performance problems and you have identified that they are caused by "bad" statistics?
    or simply you "must" collect them because they are "OLD"?
    If it is the latter, remember that statistics MUST be representative not current. Please read the SAP Note 825653 "Oracle: Common misconceptions" point 7
    Regarding the options of BRtools, it works as designed.
    BRCONNECT will check if the table needs statistics:
    - if it has changed more than 50% since last time (in your case 17.08.2008) and, if so it will do, otherwise it will not do it. See the output of DB20 that you pasted:
    > Statistics are current (|Changes| < 50 %)
    IF you need new statistics (and I mean, need, not like) then you have to force them. On BRTOOLS you go to the next screen and choose the option:
    > 7 ~ Force options (force) ............... []
    In your version/patch could be located in a different place
    and here input collect
    I strongly recommend you to read the BR*tools documentation as ALL this information is there.
    In case you do not know where to find it, it is quite easy:
    SAP on Oracle => Oracle DBA Overview  => SAP Database Guide: Oracle

  • HT1414 I updated the version on my Iphone and didn't sync before and lost all my photos, apps, contacts before.  Is there any way to recover the deleted photos deleted ?

    I updated the version on my Iphone and didn't sync before ans as a result I lost all my photos, apps, and contacts.  I will like to recover the deleted photos as they are very important to me,  it's there a way to recover them?

    did you ever do a backup.  cause if you did say like a year ago.  it should still be there and you could at least get the info back until that date.

  • TS1398 i just updated the ios on my iphone4s and now i cannot connect back to my home network ... my network pass is still the same but it keeps saying unable to join network

    i just updated the ios on my iphone4s and now i cannot connect back to my home network ... my network pass is still the same but it keeps saying unable to join network

    i just updated the ios on my iphone4s and now i cannot connect back to my home network ... my network pass is still the same but it keeps saying unable to join network

  • HT1926 I updated the Itunes on my computer and it begin having problems. I tryed a new installation and there is a message saying an application has made an attempt to load C runtime library incorrectly. What shoul I do?

    I updated the Itunes on my computer and it begin having problems. I tryed a new installation and there is a message saying an application has made an attempt to load C runtime library incorrectly. What shoul I do?

    Hello rvalle3,
    The following article can help get iTunes updated and running again.
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Cheers,
    Allen

Maybe you are looking for