Code: Alles auswählen.
CONSTANTS: "c_botype TYPE borident-objtype VALUE 'BUS2013', "'BUS2012',
c_reltyp TYPE breltyp-reltype VALUE 'ATTA'.
DATA: lv_botype TYPE borident-objtype." VALUE 'BUS2012'.
DATA: lo_is_object_a TYPE sibflporb,
lt_links TYPE obl_t_link,
ls_links TYPE LINE OF obl_t_link.
DATA: lt_rel TYPE obl_t_relt,
wa_rel LIKE LINE OF lt_rel.
DATA: lv_docid TYPE sofolenti1-doc_id,
ls_docdata TYPE sofolenti1,
lt_objcontent TYPE TABLE OF solisti1 WITH HEADER LINE.
CASE nast-kappl.
WHEN 'EL'.
"Bei Lieferplänen ander BUS!
lv_botype = 'BUS2013'.
WHEN 'EA'.
"Bei Anfragen ebenfalls
lv_botype = 'BUS2010'.
WHEN OTHERS.
lv_botype = 'BUS2012'.
ENDCASE.
wa_rel-sign = 'I'.
wa_rel-option = 'EQ'.
wa_rel-low = c_reltyp.
APPEND wa_rel TO lt_rel.
lo_is_object_a-instid = nast-objky.
lo_is_object_a-typeid = lv_botype.
lo_is_object_a-catid = 'BO'.
* Anhang besorgen
TRY.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = lo_is_object_a
it_relation_options = lt_rel
IMPORTING
et_links = lt_links.
CATCH cx_root .
gv_subrc = 1.
ENDTRY.
LOOP AT lt_links INTO ls_links.
lv_docid = ls_links-instid_b.
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_docid
IMPORTING
document_data = ls_docdata
TABLES
object_content = lt_objcontent
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
IF sy-subrc = 0.
it_anhang-doc_type = ls_docdata-obj_type.
it_anhang-subject = ls_docdata-obj_descr.
it_anhang-filename = ls_docdata-obj_descr.
it_anhang-docsize = ls_docdata-doc_size. "( tlines - 1 ) * 255 + STRLEN( object_content ). "document_data-doc_size.
it_anhang-objtp = ls_docdata-obj_type.
"it_anhang-objyr
"it_anhang-objno
APPEND LINES OF lt_objcontent TO it_anhang-cont_text.
"APPEND LINES OF object_content TO it_anhang-cont_hex.
APPEND it_anhang.
ENDIF.
ENDLOOP.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Thomas17
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Thomas17