Application Development and Automation 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: 
Read only

Purchase Order

Former Member
0 Likes
1,938

Hi all,

i have two doubts related to the purchase order.

1. How to know the Status of the purchase order

ex: Open , Closed

2. How to get the Purchasing Quantity (KOMV-KAWRT)

Please Advice me..

Many thanks for all of your help.

Regards,

Lakshma.

Hi all,

i have two doubts related to the purchase order.

1. How to know the Status of the purchase order

ex: Open , Closed

2. How to get the Purchasing Quantity (KOMV-KAWRT)

Please Advice me..

Many thanks for all of your help.

Regards,

Lakshma.

6 REPLIES 6
Read only

Former Member
0 Likes
1,533

hi check this..

the field in the table ekko shows the status whether it is open or released..

EKPO-ELIKZ..

Read only

Former Member
0 Likes
1,533
Read only

Former Member
0 Likes
1,533

hi,

You can get the staus of PO at header table ekko and

item details and coresponding qunatity details item table ekpo.

Reward if find useful

Read only

Former Member
0 Likes
1,533

Hi

Here is the code to find out the open purchase order.

List of open purchase orders for a given plant/delivery period *

  • A purchase order is open when the delivery completed indicator = ' '*(field elikz.ekpo = space)

  • Tables

TABLES: EKKO, "Purchase order - header"

EKPO, "Purchase order - lines"

EKET, "Purchase order - delivery date"

EKBE, "Purchase order - history

LFA1, "Supplier - general info"

STXH, "Text table - header info"

T001W, "Plant description table

MARA, "Material master

MAKT, "Material description table

T163X.

DATA: BEGIN OF TXTF_HEADER. "Purchase order header texts

INCLUDE STRUCTURE THEAD.

DATA: END OF TXTF_HEADER.

DATA: BEGIN OF TXTF_LINES OCCURS 2. "Purchase order header texts

INCLUDE STRUCTURE TLINE.

DATA: END OF TXTF_LINES.

DATA: WNAME(70),

WLPEIN(1),

WEINDT(10),

WMENGE LIKE EKET-MENGE,

WBISMT LIKE MARA-BISMT,

W_HISTORY(1).

SELECT-OPTIONS : S-EINDT FOR EKET-EINDT.

SELECT-OPTIONS : S-WAERS FOR EKKO-WAERS.

FIELD-GROUPS : HEADER, GROUP1.

INSERT EKPO-WERKS

EKET-LPEIN

EKET-EINDT

EKPO-EBELN

EKPO-EBELP

EKPO-MATNR

EKKO-WAERS

EKKO-WKURS

EKKO-KUFIX

EKKO-BEDAT INTO HEADER.

INSERT EKKO-SPRAS

EKKO-EKGRP

T163X-EPSTP

EKPO-TXZ01

EKPO-KONNR

EKPO-KTPNR

EKET-MENGE

EKPO-MEINS

EKPO-LGORT

EKET-WEMNG

EKPO-NETPR

EKPO-PEINH

EKPO-BPRME

EKPO-NETWR

EKKO-LIFNR

W_HISTORY INTO GROUP1.

  • General data

INITIALIZATION.

  • EM_SELKB = 'X'.

  • EM_SELKK = ' '.

  • EM_SELKL = ' '.

  • EM_SELKA = ' '.

  • Start of program

START-OF-SELECTION.

  • Read purchase order items for this plant with delivery completed

  • indicator = space

GET EKPO.

SELECT * FROM T163X WHERE SPRAS EQ SY-LANGU

AND PSTYP EQ EKPO-PSTYP.

EXIT.

ENDSELECT.

IF SY-SUBRC NE 0.

T163X-EPSTP = EKPO-PSTYP.

ENDIF.

CHECK S-WAERS.

GET EKET.

CHECK S-EINDT.

IF EKPO-ELIKZ = ' ' AND EKPO-LOEKZ = ' '.

  • if eket-wemng = 0 and eket-wamng = 0.

CLEAR : W_HISTORY.

SELECT * FROM EKBE WHERE EBELN = EKPO-EBELN

AND EBELP = EKPO-EBELP.

EXIT.

ENDSELECT.

IF SY-SUBRC = 0.

MOVE '*' TO W_HISTORY.

ENDIF.

EXTRACT GROUP1.

  • endif.

ENDIF.

END-OF-SELECTION.

  • Sort by plant - delivery date

SORT.

FORMAT INTENSIFIED OFF. "PPL26041995

LOOP.

      • read vendor

SELECT SINGLE * FROM LFA1

WHERE LIFNR = EKKO-LIFNR.

IF SY-SUBRC <> 0.

MOVE '???' TO LFA1-NAME1.

ENDIF.

      • search old materialnumber if needed

SELECT SINGLE * FROM MARA

WHERE MATNR = EKPO-MATNR.

IF SY-SUBRC <> 0.

MOVE '???' TO WBISMT.

ELSE.

MOVE MARA-BISMT TO WBISMT.

ENDIF.

      • read purchase order header text - first 2 lines of delivery text

CLEAR TXTF_LINES.

CLEAR TXTF_HEADER.

REFRESH TXTF_LINES.

MOVE EKPO-EBELN TO WNAME.

MOVE EKPO-EBELP TO WNAME+10.

SELECT SINGLE * FROM STXH

WHERE TDID = 'F04' AND

TDOBJECT = 'EKPO' AND

TDNAME = WNAME AND

TDSPRAS = EKKO-SPRAS.

IF SY-SUBRC = 0.

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = 'F04 '

LANGUAGE = EKKO-SPRAS

OBJECT = 'EKPO '

NAME = WNAME

IMPORTING

HEADER = TXTF_HEADER

TABLES

LINES = TXTF_LINES

EXCEPTIONS

ID = 01

LANGUAGE = 02

NAME = 03

NOT_FOUND = 04

OBJECT = 05

REFERENCE_CHECK = 06.

ENDIF.

READ TABLE TXTF_LINES INDEX 1.

      • print list

RESERVE 3 LINES.

AT NEW EKPO-WERKS.

SELECT SINGLE * FROM T001W WHERE WERKS = EKPO-WERKS.

IF SY-SUBRC NE 0. CLEAR T001W. ENDIF.

NEW-PAGE.

ENDAT.

CLEAR WEINDT.

CLEAR WLPEIN.

AT NEW EKET-EINDT.

CALL FUNCTION 'PERIOD_AND_DATE_CONVERT_OUTPUT'

EXPORTING

INTERNAL_DATE = EKET-EINDT

INTERNAL_PERIOD = EKET-LPEIN

IMPORTING

EXTERNAL_DATE = WEINDT

EXTERNAL_PERIOD = WLPEIN.

ENDAT.

WRITE: / WLPEIN,

3 WEINDT,

13 SY-VLINE(1),

14 EKPO-EBELN,

25 EKPO-EBELP+3(2),

28 T163X-EPSTP,

31 EKPO-MATNR,

  • add old material number

  • 52 wbismt,

62 EKET-MENGE,

80 EKPO-MEINS,

85 EKKO-LIFNR,

116 SY-VLINE(1),

  • 127 txtf_lines-tdline(40),

118 EKKO-WAERS,

122 EKPO-NETPR,

142 EKPO-PEINH,

152 EKPO-BPRME,

157 EKPO-NETWR,

177 EKKO-WKURS,

190 EKKO-KUFIX,

193 EKKO-BEDAT,

206 EKKO-EKGRP,

211 SY-VLINE,

216 W_HISTORY.

  • add storage location

  • 171 sy-vline, ekpo-lgort,

  • 178 sy-vline.

READ TABLE TXTF_LINES INDEX 2.

SELECT SINGLE * FROM MAKT WHERE MATNR = EKPO-MATNR

AND SPRAS = SY-LANGU.

IF SY-SUBRC NE 0.

MOVE EKPO-TXZ01 TO MAKT-MAKTX.

ENDIF.

WMENGE = EKET-MENGE - EKET-WEMNG.

IF EKPO-KONNR = SPACE.

WRITE:/13 SY-VLINE(1),

MAKT-MAKTX(30) UNDER EKPO-MATNR,

WMENGE UNDER EKET-MENGE,

LFA1-NAME1 UNDER EKKO-LIFNR,

  • 126 sy-vline(1),

  • txtf_lines-tdline(40) under txtf_lines-tdline,

116 SY-VLINE(1),

  • 171 sy-vline(1),

211 SY-VLINE(1).

ELSE.

WRITE:/13 SY-VLINE(1),

  • ekpo-konnr under ekpo-ebeln,

  • ekpo-ktpnr+3(2) under ekpo-ebelp,

MAKT-MAKTX(30) UNDER EKPO-MATNR,

WMENGE UNDER EKET-MENGE,

LFA1-NAME1 UNDER EKKO-LIFNR,

  • 126 sy-vline(1),

  • txtf_lines-tdline(40) under txtf_lines-tdline,

  • 167 sy-vline(1),

116 SY-VLINE(1),

211 SY-VLINE(1).

ENDIF.

ULINE /13(207).

AT END OF EKET-EINDT.

ULINE 1(12).

ENDAT.

ENDLOOP.

*

  • print delivery date with first line.

TOP-OF-PAGE.

CALL FUNCTION 'PERIOD_AND_DATE_CONVERT_OUTPUT'

EXPORTING

INTERNAL_DATE = EKET-EINDT

INTERNAL_PERIOD = EKET-LPEIN

IMPORTING

EXTERNAL_DATE = WEINDT

EXTERNAL_PERIOD = WLPEIN.

  • CALL FUNCTION 'Z_PRINT_TITEL' "PPL24041995

  • EXPORTING PROGNAME = 'ZMCH0089' "PPL24041995

  • TEXTTYPE = 'T' "PPL24041995

  • ORG_PROGNAME = ' '

  • PARAM_1 = EKPO-WERKS "PPL24041995

  • PARAM_2 = T001W-NAME2 "PPL24041995

  • PARAM_3 = ' ' "PPL24041995

  • PARAM_4 = ' ' "PPL24041995

  • PARAM_5 = ' '. "PPL24041995

Reward if helpful.

Chandralekha

Read only

Former Member
0 Likes
1,533

hi,

You need to refer EKBE table.

If the PO is open i.e. no GR OR IR then this table will not have any entry in EKBE.

If any further processing is done then EKBE will have entries.

In EKBE table please refer VGABE Field.

Status of the PO line item is mentioned there as given below.

1 Goods Receipt

2 Invoice Receipt

3 Subseq. Debit/Credit

4 Down Payment

5 Payment

6 Goods Issue for Stock Transfer

7 Consumption (Subcontracting)

8 Delivery (Stock Transfer)

9 Service Entry Sheet

A Down Payment Request

C Down Payment Clearing

Q Comparison for Internally Posted Material (Only IS-OIL)

R Return Delivery via Delivery Note

P Invoice Parking

V Down Payment Request Clearing

Hope this answers your query.

regards,

Anand

Read only

0 Likes
1,533
Hope this answers your query.

Good.

But why after 60 days?

PS:pls do not update thread Unnecessary