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: 

PO's for + - 7 days

Former Member
0 Kudos
115

Hi All,

Can anyone please guide how do i get the PO's(EKKO-EBELN ) within + - 7 days from a particular date.(Input), Your help is highly appreciated

Cheers,

Smith

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos
88

Check this:

TABLES: ekko.
PARAMETER: p_date TYPE d.

SELECT-OPTIONS: s_date FOR ekko-aedat NO INTERVALS NO-EXTENSION.

INITIALIZATION.

  CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
      date      = p_date
      days      = '7'
      signum    = '-'
    IMPORTING
      calc_date = p_date.

  w_date-sign = 'I'.
  w_date-option = 'EQ'.
  w_date-low = p_date .

  CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
      date      = p_date
      days      = '7'
      signum    = '+'
    IMPORTING
      calc_date = p_date.
  w_date-high = p_date .
  APPEND w_date TO s_date.

  SELECT * FROM ekko
    WHERE aedat IN s_date.

5 REPLIES 5

Former Member
0 Kudos
88

Hi,

Try these codes:

Parameters: P_date type sy-datum.

RANGES:
S_DATE FOR <DATE>.

AT SELECTION-SCREEN.
S_date-low = p_date - 7.

S_date-high = p_date + 7.

If S_date-high > sy-datum.
S_date-high = sy-datum.
endif.

S_date-option = 'EQ'.
S_date-sign = 'I'.
Append S_DATE.

USE the S_DATE in SELECT QUERY.

EX: SELECT PO FROM <DB> into itab where date in s_date

Regards,

Gurpreet

former_member156446
Active Contributor
0 Kudos
89

Check this:

TABLES: ekko.
PARAMETER: p_date TYPE d.

SELECT-OPTIONS: s_date FOR ekko-aedat NO INTERVALS NO-EXTENSION.

INITIALIZATION.

  CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
      date      = p_date
      days      = '7'
      signum    = '-'
    IMPORTING
      calc_date = p_date.

  w_date-sign = 'I'.
  w_date-option = 'EQ'.
  w_date-low = p_date .

  CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
      date      = p_date
      days      = '7'
      signum    = '+'
    IMPORTING
      calc_date = p_date.
  w_date-high = p_date .
  APPEND w_date TO s_date.

  SELECT * FROM ekko
    WHERE aedat IN s_date.

Former Member
0 Kudos
88

Hi GP & J@Y,

Thanks for your quick replies.

Cheers,

Smith

Former Member
0 Kudos
88

Hi GP & J@Y,

Apologies for opening this again,

I'm creating a BAPI with the input feild as date,i_date(to be checked in EKKO) and the output the list of PO numbers , which has to be checked against EKPO-WERKS = 1234. and only send the final output the list of po numbers(from EKPO-EBELN), Can you please help me to write code for this.

Your help is highly appreciated.

Cheers,

Smith

0 Kudos
88

creating a BAPI to list all the PO's that too much to imagine....

select a~ebeln 
        from ekko 
        join ekpo 
on ekko~ebeln = ekpo~ebeln
     into table itab_ek          
      where ekko~AEDAT in s_date "the way we told before...
         and  ekpo~werks = '1234'.