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: 

Date Processing for Select-Option

former_member367551
Participant
0 Kudos

Dear forumers,

I have a select-option element that takes in a range of PO Date.

The SELECT statement is as follows:-


select ebeln
       bedat
       ekorg
       ekgrp
       bukrs
from ekko
into corresponding fields of table gt_ekko
where bedat in s_p_date and   " s_p_date is a select-option for bedat
      ekorg in s_p_org and
      ekgrp in s_p_grp.

If valid low and high dates are inputted here, then there will be data correctly retrieved into the internal table gt_ekko.

However, if the low and high dates are equal, then there will be no data retrieved into the internal table gt_ekko at all.

How can I correct this? Please help. Thanks.

Additionally, is there an easier way to display this PO date (results) in an ALV list as the dd.mm.yyyy format instead of the yyyymmdd format?

8 REPLIES 8

Former Member
0 Kudos

hi

use select-options with no interval in the syntax

0 Kudos

Janagar,

I need to have my select-option, s_p_date with an interval (it's part of my requirements).


types:
begin of gs_so_input,
  bedat type ekko-bedat,      " PO Document Date
  eindt type eket-eindt,      " Item Delivery Date
  lifnr type lfa1-lifnr,      " Vendor Number
  matnr type ekbe-matnr,      " Material Number
  ekorg type ekko-ekorg,      " Purchasing Organisation
  ekgrp type ekko-ekgrp,      " Purchasing Group
end of gs_so_input.

data:
gs_input type gs_so_input.

select-options:
s_p_date for gs_input-bedat obligatory,
s_d_date for gs_input-eindt,
s_v_num for gs_input-lifnr,
s_m_num for gs_input-matnr,
s_p_org for gs_input-ekorg,
s_p_grp for gs_input-ekgrp.

0 Kudos

The date processing issue was already resolved by retrieving the necessary data correctly from multiple tables in a correct way / order.

Also, the date formatting issue was resolved by further lengthening the OUTPUTLEN of the field catalog for BEDAT (OUTPUTLEN here is more than 8).

Former Member
0 Kudos

Check the below link, as my answer to your secan question.

Regards,

Murthy.

GauthamV
Active Contributor
0 Kudos

hi,

check whether you have any po created in that particular date, because you donot have problem giving same date in low and high option.

for other option use this code.


if it_exit_new-begda = 0.
it_exit_new-begda = ' '.
else.
write it_exit-begda to it_exit_new-begda dd/mm/yyyy .
endif.

Former Member
0 Kudos

Hi,

select ebeln

bedat

ekorg

ekgrp

bukrs

from ekko

into corresponding fields of table gt_ekko

where bedat >= s_p_date-low and

bedat <= s_p_date-high and

ekorg in s_p_org and

ekgrp in s_p_grp.

For display in dd.mm.yyyy format...

suppose date is itab-bedat..

concatenate itab-bedat6(2) itab-bedat4(2) itab-bedat+0(4) into itab-bedat.

display itab-bedat.

Thanks,

Former Member
0 Kudos

Hi,

I dont see any problem in your code.

I hope you have declared the select option as :


select-options s_p_date  for ekko-bedat. 

For :

Additionally, is there an easier way to display this PO date (results) in an ALV list as the dd.mm.yyyy format instead of the yyyymmdd format?

have you declared the bedat as ekko-bedat in the ouput table ? Then you won't need nay conversion.

regards,

Advait

Former Member
0 Kudos

Hi

- A) "However, if the low and high dates are equal, then there will be no data retrieved into the internal table gt_ekko at all": what do you really mean?

If the value of low and high is the same it means it needs to search the data for the only one date: if any data will be returned, it means there no data for that date.

- B) "Additionally, is there an easier way to display this PO date (results) in an ALV list as the dd.mm.yyyy format instead of the yyyymmdd format?" Use an internal table for the output where the field for date is type SY-DATUM.

Max