REPORT  ZPURCHASE_ORDER.

TYPE-POOLS : SLIS.
TABLES:EKPO,"PURCHASE DOCUMENT ITEM
      MKPF,"MAREIAL DOCUMENT HEADER
      LIPS."DELIVERY ITEM.

**************************************END OF TABLES DECLARATION****************************************************
  DATA: BEGIN OF i_alv OCCURS 0,
         WERKS TYPE LIPS-WERKS,
        MATNR TYPE EKPO-MATNR,
        MAKTX  TYPE MAKT-MAKTX,
       VBELN TYPE LIPS-VBELN,
       LFIMG TYPE LIPS-LFIMG,
       MBLNR TYPE MKPF-MBLNR,
       MENGE TYPE MSEG-MENGE,
    END OF i_alv.

    DATA: it_ekpo TYPE STANDARD TABLE OF ekpo,
          wa_ekpo TYPE ekpo.
    DATA: it_MKPF TYPE STANDARD TABLE OF  MKPF,
      wa_MKPF TYPE MKPF.
 DATA: it_LIPS TYPE STANDARD TABLE OF LIPS ,
      wa_LIPS TYPE LIPS.
 DATA: it_MSEG TYPE STANDARD TABLE OF MSEG,
       WA_MSEG TYPE MSEG.

 DATA: gt_events  type slis_t_event.
DATA: it_ekko TYPE TABLE OF ekko WITH HEADER LINE.
DATA: wa_ekko like LINE OF it_ekko.

DATA:  BEGIN OF it_data OCCURS 1,
        xblnr TYPE xblnr,
      END OF it_data.

DATA: wa_data LIKE LINE OF it_data.
*ALV DATA DECLARATIONS
data: fieldcatalog type slis_t_fieldcat_alv with header line,
      gd_tb_group type slis_t_sp_group_alv,
      gd_tb_layout type slis_layout_alv ,
      gd_repid like sy-repid.

SELECT-OPTIONS:  S_BUDAT FOR MKPF-BUDAT,
                 S_WERKS FOR LIPS-WERKS.

*************************************************************
*FORM GET_DATA
*************************************************************
          "get_data

*START-OF-SELECTION.
START-OF-SELECTION.
PERFORM get_data.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.

*&-------------------------------------------------------*
*&Form get_data
*&--------------------------------------------------------*
FORM get_data.
* Take all Purchase Data

 SELECT ebeln aedat FROM ekko INTO CORRESPONDING FIELDS OF TABLE it_ekko
                               WHERE aedat IN s_budat.
   SELECT ebeln matnr txz01 menge  FROM ekpo INTO CORRESPONDING FIELDS OF TABLE it_ekpo FOR ALL ENTRIES IN it_ekpo
                               WHERE ebeln = it_ekpo-ebeln.
  SELECT VBELN MATNR LFIMG  FROM lips INTO CORRESPONDING FIELDS OF TABLE it_lips FOR ALL ENTRIES IN it_ekko
                               WHERE VGBEL = it_ekko-ebeln.

LOOP AT it_ekko INTO wa_ekko.

  wa_data-xblnr = wa_ekko-ebeln.
  APPEND wa_data to it_data.
  CLEAR wa_data.
ENDLOOP.

  SELECT MBLNR FROM MKPF INTO CORRESPONDING FIELDS OF TABLE it_MKPF FOR ALL ENTRIES IN it_data
                               WHERE xblnr = it_data-xblnr.

  SELECT MBLNR MATNR MENGE FROM MSEG INTO CORRESPONDING FIELDS OF TABLE it_MSEG FOR ALL ENTRIES IN it_mkpf
                                 WHERE MBLNR = it_mkpf-MBLNR.

   IF sy-subrc = 0.

   ENDIF.

ENDFORM.                         "get_data

*&-----------------------------------------------------------*
*&    Form build_catalog
*&-----------------------------------------------------------*
*     Build field catalog for alv report
*&-----------------------------------------------------------*
Form build_fieldcatalog.
  Fieldcatalog-fieldname = 'werks'. "Store
  Fieldcatalog-seltext_m = 'Store'.
   Fieldcatalog-col_pos = '1'.
  append Fieldcatalog to Fieldcatalog.
  clear Fieldcatalog.

  Fieldcatalog-fieldname = 'MATNR'.  "article
  Fieldcatalog-seltext_m = 'Article'.
  Fieldcatalog-col_pos = '2'.
  append Fieldcatalog to Fieldcatalog.
  clear Fieldcatalog.

  Fieldcatalog-fieldname = 'MAKTX'.  "article description
  Fieldcatalog-seltext_m = 'Article Description'.
  Fieldcatalog-col_pos = '2'.
  append Fieldcatalog to Fieldcatalog.
  clear Fieldcatalog.

  Fieldcatalog-fieldname = 'VBELN'. "Outbound delivery
  Fieldcatalog-seltext_m = 'OBD No.'.
  Fieldcatalog-col_pos = '3'.
  append Fieldcatalog to Fieldcatalog.
  clear Fieldcatalog.

  Fieldcatalog-fieldname = 'LFIMG'. "outbound deliveryquantity
  Fieldcatalog-seltext_m = 'OBD Quantity'.
  Fieldcatalog-col_pos = '3'.
  append Fieldcatalog to Fieldcatalog.
  clear Fieldcatalog.

  Fieldcatalog-fieldname = 'MBLNR'.  "goods receipt note
  Fieldcatalog-seltext_m = 'GRN No.'.
  Fieldcatalog-col_pos = '3'.
  append Fieldcatalog to Fieldcatalog.
  clear Fieldcatalog.
ENDFORM.           "build fieldcatalog
*&------------------------------------------------------*
*&Build layout
*&-------------------------------------------------------*
*       Build layout for ALV grid report
*----------------------------------------------------------------------*
form build_layout.
  GD_TB_layout-no_input          = 'X'.
  GD_TB_layout-colwidth_optimize = 'X'.
  GD_TB_layout-totals_text       = 'Totals'(201).

*  gd_layout-totals_only        = 'X'.
*  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
*                                         "click(press f2)
*  gd_layout-zebra             = 'X'.
*  gd_layout-group_change_edit = 'X'.
*  gd_layout-header_text       = 'helllllo'.
endform.                    " BUILD_LAYOUT

*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*       Display report using ALV grid
*----------------------------------------------------------------------*
form display_alv_report.
  gd_repid = sy-repid.
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
*            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
*            i_callback_user_command = 'USER_COMMAND'
*            i_grid_title           = outtext
            is_layout               = GD_TB_layout
            it_fieldcat             = fieldcatalog[]
*            it_special_groups       = gd_tabgroup
*            IT_EVENTS                = GT_XEVENTS
            i_save                  = 'X'
*            is_variant              = z_template

       tables
            t_outtab                = IT_EKPO
       exceptions
            program_error           = 1
            others                  = 2.
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    STOP.
  endif.
endform.                    " DISPLAY_ALV_REP
This question is marked "community wiki".

asked 08 May '13, 02:48

abap's gravatar image

abap
11112
accept rate: 0%

edited 09 May '13, 04:27

pedrolima's gravatar image

pedrolima ♦♦
1.1k232840


Looking at this on my phone. What doesb the error say?

permanent link

answered 08 May '13, 19:33

soldner's gravatar image

soldner
25114
accept rate: 0%

Finding the bug in your code will not help you in the long run. What I can suggest is a book to improve ABAP coding and a book to improve good coding practice. And combine writing with reading a lot of other people (or SAP) code. Hope it helps.

permanent link

answered 09 May '13, 04:39

pedrolima's gravatar image

pedrolima ♦♦
1.1k232840
accept rate: 32%

Nike is nearly all fantastic genius of soccer solutions subsequently introduced wholly evolved the planning of soccer footwear. Very little rules: To Nike artist Peter Hudson (Peter Hudson) can develop layed out at the start with the design and style sketches some sort of least heavy, fastest soccer footwear, it vital to help determine. Following exclusion connected with income, time as well as producing systems and also other reasons, the actual creator [url=http://www.dhruwalandankita.com/nike-blazers-women-c-24.html]Nike Blazers Women For Cheap[/url] may be fanciful, separate just about all your scientific limits, building a wholly crafted from carbon sheets soccer shoes or boots.

This particular unprecedented motivation. Regarding Nike, the final results of the initiative is usually crowned the actual beginning from the least heavy soccer footwear Mercurial SL Nike Mercurial, the actual throne, and it's also probably the actual fastest reaction, sturdiness most robust and many sturdy soccer shoes. Full sections is rather easy shoes or boots, minus the merest further layout, though each operation not really far too unfastened. With the start, Mercurial SL isn't devised for purchase, it's getting created while using very same principle automobile: guide development, to help investigate brand-new ideas, as well as area of layout along with anthropological.

Mercurial SL inside producing brand new basics, nevertheless, robust side effects concurrently, Nike identified that will these kind of sports athletes provide ground breaking ideas along [url=http://www.dhruwalandankita.com/supra-owen-c-11.html]supra owen[/url] with solutions usually are ist. Stollen far more impression as well as kind within the bottoms complemented simply by shot in to a solo big ground element thorns inside Korea. Surge works rapidly sports athletes offer the best possible hold, so that sports athletes on the stadium dribbling and also running can immediately quicken. SL back keeping human body layout is rather little, predetermined to help your back. Nike Italy Montebelluna Exploration Center, men with vision some sort of brand-new course of action, which can be that tenacious carbon sheets material for making the game shoes soft prime. Kind ought to become sensible services.

Mercurial SL co2 sheets coloration in order to ebony -based. A common more coloration is usually light red Nike tick. To creator Peter Hudson discussed in which "This form of hues, which means you cannot guide nevertheless magnified expression, then http://www.dhruwalandankita.com/nike-dunk-low-c-7.html you certainly might find superb layout particulars. " Stated Mister. Hu Desen, " Mercurial SL will be your dignity responsibilities - some sort of mild high quality, top-quality effectiveness along with easy speeding soccer shoes or boots was given birth, it's not simply the actual development connected with.

permanent link

answered 14 May '14, 23:56

bellamy19700's gravatar image

bellamy19700
(suspended)
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×28
×2
×2
×1

question asked: 08 May '13, 02:48

question was seen: 13,873 times

last updated: 14 May '14, 23:56