SAP Cloud for Customer Cloud(C4C)Application Studio里的代码调试

举报
Jerry Wang 发表于 2022/05/14 20:31:13 2022/05/14
【摘要】 和其他IDE使用方式一样,首先在需要设置断点的代码行数前面双击,设置断点:使用菜单Debug->Start Debugging,切换成调试模式:看到Show output from:Debug里,显示了提示信息:Debugger has been started for user WANGJERRY1:之后,一旦使用该user在UI上操作,只要该UI操作会触发我们设置断点的ABAP scri...

和其他IDE使用方式一样,首先在需要设置断点的代码行数前面双击,设置断点:

使用菜单Debug->Start Debugging,切换成调试模式:

看到Show output from:Debug里,显示了提示信息:

Debugger has been started for user WANGJERRY1:

之后,一旦使用该user在UI上操作,只要该UI操作会触发我们设置断点的ABAP script 文件的执行,则断点会自动触发:

可以和其他IDE一样,使用Cloud Application Studio提供的调试工具,比如查看变量值,查看callstack,Step Out,Step Over等等。

需求

https://stackoverflow.com/questions/59950572/how-to-access-the-current-categorydata-in-a-category-page

实现原理

AFAIK, currently we do not have anything similar to CurrentProductService for current category.

当前 SAP Spartacus 标准实现里,缺乏类似 CurrentProductService 对产品明细页面那样的支持。

Looking at the implementation of CurrentProductService you can see that it is using RoutingService and it’s getRouterState() method (picture 1).

研究 CurrentProductService 的实现代码,发现其实现原理是,首先利用 RoutingService,从 RouterState 中拿到当前页面的产品code,然后使用另一个API,productService, 来读取产品的明细数据。

You can create something similar for current category, because the router state consists of category informations (as seen below on picture 2).

因此我们可以采取类似的思路,从 category 页面的State里,提取出category明细信息:

  • categoryCode
  • param0, param1, param2

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。