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

Delivery details 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: Thu Oct 11, 2007 11:12 pm    Post subject: Delivery details report Reply with quote

Code:
*Report program for delivery details*
 
*Tables used: lips,
*             likp,
*             kna1.
 
REPORT  zsr_delivery_dtls NO STANDARD PAGE HEADING
                          MESSAGE-ID zivltcsr
                          LINE-SIZE 200 LINE-COUNT 35(3).
 
 
*Data declaration*
 
TABLES:likp,
       lips.
 
TYPES: BEGIN OF st_del,
         name1 TYPE kna1-name1,                             "Customer name1
         docno TYPE lips-vgbel,                             "Document number
         itmno TYPE lips-vgpos,                             "Item number
         matxt TYPE lips-mtart,                             "Material text
         name2 TYPE kna1-name2,                             "Customer name2
         salor TYPE likp-vkorg,                             "Sales organization
         qnty  TYPE lips-ntgew,                             "Quantity
         unit  TYPE lips-gewei,                             "Unit
         plant TYPE lips-werks,                             "Plant
         inct1 TYPE likp-inco1,                             "Incoterms1
         inct2 TYPE likp-inco2,                             "incoterms2
       END OF st_del.
 
DATA:wa_del TYPE st_del,
     wa_log TYPE zsr_del_login,
     it_del TYPE TABLE OF st_del,
     sysubrc TYPE sy-subrc.
 
 
 
 
*Selection screen for interactive input*
 
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:so_date  FOR likp-lfdat,                          "Delivery date
               so_shppt FOR likp-vstel,                          "Shipping point
               so_matnr FOR lips-matnr.                          "Material number
SELECTION-SCREEN END OF BLOCK b1.
 
 
 
 
TOP-OF-PAGE.                    "Header
 
  WRITE:/,(15) text-002,(15) text-003,(15) text-004,
          (25) text-005,(20) text-006,(15) text-007,
          (15) text-008,(15) text-009, (15) text-010,
          (15) text-011,(15) text-012.
  ULINE.
 
END-OF-PAGE.                     "Footer
  SKIP.
  WRITE:'End of page ',sy-pagno LEFT-JUSTIFIED.
  ULINE.
 
 
START-OF-SELECTION.
 
 
 
*Retreiving data from database*
 
*Join details: lips = a
*              likp = b
*              kna1 = c
 
  SELECT c~name1 a~vgbel a~vgpos a~mtart c~name2
         b~vkorg a~ntgew a~gewei a~werks
         b~inco1 b~inco2
 
         INTO TABLE it_del
         FROM ( ( lips AS a
 
         INNER JOIN likp AS b ON a~vbeln = b~vbeln )
         INNER JOIN kna1 AS c ON c~kunnr = b~kunnr )
 
         WHERE b~lfdat IN so_date
         AND   b~vstel IN so_shppt
         AND   a~matnr IN so_matnr.
 
  IF sy-subrc NE 0.
    sysubrc = 1.
  ELSE.
    sysubrc = 0.
 
* uploading login data to login table
 
    wa_log-usernam    = sy-uname.
    wa_log-lgdate     = sy-datum.
    wa_log-lgtime     = sy-uzeit.
    wa_log-reccnt     = sy-dbcnt.
    wa_log-deldatelo  = so_date-low.
    wa_log-deldatehg  = so_date-high.
    wa_log-shppntlo   = so_shppt-low.
    wa_log-shppnthg   = so_shppt-high.
    wa_log-materiallo = so_matnr-low.
    wa_log-materialhg = so_matnr-high.
 
    INSERT INTO zsr_del_login VALUES wa_log.
 
  ENDIF.
 
END-OF-SELECTION.
 
 
*List output logic follows*
*_________________________________________________________________________________________*
 
  IF sysubrc NE 0.                              "Error message display if no match found
    MESSAGE i000.
 
  ELSE.                                          "Display logic if match occured with input
 
*Sorting internal table by name*
 
    SORT it_del BY name1.
 
 
*Displayig data from internal table*
 
    LOOP AT it_del INTO wa_del.
 
      WRITE:/  wa_del-docno UNDER text-002,                                       "Document number
               wa_del-itmno UNDER text-003,                                       "Item number
               wa_del-matxt UNDER text-004,                                       "Material text
               wa_del-name1 UNDER text-005,                                       "Customer name1
               wa_del-name2 UNDER text-006,                                       "Customer name2
               wa_del-salor UNDER text-007,                                       "Sales organization
               wa_del-qnty  UNDER text-008 LEFT-JUSTIFIED UNIT wa_del-unit  ,     "Quantity
               wa_del-unit  UNDER text-009,                                       "Unit
               wa_del-plant UNDER text-010,                                       "Plant
               wa_del-inct1 UNDER text-011,                 "Incoterms1
               wa_del-inct2 UNDER text-012.                 "incoterms2
 
      AT END OF name1.                                       "Calculating total quantity for each customer
        SUM.
        SKIP.
        WRITE: 'Total quantity = ',wa_del-qnty LEFT-JUSTIFIED  UNIT wa_del-unit.
        WRITE: wa_del-unit.
        SKIP.
      ENDAT.
 
    ENDLOOP.
    ULINE.
 
 
 
 
  ENDIF.        "End of if sy-subrc ne 0.
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.