2007 Feb 22 3:42 PM
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
2007 Feb 22 3:56 PM
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
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
2007 Feb 22 3:56 PM
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
2007 Feb 22 4:06 PM
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
2007 Feb 22 4:10 PM
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
2007 Feb 22 4:12 PM
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
2007 Feb 22 4:23 PM
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
2007 Feb 22 4:00 PM
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.
2007 Feb 22 4:05 PM
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
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |