Standard program on good received statement

Hi all,
can anyone tell me any standard program on good received statement .

Hi
check this code
report zmmgnrep0001
       line-count 58
       line-size 234
       no standard page heading
       message-id zpp.
TABLES *********************************
tables : mseg,
         mkpf,
         bkpf,
         ekbe,
         bseg,
         rseg,
         rbkp.
DATA DECLARATION ****************************
*data xekbe like ekbe occurs 0 with header line.
*data zxekbe like ekbe occurs 0 with header line.
*data :mirodoc like ekbe-belnr,
     mbudat like ekbe-budat.
data xekbe like ekbe occurs 0 with header line.
data zxrbkp like rbkp occurs 0 with header line.
data zrseg like rseg  occurs 0 with header line.
data :mirodoc like rseg-belnr,
      mbudat like rbkp-budat.
data : begin of icheck occurs 0,
         checkdoc like rseg-belnr,
       end of icheck.
data: begin of itab occurs 0,
        mblnr  like mkpf-mblnr,
        mjahr  like mkpf-mjahr,
        budat  like mkpf-budat,
        bldat  like mkpf-bldat,
        xblnr  like mkpf-xblnr,
        zeile  like mseg-zeile,
        bwart  like mseg-bwart,
        ebeln  like mseg-ebeln,
        ebelp  like mseg-ebelp,
        lifnr  like mseg-lifnr,
        lfbnr  like mseg-lfbnr,
        lfbja  like mseg-lfbja,
        lfpos  like mseg-lfpos,
        belnr  like bkpf-belnr,
        bxblnr like bkpf-xblnr,
        bbudat like bkpf-budat,
        wrbtr  like bseg-wrbtr,
        dmbtr  like bseg-dmbtr,
        kursf  like bkpf-kursf,
        grri   like bseg-hkont,
        accn   like bkpf-belnr,
       mirodoc like ekbe-belnr,
       mbudat  like ekbe-budat,
        mirodoc like rseg-belnr,
        mbudat  like rbkp-budat,
      end of itab.
data : xmseg like mseg occurs 0 with header line,
       xmkpf like mkpf occurs 0 with header line.
Modifed  by Raja Robinson,TTIL pune *****************************
data: counter(10),
      counter1(10),
      flag,
      belnr like bkpf-belnr,
      xblnr like bkpf-xblnr,
      budat like bkpf-budat,
      totlc like bseg-dmbtr,
      totfc like bseg-wrbtr,
      kursf like bkpf-kursf,
      grri like bseg-hkont,
      nilcount(5).
data: begin of hdg occurs 10,
        f1          type c   value '|',
        line(232),
        f2          type c   value '|',
      end of hdg.
SELECTION SCREEN ****************************
selection-screen begin of block input with frame.
select-options: pos_date for mkpf-budat,
                mat_no   for mseg-matnr,
                mv_type  for mseg-bwart,
                vend_cd  for mseg-lifnr,
                po_no    for mseg-ebeln,
                hkont    for bseg-hkont.
selection-screen end of block input.
BEGIN OF CODE ******************************
BEGIN OF MAIN CODE ***************************
start-of-selection.
  perform initialization.
  perform get_data_for_input.
  perform filter_data.
  perform getmirodata.
  perform format_data.
  perform print_data.
*&      Form  INITIALIZATION
      text
-->  p1        text
<--  p2        text
form initialization.
endform.                               " INITIALIZATION
*&      Form  GET_DATA_FOR_INPUT
      text
-->  p1        text
<--  p2        text
form get_data_for_input.
  select a~mblnr                       " Material Document (GRN No.)
         a~mjahr                       " Material Document Year
         a~budat                       " Material Document Posting Date
         a~bldat                       " Material Document Date
         a~xblnr       " Reference Document (Invoice No.)
         b~zeile                       " Material Document Item No.
         b~bwart       " Movement Type (101 - GR Iss., 102 - GR Reverse)
         b~ebeln                       " Purchase Order
         b~ebelp                       " Purchase Order Line Number
         b~lifnr                       " Vendor Code
         b~lfbnr " Reference Document No(Contains 101 No in case of 102)
         b~lfbja                       " Reference Document Year
         b~lfpos                       " Reference Document Item No.
         into corresponding fields of table itab
         from mkpf as a
         inner join mseg as b
         on  amblnr = bmblnr
         and amjahr = bmjahr
         where a~budat in pos_date
         and   b~bwart in mv_type
         and   b~ebeln in po_no
         and   b~matnr in mat_no
         and   b~lifnr in vend_cd.
  if sy-subrc <> 0.
    message e000(zpp) with 'No Data Found for the Input Criteria.'.
  endif.
