Goods Receipt PO, Based on Goods Return, Including Serials

Hi All,
When you received an item to stock from your vendor, and the item was defective,
You should return the item to the vendor using 'Goods Return'.
What should one do in the following case:
Instead of crediting the returned item - the vendor decided to fix the defective part - and resend it to our stock.
     The normal procedure, as I know it, would be to copy the 'Goods Return' to a 'Goods Receipt PO'.
However, if the item is managed by serials - The system won't allow me to return the same serial to stock,
and only lets me create a new serial.
If I will type the original serial manually in the 'Goods Receipt PO', the system will simply create a new record in the serial table (assuming duplicated serials are allowed).
What is the correct way to handle this situation ?
Many Thanks ! 

Anyone ??
Pretty Please .....

Similar Messages

  • Copy to Goods Receipt PO function on Goods Return

    In current version 2007A there is no Copy to Goods Receipt PO function on Goods Return document. There is only Copy to A/P Credit Memo. This list should contain all available target documents.

    Yes, you can.  You just need to go to add A/P invoice and click on Copy From button.  Then select multiple GRPO to copy.  However, you will be warned that only target FX rate can be used if you have BP currency instead of LC.
    Thanks,
    Gordon

  • Serial number optional at goods receipt but mandatory at goods issue?

    How can we make serial number optional at goods receipt but mandatory at goods issue?
    Thanks in advance for the answers....

    Hi,
    Not in front of the system, but if i remember correctly one of these enhancements has a check on serial numbers,
    1. User exit -> MBCF0002
    2. BADi -> WORKORDER_GOODSMVT or MB_DOCUMENT_BADI
    Check & revert if it meets your need.
    Regards,
    Vivek

  • Error adding Goods Receipt PO based on Purchase Order

    I am working on an add-on that was working against a 2005A version of SAP Business One and I am upgrading it to run against a 2007A Company (PL41)
    I am receiving strange errors when testing the add-on.
    I can add a Purchase order not based on a Goods Receipt PO without any problems but as soon as I specify a base type, entry and line I get either -1 General Error, or the Tried to Read/Write Protected Memory Error.  The error I receive seems to arbitrarily change between the two.
    I have read a few notes on the forums about this but none of them have proven useful in solving my problem.  I have checked the DI-API version on my PC and it is definitely using 8.0.177.0 which matches the version of SBO that I am running.  I have re-installed the DI etc without any success.
    The following is the code snippet which I am using to test:  I have verified that the referenced purchase order is open, contains the correct item, customer etc
    int iResult = -1;
    string sResult = string.Empty;
    string sOutput = string.Empty;
    try
    sOutput += Environment.NewLine + "Connecting to company...";
          sbocoy = new SAPbobsCOM.Company();
          sbocoy.Server = "<insert server name here>";
          sbocoy.CompanyDB = "<insert database name here>";
          sbocoy.LicenseServer = "<insert server name here>:30000";
          sbocoy.UseTrusted = true;
          sbocoy.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005;
          sbocoy.UserName = "manager";
          sbocoy.Password = "<inser sap user here>";
          iResult = sbocoy.Connect();
          sOutput += Environment.NewLine + "Connected";
          SAPbobsCOM.Documents PO = (SAPbobsCOM.Documents)sbocoy.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders);
          SAPbobsCOM.Documents GoodsReceiptPO = (SAPbobsCOM.Documents)sbocoy.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes);
          sOutput += Environment.NewLine + "Get Purchase Order";
          PO.GetByKey(1402);
          sOutput += Environment.NewLine + String.Format("DocNum: {0}; DocEntry: {1}; ItemCode: {2}; LineNum: {3}", PO.DocNum, PO.DocEntry, PO.Lines.ItemCode, PO.Lines.LineNum);
          GoodsReceiptPO.CardCode = PO.CardCode;
          GoodsReceiptPO.CardName = PO.CardName;
          GoodsReceiptPO.Lines.ItemCode = PO.Lines.ItemCode;
          GoodsReceiptPO.Lines.ItemDescription = PO.Lines.ItemDescription;
          GoodsReceiptPO.Lines.Quantity = 1.0;
          GoodsReceiptPO.Lines.BaseType = int.Parse(PO.DocObjectCodeEx); // If I comment out this and the next two lines the document will add
          GoodsReceiptPO.Lines.BaseEntry = PO.DocEntry;
          GoodsReceiptPO.Lines.BaseLine = PO.Lines.LineNum;
          sOutput += Environment.NewLine + "Adding Goods Receipt...";
          iResult = GoodsReceiptPO.Add();
          sResult = sbocoy.GetLastErrorDescription();
          sOutput += Environment.NewLine + string.Format("Result [{0}] {1}", iResult, sResult);
    catch (Exception ex)
    sOutput += string.Format(Environment.NewLine + "Exception: {0}{1}SBOError: {2}", ex.Message, Environment.NewLine, sbocoy.GetLastErrorDescription());
    The results when I try and reference the purchase order are:
    Connecting to company...
    Connected
    Get Purchase Order
    DocNum: 301396; DocEntry: 1402; ItemCode: SEANTESTITEM; LineNum: 1
    Adding Goods Receipt...
    Exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    If I comment out the 3 lines that reference the base document the Goods Receipt Adds and the following is the output...
    Connecting to company...
    Connected
    Get Purchase Order
    DocNum: 301396; DocEntry: 1402; ItemCode: SEANTESTITEM; LineNum: 1
    Adding Goods Receipt...
    Result [0]
    The above code will work correctly if we base a Delivery Note on a Sales Order so it appears to be specifically related to the Purchasing Documents.
    Edited by: Sean Archer on Feb 2, 2009 2:23 PM

    Hi Ganesh,
    Thank you for the reply.
    I ran the add-on against another database and it is working.
    I also verified that the document was failing to create if done via the Data Transfer Workbench so it would appear the issue affects the DI-API irrespective of add-on.
    I will need to do more testing to confirm whether this is a bug with PL41 of 2007A or a corrupt database as you suggest.
    Cheers,
    Sean

  • Goods Receipt Amount based on PO price instead of moveing average price

    Is it possible to customise SAP so that the amount in Goods Receipt transactions is calculated based on quantity * PO price instead of quantity * moving average price?
    Thanks.

    Thanks for your reply.
    Standard SAP functionality:
    1. When material ledger is active, the GR amount is based on pre-GR moving average price.
    2. When material ledger is not active, the GR amount is based on PO price.
    We use the material ledger but want the GR transactions to record the amount based on PO price.
    Any suggestions?

  • How to stop the goods receipt before issueing the goods for production orde

    Frndz,
    I have created a production order, now before even making the issue of rawmaterials from the inventory the system is allowing the goods receipt for that production order , kindly tell me the step by step procedure to check it.
    Regards,
    Srini

    Hi Srini,
    there are couple of ways to handle this situation..
    1. If you set all the components as Backflush relevant in Material Master or setting all Compoents tick in OPK4 will ensure that at the time of confirmation you will have all the components will be done auto GI.
    Now in your control key or Prod. scheduling profile specify that Auto GR.
    Now your GR & GI are linked.
    In OPK4, in the 2nd Tab page, termination of Goods Movements and Goods movements Ticked, so that when ever there is a problem with the components system will terminate the Confirmation.
    So there will not be any GR without GI.
    But, one can make GR with MB31 or MIGO
    (So this is an option but no fool proof method).
    2. Activating the User Satus (Status Profile) so that once the GI is done only you allow the Confirmation.
    (The settings we can discuss if required).
    3. Having the Use Exit..
    Enhancement - MBCF0002
    Functional Module - EXIT_SAPMM07M_001
    Include - ZXMBCU02
    Refer below links for further details..
    do not confirm without goods issue
    default quantity of confirmation(co11) should allowed in goods movements mb
    Revert for further discussion..
    Regards,
    Siva

  • MIGO( (good receipt,Transfer pos how to  to get serial number  at run time

    Hi Experrts:-
    I need to change the status of serial number (equipment number ) during Migo (good receipt,Transfer posting).
    I have checked all the user exits and number of badis but i am not getting serial number at run time if i get serial numbar
    in exit od badi i will change the status
    I have used  following badi:-
    MB_DOCUMENT_BADI
    MB_MIGO_ITEM_BAdI
    Thanks

    Hi Dilip,
    If I am correct you are taking about changing user Status at device level (serial number)
    you can set the user status through status profile (Tcode OIBS for particular status profile).
    within this, you can also set/ change the status, if particular business transaction is executed (for e.g. good receipt, Stock transfer)
    Please check if you are using status profile in your case, if not create one, by this way i think you can able to map the requirement.
    Regards,
    Chetan

  • Goods Receipt Error: "Price of goods mvt will become negative"

    Dear all,
    When entering a receipt, the system is returning this error message:  "Price of goods mvt will become negative": The goods movement was valuated at a negative price." (M7330)
    In other threads in this forum, I read that this happens when if a receipt were posted, the value of the inventory would become negative - which the system does not allow. It seems that a solution may be to increase the material price in MR21.
    But I would like to understand the calculation.
    Material ABC is valuated at standard price.
    We want to receive: 960 pieces of ABC
    Total stock = 7,188 pieces
    Standard price = 114.62 USD/1000 pieces
    Moving average price = 143.87 USD/1000 pieces
    Total stock value = 823.89 USD
    Purchase price = 125.44 USD/1000 pieces
    How does the system end up with a negative valuation?
    Thanks,
    Annabelle R.

    Hope you are using a version below 4.7. Please SAP Notes#172122 & 147761.
    Moving average price negative
    There a lots on OSS notes on this topic, what I suggested may not be the right one, request you to look for a suitable OSS based on your version and excat problem.

  • How to stop goods receipt before issueing the goods for production order

    Hi All,
    I try to follow the thread SAP ERP Manufacturing - Production Planning (SAP PP) to do it, however it is not working. I already created the status profile, assigned it to 'StatusProfile Header' in OPJH for the correct order type. However when I change the status to permitted GR, it is still not able to give me to do it in MIGO. Any idea?
    Thanks.

    Hi Justin,
    User status will not sutiable for your requirement, the best way is to use User exit or BADI
    Implement the BADI - WORKORDER_GOODSMVT in this there is method
    MANUAL_GOODS_RECEIPT under that
    write this code
    if_ex_workorder_goodsmvt~manual_goods_receipt.
    data: lt_resb type standard table of resb,
            wa_resb type resb.
    select * from resb into table lt_resb where rsnum eq i_order_header-rsnum and xloek eq space and bdmng gt 0.
    check sy-subrc eq 0.
    loop at lt_resb into wa_resb.
         if wa_resb-enmng < wa_resb-bdmng.
              message E499(sy) with 'Order is not fully consumed. Processing is STOPed'.
         endif.
    endloop.
    endmethod.
    Enhancement: MBCF0002
    Function module: EXIT_SAPMM07M_001
    Code for your copy pasting in the source code of ZXMBCU02.
    Remember to activate the program. In SMOD enter the enhancement, press F8 and then click on activate button.
    *& Include ZXMBCU02
    Regards,
    Sankaran

  • Landed costs can not get Goods receipt PO when Goods return made

    Hi, everybody
    I need to calculate landed costs and it seems that I can not use when I built a Goods return.
    My procedure as follow ( ps: the same vendor number)
    1. created a PO then Goods receipt PO (docNum says 1111) which included 20 quanties for item no AAAA.
    2. created a Goods return which Copy from Goods receipt PO no: 1111, which included 5 quanties for item no AAAA.
    3. next, I try to caculate my Landed costs. I open a new Landed costs and click the button "Goods Receipt PO", but I can not find any Goods receipt PO no: 1111.
    What can I do to caculate my exactly landed costs & Goods receipt PO no: 1111 that included 15 quanties?
    Thanks for your help

    When you only Returned partial goods from your Receipt.  The Receipt should still be open and you should be able to process the Landed cost. I am not sure why the GR is not showing in the landed costs window.
    Please check if the GR is closed by an AP Invoice / by itself.
    Otherwise, you will need to process AP Goods Return for the remaining 15 and process a New Goods Receipt for 15.
    Regards
    Suda

  • Query for Good receipt PO Minus Good Return

    Hi Experts,
    How to write a query which is Good Receipt PO, minus out Good Return?
    Below is the Good Receipt PO which i only can do.
    SELECT T1.DocDate AS 'Posting Date', T1.DocNum AS 'Document Number', T1.U_CUSTPONO AS 'Customer PO No', T0.ItemCode AS 'Item No.', T1. U_DONO AS 'Supplier DO NO.' ,T0.Dscription AS 'Item/Service Description', T0.Quantity AS 'Quantity', T0.unitMsr AS 'UOM' , T0.WhsCode AS 'WhseCode'
    FROM  [dbo].[PDN1] T0  INNER  JOIN [dbo].[OPDN] T1  ON  T1.DocEntry = T0.DocEntry  WHERE T1.DocDate>=[%0] AND T1.DocDate <=[%1] ORDER BY T1.DocDate
    Thanks.
    Regards,
    Danny

    Hai Danny Gan 
    Try This
    SELECT T1.DocDate AS 'Posting Date', T1.DocNum AS 'Document Number', T1.U_CUSTPONO AS 'Customer PO No', T0.ItemCode AS 'Item No.', T1. U_DONO AS 'Supplier DO NO.' ,T0.Dscription AS 'Item/Service Description', T0.Quantity AS 'Quantity', T0.unitMsr AS 'UOM' , T0.WhsCode AS 'WhseCode'
    FROM dbo.PDN1 T0 INNER JOIN dbo.OPDN T1 ON T1.DocEntry = T0.DocEntry WHERE T1.DocDate>=%0 AND T1.DocDate <=%1 and T0.TargetType <> 21  ORDER BY T1.DocDate
    Edited by: Prasanna s on Apr 7, 2009 1:28 PM

  • Need to specify different price on Goods Receipt than on Purchase Order

    Hi!
    My application creates Goods Receipt (object of type SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes). This Goods Receipt is based on an existing Purchase Order. Creation itself (including the reference to the Purchase Order) works well.
    The problem is that using DI API, price in a document line is always set (automatically) to the price specified on the Purchase Order line. I'm not able to set the unit price to any other value. When I assign my unit price, document is added successfully, but my unit price is ignored. Unit price specified on the appropriate line on Purchase Order is used instead.
    Thanks for help!
    Jan

    Hi! I'm using SBO 8.81. I put my C# code below. The %xxx% strings are just symbols - for simplification.
    SAPbobsCOM.Documents oPurchaseDeliveryNotes = (SAPbobsCOM.Documents)SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes);
    oPurchaseDeliveryNotes.CardCode = %CARDCODE%;
    oPurchaseDeliveryNotes.DocDate = %DOCDATE%;
    oPurchaseDeliveryNotes.TaxDate = %TAXDATE%;
    bool first = true;
    while(...) {
        if(!first) oPurchaseDeliveryNotes.Lines.Add();
        oPurchaseDeliveryNotes.Lines.BaseType = (int)SAPbobsCOM.BoAPARDocumentTypes.bodt_PurchaseOrder;
        oPurchaseDeliveryNotes.Lines.BaseEntry = %DOCENTRY_OF_PO%;
        oPurchaseDeliveryNotes.Lines.BaseLine = %LINENUM_OF_PO%;
        oPurchaseDeliveryNotes.Lines.ItemCode = %ITEMCODE%;
        oPurchaseDeliveryNotes.Lines.Quantity = %QUANTITY%;
        oPurchaseDeliveryNotes.Lines.Price = %UNIT_PRICE_DIFFERENT_FROM_PO%;
        oPurchaseDeliveryNotes.Lines.Currency = %CURRENCY%;
        first = false;
    oPurchaseDeliveryNotes.Add();
    Althought the unit price on the Purchase Order is for example 7 and in my code I assign the Price property for example 9, then when the document is successfully added, I see that on newly created document the unit price is still 7 (same as on PO). Value 9 is ignored without any errors or warnings.
    When I remove the code which connects this Goods Reception with PO (i.e. assignment to BaseType, BaseEntry and BaseLine properties), created document is correct. However when there is a connection to PO, I'm unable to set different unit price.
    Do you or anybody else have explanation for this? Or do you have some piece of working code you can provide?
    THANKS!

  • Grn report(goods receipt notice)

    hi to all sdn people can u pls give coding for this if u give the answer i will be greatful to u and i will reward point to all of u
    my report is as follows
    a report for grn details which shows the all details of goods receipt movements based on the purcahse order.
    and pls tell what is the pupose of this report and tables used

    Hi
    Use the Tables
    EKKO,EKPO --PO tables and
    MKPF and MSEG Tables GRN related.
    This report is useful to track the qty of ggods/materials received with respect to the PO's placed.
    see the sample code and change the output as per your requirement.
    *& Report  ZMM_PO_REPORT
    REPORT  ZMM_PO_REPORT message-Id yb
           NO STANDARD PAGE HEADING
           LINE-COUNT 60(1)
           LINE-SIZE 230.
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: lfa1,           " Vendor Master
            t161,           " PO Doc Types
            t024,           " Purchase Groups
            ekko.           " PO Header
                   T Y P E S  D E C L A R A T I O N S
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_po,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bukrs TYPE bukrs,           " Company Code
            bsart TYPE bbsrt,           " PO Type
            lifnr TYPE lifnr,           " Vendor No
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
           END OF s_po.
    Purchase Orders History Structure
    TYPES: BEGIN OF s_account,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            gjahr TYPE mjahr,           " Fiscal Year
            belnr TYPE mblnr,           " PO Invoice No
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Local Currency
            dmbtr TYPE dmbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
            shkzg TYPE shkzg,           " Dr/Cr Indicator
           END OF s_account.
    Purchase Orders History Structure(Item Sum)
    TYPES: BEGIN OF s_inv_sum,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
           END OF s_inv_sum.
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_rep,
            lifnr TYPE lifnr,           " Vendor No
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bsart TYPE bbsrt,           " PO Type
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
            name1 TYPE name1,           " Plant
            orewr TYPE netpr,           " To be Invoiced Price
            curr  TYPE waers,           " Inv Doc Currency
           END OF s_rep.
               D A T A  D E C L A R A T I O N S
    DATA: gv_title1 TYPE sylisel,            " Report title
          gv_dial.                           " Color flag
                C O N S T A N T S  D E C L A R A T I O N S
    CONSTANTS: c_x                VALUE 'X',   " Flag X
               c_h                VALUE 'H',   " Debit
               c_vgabe TYPE vgabe VALUE '2'.   " Transaction Type
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S
    DATA: i_po    TYPE STANDARD TABLE OF s_po WITH HEADER LINE,
                                 " Purchase Order
          i_inv   TYPE STANDARD TABLE OF s_inv_sum WITH HEADER LINE,
                                         " PO Invoice Values
          i_rep   TYPE STANDARD TABLE OF s_rep WITH HEADER LINE,
                                     " PO Invoice Values
          i_ekbe  TYPE STANDARD TABLE OF s_account WITH HEADER LINE.
                               " PO Invoice Values
                     S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
                    s_ebeln FOR ekko-ebeln MATCHCODE OBJECT mekk,
                    s_bsart FOR t161-bsart,
                    s_ekgrp FOR t024-ekgrp,
                    s_bedat FOR ekko-bedat.
    SELECTION-SCREEN END OF BLOCK b1.
                      I N I T I A L I Z A T I O N                        *
    INITIALIZATION.
                  A T  S E L E C T I O N - S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_screen.
                   S T A R T - O F - S E L E C T I O N                   *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                   T O P - O F - P A G E                                 *
    TOP-OF-PAGE.
    Header of the List
      PERFORM header.
                   E N D - O F - P A G E                                 *
    Footer
    END-OF-PAGE.
      ULINE.
                   E N D - O F - S E L E C T I O N                       *
    END-OF-SELECTION.
    Display the Report Output data
      PERFORM display_data.
    At Line-Selection
    AT LINE-SELECTION.
    When double clicked on EBELN display the details of Purchase Doc
      PERFORM line_sel.
    *&      Form  validate_screen
    Validation of Selection Screen fields
    FORM validate_screen .
    Validation of Vendor Number
      CLEAR lfa1-lifnr.
      IF NOT s_lifnr[] IS INITIAL.
        SELECT lifnr UP TO 1 ROWS
            INTO lfa1-lifnr
            FROM lfa1
            WHERE lifnr IN s_lifnr.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Vendor'(002).
        ENDIF.
      ENDIF.
    Validation of PO Number
      CLEAR ekko-ebeln.
      IF NOT s_ebeln[] IS INITIAL.
        SELECT ebeln UP TO 1 ROWS
            INTO ekko-ebeln
            FROM ekko
            WHERE ebeln IN s_ebeln.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Document Number'(003).
        ENDIF.
      ENDIF.
    Validation of PO Document Type
      CLEAR t161-bsart.
      IF NOT s_bsart[] IS INITIAL.
        SELECT bsart UP TO 1 ROWS
            INTO t161-bsart
            FROM t161
            WHERE bsart IN s_bsart.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchase Document Type'(004).
        ENDIF.
      ENDIF.
    Validation of Purchasing Group
      CLEAR t024-ekgrp.
      IF NOT s_ekgrp[] IS INITIAL.
        SELECT ekgrp UP TO 1 ROWS
            INTO t024-ekgrp
            FROM t024
            WHERE ekgrp IN s_ekgrp.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchasing Group'(005).
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_screen
    *&      Form  fetch_data
    Fetching the PO related data from Database Tables
    FORM fetch_data .
      CLEAR i_po.
      REFRESH i_po.
      SELECT a~ebeln            " PO No.
             b~ebelp            " PO Item
             a~bstyp            " PO Category
             a~bukrs            " Company Code
             a~bsart            " PO Type
             a~lifnr            " Vendor No
             a~ekgrp            " Purchase Group
             a~waers            " Currency
             a~bedat            " PO Date
             b~txz01            " Material Text
             b~werks            " Plant
             b~lgort            " Storage Location
             b~matkl            " Material Group
             b~menge            " PR Quantity
             b~meins            " UOM
             b~bprme            " Price Unit
             b~netpr            " Net price
             b~peinh            " Price Unit UOM
             b~pstyp            " Item Category
             b~knttp            " Account Assignment Category
        INTO TABLE i_po
        FROM ekko AS a JOIN ekpo AS b
        ON a~ebeln = b~ebeln
        WHERE a~ebeln IN s_ebeln AND
              a~lifnr IN s_lifnr AND
              a~ekgrp IN s_ekgrp AND
              a~bsart IN s_bsart AND
              a~bedat IN s_bedat.
      SORT i_po BY ebeln ebelp.
      break-point.
      IF NOT i_po[] IS INITIAL.
    Fetch the PO History/Invoice Details from EKBE Table
        CLEAR i_ekbe.
        REFRESH i_ekbe.
        SELECT ebeln           " PO No.
               ebelp           " PO Item
               gjahr           " Fiscal Year
               belnr           " PO Invoice No
               menge           " PR Quantity
               wrbtr           " Price in Local Currency
               dmbtr           " Price in Foreign Currency
               waers           " Currency
               shkzg           " Dr/Cr Indicator
         INTO TABLE i_ekbe
         FROM ekbe
         FOR ALL ENTRIES IN i_po
         WHERE ebeln = i_po-ebeln AND
               ebelp = i_po-ebelp AND
               vgabe = c_vgabe.
      break-point.
        IF sy-subrc = 0.
          SORT i_ekbe BY ebeln ebelp.
          LOOP AT i_ekbe.
            IF i_ekbe-shkzg = c_h.
              i_ekbe-wrbtr = i_ekbe-wrbtr * -1.
            ENDIF.
            MODIFY i_ekbe.
          ENDLOOP.
      break-point.
    Sum up the Item wise Invoice totals
          LOOP AT i_ekbe.
            AT END OF ebelp.
              READ TABLE i_ekbe INDEX sy-tabix.
              SUM.
              MOVE-CORRESPONDING i_ekbe TO i_inv.
              APPEND i_inv.
            ENDAT.
            CLEAR i_inv.
          ENDLOOP.
          SORT i_inv BY ebeln ebelp.
            break-point.
        ENDIF.
      ENDIF.
    Move the Vendor Name and Invoice Values to I_rep Internal Table
      LOOP AT i_po.
        MOVE-CORRESPONDING i_po TO i_rep.
        CLEAR i_inv.
        READ TABLE i_inv WITH KEY ebeln = i_po-ebeln
                                  ebelp = i_po-ebelp.
        IF sy-subrc = 0.
          i_rep-orewr = ( i_po-menge - i_inv-menge ) * i_po-netpr.
          i_rep-curr  = i_inv-waers.
        ELSE.
          i_rep-orewr = i_po-menge * i_po-netpr.
          i_rep-curr  = i_po-waers.
        ENDIF.
      break-point.
    Get the Vendor Name
        CLEAR lfa1-name1.
        SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
          WHERE lifnr = i_po-lifnr.
        IF sy-subrc = 0.
          i_rep-name1  = lfa1-name1.
        ENDIF.
        APPEND i_rep.
        CLEAR  i_rep.
          break-point.
      ENDLOOP.
      SORT i_rep BY lifnr ebeln ebelp.
      DELETE i_rep WHERE orewr LE 0.
      break-point.
    ENDFORM.                    " fetch_data
    *&      Form  display_data
    Display the Report Output data
    FORM display_data .
      DATA: lv_flag,               " New Flag
            lv_rec TYPE i.         " No of Records
      CLEAR lv_rec.
      IF i_rep[] IS INITIAL.
        MESSAGE e000 WITH 'No Data found'(022).
      ELSE.
        LOOP AT i_rep.
    Toggle Color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
    At New Purchase Document
          AT NEW ebeln.
            WRITE:/1 sy-vline, 2(10) i_rep-ebeln INTENSIFIED OFF.
            lv_flag = c_x.
            lv_rec = lv_rec + 1.
          ENDAT.
          WRITE: 1 sy-vline,
                12 sy-vline,13(4)   i_rep-bsart,
                17 sy-vline,18(10)  i_rep-lifnr,
                28 sy-vline,29(35)  i_rep-name1,
                64 sy-vline,65(4)   i_rep-ekgrp,
                69 sy-vline,70(10)  i_rep-bedat,
                80 sy-vline,81(5)   i_rep-ebelp,
                86 sy-vline,87(40)  i_rep-txz01,
               127 sy-vline,128(9)  i_rep-matkl,
               137 sy-vline,138(1)  i_rep-pstyp,
               139 sy-vline,140(1)  i_rep-knttp,
               141 sy-vline,142(4)  i_rep-werks,
               146 sy-vline,147(4)  i_rep-lgort,
               151 sy-vline,152(13) i_rep-menge UNIT i_rep-meins,
               165 sy-vline,166(3)  i_rep-meins,
               169 sy-vline,170(15) i_rep-netpr CURRENCY i_rep-waers,
               185 sy-vline,186(4)  i_rep-waers,
               190 sy-vline,191(5)  i_rep-peinh,
               196 sy-vline,197(4)  i_rep-bprme,
               201 sy-vline,202(15) i_rep-orewr CURRENCY i_rep-curr,
               217 sy-vline,218(4)  i_rep-curr,
               222 sy-vline,223(7)  i_rep-bstyp centered,
               230 sy-vline.
          NEW-LINE.
          hide: i_rep-ebeln.
        ENDLOOP.
        ULINE.
        FORMAT COLOR OFF.
        WRITE : /2 'Total Number of Purchasing Documents:'(025) COLOR 3,
                    lv_rec COLOR 3.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  header
    Write the Report Header
    FORM header .
      FORMAT RESET.
    header
      WRITE:/1(230) 'LIST OF PURCHASE DOCUMENTS PER VENDOR'(006) CENTERED.
      SKIP.
      FORMAT COLOR COL_HEADING.
      ULINE.
      WRITE:/1 sy-vline,2(10)   'Pur.Doc.No'(006) CENTERED,
            12 sy-vline,13(4)   'Type'(007),
            17 sy-vline,18(10)  'Vendor'(008) CENTERED,
            28 sy-vline,29(35)  'Name'(009) CENTERED,
            64 sy-vline,65(4)   'PGrp'(010) CENTERED,
            69 sy-vline,70(10)  'Doc.Date'(012) CENTERED,
            80 sy-vline,81(5)   'Item'(011),
            86 sy-vline,87(40)  'Material Short Text'(024) CENTERED,
           127 sy-vline,128(9)  'Mat.Group'(013),
           137 sy-vline,138(1)  'I',
           139 sy-vline,140(1)  'A',
           141 sy-vline,142(4)  'Plnt'(014),
           146 sy-vline,147(4)  'SLoc'(015),
           151 sy-vline,152(13) 'Quantity'(016) CENTERED,
           165 sy-vline,166(3)  'UoM'(017),
           169 sy-vline,170(15) 'Net Value'(018) CENTERED,
           185 sy-vline,186(4)  'Curr'(019),
           190 sy-vline,191(5)  'Per'(020),
           196 sy-vline,197(4)  'Unit'(021),
           201 sy-vline,202(15) 'To be Invoiced'(023) CENTERED,
           217 sy-vline,218(4)  'Curr'(019),
           222 sy-vline,223(7)  'Doc.Cat'(026),
           230 sy-vline.
      ULINE.
    ENDFORM.                    " header
    *&      Form  toggle_color
    This routine alters the color of the records in the list
    FORM toggle_color.
      IF gv_dial = space.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        gv_dial = c_x.
      ELSE.
        FORMAT COLOR 1 INTENSIFIED OFF.
        CLEAR gv_dial.
      ENDIF.
    ENDFORM.                    " toggle_color
    *&      Form  LINE_SEL
    *When double clicked on EBELN field display the details of Purchase Doc
    FORM line_sel.
      CASE sy-lsind.
        WHEN '1'.
          DATA: lv_field(20),
                lv_value(10),
                lv_bstyp like i_rep-bstyp.
          clear: lv_bstyp,lv_value, lv_field.
          GET CURSOR FIELD lv_field VALUE lv_value.
          IF lv_field = 'I_REP-EBELN'.
            IF NOT lv_value IS INITIAL.
              READ LINE sy-index FIELD VALUE i_rep-bstyp
                                       INTO  lv_bstyp.
             READ CURRENT LINE FIELD VALUE i_rep-bstyp INTO lv_bstyp.
              if lv_bstyp = 'F'.
                SET PARAMETER ID 'BES' FIELD lv_value.
                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
              elseif ( lv_bstyp = 'K' or lv_bstyp = 'L' ).
                SET PARAMETER ID 'VRT' FIELD lv_value.
                CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
              elseif lv_bstyp = 'A'.
                SET PARAMETER ID 'ANF' FIELD lv_value.
                CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
              endif.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " line_sel
    Reward points if useful
    Regards
    Anji

  • Goods Receipt PO "money overflow" error message

    Hi all,
    A client is having problems when trying to post a Goods Receipt PO based on an A/P Reserve Invoice. When adding the following error message comes up:
    [Goods Receipt PO-Rows -Warehouse Code][line: 0], 'Money Overflow (ODBC-104)'
    Has anyone of you encountered this message? What could the problem be? They are using SAP 2005A PL 46.
    Any help will be appreciated.
    Regards,
    Anthony

    Hi,
    this note could be used to resolve your problem:
    Money overflow error message
    Symptom
    SAP Business One A does not support scenarios that might lead to a value greaterthan 9,223,372,036,854 in money fields, or in intermediate calculations, and may generate a Money Overflow error message.
    Other terms
    Money Overflow, maximum, 2005 A SP01.
    Reason and Prerequisites
    FAQ.
    Solution
    The scenarios described above are not supported in SAP Business One.
    The note # : 1026634
    Rgds,

  • Deficit of stock in Posto Goods Receipt of inbound delivery

    Hi folks. I´m trying to post goods receipt of an inbound delivery (return order), but for one material we get this message:
    Deficit of BA Unrestricted-use 21 CRT : 697-0 0001 3002 DEVOLUÇÕES
    I don´t get it, since it seems to me that its calling a deficit of 21 crates of the material 697-0, but this is an inboud delivery! I don't have any stock of this material at this plant.
    Any suggestions?

    The message looks it is checking for batch. Go to t.code 0VLP (Zero V L P), select the item category of the inbound delivery and go to the details. In the warehouse control and packing data you can find a field No batch check. Check this field and test again. Also make sure, the AutoBatchDetermination box is UNCHECKED.
    Regards,

Maybe you are looking for