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

Determine dates

Former Member
0 Likes
813

I apologize if this sounds confusing but I will try my best at explaining my question. I have a structure z45days that will hold shipped quantities for a material for 45 consecutive days. I have a select-options defined to input the date range (s_budat). I need to take the low (s_budat-low) and high (s_budat-high) and reduce each date to a single integer, which will correspond to a row in the structure. I will then need to translate a table index (row number) back to a date that will be in the date range (it will end up being the highest shipping day). Can anybody help me determine the best way to do this?

Regards,

Davis

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
774

Try:


REPORT ztest MESSAGE-ID 00.

TABLES bkpf.

SELECT-OPTIONS: date FOR bkpf-budat OBLIGATORY.

DATA: low_int TYPE i,
      high_int TYPE i.

low_int  = '00000000' + date-low.
high_int = '00000000' + date-high.

WRITE: /001 date-low, low_int,
       /001 date-high, high_int.

Rob

7 REPLIES 7
Read only

Former Member
0 Likes
775

Try:


REPORT ztest MESSAGE-ID 00.

TABLES bkpf.

SELECT-OPTIONS: date FOR bkpf-budat OBLIGATORY.

DATA: low_int TYPE i,
      high_int TYPE i.

low_int  = '00000000' + date-low.
high_int = '00000000' + date-high.

WRITE: /001 date-low, low_int,
       /001 date-high, high_int.

Rob

Read only

0 Likes
774

Rob, thanks for the reply. I am playing with the code you posted to see if I can work with that. Thanks again!

Regards,

Aaron

Read only

0 Likes
774

I started with '00000000', but you can use a different date. You can also subtract an earlier arbitrary date from these dates. But my code should work in all cases.

Rob

Read only

0 Likes
774

Rob, thanks for the replies. I played around with what you posted and I got it to do exactly what I needed. I was also wondering how you make a parameter required and your code showed me that as well. Thanks again!

Regards,

Davis

Read only

0 Likes
774

There is also a function module SELECT_OPTIONS_RESTRICT that you can use to restrict the select-options. I assume you need exactly one low and one high date with no ranges. This FM should help. It's not simple to use, but it's well documented.

Rob

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
774

This does sound confusing... First of all, <b>structures</b> do not have rows (structure is basically just a group of fields), you must be confusing it with a<b> table</b>. Second, why do you need to convert the date into integer? And I din't get the whole thing about the relation between the range and the rows at all. What on earth are you trying to do?

You can move the fields of type C into type I simply by using MOVE or '='. The row number is usually stored in sy-tabix field when you are reading the table.

Read only

0 Likes
774

I apologize, I see this structure as a table (yes I know they are different) so when I said row I mean field because the structure is 45 fields all of the same type (1 for each day). I need to convert the date to an integer so I can determine what field the quantity needs to be stored in. I am determining the RLT (replenishment lead time) for each SKU. They will input a date range (among other things) and I need to determine which date corresponds with which field in the structure.

Regards,

Aaron