Report problem with BAPI_MATERIAL_SAVEDATA (help required)

hi all,
i am using this source code to create material using
BAPI_MATERIAL_SAVEDATA.
when i am executing the program,
i am getting message the material no 512 transferred without leading 0.
but when i am checking the mara table i am not getting the material 512 created.
my program is as follows plz check where i am wrong ? why i am not able to create the material using this program.what changes i have to make in this program so that i will be successful in creating material.?
*& Report  ZCREATE_MATERIAL
*& Developer
*& Date:   &DATE
               STRUCTURE  DECLARATIONS                             *
Report:zcreate_material.
TABLES: BAPIMATHEAD,  "Headerdata
        BAPI_MARA,    "Clientdata
        BAPI_MARAX,   "Clientdatax
        BAPI_MARC,    "Plantdata
        BAPI_MARCX,   "Plantdatax
        BAPI_MAKT,    "Material description
        BAPIRET2.     "Return messages
DATA:V_FILE TYPE STRING.
DATA:
  BEGIN OF LSMW_MATERIAL_MASTER,
    MATNR(018) TYPE C,  "Material number
    MTART(004) TYPE C,  "Material type
    MBRSH(001) TYPE C,  "Industry sector
    WERKS(004) TYPE C,  "Plant
    MAKTX(040) TYPE C,  "Material description
   DISMM(002) TYPE C,  "Extra Field Added In the Program as
*itsrequired
    MEINS(003) TYPE C,  "Base unit of measure
   MATKL(009) TYPE C,  "Material group
   SPART(002) TYPE C,  "Division
   LABOR(003) TYPE C,  "Lab/office
   PRDHA(018) TYPE C,  "Product hierarchy
   MSTAE(002) TYPE C,  "X-plant matl status
   MTPOS_MARA(004) TYPE C,  "Gen item cat group
   BRGEW(017) TYPE C,  "Gross weight
   GEWEI(003) TYPE C,  "Weight unit
   NTGEW(017) TYPE C,  "Net weight
   GROES(032) TYPE C,  "Size/Dimensions
   MAGRV(004) TYPE C,  "Matl grp pack matls
   BISMT(018) TYPE C,  "Old material number
   WRKST(048) TYPE C,  "Basic material
   PROFL(003) TYPE C,  "DG indicator profile
   KZUMW(001) TYPE C,  "Environmentally rlvt
   BSTME(003) TYPE C,  "Order unit
   VABME(001) TYPE C,
   EKGRP(003) TYPE C,  "Purchasing group
   XCHPF(001) TYPE C,  "Batch management
   EKWSL(004) TYPE C,  "Purchasing key value
   WEBAZ(003) TYPE C,  "GR processing time
   MFRPN(040) TYPE C,  "Manufacturer part number
   MFRNR(010) TYPE C,  "Manufacturer number
   VPRSV(001) TYPE C,  "Price control indicator
   STPRS(015) TYPE C,  "Standard price
   BWPRH(014) TYPE C,  "Commercial price1
   BKLAS(004) TYPE C,  "Valuation class
  END OF LSMW_MATERIAL_MASTER.
               INTERNAL TABLE DECLARATIONS                         *
*to store the input data
DATA:
  BEGIN OF it_matmaster OCCURS 0.
        INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
DATA:END OF it_matmaster.
*for material description
DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
     INCLUDE STRUCTURE BAPI_MAKT .
DATA:END OF IT_MATERIALDESC.
*to return messages
DATA:BEGIN OF IT_RETURN OCCURS 0.
     INCLUDE STRUCTURE BAPIRET2.
DATA:END OF IT_RETURN.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = 'P_FILE'
    IMPORTING
      FILE_NAME     = P_FILE.
               TO UPLOAD THE DATA                                  *
START-OF-SELECTION.
V_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = V_FILE
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
  HEADER_LENGTH                 = 0
  READ_BY_LINE                  = 'X'
  DAT_MODE                      = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
  tables
    data_tab                      =  IT_MATMASTER
EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_READ_ERROR               = 2
   NO_BATCH                      = 3
   GUI_REFUSE_FILETRANSFER       = 4
   INVALID_TYPE                  = 5
   NO_AUTHORITY                  = 6
   UNKNOWN_ERROR                 = 7
   BAD_DATA_FORMAT               = 8
   HEADER_NOT_ALLOWED            = 9
   SEPARATOR_NOT_ALLOWED         = 10
   HEADER_TOO_LONG               = 11
   UNKNOWN_DP_ERROR              = 12
   ACCESS_DENIED                 = 13
   DP_OUT_OF_MEMORY              = 14
   DISK_FULL                     = 15
   DP_TIMEOUT                    = 16
   OTHERS                        = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
               DATA POPULATIONS                                    *
LOOP AT  IT_MATMASTER.
  BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
  BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
  BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
  BAPIMATHEAD-BASIC_VIEW = 'X'.
BAPIMATHEAD-PURCHASE_VIEW = 'X'.
BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
  BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.
BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-OLD_MAT_NO = 'X'.
  BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-BASIC_MATL = 'X'.
BAPI_MARAX-MFR_NO = 'X'.
BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.
BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
  IT_MATERIALDESC-LANGU = 'EN'.
  IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
  append IT_materialdesc.
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      headdata                   = BAPIMATHEAD
      CLIENTDATA                 = BAPI_MARA
      CLIENTDATAX                = BAPI_MARAx
    PLANTDATA                  = BAPI_MARc
    PLANTDATAX                 = BAPI_MARcx
    FORECASTPARAMETERS         =
    FORECASTPARAMETERSX        =
    PLANNINGDATA               =
    PLANNINGDATAX              =
    STORAGELOCATIONDATA        =
    STORAGELOCATIONDATAX       =
    VALUATIONDATA              =
    VALUATIONDATAX             =
    WAREHOUSENUMBERDATA        =
    WAREHOUSENUMBERDATAX       =
    SALESDATA                  =
    SALESDATAX                 =
    STORAGETYPEDATA            =
    STORAGETYPEDATAX           =
    FLAG_ONLINE                = ' '
    FLAG_CAD_CALL              = ' '
   IMPORTING
     RETURN                     = IT_RETURN
   TABLES
     MATERIALDESCRIPTION        = IT_MATERIALDESC
    UNITSOFMEASURE             =
    UNITSOFMEASUREX            =
    INTERNATIONALARTNOS        =
    MATERIALLONGTEXT           =
    TAXCLASSIFICATIONS         =
    RETURNMESSAGES             =
    PRTDATA                    =
    PRTDATAX                   =
    EXTENSIONIN                =
    EXTENSIONINX               =
  Bapi to commit the changes
    IF sy-subrc <> 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
WRITE:/    IT_RETURN-TYPE,
        2   IT_RETURN-ID,
        22  IT_RETURN-NUMBER,
        25  IT_RETURN-MESSAGE.
           IT_RETURN-LOG_NO,
           IT_RETURN-LOG_MSG_NO,
           IT_RETURN-MESSAGE_V1,
           IT_RETURN-MESSAGE_V2,
           IT_RETURN-MESSAGE_V3,
           IT_RETURN-MESSAGE_V4,
           IT_RETURN-PARAMETER,
           IT_RETURN-ROW,
           IT_RETURN-FIELD,
           IT_RETURN-SYSTEM.
ENDLOOP.
thanks
sanjeev

Actually your COMMIT call not at all executed.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
The sy-subrc = 0 after the BAPI executed, the right way is after BAPI call check the bapi RETURN table has any error, if not commit the BAPI otherwise rollback.

