Vous êtes sur la page 1sur 3

9/10/2015 Display source for correction

Print

FORM GR_CANCELLATION_CONSOLIDATE
Delta001
Context Block

  CONSTANTS: lc_sign_including  TYPE c VALUE 'I',
             lc_sign_excluding  TYPE c VALUE 'E',
             lc_option_equal(2) TYPE c VALUE 'EQ'.

  DATA: ls_work_po_hist_outer TYPE t_gs_work_po_hist,
        ls_work_po_hist_inner TYPE t_gs_work_po_hist.

Delete Block

  DATA: lv_tabix_outer LIKE sy‐tabix.

Insert Block

  DATA: lv_tabix_outer  LIKE sy‐tabix,
        lv_tabix_inner  LIKE sy‐tabix.

Delta002
Context Block

  DATA: lv_sel_period_low  LIKE sy‐datlo,
        lv_sel_period_high LIKE sy‐datlo.
  DATA: lv_year_conv(4)  TYPE n,
        lv_month_conv(2) TYPE n.

Delete Block

  DATA: lv_last_loop TYPE c.

Insert Block

  DATA: lv_last_loop TYPE c,
        lv_new_search TYPE c.
  DATA: lt_copy_po_hist TYPE t_gt_work_po_hist,
        ls_copy_po_hist TYPE t_gs_work_po_hist.

Delta003
Context Block

  SORT pt_work_po_hist BY budat(6) DESCENDING
                          cpudt    DESCENDING

https://websmp230.sap­ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/corr_instr/correction_detail.htm?_CINSTA=0120061532&_CALEID=0001704992&_CPAKI… 1/3
9/10/2015 Display source for correction

                          cputm    DESCENDING
                          belnr    DESCENDING
                          buzei    DESCENDING.

Delete Block

*‐‐ Achtung: Storno des Stornos ist nicht entwickelt!!!

Insert Block

*‐‐ save copy of history table to determine lv_tabix_search
  lt_copy_po_hist[] = pt_work_po_hist[].

*‐‐ Achtung: Storno des Stornos ist nicht entwickelt!!!

Delta004
Context Block

        CLEAR lv_sel_period_low.
      ENDIF.

Delete Block

      CLEAR lv_last_loop.

Insert Block

      CLEAR: lv_last_loop, lv_new_search.

Delta005
Context Block

        LOOP AT pt_work_po_hist INTO ls_work_po_hist_inner
                       FROM lv_tabix_outer
                      WHERE vgabe = gc_event_goods_receipt
                        AND bwart IN lr_movement_types_inner
                        AND shkzg <> ls_work_po_hist_outer‐shkzg
                        AND budat >= lv_sel_period_low
                        AND menge <> 0.

Delete Block

*‐‐ Special handling of cancellation from declaration period, assigned to

https://websmp230.sap­ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/corr_instr/correction_detail.htm?_CINSTA=0120061532&_CALEID=0001704992&_CPAKI… 2/3
9/10/2015 Display source for correction

*‐‐ document already reported in previous period. Try to assign in same period
*‐‐ If check = YES: assign cancellation to a newer document!
          IF ls_work_po_hist_outer‐budat(6)   NE ls_work_po_hist_inner‐budat(6) AND
             ls_work_po_hist_outer‐budat(4)   EQ pv_reporting_year           AND
             ls_work_po_hist_outer‐budat+4(2) EQ pv_reporting_month.
            IF lv_tabix_outer NE 1.
              CLEAR lv_last_loop.
              lv_tabix_outer = 1.
              EXIT.
            ENDIF.
          ENDIF.

Insert Block

          lv_tabix_inner = sy‐tabix.

*‐‐ Special handling of cancellation from declaration period, assigned to
*‐‐ document already reported in previous period. Try to assign in same period
*‐‐ If check = YES: assign cancellation to a newer document!
*‐‐ OUTER = Goods Receipt cancellation / INNER = Goods Receipt
          IF ls_work_po_hist_outer‐budat(6) NE ls_work_po_hist_inner‐budat(6).
            IF lv_new_search EQ false.           "to avoid endless loop
*‐‐ Assigned GR found in previous period:
*‐‐ find first entry from period of GR cancellation and trigger new search
              LOOP AT lt_copy_po_hist INTO ls_copy_po_hist.
                IF ls_copy_po_hist‐budat(6) EQ ls_work_po_hist_outer‐budat(6).
                  lv_tabix_outer = sy‐tabix.
                  MOVE false TO lv_last_loop.
                  MOVE true TO lv_new_search.
                  EXIT.
                ENDIF.
              ENDLOOP.
              IF lv_last_loop EQ false.
                EXIT.                            "EXIT Loop for new SEARCH
              ENDIF.
            ELSE.
              MOVE false TO lv_new_search.
            ENDIF.
          ENDIF.
*‐‐ End of special handling

Print

https://websmp230.sap­ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/corr_instr/correction_detail.htm?_CINSTA=0120061532&_CALEID=0001704992&_CPAKI… 3/3

Vous aimerez peut-être aussi