Skip to Content
0
Former Member
Jan 23, 2013 at 10:43 AM

Not able to view data after execution of mentioned program

24 Views

Purchasing Order ALV Report ( Using For All entries And Join Condition For Table EKKO And EKPO)

REPORT zabap_po.

TYPE-POOLS:slis.

TABLES: ekko,ekpo.

****************DEFINING FIELD CATLOG

DATA: fcat TYPE slis_fieldcat_alv,

it_fcat TYPE slis_t_fieldcat_alv,

lout TYPE slis_layout_alv,

head TYPE slis_listheader,

it_head TYPE slis_t_listheader,

sort TYPE slis_sortinfo_alv,

it_sort TYPE slis_t_sortinfo_alv.

************** DEFINING INTERNAL TABLE STUCTURE

types: BEGIN OF ty_ekko,

ebeln TYPE ekko-ebeln,

bedat TYPE ekko-bedat,

END OF ty_ekko.

types: BEGIN OF ty_ekpo,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

txz01 TYPE ekpo-txz01,

matnR TYPE ekpo-matnR,

END OF ty_ekpo.

types: BEGIN OF tY_po,

ebeln TYPE ekko-ebeln,

bedat TYPE ekko-bedat,

ebelp TYPE ekpo-ebelp,

matnr TYPE ekpo-matnr,

txz01 TYPE ekpo-txz01,

END OF ty_po.

data: it_ekko type table of ty_ekko,

it_ekpo type table of ty_ekpo,

it_po type table of ty_po with header line.

DATA: wa_ekko type ty_ekko,

wa_ekpo type ty_ekpo,

wa_po type ty_po.

*****************SELECTION SCREEN

SELECTION-SCREEN:BEGIN OF BLOCK b WITH FRAME TITLE t.

SELECT-OPTIONS:po_no FOR ekko-ebeln,

doc_dat FOR ekko-bedat obligatory.

SELECTION-SCREEN: END OF BLOCK b.

******************INTIALIZATION

INITIALIZATION.

t = 'ENTER PURCHASING DOCUMENT NUMBER'.

lout-zebra = 'X'.

********************** Start Of Selection

START-OF-SELECTION.

PERFORM select_data.

PERFORM fieldcatlog.

*&---------------------------------------------------------------------*

*& Form SELECT_DATA

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM select_data .

******************************Using Join Condition*****************************************

*

* select a~ebeln a~bedat b~ebelp b~matnr b~txz01

* into corresponding fields of table it_po

* from ekko as a JOIN ekpo as b on a~ebeln = b~ebeln where a~bedat in doc_dat and a~ebeln in PO_NO.

*

******************************Using Join Condition*****************************************

SELECT ebeln bedat FROM ekko

INTO CORRESPONDING FIELDS OF TABLE it_ekko

where bedat in DOC_DAT and ebeln in PO_NO.

SELECT ebeln ebelp matnr txz01 FROM ekpo

INTO CORRESPONDING FIELDS OF TABLE it_ekpo

FOR ALL ENTRIES IN it_ekko

WHERE ebeln = it_ekko-ebeln and ebeln in PO_NO.

loop at it_ekko into wa_ekko where bedat in DOC_DAT and ebeln in PO_NO.

wa_po-ebeln = wa_ekko-ebeln.

wa_po-bedat = wa_ekko-bedat.

loop at it_ekpo into wa_ekpo where ebeln = wa_ekko-ebeln.

wa_po-ebelp = wa_ekpo-ebelp.

wa_po-matnr = wa_ekpo-matnr.

wa_po-txz01 = wa_ekpo-txz01.

append wa_po to it_po.

clear wa_po.

endloop.

endloop.

ENDFORM. " SELECT_DATA

*&amp;---------------------------------------------------------------------*

*&amp; Form FIELDCATLOG

*&amp;---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM fieldcatlog .

fcat-col_pos = '1'.

fcat-tabname = 'IT_PO'.

fcat-fieldname = 'EBELN'.

fcat-outputlen = 15.

fcat-seltext_m = 'PURCHASE DOC NO'.

APPEND fcat TO it_fcat.

CLEAR fcat.

* sort-spos = '1'.

* sort-tabname = 'IT_PO'.

