我目前正在为ABAP语言编写一个生成器,而我正面临一个问题。 在我必须转换的服务中,我有以下对象:
"router_options": {
"track": true,
"motorway": true,
"toll": true,
"trailers": 0,
"weight": 0,
"weight_per_axle": 0,
"height": 0,
"width": 0,
"length": 0,
"hazardous_goods": "explosive",
"max_walk_distance": 0,
"approach": "unrestricted",
"snap": 0,
"strict_restriction": true
}
当我执行codegen生成器时,生成的代码给出了以下代码
i_router_options_track type bool optional
i_router_options_motorway type bool optional
i_router_options_toll type bool optional
i_router_options_trailers type int optional
i_router_options_weight type float optional
i_router_options_weight_per_axle type float optional
i_router_options_height type float optional
i_router_options_width type float optional
i_router_options_length type float optional
i_router_options_hazardous_goods type string optional
i_router_options_max_walk_distance type float optional
这种方法更类似于在操作部件中声明一种类型的结构
types : begin of ts_router_options,
track type bool,
motorway type bool,
toll type bool,
trailers type int,
weight type float,
weight_per_axle type float,
height type float,
width type float,
length type float,
hazardous_goods type string,
max_walk_distance type float,
approach type string,
snap type float,
strict_restriction type bool,
end of ts_router_options.
并使用如下:
data : router_options type ts_router_options.
router_options-height = '10,10'
有人可以帮助我吗?