Similar Messages

  • Curious Problem with Images - Help required soon

    I'm working towards a Monday deadline and this problem with Pages is giving me nightmares.
    The images swap but keep the same bounding area. A logo, for example, may have in its place a screenshot.
    It is getting out of hand and I need help with this quickly.
    Thanks in advance.

    You can set the preferred address to bind the registry via the "java.rmi.server.hostname" system property, which can be set via the command line:
    java -Djava.rmi.server.hostname=127.0.0.1
    or...
    java -Djava.rmi.server.hostname=my_host
    I think you can also set the property programatically via the setProperty() method in the java.lang.System class

  • Custom report templates with the help of BI Publisher.

    Hi All,
    I have created custom report templates with the help of BI Publisher it is working as we excepted.
    refered : https://blogs.oracle.com/kyle/tags/reports
    But our requirement want to change the color of heading and include filters in output report, It is possible, if yes pls share you comments?
    Best Regards
    Pradeep

    how silly of me!
    just restarting the tomcat sorted the problem!!!

  • I can't delete my bt emails or move them to folders, other emails from tiscali no problem with, anyone help please

    I can't delete my bt emails or move them to folders, other emails from tiscali no problem with, anyone help please

    I did that and it is currently whirring away, had over 16000 emails as everything got imported when I set emails up (only had this computer 5 days). So will see what happens when it stops doing whatever it is doing. Sorry if I appear stupid but first Mac I have owned so everything a bit new. Have managed to get most things working correctly just can't sort this BT email problem out. Will report back later!

  • Chrome (Windows NT 6.1 6.2) users reporting problems with loading and mouseevents - any insights?

    For several years now, I have created simple studies (I do psychological stuff) to run online, recruiting participants through Amazon Mechanical Turk (AMT). I have had no problems until recently (last 6 to 9 months). Now, some AMT users are reporting problems with stimuli loading or buttons not responding immediately when clicked (e.g., advancing to a new screen). What is common amongst all the users experiencing problems is that they use Chrome, and they also tend to be Windows NT 6.1 or 6.2 users running Flash Player 12.0. But not a single Firefox, Safari, or MSE user has ever reported an issue. I'm just looking for help in troubleshooting this problem. Again, the studies I run are incredibly simple (e.g., no videos being loaded from server, etc.), mostly word presentation where I record time and x,y coordinates of mouse movements as they respond to questions. Would attempting to publish for another target version of Flash Player help? The default setting is to publish the .swf and .html wrapper for Flash Player version 11.7. Any ideas? I also use version 13.0.1 of Flash Professional CC to create my studies if it helps. 

    This is helpful. Thanks. So it would be to my advantage to play around with something like SWFObject 2?
    http://www.adobe.com/mena_fr/devnet/flashplayer/articles/swfobject.html
    Or is there something else you would recommend?
    What I've been doing is a far cry from actual web development, but quite interested in learning more. This swfobject seems to get at what you are suggesting (I think). 

  • Reporting problems with iTunes

    Does anyone know how to report problems with updates to iTunes to Apple? I cannot find any way to contact them to alert them to bugs and problems.

    And if you're an ADC member (the Online membership is free), you can use Apple's Bug Reporter.

  • ITunes has stopped working.  Problem with iTunes Helper Module

    After i installed the 7.3.1 iTUNES update for my windows VISTA, i keep getting iTunes has stopped working, and a message saying there is a problem with iTunes Helper Module.. I've tried to re-install and everything.. Can anyone help me out?

    here you go
    Problem signature
    Problem Event Name: APPCRASH
    Application Name: iTunesHelper.exe
    Application Version: 7.3.1.3
    Application Timestamp: 468d67e8
    Fault Module Name: QuickTimeStreamingAuthoring.qtx
    Fault Module Version: 7.2.0.240
    Fault Module Timestamp: 4684a83a
    Exception Code: c0000005
    Exception Offset: 00016c09
    OS Version: 6.0.6000.2.0.0.768.3
    Locale ID: 1033
    Additional Information 1: 18fe
    Additional Information 2: f42ba5cd8b2ed31f18b99a5ea46137af
    Additional Information 3: 4735
    Additional Information 4: ae0a749503b699b3b75d581a3dbfd557
    Extra information about the problem
    Bucket ID: 466198587

  • Problem with Adobe Help Online

    Dear sir,
    Hi, My name is Palm.
    I have a problem with Adobe Help. Every time I use the function "Leyer Style" >> "Gradient Overlay".
    Adobe Help Online is often displayed without my pressing or click anything.
    It was a problem with my work.
    I have to restart the program. To work again.
    Thanks for the help.

    Thank you.
    It's excellent for this solution.
    I have solved the problem as suggested.
    Now the problem is still not found but I will monitor this issue further.

  • HT4718 are there any reported problems with safari with the new OS X Mavericks?

    My early 2008 iMac running OS X 10.9.2 all of the sudden has problems loading pages in safari.  The problem timing is the same as the upgrade to Maverick. The computer is connecting to wifi and other devices such as iPhones and three PCs have no problems.  The ISP is Xfinity.  Are there any reported problems with Maverick and Safari?

    Try searching.

  • Problems with "Mac Help"

    My help files, especially "Mac Help", no longer work properly since upgrading to Tiger. If I open "Mac Help", for example, the help window will pop up, but the links will not work (nothing happens when I click on them) and the search feature in help will not work either (the little gray "clock" just spins next to the help bar and nothing else ever happens). Any suggestions on this one? As I'm a relatively recent Mac convert, the help feature was something that I came to rely on. Thanks!

    Hi CP,
    This is a common problem with Mac Help. When it happens, try first (quit Help) deleting this folder:
    Home/Library/Caches/com.apple.helpui
    If Help still doesn't work, try then deleting those files:
    Home/Library/Preferences/com.apple.helpviewer.plist
    Home/Library/Preferences/com.apple.help.plist
    (and this one if you find it):
    Home/Library/Preferences/com.apple.helpui.plist
    See also this KB article for more info
    - Mac OS X 10.2, 10.3: Mac Help Viewer unexpectedly quits
    and this excellent X Lab FAQ
    - Troubleshooting Help Viewer
    It seems (not sure about that), that Help caches get easily corrupted when interrupting searches instead of patiently waiting for its internet accessings etc?
    Good luck!
    Axl

  • Reporting Problems with Overground Cables on Poles

    A number of houses where I live have their phone lines carried on poles.  The cables pass close to and through branches of trees and several of the cables are likely to be damaged very soon as some are being dragged down by the weight of the branches. 
    Is there a way of reporting this to BT such that they can possibly take proactive steps to avoid the problem rather than waiting for the lines to break as they have done previously?
    The fault reporting problem goes via a line check which won't fail.
    Thanks.

    Here is the link you need
    http://www.openreach.co.uk/orpg/home/contactus/tellussomething/tellussomethingaboutournetwork/tellab...
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • Problem with Adobe Help in Creative Cloud

    I'm using Mac OSX 10.9 but this problem has been here before that.
    My Adobe Help application says "No Adobe Products are currently installed." which is completely wrong. If I look at the "Local Content tab there is nothing displayed. I did have the "Display Local Help Content only" set to "yes, because it annoyed me to be taken to SLOW website whenever I clicked help. But now I have no other options and it seems to have mucked uo the help system altogether. I have changed it to "No" now so that it will display online content, but the real problem is that it does not recognise ANY of the installed CC applications.
    Any clues as to what the problem is or how I can make Adobe Help recognise my installed applications? Adobe Help has SUCKED BADLY for local help content for a long now.

    i too have issues with the help the tech sopport for Adobe. When i last tried to call i was told it would be a hour wait. Using the online chat was useless as well. Then to top things off my code for the ID theft monitering servies is not valid. Now i have to call and deal with that, there is another half a day wasted. I think its time to hack the software, YES adobe i have the .DLL files needed to have creative cloud or windows 7. Unless i get better help im going to cancle my subscription and just intall the hacks so the software still works. who needs support they are useless anyway.

  • Problem with printing help plz

    Hi Folks,
    Got a problem with printing hope you can help. I have just got back from an online printers some 40 prints. There is a big difference between the brightness of the print (it being a lot darker) and the elements screen. The company I used comes highly reccomended by many different sources. What am I doing wrong and how do I fix?
    Thanks

    which online service provider are you using?

  • Cannot "Report problem" with recent purchase.

    I am using Windows 7 Pro w/ Internet Explorer 11 and iTunes v11.1.3.8.  Both these are latest versions as far as I know.  Despite this, when I go to report a problem with a recent download, IE shows a message I must be using the latest versions of these two applications in order report the problem. 
    What to do about this?

    If it is an issue with a song not playing correctly, you may be able to re-download it with iTunes in the cloud beta. Log in to your account, click on "Purchased" in the Quicklinks section, and re-download the song.

  • XL Reporter problem with SQL 2005

    Hi,
    We just migrated our SQL Server from 2000 to 2005. Everything seemed OK, until we tried to run XL Reporter addon. Our SQL 2005 is 64bit edition, and I heard the 64bit version has some problem with transferring data to Excel, for example.
    has anybody had the some problem? How can we solve this?
    Thanks.
    Andre

    Hi Andre,
    Check this thread: Re: XLR - Terminal Server
    It should be a problem if your PL is upgrade to new.
    Thanks,
    Gordon

Maybe you are looking for