The delivery date for the PR needs to consider planning Calender Periods

Hi Friends,
Please help me in solving in my scenario given below:
The Planning calender periods are from Monday through Thursday(No Friday and weekends). When there is a Purchase Requisition (PR) planned date on Monday and the GR processing time is one day. The delivery date should be on the before Thursday (Becasue there is no period on Friday).
But, the delivery date is being created with the before Friday, which shouldn't happen.(Requirement is that Delivery date shouldn't consider that friday, hence, the delivery date needs to be on Thursday).
NOTE: The lot size settings are Lot sizing Procedure : P(Period lot sizing procedure), Lot-size indicator: K (Period lot size as in Planning Calender), Scheduling : 1 (Period Start = Delivery date).
Thanks for helping me in advance,
Surendra Chakka

Hi Santosh,
Thanks for your Questions. Below are the explainations:
1. Can you expalin how your system is behaving at the moment?
A. Presently the GR Processing time is 1 day for a material in Plant. So, if the user wants to produce on Wednesday (Planned date in PR, provided by the MRP run), then the delivery should be on Tuesday (Because GR processing time is 1 day). In  the same way, he dont wants the delivery to be on Friday. I mean, if he wants to produce on Monday,  he wants the delivery to be on Thursday.
Only Friday, he don't wants to make the Delivery.(The delivery date should not show Friday in PR's).
2. Pls explain your original MRP view and planning calendor setting...
A. For solving of the above issue, we changed the Lot size to copy of "PK" - Period lot size acc to planniong calendar. Then we maintained the Planning calendar, in which the periods are for every Monday, tuesday, wednesday and thursday. Expecting, the delivery  should be excluded for friday, the friday in the planning calendar is not given as a period.
The scheduling paramter in the Lotsize is tried with both the options (period start = Deliery date and period end = Delivery date).
Later removed "PD" in MRP type and tried with "R1" Time phase req. But, the precondition for this is to maintain "Forecast req". This is also done. But, then, the system for this material is not responding to the MRP run. It is asking to run the forecast model. We ar not using SOP.
3. The results thst you get with current setting?
A. For the planned date in PR of Monday, the delivery date in PR is on the day before monday. i.e., Friday (Saturday and sundays are holidays).
4. Expected results...?
A. For the planned date in PR of Monday, the delivery date in PR should be Thursday (the day before monday production).
Hope, i am clear in my explaination. Please revert back, if you need any more information.
Thanks and Regards
Surendra Chakka

