我的朋友似乎在使用ABAP时遇到了麻烦。这是他的问题的副本 - 发布在SAP社区论坛上。
节点:标记
我在类别属性中填充了两个类别:e_category-three
和e_category-four
。我在Date属性中填入了日期。我希望其中一些日期属于第三类,其他类别为第四类。
目前,所有日期都设置为第一个类别(e_category-three
),代码如下所示。
if ls_host_name-host_name <> host_msg and ls_vm_name-vm_name = vm_msg.
loop at lt_machine_booking into wa.
if ls_host_name-host_name = wa-host_name.
date = wa-reserved_from.
while date <= wa-reserved_till.
ls_dates_shared-dates = date. > i want these dates to be e_category-three
append ls_dates_shared to lt_dates_shared.
add 1 to date.
ENDWHILE.
endif.
ENDLOOP.
elseif ls_host_name-host_name <> host_msg and ls_vm_name-vm_name <> vm_msg.
loop at lt_machine_booking into wa.
if ls_host_name-host_name = wa-host_name and ls_vm_name-vm_name = wa-vm_name.
date = wa-reserved_from.
while date <= wa-reserved_till.
ls_dates_shared = date. > i want these dates to be e_category-four
append ls_dates_shared to lt_dates_shared.
add 1 to date.
ENDWHILE.
endif.
" ...
答案 0 :(得分:2)
我假设ls_dates_shared
是标记类型?
如果是这种情况,您必须明确填写ls_dates_shared-category
和ls_dates_shared-tooltip
字段。
目前,这可能会在您提供给我们的代码段之前填充。尝试这样的事情:
if ls_host_name-host_name <> host_msg and ls_vm_name-vm_name = vm_msg.
loop at lt_machine_booking into wa.
if ls_host_name-host_name = wa-host_name.
date = wa-reserved_from.
while date <= wa-reserved_till.
ls_dates_shared-dates = date. "i want these dates to be e_category-three"
ls_dates_shared-category = e_category-three.
"ls_dates-tooltip = appropriate_tooltip for e_category-three"
append ls_dates_shared to lt_dates_shared.
add 1 to date.
ENDWHILE.
endif.
ENDLOOP.
elseif ls_host_name-host_name <> host_msg and ls_vm_name-vm_name <> vm_msg.
loop at lt_machine_booking into wa.
if ls_host_name-host_name = wa-host_name and ls_vm_name-vm_name = wa-vm_name.
date = wa-reserved_from.
while date <= wa-reserved_till.
ls_dates_shared = date. "i want these dates to be e_category-four"
ls_dates_shared-category = e_category-four.
"ls_dates-tooltip = appropriate_tooltip for e_category-four"
append ls_dates_shared to lt_dates_shared.
add 1 to date.
ENDWHILE.
endif.
...