Mb1b Transfer posting problem (urgent)

hello
i m using movement type 309.
in the second screen they are entering batch..so based on that batch i m getting matnr and quantity in that batch.
In my ZBAPI ..
SELECT matnr clabs FROM mchb
                       INTO TABLE it_mb1b
                       WHERE werks = plant      
                       AND   lgort = send_stloc 
                       AND   charg = batch.    
In the second line item..They are entering scrap material which the data has to get from MARD table. There is no batch exists for this second line item.
i m writing query to get the data from mard like this:-
  SELECT matnr labst FROM mard
         INTO CORRESPONDING FIELDS OF TABLE it_mard
                       WHERE matnr LIKE '%-SCRAP'
                       AND   werks = plant     
                       AND   lgort = '2200'. 
So, how to fill this second line item in BAPI.
For the first line item i m using it_gmitem-entry_qnt in the BAPI item list.  This is for the first item in second screen.
Similarly how to fill the second line item in BAPI_GOODSMVT_CREATE.

FUNCTION zbapi_mb1b_new.
""Local interface:
*"  IMPORTING
*"     VALUE(MOVE_TYPE) LIKE  BAPI2017_GM_ITEM_CREATE-MOVE_TYPE DEFAULT
*"       '309'
*"     VALUE(PLANT) LIKE  BAPI2017_GM_ITEM_CREATE-PLANT DEFAULT '2000'
*"     VALUE(SEND_STLOC) LIKE  BAPI2017_GM_ITEM_CREATE-STGE_LOC
*"     VALUE(RECV_STLOC) LIKE  BAPI2017_GM_ITEM_CREATE-MOVE_STLOC
*"     VALUE(MOVE_PLANT) LIKE  BAPI2017_GM_ITEM_CREATE-MOVE_PLANT
*"       DEFAULT '2000'
*"     VALUE(BATCH) LIKE  BAPI2017_GM_ITEM_CREATE-BATCH
*"     VALUE(QUAN_MEASURE) LIKE  BAPI2017_GM_ITEM_CREATE-QUANTITY
*"  EXPORTING
*"     VALUE(MAT_DOC) LIKE  BAPI2017_GM_HEAD_RET-MAT_DOC
*"  TABLES
*"      RETURN STRUCTURE  BAPIRET2
  DATA : ls_quan1 TYPE p DECIMALS 3,
         ls_quan2 TYPE p DECIMALS 3,
         ls_quan3 TYPE p DECIMALS 3,
         ls_quan4 TYPE p DECIMALS 3,
         ls_quan5 TYPE p DECIMALS 3,
         ls_quan6 TYPE p DECIMALS 3.
  DATA : it_mard LIKE mard OCCURS 0 WITH HEADER LINE.
  gmhead-pstng_date = sy-datum.  "Posting date defaulted to system date
  gmhead-doc_date   = sy-datum.  "Document date defaulted to system date
  gmcode-gm_code    = '04'.       "Transfer Posting (MB1B)
  SELECT matnr clabs FROM mchb
                       INTO TABLE it_mb1b
                       WHERE werks = plant       "Plant
                       AND   lgort = send_stloc  "Storage location
                       AND   charg = batch.      "Batch Number
  SELECT matnr labst FROM mard
                       INTO CORRESPONDING FIELDS OF TABLE it_mard
                       WHERE matnr LIKE '%-SCRAP'
                       AND   werks = plant      "Plant
                       AND   lgort = '2200'.    "2094 in production
  LOOP AT it_mb1b INTO wa_mb1b.
    ls_quan2 = ( 5 / 100 ) * wa_mb1b-clabs.
    ls_quan3 = wa_mb1b-clabs + ls_quan2.
    ls_quan4 = wa_mb1b-clabs - ls_quan2.
    IF ( quan_measure EQ wa_mb1b-clabs ).
      ls_quan6 = wa_mb1b-clabs.
   ELSEIF ( quan_measure > wa_mb1b-clabs AND quan_measure <= ls_quan3 ).
      ls_quan5 = quan_measure - wa_mb1b-clabs.  "difference
      READ TABLE it_mard WITH KEY matnr0(3) = wa_mb1b-matnr0(3).
      IF sy-subrc EQ 0.
        it_mard-labst = it_mard-labst - ls_quan5.
        MODIFY it_mard TRANSPORTING labst WHERE
                         matnr0(3) = wa_mb1b-matnr0(3).
      ELSE.
      ENDIF.
      MODIFY mard FROM TABLE it_mard.
      CLEAR it_mard.
      ls_quan6 = wa_mb1b-clabs + ls_quan5.
   ELSEIF ( quan_measure < wa_mb1b-clabs AND quan_measure <= ls_quan4 ).
      ls_quan5 = wa_mb1b-clabs - quan_measure.
      it_mard-labst = it_mard-labst + ls_quan5.
      MODIFY it_mard TRANSPORTING labst WHERE
                          matnr0(3) = wa_mb1b-matnr0(3).
      MODIFY mard FROM it_mard.
      ls_quan6 = wa_mb1b-clabs.
   ENDIF.
    it_gmitem-move_type    = move_type.      "Movement type
    it_gmitem-plant        = plant.          "Plant
    it_gmitem-stge_loc     = send_stloc.     "Storage Location
    it_gmitem-move_plant   = move_plant.     "Receiving Plant
    it_gmitem-move_stloc   = recv_stloc.     "Receiving storage location
    it_gmitem-batch        = batch.          "Batch Number
    it_gmitem-material     = wa_mb1b-matnr.  "Material Number
    it_gmitem-move_mat     = wa_mb1b-matnr.  "Receiving/issuing material
    it_gmitem-entry_qnt   = ls_quan6.        "Quantity in unit of entry
    APPEND it_gmitem.
  ENDLOOP.
  CLEAR return.
  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
      goodsmvt_header             = gmhead
      goodsmvt_code               = gmcode
  TESTRUN                     = 'X'
   IMPORTING
  GOODSMVT_HEADRET            =
     materialdocument            = mat_doc
  MATDOCUMENTYEAR             =
    TABLES
      goodsmvt_item               = it_gmitem
  GOODSMVT_SERIALNUMBER       =
      return                      = return
  IF NOT mat_doc IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
   EXPORTING
     wait          = 'X'
IMPORTING
  RETURN        =
  ELSE.
  ENDIF.
ENDFUNCTION.

Similar Messages

  • MB1B transfer posting error "SL stock in transfer exceeded by 20 PC."

    Hi All,
    I'm doing a MB1B transfer posting for my materials from 1 storage location to another using movement type 311,
    but some of the materials I encountered this error.
    "SL stock in transfer exceeded by 20 PC : 'Material name' 'Plant' 'Stor. Loc' "
    I went to MB5T to check the materials if it's in the stock in transfer, but they are not in the list.
    I've also check in MMBE to check the stock value of these materials, it shows 100 in unrestricted use which is more than what I'm transferring.
    May I know what have i missed checking?
    Please help and thank you.

    Hi There
    Seems you are trying to do the One step Transfer between locations (311), So it is not required to look into the 313, 315 steps (Stock in trasfer, Removal and palce in transfer)
    From the Suppling location these Material and Batch is reserved for some purpose(261 or 201) and these material may under Dynamic Availability Check, In this case even if you have the stock in Location if it is hard allocated for some other purpose you cant use this qty
    Please check the above settings.
    Thanks
    Senthil P

  • Supply Area Goods Transfer Posting Problem

    Dear SAP Gurus,
    I am facing a problem in which material has to be issued by transfer posting through movement type 541 to Subcontracting Vendor.
    The material is to be issued from Supplying Area.
    When transfer posting is initiated for the PO, material is not getting issued from Supplying area whereas all other BOM materials are being picked up.
    Please guide me where can this problem be?
    Thanks & Regards
    Manav Anand

    Hi,
    I hope you are using ME2O or MB1B transaction with 541 mvt type. As per Subcontracting scenario you are supposed to sent the BOM mateials only to your subcontracting vendor and finally supposed to get the material which is raised in the PO.
    Now please let us know where you have been stuck so that we will be able to help by providing our explanations.
    Regards,
    DilL

  • Mb1b transfer posting

    Hello friends,
    In mb1b second screen, they are entering second line item which is called scrap(eg: M03-SCRAP).This is updated in MARD table as the scrap materials doesn't belong to any batch.
    So, they are entering matnr and labst (quantity in second line item).
    How to identify this particular scrap material from mard table.
    I m writing query like this:-
    SELECT matnr labst FROM mard
           INTO CORRESPONDING FIELDS OF TABLE it_mard
                           WHERE matnr = 'M03-SCRAP'
                           AND   werks = plant
                           AND   lgort = '2200'.
    How to get this material number without hardcoding bcoz this ll be vary for different material numbers.

    Hello max,
    scrap field they enter like "M03-SCRAP".
    They said that if first 3 letters of scrap = first 3 letters of receiving material.
    then data has to pick from mard-labst and to be added to the first line item of material and mard should be updated.
    please luk into my coding(function module):-
      DATA : ls_quan2 TYPE p DECIMALS 3,
             ls_quan3 TYPE p DECIMALS 3.
      DATA : it_mard LIKE mard OCCURS 0 WITH HEADER LINE.
      gmhead-pstng_date = sy-datum.
      gmhead-doc_date   = sy-datum.
      gmcode-gm_code    = '04'.       "Transfer Posting (MB1B)
      SELECT matnr clabs FROM mchb
                           INTO TABLE it_mb1b
                           WHERE werks = plant
                           AND   lgort = send_stloc
                           AND   charg = batch.
      SELECT matnr labst FROM mard
                           INTO CORRESPONDING FIELDS OF TABLE it_mard
                           WHERE matnr like '%SCRAP'
                           AND   werks = plant
                           AND   lgort = '2200'.
      LOOP AT it_mb1b INTO wa_mb1b.
        it_gmitem-move_type    = move_type.
        it_gmitem-plant        = plant.
        it_gmitem-stge_loc     = send_stloc.
        it_gmitem-move_plant   = move_plant.
        it_gmitem-move_stloc   = recv_stloc.
        it_gmitem-batch        = batch.
        it_gmitem-material     = wa_mb1b-matnr.
        ls_quan2 = quan_measure - wa_mb1b-clabs.
        IF ls_quan2 LE 0.
          ls_quan3 = wa_mb1b-clabs.
        ELSE.
          ls_quan3 = wa_mb1b-clabs + ls_quan2.
          it_mard-labst = it_mard-labst - ls_quan2.
    MODIFY table it_mard TRANSPORTING labst.
        <b>MODIFY it_mard TRANSPORTING labst WHERE matnr = 'M03-SCRAP'.</b>    MODIFY mard. " FROM TABLE it_mard.
        ENDIF.
    <b>" Here how we know that matnr only update in mard.</b>
        it_gmitem-entry_qnt    = ls_quan3.
        APPEND it_gmitem.
      ENDLOOP.
      CLEAR return.
      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          goodsmvt_header             = gmhead
          goodsmvt_code               = gmcode
      TESTRUN                     = 'X'
       IMPORTING
      GOODSMVT_HEADRET            =
         materialdocument            = mat_doc
      MATDOCUMENTYEAR             =
        TABLES
          goodsmvt_item               = it_gmitem
      GOODSMVT_SERIALNUMBER       =
          return                      = return
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait          = 'X'
    IMPORTING
      RETURN        =

  • Transfer posting problem in  material

    Hi Experts,
    Whenever we receive any  material ( quality rejection from
    plant A) at location  X in film plant A, we can not do Transfer
    posting of this material to crushing area ( location Y in plant A).
    While doing Transfer posting we get an error " Pallet -
    not consumed
    entirely ".
    We can not transfer this material to any other location.
    What could be the problem?
    Lokesh

    Hi,
    From the message it seems like in your system some message is activated. this might be due to the requirement was given that entire batch is to be consumed and partial is not allowed. please check this it should have been done through user exit or by some enhancement.

  • Transfer Posting problem via MIGO MVT 311

    While doing transfer posting through MIGO MVT 311 against reservation, we are facing the problem displayed below:-
    "Check table XMRES: entry 0000000000 0001   does not exist
    Message no. M7001
    Diagnosis
    In table XMRES the entry 0000000000 0001   is missing."

    You cannot use 311 .311 is Moving material from one storage location to another -- Un restricted to another, Reserved stock can be  moved by converting in to another movement type  .Do movement 341in mb1c , if 341 is not there then go to moment type control
    data and create particular moment type and run that for reservation no
    document created and in valuation area

  • MB1B: Transfer posting from material to material

    hello,
    I would like to add material validation mechanism in MB1B for transfer posting from material to material, that is we can define only particular materials can be transfer to receiving material and validate in MB1B with specified movement type, how to do this?
    Is there any thing available in standard?
    we can do this using user exit but I couldn't find any exit relevant for this scenario?
    I appreciate your earliest responses.
    regards,
    Jawed Ali

    well I have checked all these exits but none was called during the process:
                                                                                    MBCF0002            Customer function exit: Segment text in material doc. item               
    MBCF0005            Material document item for goods receipt/issue slip                      
    MBCF0006            Customer function for WBS element                                        
    MBCF0007            Customer function exit: Updating a reservation                           
    MBCF0009            Filling the storage location field                                       
    MBCF0010            Customer exit: Create reservation BAPI_RESERVATION_CREATE1               
    MBCF0011            Read From RESB and RKPF For Print List in  MB26                          
    MBCFC003            Maintenance of batch master data for goods movements                     
    MBCFC004            Maintenance of batch specifications for goods movements                  
    regards,
    Jawed Ali

  • Transfer Posting problem with "sales order stock type" status

    Hello, i have this problem, i spend 2 days looking in the forum, but
    nothing, the question is:
    The SD users sell an item, and the item get the status of "sales order
    stock type" in the MMBE, but at the same time, the MM user made a
    trasfer posting in two steps, he take out material with transaction
    MIGO, mvt 351, to another plant, but the materail was already
    compromised with SD; now he cant sell the items, because he dont
    realize that the material was in sales order stock type, and he already
    transfer it to another plant. how can i block this? if a material in
    MMBE is with "sales order stock type" status, he CANT transfer it with
    351 mvt type, what config i have to make?  thanks a lot!!!!
    now the quantity of the unrestict use
    stock is lower than the sales order, we dont want to have this issue,
    thanks again
    Edited by: Alex Arti on Aug 6, 2008 7:14 PM
    Edited by: Alex Arti on Aug 6, 2008 7:16 PM

    Hi!
    Have you recently upgraded to EHP4? In this case, please, check the note 1441195. This note should solve the issue that you are reporting.
    I hope this helps,
    Esther.

  • MB1B transfer posting doesn't copy serial number information to delivery

    Hi all,
    we have a decentral warehouse setting and use MB1B for transfer postings. MB1B automatically creates the corresponding delivery which will be transmittedt to the external warehouse.
    Unfortunately the serial number from MB1B will not be copied into the delivery.
    Is there a configuration setting that I miss, or is there a User-Exit which could be used to copy the serial number information from transaction MB1B into the delivery?
    Thanks fro your help,
    Frank

    Hi Frank,
    Use Tcode VOFM to define the Data transfer routine . Your MM consultant may help you more.
    Pole

  • MB1B transfer posting Idoc/Message type for outbound and inbound

    Hello All
    Can anyone tell me the idoc/message type for movement type 313 outbound and 315 inbound to SAP. This is for MB1B Enter Transfer Positing.
    Thanks
    Ricky

    Its WMMBXY

  • MB1B Transfer posting 311Q ( Material provided to vendor ) ......

    Hello
    Subcontracting process useing movement type (311 Q)
    in the trasaction MB1B. i wold like to fetch the components from the PO , like 541.
    error "Combination of movement type 311 Q and function selected not possible "
    please help me

    you cannot consume with 543 if you have not move any stock with 541, even you created a storage location.
    The storage location is useless for the consumption, except you use the PP subcontracting process instead of the MM subcontracting process.
    A storage location for the subcontractor is usually on created for the case that you send materials directly from subcontractor to customer. in this case you receive the finished material into that location, but for consumption in MM subcontracting process no storage location is involved. the material has to be in special stock O and is only monitored at plant level, instead of storage location the vendor is shon in stock overview MMBE.
    In PP subcontracting process, you create a production order yourself to consume the materials, only the service fee is ordered via a PO that is linked to this production order. the calculation of the finished material is made from the production order. you then have to receive twice, you do MIGO to confirm that you got the service, and you receive the quantity to the production order.

  • Transfer Posting - Very Urgent.

    Dear gurus
    I need help against to transfer stock from one plant to another plant through STO in SAP (Further STN (313 & 315)). Could anybody pl send me T-Code for that & further postings required to place that material in unrestricted are of other plant location.
    regds
    dev.,,!

    Hi
    Pl.follow the foll. steps for crating 2 types of STO....with Delivery
    1) Intra-Company STO: STO bet Plants belongs to Same Company Code:
    1)Create one Customer for Supplying Plant Sales area and assign this Customer no with Receiving Plant in OLME---> PO -
    > Set up STO -
    > define Shipping Data for plants. and maintain the same sales area in your Supplying plant.
    2) In OLME---> PO -
    > Set up STO.....for your Document Type: UB and Suppying plant Combination assign Del. Type NL and Checking rule RP
    3) In OLME---> PO -
    > Set up STO...for your Supplying Plant and Receiving Plant combination Maintain Doc. Type : UB
    Make sure you are maintaining Sales View for your Material at Supplying Plant.
    4) Maintain Shipping point at, SPRO----> Logistics Execution -
    > Shipping -
    > Basic Shipping Functions -
    > Shipping Point Determination for Plants.....there for your Loading group,Shipping Condition, Shipping Plant combination maintain Shipping plant..
    Now Create STO in ME21N with Doc.type: UB at Receiving Plant.
    Then Create Delivery in VL10B from Supplying Plant...
    Then Do PGI in VL02N from supplying Plant.
    Then do GR at Receiving Plant based on Outbound Delivery at Receiving Plant...
    Follow the below steps to to make STO between two plants ( different company company codes).It is also called as Inter Company STO.....
    1)Create one Customer Master in XD01 with respect to Supplying Plant Sales Area and assign this Customer no with Receiving Plant in OLME->PO-> set up STO->Define shipping data for plant and for the supplying Plant assign the above sales area.( Make sure,In Customer Master,sales Area Tab: you are maintaining shipping condition)
    2) For Receiving Plant Pur. Org and Co.Code Combination create Vendor master in XK01 and in this vendor master assign the Supplying plant in Pur.Org.Data screen->Extras--> Add.Pur.data
    3) OLME->PO-> Set up STO------>For your supplying plant assign document type NB, Delivery type NLCC and Checking Rule RP
    4)then For your supplying Plant and receiving Plant assign Document type NB
    5)Make sure you are maintaining Sales View for the material at supplying Plant and in Sales /Gen plant Data view maintain Availability check, Loading group and Transportation group.
    6) In SPRo-->Logistics execution> Shipping->Basic shipping functions->Shipping point Determination>assign shipping points-> For your Loading group,Shipping Condition and Supplying plant combination,Assign shipping point
    these are the configuration settings you have to do in background.
    Then Create STO from Receing Plant in ME21N with document type NB.
    Based on that STO, Create Delivery in VL10B from supplying Plant
    Do PGI in VL02N from Supplying plant
    Do GR in MIGO at Receiving Plant keeping Outbound delivery as a ref. document.
    Now your STO bet. two plants belongs to diff. Co.Codes will be completed.
    Reward if useful
    Regards
    S.Baskaran

  • Transfer posting between 2 StorLoc (Non HUM managed to HUM managed), MB1B

    Hi,
    I'm trying to figure out if after MB1B transfer posting (311 movement) an inbound delivery will be created automatically for the receiving StorLoc. This is for transfer of materials from a Non HUM StorLoc to a HUM StorLoc.
    If a inbound delivery can be created automatically what costomizing steps do I have to do?
    Thanks for you help.
    Regards,
    Alexander

    Hi,
    Check following link
    can any body send HUM configuration settings
    Thanks
    Diwakar

  • Transfer Posting (MB1B): Account XYZ requires an assignment to a CO object

    Hi,
    Iam doing a Sales order to Sales order transfer using MB1B (Transfer Posting) and movement type 413 (E). However i get an error "Account 526020 requires an assignment to a CO object".
    Can someone advise as to where i need to assign the Costobject.
    Please advise.
    Thanks,
    Safi

    Do you really need to post something to a Cost Centre? If its a SO to SO transfer, what kind of cost is posting to the Cost Centre?
    I would suggest you analyse the GL Account (why it needs an assignment to a CO Object?) and consider changing the Field Status Group or assigning a GL that is not a Cost Element.
    If you really have to assign a Cost Centre, then OKB9 is your best alternative. Enter a Common CCtr that will collect the costs and maybe let you allocate the same later.
    Cheers.

  • Automatic transfer posting after Purchase order creation

    I tried searching a solution for my pbm in this forum, but could not find any and hence posting a new thread. Hope to find an answer.
    I have a requirement of doing the automatic MB1B transfer posting of the PO when the PO is created and saved using ME21n.
    I initially used the BADI ME_PURCHDOC_POSTED for this purpose, in which i am calling BAPI_GOODSMVT_CREATE.
    But when i debug and see this BAPI returns an error saying that the PO doesnot exist.
    Which means, The PO is not yet created when it reaches this BADI.
    Is there any other BADI/user exit/ehancement spots? where the PO is already created and i can do the transfer posting?

    Hello K ,
    better to have a custom program to create PO & GR at the same time, u cannt create GR at the time of PO creation or change,u may get same kind of errors , ie. PO doent exists or PO locked by USER XXXX.
    regards
    Prabhu