Similar Messages

  • Output the requested delivery date for each different line item

    Hello Experts
    I have program called ZFSFSF(following), in the output Its showing multiple requested delvery dates per line item.
    But We need to show the requested delivery date for each different line item.
    Any code is highly appreciated. I wud appreacite if you cud bold the added code.
    Thanks
    SP
    TYPE-POOLS: slis.
    TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1, bkpf, bsad, bkpf_bsad,
    knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
    DATA: BEGIN OF i_list OCCURS 0,
    vbeln LIKE vbak-vbeln,
    posnr LIKE vbap-posnr,
    matnr LIKE vbap-matnr,
    erdat LIKE vbap-erdat,
    mvgr1 LIKE mvke-mvgr1,
    wadat_ist LIKE likp-wadat_ist,
    days TYPE i,
    werks LIKE vbap-werks,
    lgort LIKE vbap-lgort,
    kwmeng LIKE vbap-kwmeng," CH01+
    lfimg LIKE lips-lfimg," CH01+
    pstyv LIKE vbap-pstyv," CH01+
    obd LIKE lips-vbeln," CH01+
    obd_pos LIKE lips-posnr," CH01+
    soldto LIKE vbaK-kunnr," JR+
    shipto LIKE vbpa-kunnr," JR+
    edatu like vbep-edatu," PR+
    END OF i_list.
    DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
    i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    *ALV Output Header
    DATA: gt_list_top_of_page TYPE slis_t_listheader,
    prognm LIKE sy-repid,
    gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
    gt_events TYPE slis_t_event,
    is_layout TYPE slis_layout_alv,
    is_variant LIKE disvariant,
    it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: g_repid LIKE sy-repid,
    g_count LIKE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t10.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t11.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t12.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK block0.
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
    s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
    s_matnr FOR vbap-matnr," obligatory,
    s_mvgr1 FOR mvke-mvgr1,
    s_erdat FOR vbap-erdat OBLIGATORY,
    s_werks FOR vbap-werks,
    s_lgort FOR vbap-lgort,
    s_edatu FOR vbep-edatu.
    PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    SELECTION-SCREEN SKIP 2.
    +EC1
    Addition +EC1
    +EC1
    PARAMETERS: p_vari LIKE disvariant-variant.
    +EC1
    End Addition +EC1
    +EC1
    SELECTION-SCREEN END OF BLOCK blocko.
    +EC1
    Addition +EC1
    +EC1
    DATA: g_save(1) TYPE c,
    g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant LIKE disvariant,
    g_variant LIKE disvariant.
    +EC1
    End Addition +EC1
    +EC1
    Initialization fieldcatalog
    INITIALIZATION.
    PERFORM clear_tables.
    g_repid = sy-repid.
    PERFORM fieldcat_init USING gt_fieldcat[].
    +EC1
    Addition +EC1
    +EC1
    g_save = 'A'.
    PERFORM variant_init.
    Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
    PERFORM auth_check. "+ESC
    PERFORM pai_of_selection_screen.
    +EC1
    End Addition +EC1
    +EC1
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM alv.
    END-OF-SELECTION.
    FORM get_data *
    FORM get_data.
    *CH01 - Added kwmeng(order qty) to selection, excluded rejects
    *JR -added soldto and shipto code
    SELECT avbeln aposnr amatnr aerdat awerks algort
    akwmeng apstyv bkunnr cedatu
    CH01+
    INTO
    (i_list-vbeln, i_list-posnr, i_list-matnr, i_list-erdat, i_list-werks,
    i_list-lgort,
    i_list-kwmeng , i_list-pstyv, i_list-soldto,i_list-edatu)
    CH01+
    FROM vbap AS a INNER JOIN vbak AS b ON avbeln = bvbeln
    INNER JOIN vbep AS c ON avbeln = cvbeln
    WHERE b~vkorg = p_vkorg
    AND a~werks IN s_werks
    AND a~lgort IN s_lgort
    AND b~auart IN s_auart
    AND a~vbeln IN s_vbeln
    AND a~erdat IN s_erdat
    AND a~abgru = ''" CH01+
    AND a~matnr IN s_matnr
    AND c~edatu IN s_edatu.
    APPEND i_list.
    ENDSELECT.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
    WHERE matnr = i_list-matnr.
    MODIFY i_list.
    CLEAR: i_list.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-mvgr1 IN s_mvgr1.
    CONTINUE.
    ELSE.
    DELETE i_list.
    COMMIT WORK AND WAIT.
    ENDIF.
    ENDLOOP.
    CH01 - commented these lines out and redid logic below
    LOOP AT i_list.
    select single vbeln into lips-vbeln from lips
    where vgbel = i_list-vbeln
    and vgpos = i_list-posnr.
    select single wadat_ist into i_list-wadat_ist from likp
    where vbeln = lips-vbeln.
    SELECT b~wadat_ist INTO i_list-wadat_ist
    FROM lips AS a INNER JOIN
    likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
    AND a~vgpos = i_list-posnr.
    MODIFY i_list.
    CLEAR: i_list, lips-vbeln.
    ENDSELECT.
    ENDLOOP.
    CH01 - Changed to select multiple delivery lines & del qty
    summing the total deliveries per OBD# and date
    LOOP AT i_list.
    SELECT avbeln sum( alfimg ) b~wadat_ist
    INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
    FROM lips AS a INNER JOIN
    likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
    AND a~vgpos = i_list-posnr
    AND a~pstyv = i_list-pstyv
    group by avbeln bwadat_ist.
    i_list2 = i_list.
    APPEND i_list2.
    ENDSELECT.
    IF sy-subrc <> 0.
    i_list2 = i_list.
    APPEND i_list2.
    ENDIF.
    ENDLOOP.
    i_list[] = i_list2[].
    *End CH01
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-wadat_ist IS INITIAL.
    CONTINUE.
    ELSE.
    i_list-days = i_list-wadat_ist - i_list-erdat.
    ENDIF.
    MODIFY i_list.
    CLEAR: i_list.
    COMMIT WORK AND WAIT.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-vbeln IS INITIAL.
    DELETE i_list.
    ENDIF.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    *JR
    LOOP AT i_list.
    SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
    WHERE vbeln = i_list-vbeln
    AND parvw = 'WE'.
    MODIFY i_list.
    ENDLOOP.
    *END JR
    gt_outtab[] = i_list[].
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM alv *
    FORM alv.
    PERFORM e03_eventtab_build USING gt_events[]. "+EC1
    PERFORM e04_comment_build USING gt_list_top_of_page[]. "+EC1
    prognm = sy-repid. "+EC1
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_user_command = 'USER_COMMAND'
    i_callback_program = g_repid
    it_fieldcat = gt_fieldcat[]
    it_events = gt_events[] "+ESC
    it_sort = it_sort[]
    +EC1
    Addition +EC1
    +EC1
    is_variant = g_variant
    i_save = g_save
    +EC1
    End Addition +EC1
    +EC1
    TABLES
    t_outtab = gt_outtab.
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM fieldcat_init *
    --> I_FIELDCAT *
    FORM fieldcat_init
    USING i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    DATA: pos TYPE i VALUE 1.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'VBELN'.
    ls_fieldcat-ref_tabname = 'VBAK'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'POSNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MATNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MVGR1'.
    ls_fieldcat-ref_tabname = 'MVKE'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LGORT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'ERDAT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WADAT_IST'.
    ls_fieldcat-ref_tabname = 'LIKP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'DAYS'.
    ls_fieldcat-ref_fieldname = 'DAYS'.
    ls_fieldcat-seltext_s = '# Of Days'.
    ls_fieldcat-seltext_m = '# Of Days'.
    ls_fieldcat-seltext_l = '# Of Days'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *Begin CH01
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'KWMENG'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LFIMG'.
    ls_fieldcat-ref_tabname = 'LIPS'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD'.
    ls_fieldcat-seltext_s = 'OBD'.
    ls_fieldcat-seltext_m = 'Outbound Del'.
    ls_fieldcat-seltext_l = 'Outbound Delivery'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD_POS'.
    ls_fieldcat-seltext_s = 'OBD Ln'.
    ls_fieldcat-seltext_m = 'Outbound Del Ln'.
    ls_fieldcat-seltext_l = 'Outbound Del Line'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *End CH01
    *JR
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SOLDTO'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-seltext_m = 'Sold To'.
    ls_fieldcat-seltext_l = 'Sold To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SHIPTO'.
    ls_fieldcat-ref_tabname = 'VBPA'.
    ls_fieldcat-seltext_m = 'Ship To'.
    ls_fieldcat-seltext_l = 'Ship To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *END JR
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'EDATU'.
    ls_fieldcat-ref_tabname = 'VBEP'.
    ls_fieldcat-seltext_m = 'Requested Delivery date'.
    ls_fieldcat-seltext_l = 'Requested Delivery date'.
    ls_fieldcat-outputlen = 20.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *FOR ALV SORT & SUBTOTAL
    CLEAR it_sort.
    it_sort-spos = '0'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'POSNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '2'.
    it_sort-fieldname = 'MATNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '3'.
    it_sort-fieldname = 'MVGR1'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '4'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '5'.
    it_sort-fieldname = 'WADAT_IST'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-down = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '6'.
    it_sort-fieldname = 'PERNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '7'.
    it_sort-fieldname = 'VORNA'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '8'.
    it_sort-fieldname = 'NACHN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '9'.
    it_sort-fieldname = 'VKGRP'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '10'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '11'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '12'.
    it_sort-fieldname = 'BEZEI'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    clear it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'BELNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    append it_sort.
    ENDFORM.
    +EC1
    Addition +EC1
    +EC1
    *& Form VARIANT_INIT
    text
    --> p1 text
    <-- p2 text
    FORM variant_init.
    CLEAR g_variant.
    g_variant-report = g_repid.
    ENDFORM. " VARIANT_INIT
    FORM f4_for_variant *
    FORM f4_for_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save = g_save
    it_default_fieldcat =
    IMPORTING
    e_exit = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    IF g_exit = space.
    p_vari = gx_variant-variant.
    ENDIF.
    ENDIF.
    ENDFORM.
    *& Form PAI_OF_SELECTION_SCREEN
    text
    FORM pai_of_selection_screen.
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM. " PAI_OF_SELECTION_SCREEN
    +EC1
    End Addition +EC1
    +EC1
    FORM e03_eventtab_build *
    --> E03_LT_EVENTS *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = e03_lt_events.
    READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
    INTO ls_event.
    IF sy-subrc = 0.
    MOVE gc_formname_top_of_page TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
    ENDIF.
    ENDFORM.
    FORM e04_comment_build *
    --> E04_LT_TOP_OF_PAGE *
    FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
    DATA: ls_line TYPE slis_listheader.
    *Report Title
    CLEAR ls_line.
    ls_line-typ = 'H'.
    ls_line-info = text-007.
    APPEND ls_line TO e04_lt_top_of_page.
    **Doc Type Desc.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-008.
    ls_line-info = p_matnr.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-009.
    ls_line-info = p_werks.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-010.
    ls_line-info = p_stlan.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-011.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-012.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    ENDFORM.
    FORM top_of_page *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    FORM auth_check *
    FORM auth_check.
    AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
    ID 'VKORG' FIELD p_vkorg.
    IF sy-subrc NE 0.
    MESSAGE e054 WITH p_vkorg.
    ENDIF.
    ENDFORM. " auth_check
    *& Form USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN '&IC1'.
    PERFORM display_so_order USING r_ucomm
    rs_selfield.
    ENDCASE.
    ENDFORM.
    *& Form display_sales_order
    text
    -->P_R_UCOMM text
    -->P_RS_SELFIELD text
    FORM display_so_order USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE rs_selfield-sel_tab_field.
    WHEN '1-VBELN'.
    SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '1-MATNR'.
    SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    WHEN '1-OBD'.
    SET PARAMETER ID 'VL' FIELD rs_selfield-value.
    CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    WHEN OTHERS.
    MESSAGE i000(z1) WITH 'Please Click on the Valid Selection'.
    EXIT.
    ENDCASE.
    ENDFORM. " display_sales_order
    FORM EDit_table *

    > TYPE-POOLS: slis.
    >
    > TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1,
    > bkpf, bsad, bkpf_bsad,
    > knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
    >
    > DATA: BEGIN OF i_list OCCURS 0,
    > vbeln LIKE vbak-vbeln,
    > posnr LIKE vbap-posnr,
    <b>  etenr like vbep-etenr,</b>
    > matnr LIKE vbap-matnr,
    > erdat LIKE vbap-erdat,
    > mvgr1 LIKE mvke-mvgr1,
    > wadat_ist LIKE likp-wadat_ist,
    > days TYPE i,
    > werks LIKE vbap-werks,
    > lgort LIKE vbap-lgort,
    > kwmeng LIKE vbap-kwmeng," CH01+
    > lfimg LIKE lips-lfimg," CH01+
    > pstyv LIKE vbap-pstyv," CH01+
    > obd LIKE lips-vbeln," CH01+
    > obd_pos LIKE lips-posnr," CH01+
    > soldto LIKE vbaK-kunnr," JR+
    > shipto LIKE vbpa-kunnr," JR+
    > edatu like vbep-edatu," PR+
    > END OF i_list.
    >
    > DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
    > i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    >
    > DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    >
    >
    > *ALV Output Header
    > DATA: gt_list_top_of_page TYPE slis_t_listheader,
    > prognm LIKE sy-repid,
    > gc_formname_top_of_page TYPE slis_formname VALUE
    > 'TOP_OF_PAGE',
    > gt_events TYPE slis_t_event,
    > is_layout TYPE slis_layout_alv,
    > is_variant LIKE disvariant,
    > it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    >
    > DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    > DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER
    > LINE.
    >
    > DATA: g_repid LIKE sy-repid,
    > g_count LIKE sy-tabix.
    >
    > SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME
    > TITLE text-t01.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t10.
    >
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t11.
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t12.
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN END OF BLOCK block0.
    >
    > */ Selection and Input Parameters
    > SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME
    > TITLE text-001.
    >
    >
    >
    > SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
    > s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
    > s_matnr FOR vbap-matnr," obligatory,
    > s_mvgr1 FOR mvke-mvgr1,
    > s_erdat FOR vbap-erdat OBLIGATORY,
    > s_werks FOR vbap-werks,
    > s_lgort FOR vbap-lgort,
    > s_edatu FOR vbep-edatu.
    >
    > PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    >
    >
    >
    > SELECTION-SCREEN SKIP 2.
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > PARAMETERS: p_vari LIKE disvariant-variant.
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    > SELECTION-SCREEN END OF BLOCK blocko.
    >
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > DATA: g_save(1) TYPE c,
    > * g_default(1) TYPE c,
    > g_exit(1) TYPE c,
    > gx_variant LIKE disvariant,
    > g_variant LIKE disvariant.
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    > * Initialization fieldcatalog
    > INITIALIZATION.
    >
    > * PERFORM clear_tables.
    >
    > g_repid = sy-repid.
    > PERFORM fieldcat_init USING gt_fieldcat[].
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > g_save = 'A'.
    > PERFORM variant_init.
    > * Get default variant
    > gx_variant = g_variant.
    > CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    > EXPORTING
    > i_save = g_save
    > CHANGING
    > cs_variant = gx_variant
    > EXCEPTIONS
    > not_found = 2.
    > IF sy-subrc = 0.
    > p_vari = gx_variant-variant.
    > ENDIF.
    >
    > AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    > PERFORM f4_for_variant.
    >
    > AT SELECTION-SCREEN.
    > PERFORM auth_check. "+ESC
    > PERFORM pai_of_selection_screen.
    >
    >
    >
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    >
    > START-OF-SELECTION.
    >
    > PERFORM get_data.
    >
    > PERFORM alv.
    >
    > END-OF-SELECTION.
    >
    > *----
    > -
    > * FORM get_data *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM get_data.
    > *CH01 - Added kwmeng(order qty) to selection,
    > excluded rejects
    > *JR -added soldto and shipto code
    SELECT a~vbeln a~posnr a~matnr a~erdat a~werks a~lgort
    a~kwmeng a~pstyv b~kunnr c~edatu
    CH01+
    INTO corresponding fields of table i_list
    FROM vbap AS a INNER JOIN vbak AS b ON a~vbeln = b~vbeln
    INNER JOIN vbep AS c ON a~vbeln = c~vbeln
    and a~posnr = c~posnr
    WHERE b~vkorg = p_vkorg
    AND a~werks IN s_werks
    AND a~lgort IN s_lgort
    AND b~auart IN s_auart
    AND a~vbeln IN s_vbeln
    AND a~erdat IN s_erdat
    AND a~abgru = ''" CH01+
    AND a~matnr IN s_matnr
    AND c~edatu IN s_edatu.
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
    > WHERE matnr = i_list-matnr.
    > MODIFY i_list.
    > CLEAR: i_list.
    > ENDLOOP.
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-mvgr1 IN s_mvgr1.
    > CONTINUE.
    > ELSE.
    > DELETE i_list.
    > COMMIT WORK AND WAIT.
    > ENDIF.
    > ENDLOOP.
    > * CH01 - commented these lines out and redid logic
    > below
    > * LOOP AT i_list.
    > ** select single vbeln into lips-vbeln from lips
    > ** where vgbel = i_list-vbeln
    > ** and vgpos = i_list-posnr.
    > **
    > ** select single wadat_ist into i_list-wadat_ist from
    > likp
    > ** where vbeln = lips-vbeln.
    > *
    > * SELECT b~wadat_ist INTO i_list-wadat_ist
    > * FROM lips AS a INNER JOIN
    > * likp AS b ON a~vbeln = b~vbeln WHERE a~vgbel =
    > i_list-vbeln
    > * AND a~vgpos = i_list-posnr.
    > * MODIFY i_list.
    > * CLEAR: i_list, lips-vbeln.
    > * ENDSELECT.
    > * ENDLOOP.
    >
    > * CH01 - Changed to select multiple delivery lines &
    > del qty
    > * summing the total deliveries per OBD# and date
    > LOOP AT i_list.
    > SELECT avbeln sum( alfimg ) b~wadat_ist
    > INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
    > FROM lips AS a INNER JOIN
    > likp AS b ON avbeln = bvbeln WHERE a~vgbel =
    > i_list-vbeln
    > AND a~vgpos = i_list-posnr
    > AND a~pstyv = i_list-pstyv
    > group by avbeln bwadat_ist.
    > i_list2 = i_list.
    > APPEND i_list2.
    > ENDSELECT.
    > IF sy-subrc <> 0.
    > i_list2 = i_list.
    > APPEND i_list2.
    > ENDIF.
    > ENDLOOP.
    > i_list[] = i_list2[].
    > *End CH01
    >
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-wadat_ist IS INITIAL.
    > CONTINUE.
    > ELSE.
    > i_list-days = i_list-wadat_ist - i_list-erdat.
    > ENDIF.
    > MODIFY i_list.
    > CLEAR: i_list.
    > COMMIT WORK AND WAIT.
    > ENDLOOP.
    >
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-vbeln IS INITIAL.
    > DELETE i_list.
    > ENDIF.
    > ENDLOOP.
    > COMMIT WORK AND WAIT.
    >
    > *JR
    > LOOP AT i_list.
    > SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
    > WHERE vbeln = i_list-vbeln
    > AND parvw = 'WE'.
    > MODIFY i_list.
    > ENDLOOP.
    > *END JR
    >
    > gt_outtab[] = i_list[].
    > COMMIT WORK AND WAIT.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM alv *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM alv.
    >
    > PERFORM e03_eventtab_build USING gt_events[]. "+EC1
    > PERFORM e04_comment_build USING
    > gt_list_top_of_page[]. "+EC1
    > prognm = sy-repid. "+EC1
    >
    >
    > CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    > EXPORTING
    > i_callback_user_command = 'USER_COMMAND'
    > i_callback_program = g_repid
    > it_fieldcat = gt_fieldcat[]
    > it_events = gt_events[] "+ESC
    > it_sort = it_sort[]
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > is_variant = g_variant
    > i_save = g_save
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    > TABLES
    > t_outtab = gt_outtab.
    >
    > COMMIT WORK AND WAIT.
    >
    >
    > ENDFORM.
    >
    >
    > *----
    > -
    > * FORM fieldcat_init *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> I_FIELDCAT *
    > *----
    > -
    > FORM fieldcat_init
    > USING i_fieldcat TYPE slis_t_fieldcat_alv.
    > DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    > DATA: pos TYPE i VALUE 1.
    > CLEAR ls_fieldcat.
    <b>Please note to keep on incrementing pos variable for column position.</b>
    <b> pos = pos + 1.</b>
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'VBELN'.
    > ls_fieldcat-ref_tabname = 'VBAK'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    <b> pos = pos + 1.</b> ===> after every append to field catalog.
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'POSNR'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    <b>> ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'ETERN'.
    > ls_fieldcat-ref_tabname = 'VBEP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.</b>
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'MATNR'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'MVGR1'.
    > ls_fieldcat-ref_tabname = 'MVKE'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'WERKS'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'LGORT'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'ERDAT'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'WADAT_IST'.
    > ls_fieldcat-ref_tabname = 'LIKP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'DAYS'.
    > ls_fieldcat-ref_fieldname = 'DAYS'.
    > ls_fieldcat-seltext_s = '# Of Days'.
    > ls_fieldcat-seltext_m = '# Of Days'.
    > ls_fieldcat-seltext_l = '# Of Days'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > *Begin CH01
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'KWMENG'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-outputlen = 7.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'LFIMG'.
    > ls_fieldcat-ref_tabname = 'LIPS'.
    > ls_fieldcat-outputlen = 7.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'OBD'.
    > ls_fieldcat-seltext_s = 'OBD'.
    > ls_fieldcat-seltext_m = 'Outbound Del'.
    > ls_fieldcat-seltext_l = 'Outbound Delivery'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > * ls_fieldcat-col_pos = pos.
    > * ls_fieldcat-fieldname = 'OBD_POS'.
    > * ls_fieldcat-seltext_s = 'OBD Ln'.
    > * ls_fieldcat-seltext_m = 'Outbound Del Ln'.
    > * ls_fieldcat-seltext_l = 'Outbound Del Line'.
    > * ls_fieldcat-outputlen = 10.
    > * APPEND ls_fieldcat TO i_fieldcat.
    > * CLEAR ls_fieldcat.
    > *
    > *End CH01
    >
    > *JR
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'SOLDTO'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-seltext_m = 'Sold To'.
    > ls_fieldcat-seltext_l = 'Sold To'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'SHIPTO'.
    > ls_fieldcat-ref_tabname = 'VBPA'.
    > ls_fieldcat-seltext_m = 'Ship To'.
    > ls_fieldcat-seltext_l = 'Ship To'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    > *END JR
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'EDATU'.
    > ls_fieldcat-ref_tabname = 'VBEP'.
    > ls_fieldcat-seltext_m = 'Requested Delivery date'.
    > ls_fieldcat-seltext_l = 'Requested Delivery date'.
    > ls_fieldcat-outputlen = 20.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > *FOR ALV SORT & SUBTOTAL
    > CLEAR it_sort.
    > it_sort-spos = '0'.
    > it_sort-fieldname = 'VBELN'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > CLEAR it_sort.
    > it_sort-spos = '1'.
    > it_sort-fieldname = 'POSNR'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > it_sort-subtot = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    > *
    > CLEAR it_sort.
    > it_sort-spos = '2'.
    > it_sort-fieldname = 'MATNR'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > CLEAR it_sort.
    > it_sort-spos = '3'.
    > it_sort-fieldname = 'MVGR1'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    > *
    > CLEAR it_sort.
    > it_sort-spos = '4'.
    > it_sort-fieldname = 'ERDAT'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    >
    > CLEAR it_sort.
    > it_sort-spos = '5'.
    > it_sort-fieldname = 'WADAT_IST'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-down = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '6'.
    > * it_sort-fieldname = 'PERNR'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '7'.
    > * it_sort-fieldname = 'VORNA'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '8'.
    > * it_sort-fieldname = 'NACHN'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '9'.
    > * it_sort-fieldname = 'VKGRP'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '10'.
    > * it_sort-fieldname = 'VBELN'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '11'.
    > * it_sort-fieldname = 'ERDAT'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '12'.
    > * it_sort-fieldname = 'BEZEI'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    >
    > * clear it_sort.
    > * it_sort-spos = '1'.
    > * it_sort-fieldname = 'BELNR'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > * append it_sort.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > *&----
    > -
    > *& Form VARIANT_INIT
    > *&----
    > -
    > * text
    > *----
    > -
    > * --> p1 text
    > * <-- p2 text
    > *----
    > -
    > FORM variant_init.
    > *
    > CLEAR g_variant.
    > g_variant-report = g_repid.
    > ENDFORM. " VARIANT_INIT
    >
    >
    >
    > *----
    > -
    > * FORM f4_for_variant *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM f4_for_variant.
    > *
    > CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    > EXPORTING
    > is_variant = g_variant
    > i_save = g_save
    > * it_default_fieldcat =
    > IMPORTING
    > e_exit = g_exit
    > es_variant = gx_variant
    > EXCEPTIONS
    > not_found = 2.
    > IF sy-subrc = 2.
    > MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    > WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    > ELSE.
    > IF g_exit = space.
    > p_vari = gx_variant-variant.
    > ENDIF.
    > ENDIF.
    > ENDFORM.
    > *&----
    > -
    > *& Form PAI_OF_SELECTION_SCREEN
    > *&----
    > -
    > * text
    > *----
    > -
    > FORM pai_of_selection_screen.
    > *
    > IF NOT p_vari IS INITIAL.
    > MOVE g_variant TO gx_variant.
    > MOVE p_vari TO gx_variant-variant.
    > CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    > EXPORTING
    > i_save = g_save
    > CHANGING
    > cs_variant = gx_variant.
    > g_variant = gx_variant.
    > ELSE.
    > PERFORM variant_init.
    > ENDIF.
    > ENDFORM. " PAI_OF_SELECTION_SCREEN
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    >
    > *----
    > -
    > * FORM e03_eventtab_build *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> E03_LT_EVENTS *
    > *----
    > -
    > FORM e03_eventtab_build USING e03_lt_events TYPE
    > slis_t_event.
    > DATA: ls_event TYPE slis_alv_event.
    >
    > CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    > EXPORTING
    > i_list_type = 0
    > IMPORTING
    > et_events = e03_lt_events.
    > READ TABLE e03_lt_events WITH KEY name =
    > slis_ev_top_of_page
    > INTO ls_event.
    > IF sy-subrc = 0.
    > MOVE gc_formname_top_of_page TO ls_event-form.
    > APPEND ls_event TO e03_lt_events.
    > ENDIF.
    > ENDFORM.
    >
    > *----
    > -
    > * FORM e04_comment_build *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> E04_LT_TOP_OF_PAGE *
    > *----
    > -
    > FORM e04_comment_build USING e04_lt_top_of_page TYPE
    > slis_t_listheader.
    > DATA: ls_line TYPE slis_listheader.
    >
    > *Report Title
    > CLEAR ls_line.
    > ls_line-typ = 'H'.
    > ls_line-info = text-007.
    > APPEND ls_line TO e04_lt_top_of_page.
    > *
    > *
    > **Doc Type Desc.
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-008.
    > ** ls_line-info = p_matnr.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-009.
    > ** ls_line-info = p_werks.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-010.
    > ** ls_line-info = p_stlan.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-011.
    > ** ls_line-info = p_stlal.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-012.
    > ** ls_line-info = p_stlal.
    > * append ls_line to e04_lt_top_of_page.
    >
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM top_of_page *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM top_of_page.
    >
    > CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    > EXPORTING
    > it_list_commentary = gt_list_top_of_page.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM auth_check *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM auth_check.
    >
    > AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
    > ID 'VKORG' FIELD p_vkorg.
    > IF sy-subrc NE 0.
    > MESSAGE e054 WITH p_vkorg.
    > ENDIF.
    >
    >
    > ENDFORM. " auth_check
    >
    >
    > *&----
    > -
    > *& Form USER_COMMAND
    > *&----
    > -
    > FORM user_command USING r_ucomm LIKE sy-ucomm
    > rs_selfield TYPE slis_selfield.
    >
    > CASE r_ucomm.
    > WHEN '&IC1'.
    > PERFORM display_so_order USING r_ucomm
    > rs_selfield.
    >
    > ENDCASE.
    >
    > ENDFORM.
    >
    > *&----
    > -
    > *& Form display_sales_order
    > *&----
    > -
    > * text
    > *----
    > -
    > * -->P_R_UCOMM text
    > * -->P_RS_SELFIELD text
    > *----
    > -
    > FORM display_so_order USING r_ucomm LIKE sy-ucomm
    > rs_selfield TYPE slis_selfield.
    >
    > CASE rs_selfield-sel_tab_field.
    > WHEN '1-VBELN'.
    > SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
    > CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    > WHEN '1-MATNR'.
    > SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
    > CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    > WHEN '1-OBD'.
    > SET PARAMETER ID 'VL' FIELD rs_selfield-value.
    > CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    > WHEN OTHERS.
    > MESSAGE i000(z1) WITH 'Please Click on the Valid
    > Selection'.
    > EXIT.
    > ENDCASE.
    >
    >
    > ENDFORM. " display_sales_order
    >
    > *----
    > -
    > * FORM EDit_table *
    > *----
    > -
    > * ........ *
    > *----
    > -
    Message was edited by: Anurag Bankley

  • Delivery grouping and the delivery date for group in SD

    Hi
    Using a userexit I am grouping certain materials together.  However the delivery date for group field is not picking up the expected date.
    Assume the following example:
    Material X            Delivery Date 20.12.2006
    Material Y           Delivery Date 27.12.2006
    If I group them together I expect the delivery date for the group to become 27.12.2006 however it is picking up 20.12.2006.
    If anyone has some thoughts regarding this they would be most appreciated.

    Yeah got ur point i was mapping the table configuaration for ur reference.
    This grouping is supposed to make sure that all materials are delievered at the same Date (VBEP-EDATU) and must use the last date in the delivery group.
    say materials  X -- DELIVERY DATE  20 12 2006
                         Y -- DELIVERY DATE  27 12 2006
    so the matnrs are avalaible in VBAP along with  for the VBELN and POSNR values now pick the delivery date for this material from VBEP   ,,
    Now once the itab is sorted by delivery group  and EDATU descending .
    so X and Y are present in for delivery group 001 say .
    X -- DELIVERY DATE  20 12 2006
    Y-- DELIVERY DATE  27 12 2006
    after sort by date it will be
    Y-- DELIVERY DATE  27 12 2006
    X -- DELIVERY DATE  20 12 2006
    which will pick up the latest date (or max date)
    Tis was what i meant to say.
    what is the incude you r using ?
    regards,
    vijay

  • Is there an expected delivery date for the 16GB 5s iPhone in Australia?

    Is there an expected delivery date for the 16GB 5s iPhone in Australia?

    Kim Archbold wrote:
    Is there an expected delivery date for the 16GB 5s iPhone in Australia?
    The answer you seek is customarily delivered to your email inbox.

  • How to get the pricing hierarchy based on the delivery date for sales order

    Hi,
    How to get the pricing hierarchy based on the delivery date for sales order other than system date.
    My requirement is to get the Pricing hierarchy based on the delivery date other than system date.
    Waiting for kind response.
    Best Regards,
    BDP

    HI Sai,
    please refer teh document already how to write FM based extration on generic extractors.
    and here  the logic to find the latest records values:-
    -> get the data in an internal table
    ->Sort the internal table data based from date descending
    -> Using READ statement , we can read the first record of the table which is nothign but your latest record.
    Regards.
    Sakthi

  • Calculate all days in month from schedule line delivery date for 12 mths

    Hi experts,
    I am trying to solve a problem and would appreciate any help! Im on BI7.
    The user will input a date for the schedule line delivery date via a variable.
    From this date I need to go forward 12 months exactly and display a key figure (outstanding value) by months but the first and last months must only use the days in that month i.e not the whole month if not selected by the user.
    I.e if the user types in 13.05.2008
    The display need to show (columns)
    May 08 (13th to end of May 2008)
    June 08   (All)
    July 08    (All)
    August 08    (All)
    Sept 08    (All)
    Oct 08     (All)
    Nov 08     (All)
    Dec 08    (All)
    Jan 09     (All)
    Feb 09    (All)
    Mar 09    (All)
    April 09   (All)
    May 09  (1st to 12)
    So I neen to restrict the key figure (Outstanding Value) by Schedule Line Delivery Date and display as above on a 12 month forecast basis from the day (sch line delivery daye) entered as a variable by the user.
    I also need the first month to only show the dates in the month remaining including the date entered as a variable. The last month must go up to the day before exactly a year in front.
    I have created the 12 months as a structure and can include the key figure and the schedule line delivery date. The schedule line delivery date for each period needs to be restricted. How can I do this to achieve the above?
    Thanks in advance. Will assign good points for a speedy solution.
    Best
    Steve.

    Hi,
        Check "OVLY" and "OVLZ" and If the sceduling is active for he shipping point /sales document type.  Check "OVXD" and see If the Loading time/ Pick/pack time is determined from it. If they are getting determined from shipping point check the shipping point calender in "SCAL" .If it has saturday and sunday as holidays ,then you may have to change them. And check If the customer has goods recieving hours assigned to him (In customer master unloading point). If he has only 5 working days and If he accepts only goods at 8 am in the morining then system would propose like this.Kindly please let me know If you need any more Information on this.
    Regards
    Ram Pedarla

  • How to Restrict Single Delivery Date for PO with Multiple Line Items

    Dear Experts,
    How to Restrict Single Delivery Date for PO with Multiple Line Items.
    System needs to through Error Message if User Inputs Different Delivery Dates for PO with Multiple Line Items in ME21N Tcode.
    Can we achive this by Some Enhancement in SAP or Not ???
    If so how to do it.
    Any Inputs is highly appreciated.
    Thanks and Regards,
    Selvakumar. M

    Hi Selvakumar,
    we can resrict the PO to have a single delivery date in all the line items by means of giving a error message or overwiting the delivery date keyed/determined in the line item.
    You can use the BADI -> ME_PROCESS_PO_CUST. In which you need to implement the method PROCESS_SCHEDULE.
    (for technical aid - This method will be called for each and every PO line item, From the imporing parameter im_schedule we can get all the details of current PO line, even we can change the data in the current PO line. )
    Regards,
    Madhu.

  • Delivery date for forwarder and plant

    Hi Gurus,
    I have got one issue, the description provided for me is "We have delivery date plant, and delivery date forwarder, but in case we use one lead time, should only delivery date plant showed in form." Could any body help me out in this regard.
    Please reply me if you need any further information.
    warm regards
    Sridhar B

    Yeah got ur point i was mapping the table configuaration for ur reference.
    This grouping is supposed to make sure that all materials are delievered at the same Date (VBEP-EDATU) and must use the last date in the delivery group.
    say materials  X -- DELIVERY DATE  20 12 2006
                         Y -- DELIVERY DATE  27 12 2006
    so the matnrs are avalaible in VBAP along with  for the VBELN and POSNR values now pick the delivery date for this material from VBEP   ,,
    Now once the itab is sorted by delivery group  and EDATU descending .
    so X and Y are present in for delivery group 001 say .
    X -- DELIVERY DATE  20 12 2006
    Y-- DELIVERY DATE  27 12 2006
    after sort by date it will be
    Y-- DELIVERY DATE  27 12 2006
    X -- DELIVERY DATE  20 12 2006
    which will pick up the latest date (or max date)
    Tis was what i meant to say.
    what is the incude you r using ?
    regards,
    vijay

  • Delivery Date for Purchase Order

    Experts,
    which table contains the delivery date for a Purchase Order (NB). ?
    Thanks in advance
    Jörg

    Dear
    Try SAP Table : EKET-EINDT
    Check also EKPO , EORD,EKKO
    Regards
    JH
    Edited by: Jiaul Haque on Aug 28, 2010 10:09 AM

  • Delivery Date for PR in Sales Order

    Dear All,
    We have a case where Sales order will trigger a Purchase requisition when the Material is non-stock.
    But when looking at the Delivery date for the Purchase Requisition in the Sales order, the delivery date is always the creation date, which is incorrect, the correct date should be calculate based on the planned delivery date in the material master.
    Sales Order--> schedule lines --> Purchase Requisition
    Thank you very much,
    Regards,
    Chee Wee

    Dear Ravi,
    Sorry, i did a tried to convert a PR into a PO, and which PR was triggered from SO.
    The delivery date in the PO still the SO creation date, which is the same as the PR delivery date.
    Can you please advice?
    Thank you very much,
    Regards,
    CheeWee

  • ME2N - Delivery date for Standard PO

    Hi
    This is my first time here and I am new to SAP ERP. So, if my question sounds too naive, please bear with me for a few days until I find my feet.
    Is it possible to add Delivery Date of Standard POs to ME2N. I looked at both basic list view and account assignment view and am not able to figure out how I can add this
    Thanks

    Hi MBKM
    Thanks for your quick response. But I don't see a column name 'goods delivery date' in the list of column names. When I run ME23N, i see the delivery date as 08.09.09 and statistical delivery date as 08.09.09. PO release date is 02.09.09
    While I can see the PO release date in ME2N, I am not able to see any column that can give me the delivery date/statistical delivery date for all Standard POs listed in my ME2N.
    Thanks

  • Incorrect delivery date for third party sales order

    Hi,
    When I create a Third party sales order, the delivery date refers as todayu2019s dates, but when I save the order the same is getting copied in to Purchase requisition and subsequently to Purchase Order and is not recalculating based on the Planned Delivery time maintained in the Purchase Info Record.
       Is there any configuration setting to enable re determine the delivery date in PR?
    Regards
    Raj

    Hey babu,
    I understand ur problem. First check that you have maintained all the time durations that would be taken into consideration when the sales order will do the scheduling. E.g.
    !) GR processing time
    2) Planned delivery time
    3) Purchase dept processing time ... etc
    Now you need to check if scheduling is taking place on the sales order. That means, does it show you the date that can be confirmed for delivering that 3rd party item when you press enter after entering its material number and the order quantity.
    1) If yes you need to check the box that says  "Fix time/quantity" on the availability check screen that pops up when you place the order.
    Now the system will pass this new scheduled date to the production order, but it will show the requested date as the one determined from the lead time in the order type. so no need to worry.
    also if it is not showing you the availability check screen and automatically using a date scheduled in the future based on the values you set in PIR, in that case yo need to go to the item details > schedule lines > and check the box that says "Fix time/quantity" for that 3rd party materials and the confirmed date will be passed to the PO automatically.
    2) If no then you have to make sure that availability check is turned on for that material and then try placing the order.
    Regards,
    Vinit Parkar

  • Getting delivery date for material number i PO...

    Hi,
    I am Smartform associated with PO in ME22N:
    Now I need to get the delivery date associated with Differnet Grid items in a material.
    So if I go to some material and then if I click on Delivery schedule:
    I see columns for delivery date, sat. del da, Grid value, etc...
    But I want to know the table or function module we need to use to get Delivery date associated with
    prticular Grid item of a material in PO.
    Please help me out.
    Thanks.
    Regards,
    Ramesh.

    Hi ,
    Check out for BAPI_PO_GETDETAIL.
    In this BAPI,
    fill parameters : PURCHASEORDER with PO number
                      ITEMS with 'X'
                      SCHEDULES with 'X'
    Then in tables PO_ITEMS you will get Item details and
    in table <b>PO_ITEM_SCHEDULES</b> you will get required details like delivery date
    Hope this helps.
    Regards,
    Akshay Bhagwat

  • Calculation delivery date for items

    Hello,
    I am looking for the option to set a delivery date calculation in master data so this will be automatically calculated in sales and purchase documents.
    The only thing that comes remotely close is the 'Lead Time' in tab 'Planning Data' but this will only be used in MRP runs.
    I want to set per Business Partner and/or Item a delivery date calculation. For instance it will take 5 (working) days before the item will be delivered. Therefore when entering a PO it will update the delivery date automatically from today plus 5 days.
    Same will go for the SO calculating the delivery date if there is no stock from the set delivery date calculation.
    It seems I have to set this up myself via UDF's with queries?!
    Kind regards,
    Petronella

    If the lead time is always the same length for the item irrespective of the BP then you could store this in an UDF on the item master. 
    If the lead time is per BP then it can be an UDF on the BP Master data.  However if its a matrix of per BP and Item then you can do this by creating a user defined table. 
    I have done something similar to this, a few quick pointers would be:
    Create User Defined Table (eg. @Leadtime)
    Add 3 user defined fields to the table, CardCode, ItemCode and Leadtime
    Open up the table and add a formatted search to the BP Code UDF (e.g. Select t0.CardCode, t0.CardName from OCRD t0 where t0.CardType = 'C')
    add a formatted search to the Item Number UDF (select t0.ItemCode from OITM t0)
    Add a UDF on the marketing document lines called Leadtime.
    Add a formatted search to the leadtime field (select T0.[U_Leadtime] FROM [dbo].[@Leadtime] T0 Where T0.[U_BPCode] = $[$4.CardCode] AND T0.[U_ItemCode] = $[$38.1.0])
    That should pull through the leadtime based on the BP and Item on the marketing document, you will then need to add a formatted search to the delivery date field on the rows by picking up the document date and adding the leadtime UDF days to it.  I'm afraid I don't have SBO open and I can't remember the variable for picking up the document date, you can find this out by clicking View | System Information.  To pick up the leadtime udf it will be $[$38.U_leadtime.0] i think.
    Regards,

  • Different Delivery dates for single material in sale order

    Dear All
                  I had a problem while creating a sale order, our customer orders a material for 100 SETS, but he needs 30 SETS On 30th July 2010 and remaining on 31st Aug 2010,
    how to mention the delivery dates in sale order, like for 30 SETS delivery date : 30.07.2010 and other 70 SETS Delivery Date : 31.08.2010.
    Thanks & Regards
    Maheshwar Rao. G
    Edited by: mahesh21973 on Jul 2, 2010 9:08 AM

    Hi,
    Maintain in sales order (VA01/VA02)Item details --> schedule lines enter the Qty with Delivery dates.
    SAM

