这篇文章主要讲解了“怎么使用ABAP代码返回Attachment”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么使用ABAP代码返回Attachment”吧!
在事务码 MM02里为ID为16的material维护附件:
如何使用ABAP代码获得如下附件的名称和文件内容?
REPORT zgos_api. DATA ls_appl_object TYPE gos_s_obj. DATA lo_gos_api TYPE REF TO cl_gos_api. DATA lt_attachment_list TYPE gos_t_atta. DATA lt_role_filter TYPE gos_t_rol. DATA ls_attachment TYPE gos_s_atta. DATA ls_attachm_cont TYPE gos_s_attcont. DATA ls_atta_key TYPE gos_s_attkey. DATA: lv_id TYPE matnr VALUE '16', lt_att TYPE TABLE OF sibflporb. CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' EXPORTING input = lv_id IMPORTING output = lv_id. ls_appl_object-typeid = 'BUS1001006'. ls_appl_object-instid = lv_id. ls_appl_object-catid = 'BO'. START-OF-SELECTION. TRY. lo_gos_api = cl_gos_api=>create_instance( ls_appl_object ). APPEND cl_gos_api=>c_attachment TO lt_role_filter. lt_attachment_list = lo_gos_api->get_atta_list( lt_role_filter ). CATCH cx_gos_api INTO DATA(error). WRITE:/ error->get_text( ). RETURN. ENDTRY. DATA: ls_key TYPE gos_s_attkey. LOOP AT lt_attachment_list ASSIGNING FIELD-SYMBOL(<id>). ls_key-atta_id = <id>-atta_id. ls_key-atta_cat = <id>-atta_cat. DATA(ls) = lo_gos_api->get_al_item( ls_key ). ENDLOOP.
执行结果:
感谢各位的阅读,以上就是“怎么使用ABAP代码返回Attachment”的内容了,经过本文的学习后,相信大家对怎么使用ABAP代码返回Attachment这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。