endform.                               " GET_DATA_FOR_INPUT
*&      Form  GETMIRODATA
form getmirodata.
select * from rseg into table zrseg for all entries in itab
              where  ebeln = itab-ebeln
                 and ebelp = itab-ebelp.
select * from rbkp into table zxrbkp for all entries in zrseg
               where  belnr = zrseg-belnr.
endform.
*&      Form  FILTER_DATA
      text
-->  p1        text
<--  p2        text
form filter_data.
  sort itab by lifnr mblnr ebeln.
  loop at itab.
    if itab-bwart = '102'.
      delete itab where mblnr = itab-lfbnr
                  and   mjahr = itab-lfbja
                  and   zeile = itab-lfpos.
      delete itab.
    endif.
  endloop.
endform.                               " FILTER_DATA
*&      Form  FORMAT_DATA
      text
-->  p1        text
<--  p2        text
form format_data.
  loop at itab.
    clear : ekbe,bkpf.
*select * from ekbe
            into corresponding fields of table zxekbe
           where ebeln = itab-ebeln   "xmseg-ebeln
           and   ebelp = itab-ebelp   "xmseg-ebelp
           and   bewtp  in ('R', 'Q').
    select * from ekbe
             into corresponding fields of table xekbe
            where ebeln = itab-ebeln   "xmseg-ebeln
            and   ebelp = itab-ebelp   "xmseg-ebelp
            and   lfbnr = itab-mblnr   "xmseg-mblnr
            and   lfgja = itab-mjahr   "xmseg-mjahr
            and   lfpos = itab-zeile   "xmseg-zeile
            and   bewtp in ('E', 'R').
    if sy-subrc = 0.
      loop at xekbe.
        case xekbe-bewtp.
          when 'E'.
            select single * from bkpf
                           where bukrs = 'GMI'
                          and   belnr like '%'
                          and   gjahr like '%'
                           and   bstat = space
                           and   xblnr = xekbe-xblnr
                           and   blart = 'WE'.
                          and   budat = xekbe-budat
                          and   bldat = xekbe-bldat and  blart = 'WE'.
            itab-wrbtr = xekbe-wrbtr.
            itab-dmbtr = xekbe-dmbtr.
            itab-kursf = bkpf-kursf.
            itab-accn = bkpf-belnr.
          when 'R'.
            select single * from bkpf
                           where bukrs = 'GMI'
                           and   belnr = xekbe-belnr
                           and   gjahr = xekbe-gjahr.
            move bkpf-belnr to itab-belnr.
            move bkpf-xblnr to itab-bxblnr.
            move bkpf-budat to itab-bbudat.
        endcase.
        select single * from bseg where bukrs = bkpf-bukrs and gjahr =
        bkpf-gjahr and belnr = bkpf-belnr and buzid = 'W'.
        itab-grri = bseg-hkont.
        clear bkpf.
      endloop.
    endif.
  read table zrseg with key  ebeln = itab-ebeln
                             ebelp = itab-ebelp.
           on change of zrseg-belnr.
          if not icheck[] is initial.
          read table icheck with key checkdoc = zrseg-belnr.
            if sy-subrc <> 0.
            icheck-checkdoc = zrseg-belnr.
             append icheck.
           move zrseg-belnr to itab-mirodoc.
           read table zxrbkp with key belnr = zrseg-belnr.
           if zxrbkp-budat >= itab-budat.
              move zxrbkp-budat to itab-mbudat.
            endif.
           endif.
         else.
          move zrseg-belnr to itab-mirodoc.
           icheck-checkdoc = zrseg-belnr.
             append icheck.
            endif.
            read table zxrbkp with key belnr = zrseg-belnr.
           if zxrbkp-budat >= itab-budat.
              move zxrbkp-budat to itab-mbudat.
            endif.
           endon.