Maybe you are looking for

  • Airport extreme configuration problem with Netgear DG834PN

    Good morning, I have a problem. I bought an AEBS via the WAN port to connect to my Netgear DG834PN. I turned off the WiFi on the Netgear, I connected the AEBS in bridge mode, but with the iMac and other iDevice there are no problems. On the contrary

  • Officejet 7000 E809a driver doesn't download in mac os 10.8

    1. Product: HP Officejet 7000 E809a 2. Operating system: Mac OS 10.8.1 3. printer initially worked fine, then began to print only blank pages. an attempt to delete/re-install the driver resulted in the following errror message (upon attempting to dow

  • I am no longer able to resize my firefox window horizontally, any ideas?

    I noticed earlier that I can no longer resize my firefox window horizontally, the border seems to have disappeared. I've searched, using google and various other sites to find a solution to this and I'm coming up short. I've tried multiple things, sa

  • Click on Add (plus) button, but nothing happens

    Hi, When I insert a new star point, end point, singal in, or signal out, and I want to add/remove fields, clicking on the Ad(plus)/Remove(minus) button, nothing happens. I mean, the popup window where I enter the names and types of the fields never s

  • Installating Oracle 10g Developer Suite (most urgent)

    Dear All, I have downloaded ORacle IDS 10g from Oracle web site and tring to install on my win2003 Server. when i click Setup.exe file it give me error message 'Fatal Error' pl.give me an prior to installation instruction that i follow, regards