Bapi  material master create

heloo gurus,
when i execute the below code
it throws a short dump error
can u please correct my code if there is anything wrong in it
  DATA: headdata    TYPE bapimathead.
  DATA: clientdata  TYPE bapi_mara.
  DATA: clientdatax TYPE bapi_marax.
  DATA: plantdata  TYPE bapi_marc.
  DATA: plantdatax TYPE bapi_marcx.
  DATA: descdata    TYPE TABLE OF bapi_makt WITH HEADER LINE.
*data: return  type table of bapiret2 with header line.
  DATA: returnm TYPE TABLE OF bapi_matreturn2 WITH HEADER LINE.
  DATA: imat    TYPE TABLE OF bapimatinr WITH HEADER LINE.
  CALL FUNCTION 'BAPI_MATERIAL_GETINTNUMBER'
    EXPORTING
      material_type          = 'ZMED'
  INDUSTRY_SECTOR        = 'M'
    TABLES
      material_number        = imat.
  READ TABLE imat INDEX 1.
  IF sy-subrc = 0.
    headdata-material = imat-material.
  ENDIF.
  headdata-ind_sector      = 'Z'.
  headdata-matl_type       = mtart.
  headdata-basic_view      = 'X'.
  headdata-purchase_view   = 'X'.
  clientdata-base_uom      = meins.
  clientdatax-base_uom     = 'X'.
  clientdata-old_mat_no    = bismt.
  clientdatax-old_mat_no   = 'X'.
  clientdata-matl_group    = matkl.
  clientdatax-matl_group   = 'X'.
  clientdata-document      = zeinr.
  clientdatax-document     = 'X'.
  clientdata-size_dim      = groes.
  clientdatax-size_dim     = 'X'.
  clientdata-std_descr     = normt.
  clientdatax-std_descr    = 'X'.
  clientdata-basic_matl    = wrkst.
  clientdatax-basic_matl   = 'X'.
  clientdata-del_flag      = lvorm.
  clientdatax-del_flag     = 'X'.
  descdata-langu = sy-langu.
  descdata-matl_desc = maktx.
  APPEND descdata.
  plantdata-pur_group     = ekgrp.
  plantdatax-pur_group    = 'X'.
  plantdata-auto_p_ord    = kautb.
  plantdatax-auto_p_ord   = 'X'.
  plantdata-plant         = werks.
  plantdatax-plant        = 'X'.
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      headdata                   = headdata
      clientdata                 = clientdata
      clientdatax                = clientdatax
      plantdata                  = plantdata
      plantdatax                 = plantdatax
  FORECASTPARAMETERS         =
  FORECASTPARAMETERSX        =
  PLANNINGDATA               =
  PLANNINGDATAX              =
  STORAGELOCATIONDATA        =
  STORAGELOCATIONDATAX       =
  VALUATIONDATA              =
  VALUATIONDATAX             =
  WAREHOUSENUMBERDATA        =
  WAREHOUSENUMBERDATAX       =
  SALESDATA                  =
  SALESDATAX                 =
  STORAGETYPEDATA            =
  STORAGETYPEDATAX           =
   IMPORTING
      return                     = return
    TABLES
      materialdescription        = descdata
  UNITSOFMEASURE             =
  UNITSOFMEASUREX            =
  INTERNATIONALARTNOS        =
  MATERIALLONGTEXT           =
  TAXCLASSIFICATIONS         =
      returnmessages             = returnm
  PRTDATA                    =
  PRTDATAX                   =
  EXTENSIONIN                =
  EXTENSIONINX               =
CHECK sy-subrc  = 0.
  IF sy-subrc EQ 0.
    return-number     = 0.
    return-type       = 'S'.
    return-id         = 'Z1'.
    return-message    = 'Successfully updated'.
    return-message_v1 = ''.
    return-message_v2 = ''.
    return-message_v3 = ''.
    return-message_v4 = sy-mandt.
  ELSE.
    return-number     = 0.
    return-type       = 'E'.
    return-id         = 'Z1'.
    return-message    = 'Not updated'.
    return-message_v1 = ''.
    return-message_v2 = ''.
    return-message_v3 = ''.
    return-message_v4 = sy-mandt.
  ENDIF.
<b>Error analysis</b>
    An exception occurred. This exception is dealt with in more detail bel
    . The exception, which is assigned to the class 'CX_SY_DYN_CALL_ILLEGA
     was neither
    caught nor passed along using a RAISING clause, in the procedure
     "ZTEST_BAPI_MM01" "(FUNCTION)"
    Since the caller of the procedure could not have expected this excepti
     to occur, the running program was terminated.
    The reason for the exception is:
    The call to the function module "BAPI_MATERIAL_SAVEDATA" is incorrect:
    In the function module interface, you can specify only
    fields of a specific type and length under "RETURN".
    Although the currently specified field
    "RETURN" is the correct type, its length is incorrect.