Maybe you are looking for

  • YC_GEN app engine failed after upgrading from EPM 8.9 to 9.1 Rev1

    we tried upgrading our EPM 8.9 + tools 8.49.23 application to EPM 9.1 + tools 8.53.08. After upgrading when we tried to run the YC_GEN app engine it failed with the below error. Error: 17449 20.26.27 0.000111 321: &ln_1 = &lbi_1.Execute(); 17450 20.2

  • Create Link to a folder

    Greeting Gurus, is it possible to create a link in page, which will point me to a folder, instead of a page? Coz from what i found in the peoplecode, they are transferring me to a page, and i did for an "External link" by setting up the definition in

  • IPhone, Gmail, and Outlook 2007 - A question please

    Hello all, I just recently installed Outlook 2007 on my Windows XP machine. It is set up with my gmail account. I have iPhone successfully looking at the same gmail account. Here's what I'm asking if it can be done: If I access/read my email from Out

  • PR with contract number.

    HI, Can anyone please guide me the following process In Material management we have created the  service contract with A vendor for set of activities. My docubt is :it is possible to assign this contract number to purchase requsition which has come f

  • Session Border Controller

    Hi, I want to know that the Session Border Controller is a Interface or device or a technology used in VoIP ? As we need a Inter chassis Redundancy in Cisco ASR 1002 and we checked a document in which it is mentioned that we need SBC on these devices