read table zxekbe with key ebeln = itab-ebeln
                                   ebelp = itab-ebelp.
          move zxekbe-belnr to itab-mirodoc.
          move zxekbe-budat to itab-mbudat.
       clear: zxekbe.
********- SZ398R on 22.04.2008
    modify itab.
  endloop.
  sort itab by mblnr.
  counter = 0.
endform.                               " FORMAT_DATA
*&      Form  PRINT_DATA
      text
-->  p1        text
<--  p2        text
form print_data.
  if hkont <> ''.
    delete  itab where not  grri in hkont.
  endif.
  loop at itab.
    clear flag.
    mirodoc = itab-mirodoc.
    mbudat  = itab-mbudat.
    on change of itab-mblnr.
      counter = counter + 1.
      write:/0(12)  itab-lifnr,        " to out-line+0(12).
             13(10) itab-mblnr,        " to out-line+13(10).
             24(10) itab-budat,        " to out-line+24(10).
             36(16) itab-xblnr,        " to out-line+36(16).
             53(10) itab-bldat,        " to out-line+53(10).
             64(10) itab-ebeln,        " to out-line+64(10),
             160(12) itab-accn,
            180(15) itab-grri.
      flag = 1.
    endon.
    if belnr = '   '.
      belnr = itab-belnr.
      xblnr = itab-bxblnr.
      budat = itab-bbudat.
      kursf = itab-kursf.
    endif.
    totlc = totlc + itab-dmbtr.
    totfc = totfc + itab-wrbtr.
    counter1 = counter1 + 1.
    at end of mblnr.
      if belnr = '   '.
        belnr = 'Nil'.
        nilcount = nilcount + 1.
      endif.
      write: 75(16)  totlc no-zero,
             92(16)  totfc no-zero,
             109(8)  kursf no-zero,
             118(10) belnr,
             129(16) xblnr,
             146(10) budat,
             198 mirodoc,
             215 mbudat.
           CLEAR:mirodoc,mbudat  .
      clear: totlc, totfc, belnr, xblnr, budat.
    endat.
  endloop.
  uline.
  write : / counter, 'GRNs Selected'.
write : / counter1, 'records selected.'.
  write : / nilcount, 'GRNs have no JV attached'.
  write : 69 '***END OF REPORT*****'.
endform.                               " PRINT_DATA
TOP OF PAGE *******************************
top-of-page.
  uline.
  clear hdg-line.
  write : 'General Motors India Confidential' to hdg-line+90.
  write : hdg color col_heading intensified.
  clear hdg-line.
  write : 'Report : ZMM4' to hdg-line+1.
  write : hdg color col_heading intensified.
  clear hdg-line.
  write : 'Date   :' to hdg-line+10.
  write : sy-datum to hdg-line+20.
  write : sy-uzeit to hdg-line+39.
  write : 'Requested By :' to hdg-line+55.
  write : sy-uname to hdg-line+70.
  write : hdg color col_heading intensified.
  clear hdg-line.
  write :  'Goods Receiving Report' to hdg-line+45,
           'Page No.     : '    to hdg-line+75,
           sy-pagno             to hdg-line+91(3).
  write : hdg color col_heading intensified off.
  uline.
  clear hdg-line.
  write :/0(12)   'Vendor',            "          to hdg-line+0,
          13(10)  'GRN No.',           "          to hdg-line+13,
          24(10)  'GRN Date',          "          to hdg-line+24,
          36(16)  'Invoice No.',       "          to hdg-line+36,
          53(10)  'Inv. Dt.',          "          to hdg-line+53,
          64(10)  'PO No.',            "          to hdg-line+64,
          75(16)  'Amount in LC' right-justified, " to hdg-line+153,
          92(16)  'Amount in FC' right-justified, " to hdg-line+179,
          109(8)  'Exchg Rt' right-justified,     " to hdg-line+167,
          118(10) 'JV No.',            "          to hdg-line+193,
          129(16) 'JV.Reference',      "          to hdg-line+204,
          146(10) 'Post.date',         "          to hdg-line+221.
          160     'Account No',
          180     'Acc Post',
         198     'MIRO Document',
         215     'MIRO Post'.
END OF CODE *******************************
thanks
sitaram