Thamks
senthil

i have uncommented the line
data: return  type table of bapiret2 with header line.

Similar Messages

  • Material Master create / change screen addition

    Hi
    I am trying to add purchasing order text screen to material master create / change Z T code. I added purchasing order text for screen sequence group through T code OMT3B. But when I check screen sequnce in TCode OMT3R - Change view of screen order, new screen is not apperaing.
    I did similar configuration in sandbox of my system, I am able to add screen in material master create / change t code.
    Is there any other settings need to be maintained to add this screen?
    Regards,
    Nilesh Sankpal

    Do the maintenance in OMT3E also.

  • Automatic Trigger of Idoc Sending to PI on Material Master Create/Change

    Hi All,
    I would like to ask how to automatically trigger sending of idoc on material master create/change without using a standard transaction like BD10. I already tried using MASTER_IDOC_DISTRIBUTE in the material master change user exit. It does send the idoc but my problem is when an inbound idoc creates a material, it will then pass through the userexit and use MASTER_IDOC_DISTRIBUTE again.
    Any suggestions? Or do you have a better solution for this? My requirement is when uer goes throgh MM01/MM02 an idoc will automatically be sent to PI.
    Thanks.

    First of all a quick comment to your present solution. If it works and your only problem is that you'd like to suppress triggering the IDoc creation when a material is created/updated via inbound IDoc then you might want to just fix that. There's many possible ways to approach this, it all depends how much you want to change and what your processes are (I sorted the listed ones in order of personal preference, though the list is not complete for sure):
    <ul style="list-style:circle;">
    <li>Export some flag to memory when processing an IDoc that you can import in your exit and thus recognize that you don't want to send an IDoc. Depending on how you are processing your inbound IDoc BAdI BADI_MATMAS_ALE_IN might work; you might find others if this is not applicable or sufficient. If you're working on ECC 6.0 you could also consider coding the export of the flag in an implicit enhancement spot in your function modules used for IDoc processing.</li>
    <li>Evaluate in your existing coding the transaction code SY-TCODE; most likely you should see a clear difference between your IDoc processing and the other updates where you want to trigger the IDoc.</li>
    <li>Most likely the IDoc processing triggers function module MATERIAL_MAINTAIN_DARK (e.g. MATERIAL_INPUT_MATMAS01 does); this function module uses a global variable FLAG_BAPI_CALL to indicate the non-dialog processing. So if you feel adventurous you could evaluate this flag in your coding.</li>
    </ul>
    Change pointer won't really do you any good if your functionality is already working without them apart from the trigger. Even if you write change pointers, you still have to implement the trigger functionality, so essentially back to square one...
    In general another good option is often to use workflow events that are already triggered. I.e. in your case business object BUS1001006 almost does the trick. It has events for <em>ViewCreated</em> and <em>Created</em>, but unfortunately lacks events for material updates (and I didn't see any other appropriate object that has it and a quick trace while updating a material didn't fire any appropriate event).
    Cheers, harald

  • BAPI : MATERIAL MASTER - Internal Number generation

    Dear Experts,
                        I am using BAPI_MATERIAL_SAVEDATA to update material master,Material number should be generated
    internally.If iam not including Material number,Bapi returns errror mesage.How can i do this?
    Regards,
    Sujay .

    From the function module documentation:
                                                                                    o   MATERIAL                                                            
         Only external number assignment is supported for the material number
         (MATERIAL). If you want the material number to be assigned          
         internally, the method BAPI_MATERIAL_GETINTNUMBER must first be     
         called. This method determines an internal number for the material  
         to be created. You must enter this internal number in field         
         HEADDATA-MATERIAL.                                                  
    Hope this helps,
    -Mark

  • LSMW Material Master - create several valution types within one Run

    Hello @ll,
    i created a LSMW for material master migration, and i would like to create up to 4 different accounting views (based on different valuation types) within one LSMW Run.
    As there is the Field BWTAR on Structure BMM00, and the accounting fields on Structure BMMH1 i dont know if:
    1. this is possible in general with LSMW and
    2. if possible where i have to set the "transfer_record" commands...
    Does anybody have experience on this?
    BR,
    Gregor H.

    I never used the standard batch input method, so I cant answer this part. But with IDOC as import method I do this right now and it works without any problem
    The transfer record command is set in the  section of processing time  __END_OF_RECORD__
    you can display this section when you are in field mapping and conversion rules. choose from menu Extras > Layout and activate all boxes.

  • Mass upload of Object Services to material master - Create Document (URL)

    Hi there,
    Does anyone have any experience of uploading URL's to material masters via object services. Can we use LSMW?
    I have tried to record the transaction, however, this excludes the object services button
    Any feedback greatly appreciated
    Steve

    Hi Csabar,
    Thanks.
    BUt may I know clearly what do you mean by your following statement?
    I would suggest you should always create/modify/delete only one record in config via LSMW. 
    I have more than 3000 records for this exercise, do You mean I should test it out on one record first in 0VRF during the recording??
    thanks
    tuff

  • How to create a new field in a sub screen in material master. ?

    How to create a new field in a sub screen in material master. ?
    Kindly help us.
    LIke wise tell me how to create a new sub screen as per my desired

    Follow the documentation of Logistics - General->Material Master->Configuring the Material Master->Create Program for Customized Subscreens  to add the new field in material master.
    Create Program for Customized Subscreens
    In this IMG activity, you can create a function group of your own by copying function group MGD1 (for industry) or function group MGD2 (for retail). The subscreens are not copied, except for two subscreens which are copied for technical reasons. You can use this copy to create subscreens of your own which you can assign to a data screen in the activity Define Structure of Data Screens for Each Screen Sequence.
    Requirements
    Be sure to read the program documentation first.
    Activities
    1. Create a function group of your own by choosing Execute.
    2. Enter a name containing up to 25 characters, beginning with the letter Y or Z, and choose Save.
    3. Access the Object Navigator.
    You do this from the SAP standard menu by choosing Tools -> ABAP Workbench, and then Object Navigator.
    4. Display either program SAPLMGD1 (industry) or SAPLMGD2 (retail) as required.
    5. Copy the subscreens as required, ensuring that they already contain as many as possible of the field names you want to use in your function group. You do this as follows:
    a) Choose Screens, position the cursor on the corresponding subscreen, and choose Copy in the context menu.
    b) Enter the program to which you want to copy the subscreen, prefixing it with SAPL, and enter a screen number. Use the screen number of the original subscreen where possible. If the F1 help is specific to a particular subscreen, this ensures that this context-specific help continues to be displayed.
    Example
    You have called your function group YENTERPRISE, to which you want to copy subscreen SAPLMGD1 2301. Enter SAPLYENTERPRISE as the program to which the subscreen is to be copied, and enter (preferably) 2301 as the screen number.
    6. Return to the initial screen of the Object Navigator and display your program. In the example above, you would enter SAPLYENTERPRISE.
    7. Choose Update object list.
    8. Select the subscreen you have copied and activate it by choosing Activate in the context menu.
    Using the Screen Painter, you can remove fields you do not require on the subscreen or include additional fields from other subscreens (see the ABAP Dictionary). For information on the Screen Painter, see the SAP library documentation BC ABAP Workbench Tools.
    Points to consider when removing or adding fields
    Make sure that a field statement exists for each field on the subscreen since data may not otherwise be transported correctly. You can use subscreen SAPLMGD1 2002 as an example.
    For the fields you have added, include any check modules and modules for self-programmed F4 help that are called up for these fields on the original subscreen. You can do this by displaying the flow logic for the original subscreen and searching for such modules. They normally have the same names as the fields themselves. When you find a module, copy the corresponding module call to your subscreen.
    If you change the order in which fields are transported that are checked together in the flow logic (such as the safety stock and minimum safety stock), you must deactivate the check module for the first field and activate it for the second. The system would otherwise transport the first field, and carry out the check before the second field is transported.
    Any error messages that fields are unknown when activating the subscreen are due to the fields still being included in checks, even though you have removed the fields from the subscreen. Search for the fields in the source code and make the lines in which they appear comment lines. Then reactivate the screen.
    9. Assign the subscreen to a data screen as required.
    Note on transport
    Use the Workbench Organizer to transport the copy you have created.
    Proceed

  • Creating Material Master IDoc when creating a Material

    Hi Guys,
        My requirement is to trigger an IDOC at the time when I am creating a material using MM01 transaction. The Changepointer is active and when i am tring to send materials using BD10 it's showing that the IDOC is created which certifies that the config is OK. but when I am creating a material and saving it ..the same process is not triggering an Idoc.
    Can anyone help me out ...where I am missing out.
    Thanks
    Debasis Roy Chowdhury

    Hi Debasis,
    Activating pointers for the message type do not  trigger Idoc, we need to manually or scheduled the program to create the idoc against  pointers.You need to run BD21 transaction or  schedule RBDMIDOC .
    Go through this [Idoc Triggers|Automatic Trigger of Idoc Sending to PI on Material Master Create/Change;.There is a good discussions.
    Regards,
    Madhu.
    Edited by: madhurao123 on Feb 2, 2012 9:40 PM
    Edited by: madhurao123 on Feb 2, 2012 9:43 PM

  • MM01 Create New Material Master without Basic view

    Hi,
    The SAP system allow us to create a new material master Purchasing View only (without Basic views). We execute T-code MM01, select Purchasing view only, enter the purchasing view data and save. Material master created with only the Purchasing view.
    We want to control whereby Basic view must be created first before any plant/organisation material views (Sales, purchasing, Accouting etc) can be created. That means user cannot create Purchasing view ONLY if the Basic views is not created, can this be done??
    best regards,

    Hi,
        For most of the standard SAP material types the basic data 1 view is configured as mandatory, but that can be turned off in the configuration. The first place I would look would be in SPRO under 'Logistics - General -> Material Master -> Basic Settings -> Material Types -> Define Attributes of material types'. In this transaction, highlight the material type being used and click on the magnifying glass. The section 'User departments' shows what views can be created for a material. You need to check 'Basic Data' is selected here.
    If that isn't the problem, then I would suggest that you look at the screen sequence and also the field selection configuration for the material type, which you can find under 'Logistics - General -> Material Master -> Configuring the Material Master'. This configuration dictates what fields are shown on the material master and the status of each field, i.e. whether it is mandatory or not.

  • Valuatiopn type in material master

    HI Friends,
    Valuation type not selected while material master created and now we want to update valuation type for same material ,please tell me how we update valuation type for the same  material .
    Thanks,
    Dharmveer

    hi expert,
    goood morning
    as i have some problem with material creation by using bapi and rfc
    as i am able to create material by using  BAPI_MATERIAL_GETINITNUMBER
                                                                    BAPI_MATERIAL_SAVEDATA
    THE THING IS I MATERIAL HAS BEEN CREATED
    AND I NEED TO EXTEND THIS TO VALUATION TYPE ITS IS NOT GET UPDATED IN MBEW TABLE.
    AND WAT DO I NEED TO GET UPDATED THAT FIELD IN MBEW
    AND WAT FUNCTIONS R WAT SELECT STAMENTS DO I NEED TO USEE
    PLEASE
    SEND ME REPLY AS I AM WAITING FOR REPLY
    THANK YOU
    REGARDS
    PRABHANJAN
    prabhanjan.g06 at g com

  • How to activate the new fields on material master(MM01/MM02/MM03) for existing Materials

    Hi,
    We have a requirement to add  some custom fields as a new tab in additional data option(Descriptions, Unit of measure, etc.) in Basic data of Material master (MM01/MM02/MM03). I have successfully added and these custom fields and they are not part of standard(MARA, MARC) but a custom table and the updates are also done in custom table.
    For new materials, I can see the new tab in additional data screens of basic data view and I could successfully create/change/display using MM01/MM02/MM03. However I cannot see the new tab/fields for existing materials in the system in all 3 tcodes (MM01/MM02/MM03). This is not a main view in material master so that I can extend it by MM01.
    Is there any setting or mass generation program I have top perform so that I can see and maintain these new fields for existing materials. Appreciate any leads or help on this.
    Thanks,
    Harry

    Hello Harry,
    Goto t.code SPRO ---> Display IMG --->  Logistics - General --> Material master --> Configuring the material master --> Create program for customized screens
    Use the above path and create the screen and assign it to the sequence using the below link as reference.
    **************** - Tips - Implementing screen exits for MM01/MM02/MM03
    Regards,
    Thanga

  • Accounting & costing view in the material master

    hi
    my client wanted to block the accounting & costing view in the material master for the end users
    what i need to do

    Hi,
    You can (Authorization material master by views of accounting & costing ) achieve this by way of authorization control. In transaction PFCG, select your role for creating / changing the material master. Select option Maintenance statuses. Then at change status option select views that you want to give the authorization to the users. Create profile & save the role. Now assign the role to the users. They will get only those views you have selected. You have to select those views in all the roles related to material master (create, change, display).Better Consult Basis Consultant,
    Regards,
    Biju K

  • Authorization material type in material master

    Hi expert,
    I want to know how to restrict users to create/change Material Master following
    the material type in the role.
    In role authorization Object: M_MATE_MAR Material Master: Material Types.
    I maintain material type like ROH , HALB , HAWA in authorization Group.
    But it is not work. Please help me.
    Thanks,

    Hi,
    Pl. check your role to users for the material master again for allowed material types. It should restrict the users only for the selected views only. This should be done for all the roles assigned to users in relation to materail master. (i.e. Create, Display & CHange). If you restrict the material type in create role only & it is not restricted in display role, then user will be able to create all the material types. hence restrict the material types in all roles related to material master (create, change, display) assigned to the user.
    Regards,
    Prashant

  • Add a field in Material Master-QM view

    The requirement is as...
    Create a field on the QM view of the material master MM01.  The field will be a check box.
    F1 help on this field should say “ Select ******** ”.
    Is there any BADI or any other way to achieve this?

    Hello Sumanth,
    For material master there is no concept like BADI. You will have to follow certain steps to do this.
    SPRO->Logistic General->material master->configuring material master->create program for customised screen.
    Execute this which will create a function group for you ZMGD1(say). Goto to SE80 select MGD1 function group, open screen section, select 3000 screen and right click, chose option of copy. In popup in the TO section enter ur SAPLZMGD1 screen 9001. this will copy the screen 3000 to 9001 in ZMGD1. Now goto screen painter and delete all the unwanted fields from the screen and create check box field. Save and activate. Now for processing in PBO u will have to have do as follows...
    PBO..
      MODULE BEZEICHNUNGEN_LESEN.
      module move_data_checkbox. <- created new
      MODULE SET_DATEN_SUB.
    has to be between BEZEICHNUNGEN_LESEN & SET_DATEN_SUB
    similarly for PAI same thing follows.
    Now go back to customising and goto Define structure of data screen for each screen seq. Select the seq which is most probably 01. click on data screen. Select the Quality screen and click on subscreen and here u overwrite an entry with 0001.
    01 20 4 SAPLZMGD1 9001.
    Save and try creating a material.

  • Downloading Material Master data from ECC to CRM

    Hello friends, I am working in CRM 5.0., I am finding difficulty in downloading Material master created in ECC to a Product Master in CRM. Can you please tell me how to use Customizations to download the material master to product master.

    Hi Rghunandan,
    To carry out the product replication from ECC to CRM,you need to carry out the foll steps.
    First download the customizing objects using R3AS
    DNL_CUST_PROD0 u2013 Material number conversions
    DNL_CUST_PROD1 u2013 Product : Categories
    DNL_CUST_PROD3 u2013 Material : R/3 sales status
    DNL_CUST_SPROD u2013 Sales product item
    DNL_PLANT - Plant
    To download products foll the steps below
    1.Defining Product ID Settings  -COMCPRFORMAT
    Cross-Application Components  SAP Products  Basic Settings  Define Output Format and Storage Form of Product Ids
    This activity describes how to synchronize the product Ids in the CRM system and the R/3 system.
    The material master length is R/3 is defined in transaction code OMSL and is set to 18.  (also check note no. 545824)
    2.Make sure that CRM item categories and R/3 item categories are the same.
    In CRM, item categories and item category groups are seen via
    Customer Relationship Management  Transactions  Basic Settings
    3.Selecting specific objects for replication : R3AC1
    Use adapter object MATERIAL
    Use filter settings tab and specify the material or a range of products you want to download .Use atble name MARA,field MATNR use an approriate operator and mention theproduct you want to downlaod.
    4.Replicate Materials : R3AS
    mention the adaptor object Material and execute
    Regards
    Itty

Maybe you are looking for

  • Handling Audio streams accross a network

    Hi, I have written a Computer Telephony Interface package for a SIP based PBX system and I'm currently exploring the possibility of turning it into a fully functional SIP softphone. The program has a basic SIP stack which I have extended to include t

  • Downloading Album Artwork

    I went to the manuals to figure out how to get the album artwork onto my ipod. It said to go to ipod nano in the sources, (where is that?). I went to my ipod in devices since I didn't know where that was. Then it said to click on the music tab and cl

  • Thread execution

    Hello, I am misunderstanding why this finishes the thread before the program exits. I thought that the thread executes on its own branch then the main program continues, in which the main method finishes thus calling the threads to stop before java s

  • Can't install quicktime player...

    Hey you guys, i have a strange problem.. i download the latest quicktime player, but when i run it to install it, it says: "preparing for install", and then it stops preparing and it does nothing.. i tried to install it 4-5 times and it always stoppe

  • NSAPI,  C++ and the STL string class

    Hi, I have a NSAPI service function written in C, but I would like to use C++ in order to take advantage of the STL string class. I am using NSAPI 4.1 and Solaris 8 and compiling with gcc 3.2. Everything compiles fine, but when I start the server, I