Hi Experts/Gurus,
I had a problem when i am passing the ct_extension data to ct_text. I need to pass the data of two new fields created in order jsp as extension data. For this i used the BADI method "changehead_before_order" and i had passed this extensoin data from ct_extension to ct_text which can be passed to crm_order_maintain before order. And when i try to get the data using the method gethead_get_data, in this iam calling CRM_ORDER_READ to get the values of IT_TEXT, the b2b webshop is giving an error and asking to logon again.
The below is the code which i have written in both the methods:
METHOD if_ex_crm_isa_basket_head~changehead_before_order.
DATA : ls_orderadm_h TYPE LINE OF crmt_orderadm_h_comt,
wa_orderadm_h TYPE LINE OF crmt_orderadm_h_comt,
ls_extension TYPE crmt_isales_extension,
wa_extension TYPE crmt_isales_extension,
ls_text TYPE crmt_text_comt,
ls_lines TYPE comt_text_lines_t,
wa_lines LIKE LINE OF ls_lines,
wa_text LIKE LINE OF ls_text,
READ TABLE it_extension INTO wa_extension WITH KEY name = 'ZEXTNSM'.
wa_text-ref_guid = wa_extension-ref_guid.
* wa_text-tdobject = 'CRM_ORDERH'.
* wa_text-tdname = wa_extension-ref_guid.
wa_text-tdid = '0001'.
wa_lines-tdline = wa_extension-value.
APPEND wa_lines TO ls_lines.
wa_text-lines = ls_lines.
INSERT wa_text INTO TABLE ct_text.
CLEAR wa_text.
CLEAR wa_lines.
CLEAR ls_lines.
READ TABLE it_extension INTO wa_extension WITH KEY name = 'ZEXTNSI'.
wa_text-ref_guid = wa_extension-ref_guid.
wa_text-tdid = '0002'.
wa_lines-tdline = wa_extension-value.
APPEND wa_lines TO ls_lines.
wa_text-lines = ls_lines.
INSERT wa_text INTO TABLE ct_text.
* ct_text = ls_text.
* append ls_text to CT_TEXT.
ENDMETHOD.
to get the data :
METHOD if_ex_crm_isa_basket_head~gethead_get_data.
DATA : ls_extension TYPE crmt_isales_extension,
ls_text TYPE crmt_text_comt,
wa_text type CRMT_TEXT_COM,
ls_lines TYPE comt_text_lines_t ,
wa_lines type TLINE,
ls_basket_head TYPE crmt_isales_baskethead_ui,
lv_objectid type CRMT_OBJECT_ID.
lv_objectid = cs_basket_head-OBJECT_ID.
if lv_objectid is not initial.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = cs_basket_head-guid
IMPORTING
et_text = ls_text.
READ TABLE ls_text INTO wa_text WITH KEY tdid = 'ZSM'.
*Appending the discount value from the database.
ls_extension-ref_guid = cs_basket_head-guid.
ls_extension-name = 'ZEXTNSM'.
ls_lines[] = wa_text-lines[].
READ TABLE ls_lines INTO wa_lines INDEX 0.
ls_extension-value = wa_lines-TDLINE.
APPEND ls_extension TO ct_extension.
CLEAR ls_extension.
endif.
ENDMETHOD.
When i put the external break point and checked, in the webshop when i click the update button, in the method changehead_before_order, in the ct_extension table i am getting the values and keys which i have set in the java action. But when i click "order" button, i am not getting anything in ct_extension table which i cannot in turn pass this values to ct_text.
Can you please help me in this regard??
Thanks a lot in Advance!
Regards,
Lakshman.