cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create/Insert - Text Type/Notes in Freight Order with Content from ABAP Code in S4 HANA -TM

suhel_sheikh
Explorer
0 Kudos

Hi All,

I am working on S/4 HANA Embedded TM system and my client requirement is to update the Seal Number and Driver Name in Freight Order manually from ABAP code using RFC which will be triggered from SAP MII system.

For this Functional Consultant already configured the Text Type which will be at Root/Header Level.

From ABAP side I need to 1st Insert the Text Type in Freight Order and then Update the Content in Text Type .

still i havnt found any solution.

so please let me know if any Class/Method can be use to do the same or share me the documents if available .

Regards,

Suhel Sheikh

View Entire Topic
suhel_sheikh
Explorer

Hi Aditya,

PFB/attached the sample code.

GT_MOD will contain the actual entry to be use with Modify Method of service manager.

IM_KEY will be the FO/FB root key,im_text_content will content the actual content for text type and im_text_type will be Text Type like SEAL or DRI or etc

Regards,

Suhel Sheikh

*- Local Data Declarations
DATA:
lr_txc_root TYPE REF TO /bobf/s_txc_root_k,
lr_txc_text TYPE REF TO /bobf/s_txc_txt_k,
lr_txc_cont TYPE REF TO /bobf/s_txc_con_k,
lwa_txc_key_mapping TYPE /scmtms/cl_common_helper=>ty_txc_key_mapping,
lv_source_node TYPE /bobf/obm_node_key,
lv_association TYPE /bobf/obm_assoc_key.
*- Local Feild Symbol
FIELD-SYMBOLS:
<lwa_mod> TYPE /bobf/s_frw_modification.
*- Instantiating the Class
DATA(lo_helper) = NEW /scmtms/cl_tor_helper_text_col( ).
*- Get DO key mapping for input node
lo_helper->get_txc_key_mapping(
EXPORTING
iv_node = /scmtms/if_tor_c=>sc_node-textcollection
IMPORTING
es_txc_key_mapping = lwa_txc_key_mapping ).
*- Root textcollection
lv_source_node = /scmtms/if_tor_c=>sc_node-root.
lv_association = /scmtms/if_tor_c=>sc_association-root-textcollection.

*- Create new DO instance
CREATE DATA lr_txc_root.
APPEND INITIAL LINE TO gt_mod ASSIGNING <lwa_mod>.

lr_txc_root->key = go_srvmgr_tor->get_new_key( ).
lr_txc_root->parent_key = im_key.
<lwa_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
<lwa_mod>-association = lv_association.
<lwa_mod>-source_node = lv_source_node.
<lwa_mod>-node = /scmtms/if_tor_c=>sc_node-textcollection.
<lwa_mod>-source_key = im_key.
<lwa_mod>-key = lr_txc_root->key.
<lwa_mod>-data = lr_txc_root.

*- Create text item
CREATE DATA lr_txc_text.
APPEND INITIAL LINE TO gt_mod ASSIGNING <lwa_mod>.

lr_txc_text->key = go_srvmgr_tor->get_new_key( ).
lr_txc_text->parent_key = lr_txc_root->key.
lr_txc_text->text_type = im_text_type.
lr_txc_text->language_code = sy-langu.
lr_txc_text->internal_ind = abap_true.
lr_txc_text->datetime_cr = sy-datum && sy-uzeit.
lr_txc_text->user_id_cr = sy-uname.
lr_txc_text->datetime_ch = sy-datum && sy-uzeit.
lr_txc_text->user_id_ch = sy-uname.

<lwa_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
<lwa_mod>-association = lwa_txc_key_mapping-text_asc.
<lwa_mod>-source_node = lwa_txc_key_mapping-root_key.
<lwa_mod>-node = lwa_txc_key_mapping-text_key.
<lwa_mod>-source_key = lr_txc_root->key.
<lwa_mod>-key = lr_txc_text->key.
<lwa_mod>-data = lr_txc_text.

*- Create text item content with 1:1 relationship to text item
CREATE DATA lr_txc_cont.
APPEND INITIAL LINE TO gt_mod ASSIGNING <lwa_mod>.

lr_txc_cont->key = go_srvmgr_tor->get_new_key( ).
lr_txc_cont->parent_key = lr_txc_text->key.
lr_txc_cont->text = im_text_content.
<lwa_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
<lwa_mod>-association = lwa_txc_key_mapping-cont_asc.
<lwa_mod>-source_node = lwa_txc_key_mapping-text_key.
<lwa_mod>-node = lwa_txc_key_mapping-cont_key.
<lwa_mod>-source_key = lr_txc_text->key.
<lwa_mod>-key = lr_txc_cont->key.
<lwa_mod>-data = lr_txc_cont.
former_member774543
Discoverer

Suhail,

Thank you very much. It made my day. Tried simple update scenario by taking your code as reference. It worked.

Gaurav_k
Discoverer
0 Kudos
I'm stuck with the same problem of adding Text in NOTE tab of Freight Order application - 'go_srvmgr_tor' & the rest of code.. Can you provide the details related to
Gaurav_k
Discoverer
0 Kudos
I'm stuck with the same problem of adding Text in NOTE tab of Freight Order application. Can you provide the details related to - 'go_srvmgr_tor' & the rest of code.