* sort-fieldname = 'EBELN'.

* sort-up = 'X'.

* append sort to it_sort.

* clear sort.

fcat-col_pos = '2'.

fcat-tabname = 'IT_PO'.

fcat-fieldname = 'BEDAT'.

fcat-seltext_m = 'DOC DATE'.

fcat-outputlen = 15.

APPEND fcat TO it_fcat.

CLEAR fcat.

* sort-spos = '2'.

* sort-tabname = 'IT_PO'.

* sort-fieldname = 'BEDAT'.

* sort-up = 'X'.

* append sort to it_sort.

* clear sort.

fcat-col_pos = '3'.

fcat-tabname = 'IT_PO'.

fcat-fieldname = 'EBELP'.

fcat-seltext_m = 'ITEM'.

fcat-outputlen = 15.

APPEND fcat TO it_fcat.

CLEAR fcat.

fcat-col_pos = '4'.

fcat-tabname = 'IT_PO'.

fcat-fieldname = 'MATNR'.

fcat-seltext_m = 'MATERIAL'.

APPEND fcat TO it_fcat.

CLEAR fcat.

fcat-col_pos = '5'.

fcat-tabname = 'IT_PO'.

fcat-fieldname = 'TXZ01'.

fcat-seltext_m = 'SHORT TEXT'.

fcat-outputlen = 30.

APPEND fcat TO it_fcat.

CLEAR fcat.

ENDFORM. " FIELDCATLOG

END-OF-SELECTION.

PERFORM display.

*&amp;---------------------------------------------------------------------*

*&amp; Form DISPLAY

*&amp;---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM display.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

i_callback_program = sy-cprog

* I_CALLBACK_PF_STATUS_SET = ' '

* i_callback_user_command = 'CLICK'

i_callback_top_of_page = 'HEADING'

* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '

* I_STRUCTURE_NAME =

* I_BACKGROUND_ID = ' '

i_grid_title = 'PURCHASING DOUMENT NUMBER'

* I_GRID_SETTINGS =

is_layout = lout

it_fieldcat = it_fcat[]

* IT_EXCLUDING =

* IT_SPECIAL_GROUPS =

it_sort = it_sort[]

* IT_FILTER =

* IS_SEL_HIDE =

* I_DEFAULT = 'X'

* I_SAVE = ' '

* IS_VARIANT =

* IT_EVENTS =

* IT_EVENT_EXIT =

* IS_PRINT =

* IS_REPREP_ID =

* I_SCREEN_START_COLUMN = 0

* I_SCREEN_START_LINE = 0

* I_SCREEN_END_COLUMN = 0

* I_SCREEN_END_LINE = 0

* I_HTML_HEIGHT_TOP = 0

* I_HTML_HEIGHT_END = 0

* IT_ALV_GRAPHICS =

* IT_HYPERLINK =

* IT_ADD_FIELDCAT =

* IT_EXCEPT_QINFO =

* IR_SALV_FULLSCREEN_ADAPTER =

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = it_po

* 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.

ENDIF.

ENDFORM. " DISPLAY

*&amp;---------------------------------------------------------------------*

*&amp; Form heading

*&amp;---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM heading.

CLEAR it_head.

head-typ = 'H'.

head-info = 'PURCHASING DOCUMNET'.

APPEND head TO it_head.

CLEAR head.

head-typ = 'S'.

head-info = 'DATE:'.

CONCATENATE: sy-datum+6(2)'.' sy-datum+4(2)'.' sy-datum(4) INTO head-info.

APPEND head TO it_head.

CLEAR head.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_head

* I_LOGO = ''

* I_END_OF_LIST_GRID =

* I_ALV_FORM =

.

ENDFORM. " heading

*****************************************************************************

Hello all,

With reference to above code which I found easy to understand so have tried to execute ,but not able to view the proper output

Which can be helpful for me to clear my alv concept.

When I entered PO number on selection screen I.e. 4500006370 to 4500012165 and document date 02.07.2000 to 23.01.2013

It's showing me following error.

Field symbol has not yet been assigned . ( runtime errors getwa_not_assigned )

Error analysis

You attempted to access an unassigned field symbol.

If someone could help me to get proper output using same code so that I can view table details and I'll help to understand alv.