SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Blocked for “Credit limit” and released Sales orders report



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Jan 19, 2008 11:11 pm    Post subject: Blocked for “Credit limit” and released Sales orders report Reply with quote

I want to know, for statistic reasons, how many sales orders were blocked for “Credit limit” ( Delivery block status to 01 ) and then released during a period.( using Select Statement )



Code:
REPORT  z_stat_so_blocked.

TABLES : cdhdr, cdpos.

DATA : BEGIN OF t_cdhdr OCCURS 0,
       objectid LIKE cdhdr-objectid,
       changenr LIKE cdhdr-changenr,
       udate    LIKE cdhdr-udate,
       username LIKE cdhdr-username,
       END OF t_cdhdr.

DATA : BEGIN OF t_cdpos OCCURS 0,
       objectid LIKE vbap-vbeln,
       END OF t_cdpos.

*-
SELECT-OPTIONS : period   FOR cdhdr-udate OBLIGATORY.

*-
START-OF-SELECTION.

  CLEAR cdhdr.
  SELECT  objectid
          changenr
          udate
          username
          INTO TABLE t_cdhdr
          FROM cdhdr
          WHERE objectclas EQ 'VERKBELEG'     "This is the Class
                                              "for Sales Order
          AND   udate IN period
          AND   tcode EQ 'VA02'               " T-code
          AND   change_ind EQ 'U'.            " Update

  SORT t_cdhdr BY objectid.

  CHECK NOT t_cdhdr[] IS INITIAL.

  CLEAR cdpos.
  SELECT objectid
         INTO TABLE t_cdpos
         FROM cdpos
         FOR ALL ENTRIES IN t_cdhdr
         WHERE objectclas EQ 'VERKBELEG'
         AND   objectid EQ t_cdhdr-objectid
         AND   changenr EQ t_cdhdr-changenr
         AND   tabname  EQ 'VBAK'
         AND   fname    EQ 'LIFSK'       " Field name for Delivery Block
         AND   chngind  EQ 'U'           " Update
         AND   value_old EQ '01'.

  SORT t_cdpos BY objectid.

  LOOP AT t_cdpos.
    WRITE : / t_cdpos-objectid.
  ENDLOOP.

END-OF-SELECTION.


Author: Erwan LE BRUN
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.