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

Finding Open POs

sashi_manthena
Discoverer
0 Likes
3,752

Hi ,

To get Open POs, I have used ME2N. Which is giving the data I required. My requirement is to write a pipe delimited file onto Application server. To do it I used the statement SUBMIT ... EXPORT TO MEMORY ... RETURN . Only problem with this is not able to load the result data into my internal table.

I don't find any proper code to find OPEN POs in this fourm. Does anyone have code for this?

Thank you,

Sasi Manthena

6 REPLIES 6
Read only

former_member156446
Active Contributor
0 Likes
3,604

Try this example:

     Submit the report ROIADELSTA and export output list to memory


      SUBMIT roiadelsta WITH SELECTION-TABLE

      t_select_tab EXPORTING LIST TO MEMORY

                                     AND RETURN.

Read only

Former Member
0 Likes
3,604

Hi Sashi,

To find out the open POs you can use the table EKET, checking the schedule quantity and the Quantity of Goods Received, fields MENGE and WEMNG, respectively. But this rule only is not enough. You have to consider other things like: PO itens blocked/deleted (EKPO-LOEKZ) , PO released (EKKO-FRGKE) (check if needed), etc.

There is also the field EKPO-EREKZ (Final Invoice Indicator) .

You can also check the post http://scn.sap.com/thread/218844

Read only

iftah_peretz
Active Contributor
0 Likes
3,604

Hi Sashi,

This will work, textlines will contain the list:

Submit  RM06EN00 AND RETURN EXPORTING LIST TO MEMORY
     WITH EN_EBELN-LOW = '115669'
     WITH LISTU = 'BEST'.
check sy-subrc eq 0.
DATA: ABAPLIST LIKE ABAPLIST OCCURS 0.
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
  LISTOBJECT = ABAPLIST
  EXCEPTIONS
  NOT_FOUND = 1
  OTHERS = 2.
DATA textlines(1024) TYPE C OCCURS 0 WITH HEADER LINE.
call function 'LIST_TO_ASCI'
  tables
  listobject = ABAPLIST
  listasci = textlines
  exceptions
  empty_list = 1
  list_index_invalid = 2
  others = 3.

See these links for more info:

<link to blocked site removed by moderator>

http://saplab.blogspot.co.il/2007/10/sample-abap-program-to-export-list-to_18.html

Let know how that worked for you,

Best,

Iftah

Message was edited by: Thomas Zloch

Read only

0 Likes
3,604
Hi Sashi Manthena ,

I done related to Open PO LisT with out using standard.

Please Check Below Code :

    SELECT ebeln bedat
    FROM ekko
    INTO TABLE i_ekko
   WHERE bstyp = 'F'
     AND bsart IN ('EL' ,'ER')
     AND lifnr IN s_lifnr.

  sort i_ekko by ebeln.


  IF i_ekko[] IS NOT INITIAL.

      SELECT ebeln ebelp matnr werks infnr mtart menge
        INTO CORRESPONDING FIELDS OF TABLE i_order
        FROM ekpo
         FOR ALL ENTRIES IN i_ekko
       WHERE ebeln = i_ekko-ebeln
         AND werks in s_werks
         AND loekz = ' '
         AND elikz <> 'X'
         AND mtart = 'PART'.

ENDIF.

Regards,

S.Chandrakumar

Read only

0 Likes
3,604

I tried using

call function 'LIST_TO_ASCI'

  tables

  listobject = ABAPLIST

  listasci = textlines

  exceptions

  empty_list = 1

  list_index_invalid = 2

  others = 3.

This does not help me as I can not get the required data from the 'textlines' table to my internal table. The row data for 'textlines' is a character string and some data like list header need to be removed.

My requirement is to write a pipe delimited file to the Application Server. The data type that need to be in the file is :

types : begin of ty_output

       ,   pur_name  type ernam

       ,   leg_entiry  type bukrs

       ,   po_num  type ebeln

       ,   currency  type waers

       ,   status_po type char20

       ,   vendor_id type elifn

       ,   taxcode type mwskz

       , end of ty_output

       .

select statement used is :

select a~ernam a~bukrs

          a~ebeln a~waers

          a~statu a~lifnr

          b~mwskz

     into table lt_output

          from ekko as a

     inner join ekpo as b on a~ebeln = b~ebeln

          where a~ebeln in s_ebeln and

             a~ekorg in s_ekorg and

             a~bsart in s_bsart and

             a~aedat in s_aedat and

             a~bstyp eq 'F'     and

             a~loekz eq space   and

             a~frgrl eq space   and

             b~loekz eq space   and

             b~elikz eq space

.

   sort lt_output.

   delete adjacent duplicates from lt_output.



Read only

0 Likes
3,604

I am able to match the data with ME2N by modifying the above query with the following. Its working fine.

SELECT a~ernam a~bukrs

          a~ebeln a~waers

          a~statu a~lifnr

          b~mwskz

     INTO TABLE lt_output

          FROM ekko AS a

     INNER JOIN ekpo AS b ON a~ebeln = b~ebeln

     INNER JOIN eket AS c ON b~ebeln = c~ebeln AND

                             b~ebelp = c~ebelp

          WHERE a~ebeln IN s_ebeln AND "pur. doc.

                a~ekorg IN s_ekorg AND  "pur. org.

                a~bsart IN s_bsart AND  "document type

                a~aedat IN s_aedat AND  "created on

                a~bstyp EQ 'F'     AND  "doc. category

                a~loekz EQ space   AND  "delition indicator

*               a~frgrl EQ space   AND  "subj. to release

                b~loekz EQ space   AND  "deletion indicator

                b~elikz EQ space   AND  "delivery complete

                ( ( b~eglkz EQ 'X' AND  "final delivery

                    c~wamng NE space ) OR "

                  b~repos = 'X' )       "invoice receipt

             .