Similar Messages

  • Why standard programs uses the OCCURS statement

    Hi Experts,
    instead of occurs we usually use STANDARD TABLE OF due to performance issue ,
    but i noticed that stadard programs are using OCCURS statement only.
    could u plz tell me why stadard programs are using OCCURS only.
    Thanks.

    Hi,
    Occurs Statement created the internal table with header line. But Header Line is not supported in Oop's Concept. So it is better practice to create the table with TYPE/LIKE STANDARD TABLE OF statement without specifying Header line option in declaration.
    Yes in most of the standard Programs OCCURS statement are used. This is because these are SAP standard and developed in older version of sap.

  • Short  Dump in Standard program for the INSERT Statement

    Hi All,
    In the Transaction FPCJ, when I click on the Button Close Cash Desk, I ma getting a short Dump.
    The problem is in the Standard SAP program 'SAPLSUU1' and the include program is 'LSUU1F01'.
    The reason is the code is trying to insert duplicate entries into a Data base table. And SAP is suggesting for a SAp NOTE.
    The problem is when I am trying with the suggested dearch terms I get very large number of notes and I am unable
    to zero down any single note.
    If someone has worked on these or have any idea on the Note number, please share that with me.
    Thans in advance.
    Thanks & regards,
    Y Gautham

    Hi Nicole,
    Thanks a lot! It actually worked.
    Thanks & regards,
    Y Gautham

  • Standard Program (SQ02) hangs @ delete statement

    Hi,
        I have problem when i try to display a infoset @ SQ02, when i debug it, it hangs @ this statement.
        delete from aqgdb where relid = 'AQ'
                            and srtfd like l_sukeylang.
    Any idea what could be wrong? AQGDB is not a big table, and i try selecting from SE16 with the same select statement, it is fine.
    Thanks,
    CK

    One explanation could be that srtfd is a 60Char field and a 'like' clause in the sql is going to take long (if it tries to match through the string for each record).
    SE16 may be working because of its row-count limit (200/500 etc). You can probably remove this row-count to read all records (also specify a str value which is not normally to be found in aqgdb-srtfd, this will make it take longer).
    cheers,

  • Issue with the Receiving Transaction Processor Standard Program

    We are facing issue in the Receiving Transaction Processor Standard Program.
    The error description is as below:
    RVTII-030: Subroutine rvtiicreate() returned error
    Cause: Subroutine rvtiicreate() returned an internal error.
    Action: Note this error number and the actions you are trying to perform. Contact your system administrator.
    RVTII-077: ORA-01476: divisor is equal to zero
    Cause: A SQL error has occurred in RVTII. The SQL error is &LSQL_ERR.
    if any once faced this issue earlier and any solution, Please let us know.
    Regards,
    Krishna

    Please see if these docs help.
    RMA Receipt Errors With RVTII:077 OE COGS API Returned Error Warehouse NULL [ID 301767.1]
    RCVRCERC: RVTII-077: ORA-0146: divisor is equal to zero [ID 1287907.1]
    Cost Of Goods Sold Account Generation Failed With Error [ID 406035.1]
    RMA Transaction Issues (Troubleshooting) [ID 311208.1]
    Thanks,
    Hussein

  • Customer Statement (Standard Program and Scripts)

    Hi All ABAPers,
    Can anyone tell me the standard programs and their tcodes used for Customer statement with the smartform and sap script names?

    Custom statement Prog Name: RFKORD11
    Script name: F140_CUS_STAT_01 & F140_CUS_STAT_02
    Statements would be printed via FBL5N.
    Edited by: Alexander on Jul 1, 2009 12:00 PM

  • Transaction or standard program for testing Open SQL statements

    Hi experts,
    Is there a standard program or transaction that can be used to test Open SQL statements?, I was thinking in something similar to a SQL client like sqlcli, but for Open SQL and within SAP GUI.
    I know i can write a test ABAP program for this matter but I rather a standard testing facily in this case
    Thank you for any help
    regards

    Hi Ozcan
    I tried DB02 -> Diagnosis -> SQL Command editor , but I couldn't made it work. It is for Open SQL or for Native SQL?
    I tried the following simple Open SQL statements inside the SQL Code tab there were erros
    SELECT *
    FROM /BI0/PCOMP_CODE
    error was: Incorrect syntax near '/'.
    SELECT * FROM DD03L
    error was: Invalid object name 'DD03L'.
    Where is the mistake?
    regards

  • Goods Received Valuation for Order Delivery

    Dear Experts,
    In our business process planned order is created through project system. planned order is converted in to production order. while receiving finished goods throgh production order .
    for exmple:  production order 1:
             In finished good A with moving avg price is Rs150
                               for this we use raw material B  Rs 120
                                 labour & machine                       Rs  20
              toatl production cost is                               Rs  140
    while goods receiving the production order credited with Rs 140.
    For same material again we created one more Production order with another planned order.
                                production order 2:
                      In finished good A with moving avg price is Rs150
                                        for this we use raw material B  Rs 140
                                          labour & machine                       Rs  20
                       toatl production cost is                               Rs  160
    while goods receiving the production order2 credited with Rs 140. which is previous production order1 cost.
    our client wants to credit production2 with Rs 160.
    this credit posting Rs 140 is taken for all production order which is created to mateial finished good A.
    Define Goods Received Valuation for Order Delivery here i assigned the valuation varient to the plant.
    Is there any configuration for this apart from  the valuation type  V in the Material Master.
    Please help on this.  I will be grateful for all of you.
    Thanks and Regards
    Raju

    Hi
    The situation you are describing is a standard behaviour... SAP documentation states that in MTO scenario, your price from 1st goods receipt is used to valuate the subsequent Goods receipts
    I think, both of your production orders pertain to the same project.... Correct me if i am wrong plz...
    If you create another project, 140 will not be used... System will use the price from the 1st goods receipt of that project
    This behaviour is controlled by requirement class settings. Check what requirement class you are using and see what all valuation settings have you made there.. especially in fields "Valuation" and "Without valuation strategy"
    Refer the following path in SAP library or help.sap.com
    - Controlling > Product Cost Controlling > Cost Obj Contr > Product Cost by sales order > Valuated sales order stock >  Std price with valuated sales order stock
    This appllies to both sales order stock and project stock
    This explanation is very detailed and comprehensive... Believe me, these settings are extremely influential  and must be done with utmost care.... Understand this documentation well b4 doing the settings
    Regards
    Ajay M

  • What's the standard program for smartform : HR_ECM_CRS

    Hi Friends
    what's the standard program for smartform : HR_ECM_CRS?
    <REMOVED BY MODERATOR>
    Regards,
    Sree
    Edited by: Alvaro Tejada Galindo on Feb 21, 2008 4:14 PM

    hi
    good
    check this link, hope this would help you to solve your problem.
    http://saphelpbykevin.blogspot.com/2006/09/compensation-review-statement-confusion.html
    thanks
    mrutyun^

  • Goods Receive for Outbound Delivery Without Reference using MIGO

    Dear Colleague ...
    We might need your insight on the case below related to Goods Receive of Outbound Delivery without Reference using MIGO:
    (1) In the current SAP Enjoy screen of MIGO, we are allowed to select the reference document (e.g. = PO, Material Document, Inbound Document, Outbound Document, etc.)
    (2) We did 3 (three) kind of test set: GR for Inbound Delivery, GR for Outbound Delivery with STO and GR for Outbound Delivery without reference.
    (3) The first 2 (two) cases work just find with MIGO.  We believe it is because the receiving plant is pretty much determined in the reference document, which is PO (case 1) or STO (case 3)
    (4) However, the last case came up with the error message "Goods receipt not possible for delivery 8000610236: error code 5".  We believe that this is the standard design of SAP, that the receiving plant is required and it is not defined explicitly in the delivery document.
    (5) Moreover, we also believe that that's the reason why SAP (via the Logistic Execution module) provide the Handling Unit and Shipment, which can be used to perform such receive function, which will imply the MM posting (goods issue and goods receive) IF there is stock transfer involved.
    Appreciate for any thoughts or input on the above.  Many thanks,
    Alvon Sibarani

    use transaction mb0a it will work for the scenario.

  • SAP Standard Report for Good Reciept and Open Goods Reciept .

    Dear All Guru's ,
                                                                                    Is there any std. report in which User can see the Actual Goods rcpt and also Open Goods Reciept in that report , What I know that we can see the Goods Rciept thru Trxn = MB51 , but here Open good rcpt
    is not possible.
    Can any one help to fix this requirement.
    Rgds,
    sap11

    Hi
    try MB5S to get an overview of all goods receipts not invoiced.
    I would change the standard variant to also add material not only PO.
    If you want deliveries not invoiced and you have goods received based IV on you can get an overview per vendor with report from F4 in MIRO (I just learnd recently from here that this is the only suitable report available)
    Cheers
    Tim

  • Hiding Fields in Standard Program :  RFITEMAR ,LDB : DDF

    Hi Experts,
    Am using standard program : RFITEMAR ,as per my requirement i dont need
    to display all the fields in the standard selection screen,i juss want to hide the fields which
    i dont want to dispaly in the selection, as there are some dependencies i dont want keep that code in active state.
    can anyone pls help me/suggest me with my logic/guidance would be helpful and very much appreciated.
    Regards,
    Ashok.

    Hi Marcin,
    Thnaks for your response.
    SHDO Tcode is used for Transcation Varient which is used to hide the fields
    or display additioal fields in sales order.
    According to my requirement i copied the standard program into a custom program
    thats where am tryig to implement changes.am not sure wether that would fulfill my requirement.
    do let me if know any solution /guidance would be helpful and appreciated.
    Regards,
    Ashok.

  • Exporting An message Internal table to Standard program Internal Table

    Hi,
      In T-code VOFM, We have Goods issue routine 113, Now in Custmizing 913 is Configured. we are Checking the status of each handling unit of the Delivery. So I am getting the status Incomeplete Message for Multipe HU's. hence AM storing into One internal Table and Now I want To Export That Internal Table to Standard Program Internal Table 'WAT'.
    If I raise

    Elaborate your questions Please.

  • How to find out if ENQUEUE_ESRDIRE is used inside a standard program!

    Hi All,
    I have run VFX3 to rellease billing document using VF02 BDC that is called inside VFX3.
    I used debugging to find out in ENQUEUE_ESRDIRE, or ENQUEUE_E_TRDIR is used anywhere in the process.
    I also used System Debugging and Break-point at statement functions. But I have not ben stopped at these function modules.
    However, I checked using ST05 with enqueue trace enabled, and I found the below entries.
    255 ESRDIRE    ENQUEUE     1      0 Excl(***) TRDIR GP3VOFY4EM1BE5DHB1155DUU8H
    37 ESRDIRE    DEQUEUE     1      0 Excl(***) TRDIR GP3VOFY4EM1BE5DHB1155DUU8H
    My query is how can we debug to a point where these lock objects are used or Do these lock objects are not identified in debug mode but are logged while enqueue trace used i.e., SAP uses internally?
    Please help me as this helps me in resolving an issue where locking issue is there that fails to update VFX3 becuase for one user
    in SQL trace it is logged as VF02  TRDIR Lock > 6 hours VF02 TRDIR
    and for another job "UPD 42 050 BATCHFIN          GZZ K > Obj: ESRDIRE # enxxhead7727" is logged in ST05.                        
    Regards,
    Pratyusha

    Hi Clemens,
    I was unable to trigger the exact point from where this lock object has triggered.
    But I am sure that it is a standard SAP process which is locking while releasing the billing documents.
    Now my query is why SAP why SAP'S standard program VF02 that is internally called by VFX3 (RVFAKSPE) and that can be submitted in background mode will use ESRDIRE lock whil each time it releases the block?
    The problem I am facing is - there are different BATCH jobs and all are for VFX3 with different variant so that no billing document is processed by two different jobs at same time. However the lock entries ENQUEUE_ESRDIRE is creating problem as it is creating locking issue and hence the jobs are processed longer than expected. This is evident from ENQUEUE trace of ST05.
    Is VFX3 ( In version 4.5B) is meant for running 1 background job of VFX3 at a time?
    Regards,
    Pratyusha

  • Standard programs for reports..

    hi,
    how to find d standard report programs... for example i need a report for goods reciept or say purchase price variation report... do we have any  standard sap report prg fr it??? if yes how to find it???

    Go to SE38 and give f4 and give package name of the Business Process you are looking for.
    Go to SE11 -->TADIR give the package name of the Business Process
    Go to SE11--> TRDIR and look for SAP in Created by field name .
    All 3 will fetch you standard programs.
    Reward if Useful.
    Thanks,
    Anita

Maybe you are looking for