Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Open Purchase order

Former Member
0 Kudos

Hi,

I need to write a report for open purchase orders. How to get the open purchase order items and reverse goods receipt is also open. If any body knows mail me back gopalsudarsan@yahoo.co.in.

Thanks in advance.

4 REPLIES 4

Former Member
0 Kudos

u have to put logic on EKPO qty , like Scheduled Qty and Confirmed qty ? based on these u can say this is a Open PO.

ask ur functional to define what is Open PO.

regards

Peram

Former Member
0 Kudos

See the example code for OPEN PO :

should look at EKPO-ELIKZ = space -> open order qty.

type-pools : slis.

  • Tables

tables : ekko, " Purchase order Header

ekpo, " Purchase order Item

marc. " Material with Plant data

  • Internal table for output.

data : begin of i_output occurs 0,

ebeln like ekko-ebeln,

matnr like ekpo-matnr,

end of i_output.

  • ALV Data declaration.

data : v_repid like sy-repid.

  • ALV Function Module Variables

DATA: gs_layout type slis_layout_alv,

g_exit_caused_by_caller,

gs_exit_caused_by_user type slis_exit_by_user.

DATA: gt_fieldcat type slis_t_fieldcat_alv,

gs_print type slis_print_alv,

gt_events type slis_t_event,

gt_list_top_of_page type slis_t_listheader,

g_status_set type slis_formname value 'PF_STATUS_SET',

g_user_command type slis_formname value 'USER_COMMAND',

g_top_of_page type slis_formname value 'TOP_OF_PAGE',

g_top_of_list type slis_formname value 'TOP_OF_LIST',

g_end_of_list type slis_formname value 'END_OF_LIST',

g_variant LIKE disvariant,

g_save(1) TYPE c,

g_tabname_header TYPE slis_tabname,

g_tabname_item TYPE slis_tabname,

g_exit(1) TYPE c,

gx_variant LIKE disvariant.

data : gr_layout_bck type slis_layout_alv.

  • Ranges

ranges r_eindt for eket-eindt.

initialization.

v_repid = sy-repid.

start-of-selection.

  • Get the data from EKKO ,EKPO and MARC Table

perform get_data_tables.

end-of-selection.

  • display the data in the form of ALV

perform display_data.

&----


*& Form get_data_tables

&----


  • Get the data from EKKO,EKPO and MARC Table

----


FORM get_data_tables.

clear : i_output.

refresh : i_output.

  • fill the dates in ranges

r_eindt-low = sy-datum - 7.

r_eindt-high = sy-datum + 14.

r_eindt-option = 'BT'.

r_eindt-sign = 'I'.

append r_eindt.

  • Get the data from EKKO,EKPO and EKET Tables

select aebeln bmatnr into table i_output

from ekko as a inner join

ekpo as b on aebeln = bebeln

inner join marc as c on cmatnr = bmatnr

inner join mara as d on dmatnr = bmatnr

inner join eket as e on eebeln = aebeln

and eebelp = bebelp

where c~beskz = 'E'

and c~werks = '1000'

and d~mtart = 'FERT'

and b~loekz = space

and b~elikz = space

and e~eindt in r_eindt.

if sy-subrc ne 0.

message e000(zwave) with 'No open purchase order found'.

endif.

ENDFORM. " get_data_tables

&----


*& Form display_data

&----


  • text

----


FORM display_data.

  • Fill the Fiedlcat

PERFORM fieldcat_init using gt_fieldcat[].

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = g_user_command

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT = gr_layout_bck

IT_FIELDCAT = gt_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = g_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

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = i_output

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_data

&----


*& Form fieldcat_init

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

  • Purchase order number

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'EBELN'.

LS_FIELDCAT-ref_fieldname = 'EBELN'.

LS_FIELDCAT-ref_tabname = 'EKKO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Purchase Order'.

ls_fieldcat-seltext_M = 'Purchase Order'.

ls_fieldcat-seltext_S = 'Purchase Order'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

  • Material #

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MATNR'.

LS_FIELDCAT-ref_fieldname = 'MATNR'.

LS_FIELDCAT-ref_tabname = 'EKPO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Material'.

ls_fieldcat-seltext_M = 'Material'.

ls_fieldcat-seltext_S = 'Material'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

ENDFORM. " fieldcat_init

0 Kudos

Hi Seshu,

I got that point (we have to check the delivery complete indicator) but my client told that Revers GR is also open OP. So how to get those information. I have checked in SDN most of them told that this information is exist in MSEG table. my qestion is how to find out that orders. Any how thanks for your information.

0 Kudos

Hi,

why don't you just use transaction ME2N and chose the selekction parameters you desire in the 4th field from the top?

For example:

WE101 (open GR)

RECHNUNG (open IV)

Regards,

AndyG