Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DATA : order_header_in LIKE bapisdhd1.
- DATA : order_items_in LIKE bapisditm OCCURS 0 WITH HEADER LINE.
- DATA : return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
- DATA : order_partners LIKE bapiparnr OCCURS 0 WITH HEADER LINE.
- DATA : order_keys LIKE bapisdkey OCCURS 0 WITH HEADER LINE.
- DATA : order_schedules_in LIKE bapischdl OCCURS 0 WITH HEADER LINE.
- DATA : salesdocument LIKE bapivbeln-vbeln.
- DATA : lv_vkont TYPE vkont_kk.
- DATA : lt_bapisdtext LIKE bapisdtext OCCURS 0 WITH HEADER LINE.
- DATA : ls_line TYPE tline.
- * Start of HDDK901840 - HEP_WM_PM_00019 Unauthorised Consumption
- IF NOT ls_uc-non_std_service_fee IS INITIAL AND
- gs_uc_type-non_std_fee_rel IS INITIAL.
- CLEAR lv_vkont.
- SELECT SINGLE vkonto FROM ever INTO lv_vkont
- WHERE anlage = ls_uc-anlage.
- IF sy-subrc EQ 0.
- order_header_in-fkk_conacct = lv_vkont.
- ENDIF.
- "fill header
- order_header_in-doc_type = 'ZNAP'.
- order_header_in-sales_org = '0031'.
- order_header_in-distr_chan = '10'.
- order_header_in-purch_date = sy-datum.
- order_header_in-division = '10'.
- ***UC-A
- "fill items
- order_items_in-itm_number = 10.
- order_items_in-material = ls_uc-non_std_service_fee_matnr.
- order_items_in-plant = ls_uc-plant.
- APPEND order_items_in.
- "fill qty
- order_schedules_in-itm_number = 10.
- order_schedules_in-req_qty = 1.
- APPEND order_schedules_in.
- "set partner
- order_partners-partn_role = 'AG'.
- order_partners-partn_numb = ls_uc-kunnr.
- APPEND order_partners.
- LOOP AT gt_line INTO ls_line.
- lt_bapisdtext-text_id = '0001'.
- lt_bapisdtext-langu = sy-langu.
- lt_bapisdtext-text_line = ls_line-tdline.
- lt_bapisdtext-format_col = ls_line-tdformat.
- APPEND lt_bapisdtext.
- ENDLOOP.
- ELSE.
- * End of HDDK901840 - HEP_WM_PM_00019 Unauthorised Consumption
- CLEAR lv_vkont.
- SELECT SINGLE vkonto FROM ever INTO lv_vkont
- WHERE anlage = ls_uc-anlage.
- IF sy-subrc EQ 0.
- order_header_in-fkk_conacct = lv_vkont.
- ENDIF.
- "fill header
- order_header_in-doc_type = 'ZNAP'.
- order_header_in-sales_org = '0100'.
- order_header_in-distr_chan = '10'.
- order_header_in-purch_date = sy-datum.
- order_header_in-division = '01'.
- ***UC-A
- "fill items
- order_items_in-itm_number = 10.
- order_items_in-material = 'ZWM=_____UC-A'.
- order_items_in-plant = ls_uc-plant.
- APPEND order_items_in.
- "fill qty
- order_schedules_in-itm_number = 10.
- order_schedules_in-req_qty = ls_uc-amp.
- APPEND order_schedules_in.
- ***UC-HOURS
- "fill items
- order_items_in-itm_number = 20.
- order_items_in-material = 'ZWM=_UC-HOURS'.
- order_items_in-plant = ls_uc-plant.
- APPEND order_items_in.
- "fill qty
- order_schedules_in-itm_number = 20.
- order_schedules_in-req_qty = ls_uc-tot_hours.
- APPEND order_schedules_in.
- ***UC-KWH
- "fill items
- order_items_in-itm_number = 30.
- order_items_in-material = 'ZWM=___UC-KWH'.
- order_items_in-plant = ls_uc-plant.
- APPEND order_items_in.
- "fill qty
- order_schedules_in-itm_number = 30.
- order_schedules_in-req_qty = ls_uc-consump.
- APPEND order_schedules_in.
- ***UC-V
- "fill items
- order_items_in-itm_number = 40.
- order_items_in-material = 'ZWM=_____UC-V'.
- order_items_in-plant = ls_uc-plant.
- APPEND order_items_in.
- * start of HDDK901840 - HEP_WM_PM_00019 Unauthorised Consumption
- "fill qty
- order_schedules_in-itm_number = 40.
- order_schedules_in-req_qty = ls_uc-voltage.
- APPEND order_schedules_in.
- **Non Std Service Fee for ALL Other
- * "fill items
- IF NOT gs_uc_type-non_std_fee_matnr IS INITIAL.
- order_items_in-itm_number = 50.
- order_items_in-material = gs_uc_type-non_std_fee_matnr.
- order_items_in-plant = ls_uc-plant.
- APPEND order_items_in.
- "fill qty
- order_schedules_in-itm_number = 50.
- order_schedules_in-req_qty = ls_uc-non_std_service_fee.
- APPEND order_schedules_in.
- ENDIF.
- * end of HDDK901840 - HEP_WM_PM_00019 Unauthorised Consumption
- "set partner
- order_partners-partn_role = 'AG'.
- order_partners-partn_numb = ls_uc-kunnr.
- APPEND order_partners.
- * start of HDDK901840 - HEP_WM_PM_00019 Unauthorised Consumption
- LOOP AT gt_line INTO ls_line.
- lt_bapisdtext-text_id = '0001'.
- lt_bapisdtext-langu = sy-langu.
- lt_bapisdtext-text_line = ls_line-tdline.
- lt_bapisdtext-format_col = ls_line-tdformat.
- APPEND lt_bapisdtext.
- ENDLOOP.
- APPEND lt_bapisdtext.
- * end of HDDK901840 - HEP_WM_PM_00019 Unauthorised Consumption
- ENDIF.
- CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
- EXPORTING
- order_header_in = order_header_in
- IMPORTING
- salesdocument = salesdocument
- TABLES
- return = return
- order_items_in = order_items_in
- order_partners = order_partners
- order_schedules_in = order_schedules_in
- order_keys = order_keys
- order_text = lt_bapisdtext.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement