Logosworld SAP and SOA

Primary links

  • Home
  • SOA City News
    • SOA Cafe
      • SoaXchange Blog
      • SOA Blog
      • Chatroom
    • SOA Garden
      • Karoona
        • Karoona Adapters
      • PPT
    • SOA City
    • SOA India
    • Whitepapers
    • Fotowall
    • Recruitment Forum
      • Experts
    • Techroom Forum
      • SOA
        • Fiorano Forum
          • Fiorano Home
        • SOA Forum
      • SAP Forum
  • Consulting
    • Services
    • People
    • Project Angels
    • Project Arbitration and Rescue
    • SOA Consulting
    • SOA Education
    • Hologramming
  • Products
    • Karoona ESB
    • IDocLink
    • Bookstore
  • SOA Box
  • Wiki
    • Library
      • Books
      • WhitePapers
        • SOA Whitepapers
      • Archive
    • ABAP
  • Events
  • RSS
  • About
    • Wrapper
    • About
    • Joomla
    • Impressum
    • Logosworld 2005
Home Blogs Axel's blog

Search

Context

Management Consulting
CMI 9 - Capability Maturity Index
SAP Multi-Enterprise SOA
Hologramming - Governance for SOA and Disparate Resources
SOA Maturity Audits
SAP Task Forces
eSOA - Collaborate or Die
Fujitsu verteidigt SOA-Konzepte
Project Arbitration and Realignment
PPT - Template Rollout

Topics

About
Archive
Award
Consultants
Consulting
Event archive
Events
Gallery
Hotnews
Karoona
Management
Middleware
News
Partner
Recruiting
SAP
SAP Netweaver
SAP XI
Slideshow
SOA
SOA Atoms
SOA Blog
SOA Garden
SOA Labs
SolutionsPARC
Wiki
more

Book navigation

  • Experts
  • JAX & SOACON Conferences on SOA
  • Karoona
  • Karoona IDOCLINK
  • Lyrics
  • Main
  • Middleware
  • Powerpoints
  • Project Angels
  • Sandbox
  • SOA Rainbow Tour
  • Techroom (Chat)
  • Useful Functions and ABAP

Popular content

  • CMI 9 - Capability Maturity Index (1,606)
  • Generate ABAP Webservice Proxy from RFC Function (1,555)
  • SAP SOAMANAGER Webservice Administration (1,432)
  • SoaXchange Srinath Naga Blog (1,112)
  • Powerpoints (1,108)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • …
  • next ›
  • last »
more

Project Angels

  • Home
  • About
    • About

Calculate lead time on the grounds of factory calender

Submitted by Axel on Fri, 2009-08-14 14:29
  • ABAP
  • English
  • SOA Labs
  • SOA Garden
  • SAP XI
Printer-friendly versionSend to friendPDF version.....here is a quick function module I did now to work out a Shopping Cart delivery date.....using factory calendars and lead time etc.....

FUNCTION zzebp_change_sc_deliv_date.

  • "----------------------------------------------------------------------
  • "*"Local Interface:
  • " IMPORTING
  • " REFERENCE(IV_OBJECT_ID) TYPE CRMT_OBJECT_ID_DB
  • " EXPORTING
  • " REFERENCE(EV_SUCCESS) TYPE CHAR01
  • " REFERENCE(ET_ITEMS) TYPE BBPT_PD_SC_ITEM_D
  • " EXCEPTIONS
  • " SC_NOT_FOUND
  • " FACTORY_CALENDAR_ERROR
  • "----------------------------------------------------------------------

DATA: ls_sc_header TYPE bbp_pds_sc_header_d,
ls_sc_upd_header TYPE bbp_pds_sc_header_u,
lt_items TYPE bbpt_pd_sc_item_d,
ls_item LIKE LINE OF lt_items,
ls_bbp_pdigp TYPE bbp_pdigp,
lv_date TYPE scal-date,
lv_factory_date TYPE scal-facdate,
lv_workingday_indicator TYPE scal-indicator,
lv_date_tmp TYPE sy-datum,
lv_index TYPE i,
lv_changed_flag(1) TYPE c,
lt_messages TYPE bbpt_pds_messages,
lv_update_flag(1) TYPE c.

ev_success = 'X'.

CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_object_id = iv_object_id
i_with_itemdata = 'X'
IMPORTING
e_header = ls_sc_header
TABLES
e_item = lt_items.

IF NOT ls_sc_header IS INITIAL.
CLEAR lv_changed_flag.
LOOP AT lt_items INTO ls_item.
lv_index = sy-tabix.
CLEAR: ls_bbp_pdigp,
lv_date,
lv_factory_date,
lv_workingday_indicator.

SELECT SINGLE *
INTO ls_bbp_pdigp
FROM bbp_pdigp
WHERE guid = ls_item-guid.

IF sy-subrc = 0.

  • Check if the item is a catelog item, if so then add the lead time...

lv_date_tmp = ls_item-deliv_date.
lv_workingday_indicator = '+'.

IF NOT ls_bbp_pdigp-leadtime IS INITIAL.
lv_date_tmp = sy-datum.
ELSE.
lv_date_tmp = ls_item-deliv_date.
ENDIF.

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
correct_option = '+'
date = lv_date_tmp
factory_calendar_id = 'ZA'
IMPORTING
date = lv_date
factorydate = lv_factory_date
workingday_indicator = lv_workingday_indicator
EXCEPTIONS
calendar_buffer_not_loadable = 1
correct_option_invalid = 2
date_after_range = 3
date_before_range = 4
date_invalid = 5
factory_calendar_not_found = 6
OTHERS = 7.

IF sy-subrc = 0.
IF NOT lv_date IS INITIAL.
ls_item-deliv_date = lv_date.
IF NOT ls_bbp_pdigp-leadtime IS INITIAL.
lv_factory_date = lv_factory_date + ls_bbp_pdigp-leadtime.
CLEAR lv_date_tmp.
CALL FUNCTION 'FACTORYDATE_CONVERT_TO_DATE'
EXPORTING
factorydate = lv_factory_date
factory_calendar_id = 'ZA'
IMPORTING
date = lv_date_tmp. "Actual date

IF NOT lv_date_tmp IS INITIAL.
ls_item-deliv_date = lv_date_tmp.
ENDIF.
ENDIF.

MODIFY lt_items FROM ls_item INDEX lv_index.
lv_changed_flag = 'X'.
ENDIF.
ELSE.
CLEAR ev_success.
RAISE factory_calendar_error.
ENDIF.

ENDIF.
ENDLOOP.

IF lv_changed_flag = 'X'.
et_items[] = lt_items[].
ENDIF.
ELSE.
CLEAR ev_success.
ENDIF.

ENDFUNCTION.

  • Axel's blog
  • Login to post comments
  • Printer-friendly version
  • Send to friend
  • PDF version
Trademarks may be copyrighted. SAP is a trademark of SAP AG.
RoopleTheme