Skip to Content
avatar image
Former Member

ALV's

In ALV reports i have to include check boxes on each line and on selecting a particular check box i need to get that respective secondary list with further details

how can we acheive this task.

good points will be rewarded according.

Thanks

PV

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 05:33 PM

    Hi,

    Why u want to put check box.

    You can put a HOTSPOT on particular column usinf field-catelog.

    If you click on that field by using i_usercommand or i_call back at line selection is there in FM reuse_alv_grid_display.

    Right now i am not on the system to give in depth details.

    Thanks,

    Deepak.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 05:34 PM

    Hi,

    Please refer this link...

    check-box-in-alv

    Thanks,

    Yogesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 06:11 PM

    ALV with check boxes

    REPORT ZTESTPRG .

    ************************************************************************

    • TABLES AND DATA DECLARATION.

    ************************************************************************

    *TABLES: mara,makt.",marc.

    data syrepid like sy-repid.

    data sydatum(10). " LIKE sy-datum.

    data sypagno(3) type n.

    • WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE

    • GROUP (TYPE-POOLS--------->SLIS)

    type-pools : slis.

    ************************************************************************

    • INTERNAL TABLE DECLARATION.

    ************************************************************************

    • INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE

    data: begin of t_mara occurs 0,

    matnr like mara-matnr,

    meins like mara-meins,

    mtart like mara-mtart,

    matkl like mara-matkl,

    end of t_mara.

    • INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE

    data : begin of t_marc occurs 0,

    matnr like mara-matnr,

    werks like marc-werks,

    minbe like marc-minbe.

    data: end of t_marc.

    • INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.

    data : begin of t_makt occurs 0,

    matnr like mara-matnr,

    maktx like makt-maktx,

    spras like makt-spras,

    end of t_makt.

    • INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.

    data: begin of itab1 occurs 0,

    chkbox(1) type c,

    matnr like mara-matnr,

    meins like mara-meins,

    maktx like makt-maktx,

    spras like makt-spras,

    werks like marc-werks,

    minbe like marc-minbe,

    end of itab1.

    • THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT

    • AND THE LAYOUT FOR THE ALV.

    • HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE

    • WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT

    • OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.

    • THIS IS DONE TO MAKE THE CODE SIMPLER.

    • OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP

    • PROGRAMS.

    • IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR

    • MORE TABLES AND CREATE A STRUCTURE

    • IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS

    • LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.

    data: fieldcatalog type slis_t_fieldcat_alv with header line,

    fieldlayout type slis_layout_alv.

    • DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE

    • TOP-OF-PAGE ETC.

    data : eventstab type slis_t_event with header line.

    • DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE

    data : heading type slis_t_listheader with header line.

    data : heading1 type slis_t_listheader with header line.

    data : heading2 type slis_t_listheader with header line.

    data : heading3 type slis_t_listheader with header line.

    data : heading4 type slis_t_listheader with header line.

    data : heading5 type slis_t_listheader with header line.

    data : heading6 type slis_t_listheader with header line.

    data : heading7 type slis_t_listheader with header line.

    data : heading8 type slis_t_listheader with header line.

    • STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.

    data : colorstruct type slis_coltypes.

    ************************************************************************

    • INITIALIZATION. *

    ************************************************************************

    initialization.

    syrepid = sy-repid.

    sypagno = sy-pagno.

    clear fieldcatalog.

    ************************************************************************

    • START-OF-SELECTION. *

    ************************************************************************

    start-of-selection.

    • SUBROUTINE TO POPULATE THE COLORSTRUCT

    perform fill_colorstruct using colorstruct.

    • SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE

    perform populate_fieldcatalog.

    • SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE

    • INTERNAL TABLE.

    perform selectdata_and_sort.

    • SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.

    perform populate_layout using fieldlayout.

    • SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.

    perform merge_fieldcatalog.

    • SUBROUTINE TO POPULATE THE EVENTSTAB.

    perform fill_eventstab tables eventstab.

    • SUBROUTINE TO POPULATE THE HEADING TABLES.

    perform fill_headingtable tables heading using 'HEADING'.

    perform fill_headingtable tables heading1 using 'HEADING1'.

    perform fill_headingtable tables heading2 using 'HEADING2'.

    perform fill_headingtable tables heading3 using 'HEADING3'.

    perform fill_headingtable tables heading4 using 'HEADING4'.

    perform fill_headingtable tables heading5 using 'HEADING5'.

    perform fill_headingtable tables heading6 using 'HEADING6'.

    perform fill_headingtable tables heading7 using 'HEADING7'.

    perform fill_headingtable tables heading8 using 'HEADING8'.

    • SUBROUTINE TO DISPLAY THE LIST.

    perform display_alv_list.

    ************************************************************************

    • FORMS

    ************************************************************************

    • IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES

    • OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND

    • COLUMN JUSTIFICATION.

    form populate_fieldcatalog.

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'MATNR' 'X' .

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'MEINS' ' '.

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'MAKTX' ' ' .

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'MTART' ' ' .

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'MATKL' ' ' .

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'SPRAS' ' ' .

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'WERKS' ' ' .

    perform fill_fields_of_fieldcatalog tables fieldcatalog

    using 'ITAB1' 'MINBE' ' ' .

    endform. " POPULATE_FIELDCATALOG

    ----


    • FORM FILL_FIELDS_OF_FIELDCATALOG *

    ----


    • ........ *

    ----


    • --> FIELDCATALOG *

    • --> P_TABNAME *

    • --> P_FIELDNAME *

    • --> P_KEY *

    • --> P_KEY *

    ----


    form fill_fields_of_fieldcatalog tables fieldcatalog

    structure fieldcatalog

    using p_tabname

    p_fieldname

    p_key.

    • p_no_out.

    fieldcatalog-tabname = p_tabname.

    fieldcatalog-fieldname = p_fieldname.

    fieldcatalog-key = p_key.

    fieldcatalog-emphasize = '1234'.

    *fieldcatalog-no_out = p_no_out.

    append fieldcatalog.

    endform. " FILL_FIELDSOFFIELDCATALOG

    ----


    • FORM POPULATE_LAYOUT *

    ----


    • ........ *

    ----


    • --> FIELDLAYOUT *

    ----


    form populate_layout using fieldlayout type slis_layout_alv.

    fieldlayout-f2code = '&ETA' .

    fieldlayout-zebra = 'X'.

    • FOR THE WINDOW TITLE.

    fieldlayout-window_titlebar = 'ALV with Events'.

    fieldlayout-colwidth_optimize = 'X'.

    fieldlayout-no_vline = ' '.

    *fieldlayout-no_input = 'X'.

    fieldlayout-confirmation_prompt = ''.

    fieldlayout-key_hotspot = 'X'.

    • This removes the column headings if the flag is set to 'X'

    fieldlayout-no_colhead = ' '.

    *fieldlayout-hotspot_fieldname = 'MAKTX'.

    fieldlayout-detail_popup = 'X'.

    • fieldlayout-coltab_fieldname = 'X'.

    fieldlayout-box_fieldname = 'CHKBOX'.

    fieldlayout-edit_mode = 'X'.

    endform. " POPULATE_LAYOUT

    ----


    • FORM SELECTDATA_AND_SORT *

    ----


    • ........ *

    ----


    form selectdata_and_sort.

    select matnr meins mtart matkl from mara

    into corresponding fields of t_mara

    up to 500 rows .

    select matnr maktx spras from makt

    into corresponding fields of t_makt

    where matnr = t_mara-matnr and

    spras = sy-langu.

    select matnr werks minbe from marc

    into corresponding fields of t_marc

    where matnr = t_mara-matnr.

    append t_marc.

    endselect.

    append t_makt.

    endselect.

    append t_mara.

    endselect.

    perform populate_itab1.

    sort itab1 by matnr.

    endform. " SELECTDATA_AND_SORT

    ----


    • FORM MERGE_FIELDCATALOG *

    ----


    • ........ *

    ----


    form merge_fieldcatalog.

    call function 'REUSE_ALV_FIELDCATALOG_MERGE'

    exporting

    i_program_name = syrepid

    i_internal_tabname = 'ITAB1'

    • i_structure_name = 'COLORSTRUCT'

    • I_CLIENT_NEVER_DISPLAY = 'X'

    i_inclname = syrepid

    changing

    ct_fieldcat = fieldcatalog[]

    exceptions

    inconsistent_interface = 1

    program_error = 2

    others = 3.

    endform. " MERGE_FIELDCATALOG

    • IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS

    • FOLLOWS:-

    • i_callback_program --> CALLING PROGRAM NAME

    • i_structure_name --> STRUCTURE NAME.

    • is_layout --> LAYOUT NAME.

    • it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE

    form display_alv_list.

    call function 'REUSE_ALV_LIST_DISPLAY'

    exporting

    • I_INTERFACE_CHECK = ' '

    i_callback_program = syrepid

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    i_structure_name = 'ITAB1'

    is_layout = fieldlayout

    it_fieldcat = fieldcatalog[]

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD

    • TOOL BAR

    i_save = 'A'

    • IS_VARIANT = ' '

    it_events = eventstab[]

    • IT_EVENT_EXIT =

    • IS_PRINT =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    tables

    t_outtab = itab1

    exceptions

    program_error = 1

    others = 2.

    endform. " DISPLAY_ALV_LIST

    &----


    *& Form POPULATE_ITAB1

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form populate_itab1.

    loop at t_mara.

    loop at t_makt where matnr = t_mara-matnr.

    loop at t_marc where matnr = t_mara-matnr.

    move-corresponding t_mara to itab1.

    move-corresponding t_makt to itab1.

    move-corresponding t_marc to itab1.

    append itab1.

    endloop.

    endloop.

    endloop.

    endform. " POPULATE_ITAB1

    &----


    *& Form FILL_EVENTSTAB

    &----


    • text

    ----


    • -->P_EVENTSTAB text *

    ----


    form fill_eventstab tables p_eventstab structure eventstab.

    • WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE

    • INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.

    • AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14

    • EVENTS NAME.

    call function 'REUSE_ALV_EVENTS_GET'

    exporting

    i_list_type = 0

    importing

    et_events = p_eventstab[]

    exceptions

    list_type_wrong = 1

    others = 2.

    • BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH

    • THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.

    • WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.

    • FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM

    • IS DYNAMICALY CALLED.

    read table p_eventstab with key name = slis_ev_top_of_page.

    if sy-subrc = 0 .

    move 'TOP_OF_PAGE' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_top_of_coverpage.

    if sy-subrc = 0 .

    move 'TOP_OF_COVERPAGE' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_end_of_coverpage .

    if sy-subrc = 0 .

    move 'END_OF_COVERPAGE' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_foreign_top_of_page.

    if sy-subrc = 0 .

    move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_foreign_end_of_page.

    if sy-subrc = 0 .

    move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_list_modify.

    if sy-subrc = 0 .

    move 'LIST_MODIFY' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_top_of_list.

    if sy-subrc = 0 .

    move 'TOP_OF_LIST' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_end_of_page.

    if sy-subrc = 0 .

    move 'END_OF_PAGE' to p_eventstab-form.

    append p_eventstab.

    endif.

    read table p_eventstab with key name = slis_ev_end_of_list .

    if sy-subrc = 0 .

    move 'END_OF_LIST' to p_eventstab-form.

    append p_eventstab.

    endif.

    endform. " FILL_EVENTSTAB

    &----


    *& Form FILL_HEADINGTABLE

    &----


    • text

    ----


    • -->P_HEADING text *

    ----


    form fill_headingtable tables p_heading structure heading

    using tablename.

    case tablename.

    when 'HEADING'.

    p_heading-typ = 'H'.

    concatenate

    ' REPORT NAME:-' syrepid

    ' ABB Industry Pte Ltd' into p_heading-info.

    append p_heading.

    write sy-datum using edit mask '__/__/____' to sydatum.

    concatenate

    ' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno

    into p_heading-info.

    append p_heading.

    when 'HEADING1'.

    p_heading-typ = 'H'.

    p_heading-info = 'TOP-OF-COVER-PAGE'.

    append p_heading.

    when 'HEADING2'.

    p_heading-typ = 'H'.

    p_heading-info = 'END-OF-COVER-PAGE'.

    append p_heading.

    when 'HEADING3'.

    p_heading-typ = 'H'.

    p_heading-info = 'FOREIGN-TOP-OF-PAGE'.

    append p_heading.

    when 'HEADING4'.

    p_heading-typ = 'H'.

    p_heading-info = 'FOREIGN-END-OF-PAGE'.

    append p_heading.

    • WHEN 'HEADING5'.

    • P_HEADING-TYP = 'H'.

    • P_HEADING-INFO = 'LIST-MODIFY'.

    • APPEND P_HEADING.

    when 'HEADING6'.

    p_heading-typ = 'H'.

    p_heading-info = 'END-OF-PAGE'.

    append p_heading.

    when 'HEADING7'.

    p_heading-typ = 'H'.

    p_heading-info = 'END-OF-LIST'.

    append p_heading.

    when 'HEADING8'.

    p_heading-typ = 'H'.

    p_heading-info = 'TOP-OF-LIST'.

    append p_heading.

    endcase.

    endform. " FILL_HEADINGTABLE

    ----


    • FORM TOP_OF_PAGE *

    ----


    • ........ *

    ----


    form top_of_page.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading[]

    exceptions

    others = 1.

    endform.

    &----


    *& Form FILL_COLORSTRUCT

    &----


    • text

    ----


    • -->P_COLORSTRUCT text *

    ----


    form fill_colorstruct using p_colorstruct type slis_coltypes .

    p_colorstruct-heacolfir-col = 6.

    p_colorstruct-heacolfir-int = 1.

    p_colorstruct-heacolfir-inv = 1.

    endform. " FILL_COLORSTRUCT

    ----


    • FORM TOP_OF_COVERPAGE *

    ----


    • ........ *

    ----


    form top_of_coverpage.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading1[]

    exceptions

    others = 1.

    endform.

    ----


    • FORM END_OF_COVERPAGE *

    ----


    • ........ *

    ----


    form end_of_coverpage.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading2[]

    exceptions

    others = 1.

    endform.

    ----


    • FORM FOREIGN_TOP_OF_PAGE *

    ----


    • ........ *

    ----


    form foreign_top_of_page.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading3[]

    exceptions

    others = 1.

    endform.

    ----


    • FORM FOREIGN_END_OF_PAGE *

    ----


    • ........ *

    ----


    form foreign_end_of_page.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading4[]

    exceptions

    others = 1.

    endform.

    ----


    • FORM LIST_MODIFY *

    ----


    • ........ *

    ----


    *FORM LIST_MODIFY.

    • CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    • EXPORTING

    • IT_LIST_COMMENTARY = HEADING5[]

    • EXCEPTIONS

    • OTHERS = 1.

    *ENDFORM.

    ----


    • FORM END_OF_PAGE *

    ----


    • ........ *

    ----


    form end_of_page.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading6[]

    exceptions

    others = 1.

    endform.

    ----


    • FORM END_OF_LIST *

    ----


    • ........ *

    ----


    form end_of_list.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading7[]

    exceptions

    others = 1.

    endform.

    ----


    • FORM TOP_OF_LIST *

    ----


    • ........ *

    ----


    form top_of_list.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = heading8[]

    exceptions

    others = 1.

    endform.

    *--- End of Program

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 07:22 PM

    Hi,

    find the below code which suits your requirement.

    ************************************************************************

    • *

    • PROGRAM NAME: ZPP_ALV_CHECKBOXES *

    • *

    • DESCRIPTIONS: PP Ticket#XXXXX Mixing Recipe *

    • *

    • DATE : 05/12/2007 *

    • *

    • AUTHOR : IGROUP(RAMESH MAVILLA) *

    • *

    ************************************************************************

    ************************************************************************

    • Date Programmer Task # Description *

    • -------- ------------- -------- ----------------------------- *

    • 05/12/2007 RAMESH MAVILLA DEVK928402 INITIAL *

    • (IGROUP) *

    ************************************************************************

    REPORT ZPP38

    NO STANDARD PAGE HEADING LINE-COUNT 30(5)

    MESSAGE-ID ZMR.

    TYPE-POOLS:SLIS.

    ************************************************************************

    • T A B L E S *

    ************************************************************************

    TABLES: AFKO, " Order Header

    AFPO, " Order Item

    AUFK, " Order Master

    RESB, " Reservation/dependent requirements

    AFVC, " Order Operation w/i an Order

    CRHD, " Work Center

    MARA, " Material Master

    MAKT, " Material Description

    PLFL, " Task list - sequences

    JEST. " Individual Object Status

    ************************************************************************

    • T Y P E S *

    ************************************************************************

    TYPES:BEGIN OF T_AFKO,

    • CHECK, " Selection

    AUFNR TYPE AFKO-AUFNR, " Production order

    GLTRP TYPE AFKO-GLTRP, " Basic finish date

    GSTRP TYPE AFKO-GSTRP, " Basic start date

    GAMNG TYPE AFKO-GAMNG, " Total order quantity

    GMEIN TYPE AFKO-GMEIN, " Base Unit of Measure

    PLNBEZ TYPE AFKO-PLNBEZ, " Material Number

    AUFPL TYPE AFKO-AUFPL, " Routing no. of oper's in the order

    END OF T_AFKO.

    TYPES:BEGIN OF T_CRHD,

    OBJID TYPE CRHD-OBJID, " Object ID of the resource

    ARBPL TYPE CRHD-ARBPL, " Work Center

    END OF T_CRHD.

    TYPES:BEGIN OF T_AFVC,

    AUFPL TYPE AFVC-AUFPL, " Routing no. of oper's in the order

    PLNFL TYPE AFVC-PLNFL, " Sequence

    VORNR TYPE AFVC-VORNR, " Operation/Activity Number

    ARBID TYPE AFVC-ARBID, " Object ID of the resource

    OBJNR TYPE AFVC-OBJNR, " Object number

    END OF T_AFVC.

    *TYPES:BEGIN OF T_AFVC1,

    • AUFPL TYPE AFVC-AUFPL, " Routing no. of oper's in the order

    • PLNFL TYPE AFVC-PLNFL, " Sequence

    • VORNR TYPE AFVC-VORNR, " Operation/Activity Number

    • ARBID TYPE AFVC-ARBID, " Object ID of the resource

    • OBJNR TYPE AFVC-OBJNR, " Object number

    • END OF T_AFVC1.

    TYPES:BEGIN OF T_AFKO1,

    AUFNR TYPE AFKO-AUFNR,

    AUFPL TYPE AFKO-AUFPL,

    END OF T_AFKO1.

    DATA:I_AFKO1 TYPE STANDARD TABLE OF T_AFKO1,

    W_AFKO1 LIKE LINE OF I_AFKO1.

    TYPES:BEGIN OF T_AFVC1,

    AUFPL TYPE AFVC-AUFPL,

    PLNFL TYPE AFVC-PLNFL,

    VORNR TYPE AFVC-VORNR,

    ARBID TYPE AFVC-ARBID,

    END OF T_AFVC1.

    DATA:I_AFVC1 TYPE STANDARD TABLE OF T_AFVC1,

    W_AFVC1 LIKE LINE OF I_AFVC1.

    TYPES:BEGIN OF T_ITEM,

    MATNR TYPE RESB-MATNR, " Component Matl Number

    MAKTX TYPE MAKT-MAKTX, " Matl Desc for Component

    BDMNG TYPE RESB-BDMNG, " Component Req'd Qty

    END OF T_ITEM.

    TYPES:BEGIN OF T_RESB,

    MATNR TYPE RESB-MATNR, " Component Matl Number

    BDMNG TYPE RESB-BDMNG, " Matl Desc for Component

    MEINS TYPE RESB-MEINS, " Base Unit of Measure

    AUFNR TYPE RESB-AUFNR, " Production order

    AUFST TYPE RESB-AUFST, " Order level

    AUFWG TYPE RESB-AUFWG, " Order Path

    DUMPS TYPE RESB-DUMPS, " Phantom indicator

    END OF T_RESB.

    TYPES:BEGIN OF T_RESBS,

    MATNR TYPE RESB-MATNR, " Phantom material

    PLNFL TYPE RESB-PLNFL, " Sequence

    VORNR TYPE RESB-VORNR, " Operation/Activity Number

    AUFNR TYPE RESB-AUFNR, " Production order no

    END OF T_RESBS.

    TYPES:BEGIN OF T_AUFK,

    AUFNR TYPE AUFK-AUFNR, " Poduction order no

    AUART TYPE AUFK-AUART, " Order type

    OBJID TYPE AUFK-OBJID, " Object ID

    END OF T_AUFK.

    TYPES:BEGIN OF T_HHEADER,

    MATNR TYPE RESB-MATNR, " Phantom material

    MAKTX TYPE MAKT-MAKTX, " Phantom material description

    V_QTY TYPE AFKO-GAMNG, " Total batch quantity

    GMEIN TYPE AFKO-GMEIN, " Unit for total batch quantity

    END OF T_HHEADER.

    TYPES:BEGIN OF T_HITEM,

    CHECK,

    MATNR TYPE RESB-MATNR, " Phantom material

    AUFNR TYPE AFKO-AUFNR, " Production order

    • GAMNG TYPE AFKO-GAMNG, " Production order quantity

    BDMNG TYPE RESB-BDMNG,

    GMEIN TYPE AFKO-GMEIN, " Base unit for the P.O quantity

    PLNBEZ TYPE AFKO-PLNBEZ, " Production order header material

    MAKTX TYPE MAKT-MAKTX, " PO header material description

    GLTRP TYPE AFKO-GLTRP, " Order basic start date

    GSTRP TYPE AFKO-GSTRP, " Order basic finish date

    END OF T_HITEM.

    TYPES:BEGIN OF T_MHEAD,

    PHANTA TYPE RESB-MATNR, " Phantom material for mixing report

    MAKTX TYPE MAKT-MAKTX, " Phantom material description

    V_QTY TYPE AFKO-GAMNG, " Phantom material quantity

    GMEIN TYPE AFKO-GMEIN, " Base unit of measure

    ARBPL TYPE CRHD-ARBPL, " Work Center

    END OF T_MHEAD.

    TYPES:BEGIN OF T_MITEM,

    PHANTA TYPE RESB-MATNR, " Phantom material

    MATNR TYPE RESB-MATNR, " Component material

    MAKTX TYPE MAKT-MAKTX, " Component material description

    BDMNG TYPE RESB-BDMNG, " Component mat cumilative quantity

    MEINS TYPE RESB-MEINS, " Unit for the quantity

    CHECK1, " Selection for the user

    END OF T_MITEM.

    TYPES:BEGIN OF T_AFKOS,

    AUFNR TYPE AFKO-AUFNR, " Order no. for mixing recipe

    AUFPL TYPE AFKO-AUFPL, " Operation no for mixing recipe

    END OF T_AFKOS.

    TYPES:BEGIN OF T_AFVCS,

    AUFPL TYPE AFVC-AUFPL, " Routing no. of oper's in the order

    PLNFL TYPE AFVC-PLNFL, " Sequence

    END OF T_AFVCS.

    TYPES:BEGIN OF T_MTOP,

    PLNFL TYPE AFVC-PLNFL, " Sequence

    VORNR TYPE AFVC-VORNR, " Operation/Activity Number

    AUFNR TYPE AFKO-AUFNR, " Production order no

    MATNR TYPE RESB-MATNR, " Phantom Material

    END OF T_MTOP.

    TYPES:BEGIN OF T_RESBX,

    MATNR TYPE RESB-MATNR, " Component material

    BDMNG TYPE RESB-BDMNG, " Component mat quantity

    AUFNR TYPE RESB-AUFNR, " Production order no

    AUFST TYPE RESB-AUFST, " Order level

    AUFWG TYPE RESB-AUFWG, " Order path

    END OF T_RESBX.

    ************************************************************************

    • I N T E R N A L T A B L E S *

    ************************************************************************

    DATA:I_AFKO TYPE STANDARD TABLE OF T_AFKO,

    W_AFKO LIKE LINE OF I_AFKO.

    DATA:I_CRHD TYPE STANDARD TABLE OF T_CRHD,

    W_CRHD LIKE LINE OF I_CRHD.

    DATA:I_AFVC TYPE STANDARD TABLE OF T_AFVC,

    W_AFVC LIKE LINE OF I_AFVC.

    *DATA:I_AFVC1 TYPE STANDARD TABLE OF T_AFVC1,

    • W_AFVC1 LIKE LINE OF I_AFVC1.

    DATA:I_RESB TYPE STANDARD TABLE OF T_RESB,

    W_RESB LIKE LINE OF I_RESB.

    DATA:I_RESBS TYPE STANDARD TABLE OF T_RESBS WITH HEADER LINE,

    W_RESBS LIKE LINE OF I_RESBS.

    DATA:I_MAKT TYPE STANDARD TABLE OF MAKT,

    W_MAKT LIKE LINE OF I_MAKT,

    I_MAKT1 TYPE STANDARD TABLE OF MAKT,

    W_MAKT1 LIKE LINE OF I_MAKT1.

    DATA:I_JEST TYPE STANDARD TABLE OF JEST,

    W_JEST LIKE LINE OF I_JEST,

    I_JEST1 TYPE STANDARD TABLE OF JEST,

    W_JEST1 LIKE LINE OF I_JEST1,

    I_JEST11 TYPE STANDARD TABLE OF JEST,

    W_JEST11 LIKE LINE OF I_JEST11.

    DATA:I_AUFK TYPE STANDARD TABLE OF T_AUFK,

    W_AUFK LIKE LINE OF I_AUFK.

    DATA:I_MHEAD TYPE STANDARD TABLE OF T_MHEAD,

    W_MHEAD LIKE LINE OF I_MHEAD.

    DATA:I_MITEM TYPE STANDARD TABLE OF T_MITEM,

    W_MITEM LIKE LINE OF I_MITEM.

    DATA:I_AFVCS TYPE STANDARD TABLE OF T_AFVCS,

    W_AFVCS LIKE LINE OF I_AFVCS,

    I_SHEAD TYPE STANDARD TABLE OF T_AFVCS,

    W_SHEAD LIKE LINE OF I_SHEAD.

    DATA:I_MTOP TYPE STANDARD TABLE OF T_MTOP WITH HEADER LINE,

    W_MTOP LIKE LINE OF I_MTOP.

    DATA:I_RESBX TYPE STANDARD TABLE OF T_RESBX,

    W_RESBX LIKE LINE OF I_RESBX.

    ****FOR PRODUCTION ORDER SELECTION SCREEN*****************************

    DATA:I_HHEADER TYPE STANDARD TABLE OF T_HHEADER,

    W_HHEADER LIKE LINE OF I_HHEADER,

    I_HHEADER1 TYPE STANDARD TABLE OF T_HHEADER,

    W_HHEADER1 LIKE LINE OF I_HHEADER1.

    DATA:I_HITEM TYPE STANDARD TABLE OF T_HITEM,

    W_HITEM LIKE LINE OF I_HITEM,

    I_HITEM1 TYPE STANDARD TABLE OF T_HITEM,

    W_HITEM1 LIKE LINE OF I_HITEM1.

    *****************CATALOG FOR MIXING REPORT****************************

    DATA:I_FLDCATALOG TYPE SLIS_T_FIELDCAT_ALV,

    W_FLDCATALOG LIKE LINE OF I_FLDCATALOG.

    DATA:I_SFLDCATALOG TYPE SLIS_T_FIELDCAT_ALV,

    W_SFLDCATALOG LIKE LINE OF I_SFLDCATALOG.

    ****FOR GETTING EVENTS INTO INTERNAL TABLE****************************

    DATA: I_EVENTS TYPE SLIS_T_EVENT,

    W_EVENTS LIKE LINE OF I_EVENTS.

    ************************************************************************

    • D A T A *

    ************************************************************************

    DATA:LINES TYPE I,

    CHECK(1),

    CHECK1(1),

    W_AMOUNT TYPE GAMNG VALUE 0,

    SYS_DATE TYPE SY-DATUM.

    **********************ALV data declarations***************************

    DATA: I_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,

    W_FIELDCATALOG LIKE LINE OF I_FIELDCATALOG,

    GD_LAYOUT TYPE SLIS_LAYOUT_ALV,

    GD_REPID LIKE SY-REPID VALUE SY-REPID,

    W_KEYINFO TYPE SLIS_KEYINFO_ALV,

    WA_SORT TYPE SLIS_SORTINFO_ALV,

    IT_SORT TYPE SLIS_T_SORTINFO_ALV,

    M_LAYOUT TYPE SLIS_LAYOUT_ALV,

    M_KEYINFO TYPE SLIS_KEYINFO_ALV,

    P_SELFIELD TYPE SLIS_SELFIELD,

    W_PRINT TYPE SLIS_PRINT_ALV1.

    ************************************************************************

    • S E L E C T - O P T I O N S / P A R A M E T E R S *

    ************************************************************************

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    PARAMETERS:

    P_WERKS TYPE AUFK-WERKS OBLIGATORY MEMORY ID WRK,

    "PLANT

    P_AUART TYPE AUFK-AUART OBLIGATORY MEMORY ID AAT. "ORDER TYPE

    SELECT-OPTIONS: S_PLNBEZ FOR AFKO-PLNBEZ. "material

    PARAMETERS:

    P_ARBPL TYPE CRHD-ARBPL OBLIGATORY MATCHCODE OBJECT ZSEARCH_HELP MEMORY

    ID AGR.

    "WORK CENTER

    SELECT-OPTIONS:

    S_GSTRP FOR AFKO-GSTRP OBLIGATORY.

    "ORDER BASIC START DATE

    PARAMETERS:P_MATNR TYPE RESB-MATNR. "Phantom material

    SELECTION-SCREEN END OF BLOCK B1.

    ************************************************************************

    • I N I T I A L I Z A T I O N *

    ************************************************************************

    INITIALIZATION.

    SYS_DATE = SY-DATUM.

    ****BUILDING FIELD CATALOG.

    PERFORM BUILD_FIELDCATALOG.

    ****BUILDING LAYOUT FOR THE HIERSEQ LIST(PRODUCTION ORDERS SELECTION)

    PERFORM BUILD_LAYOUT.

    ****GETTING EVENTS FOR THE HIERSEQ LIST(PRODUCTION ORDERS SELECTION)

    PERFORM GET_EVENTS.

    ************************************************************************

    • A T S E L E C T I O N - S C R E E N *

    ************************************************************************

    ******VALIDATING BASIC START DATE

    AT SELECTION-SCREEN.

    IF S_GSTRP-LOW > SYS_DATE.

    MESSAGE E000(ZMR).

    ENDIF.

    ************************************************************************

    • S T A R T - O F - S E L E C T I O N *

    ************************************************************************

    START-OF-SELECTION.

    ****GETTING DATA INTO INTERNAL TABLE.

    PERFORM GET_DATA.

    ****SORTING THE REQUIRED DATA

    PERFORM GET_VALUES.

    ************************************************************************

    • E N D - O F - S E L E C T I O N *

    ************************************************************************

    END-OF-SELECTION.

    ****TO DISPLAY THE LIST

    PERFORM DISPLAY_ALV_REPORT.

    ************************************************************************

    • F O R M S *

    ************************************************************************

    &----


    *& Form BUILD_FIELDCATALOG

    &----


    • BUILDING FIELD CATALOG.

    ----


    FORM BUILD_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '1'.

    W_FIELDCATALOG-FIELDNAME = 'MATNR'.

    W_FIELDCATALOG-TABNAME = 'I_HHEADER'.

    W_FIELDCATALOG-SELTEXT_M = 'Pha.Mat.No.'.

    W_FIELDCATALOG-OUTPUTLEN = '28'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '2'.

    W_FIELDCATALOG-FIELDNAME = 'MAKTX'.

    W_FIELDCATALOG-TABNAME = 'I_HHEADER'.

    W_FIELDCATALOG-SELTEXT_L = 'Pha.Mat.Desc.'.

    W_FIELDCATALOG-OUTPUTLEN = '40'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '3'.

    W_FIELDCATALOG-FIELDNAME = 'V_QTY'.

    W_FIELDCATALOG-TABNAME = 'I_HHEADER'.

    W_FIELDCATALOG-OUTPUTLEN = '25'.

    W_FIELDCATALOG-SELTEXT_M = 'Total.Mix.Qty.'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '4'.

    W_FIELDCATALOG-FIELDNAME = 'GMEIN'.

    W_FIELDCATALOG-TABNAME = 'I_HHEADER'.

    W_FIELDCATALOG-OUTPUTLEN = '5'.

    W_FIELDCATALOG-SELTEXT_M = 'Unit'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '1'.

    W_FIELDCATALOG-SELTEXT_S = 'Select'.

    W_FIELDCATALOG-FIELDNAME = 'CHECK'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    W_FIELDCATALOG-EDIT = 'X'.

    W_FIELDCATALOG-CHECKBOX = 'X'.

    W_FIELDCATALOG-INPUT = 'X'.

    W_FIELDCATALOG-OUTPUTLEN = '6'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '2'.

    W_FIELDCATALOG-FIELDNAME = 'AUFNR'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    W_FIELDCATALOG-SELTEXT_S = 'Order'.

    W_FIELDCATALOG-OUTPUTLEN = '12'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    *

    • CLEAR W_FIELDCATALOG.

    • W_FIELDCATALOG-COL_POS = '3'.

    • W_FIELDCATALOG-SELTEXT_M = 'PO.Qty.'(007).

    • W_FIELDCATALOG-FIELDNAME = 'GAMNG'.

    • W_FIELDCATALOG-OUTPUTLEN = '16'.

    • W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    • APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG.

    W_FIELDCATALOG-COL_POS = '3'.

    W_FIELDCATALOG-SELTEXT_M = 'Mix.Qty.'(012).

    W_FIELDCATALOG-FIELDNAME = 'BDMNG'.

    W_FIELDCATALOG-OUTPUTLEN = '17'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG.

    W_FIELDCATALOG-COL_POS = '4'.

    W_FIELDCATALOG-SELTEXT_S = 'Unit'.

    W_FIELDCATALOG-FIELDNAME = 'GMEIN'.

    W_FIELDCATALOG-OUTPUTLEN = '4'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG.

    W_FIELDCATALOG-COL_POS = '5'.

    W_FIELDCATALOG-SELTEXT_M = 'Ord.Mat.'(008).

    W_FIELDCATALOG-FIELDNAME = 'PLNBEZ'.

    W_FIELDCATALOG-OUTPUTLEN = '18'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG.

    W_FIELDCATALOG-COL_POS = '6'.

    W_FIELDCATALOG-SELTEXT_L = 'Ord.Mat.Desc.'(009).

    W_FIELDCATALOG-FIELDNAME = 'MAKTX'.

    W_FIELDCATALOG-OUTPUTLEN = '40'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '7'.

    W_FIELDCATALOG-FIELDNAME = 'GSTRP'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    W_FIELDCATALOG-SELTEXT_S = 'Basic St.'(010).

    W_FIELDCATALOG-OUTPUTLEN = '10'.

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    CLEAR W_FIELDCATALOG .

    W_FIELDCATALOG-COL_POS = '8'.

    W_FIELDCATALOG-FIELDNAME = 'GLTRP'.

    W_FIELDCATALOG-TABNAME = 'I_HITEM'.

    W_FIELDCATALOG-OUTPUTLEN = '10'.

    W_FIELDCATALOG-SELTEXT_S = 'Basic Fin.'(011).

    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.

    ENDFORM. "BUILD_FIELDCATALOG

    &----


    *& Form build_layout

    &----


    • BUILDING LAYOUT FOR THE HIERSEQ LIST(PRODUCTION ORDERS SELECTION)

    ----


    FORM BUILD_LAYOUT.

    GD_LAYOUT-ZEBRA = 'X'.

    GD_LAYOUT-HEADER_TEXT = 'PO DETAILS'.

    • GD_LAYOUT-BOX_FIELDNAME = 'CHECK'.

    W_KEYINFO-HEADER01 = 'MATNR'.

    W_KEYINFO-ITEM01 = 'MATNR'.

    ENDFORM. " BUILD_LAYOUT

    &----


    *& Form get_events

    &----


    ****GETTING EVENTS FOR THE HIERSEQ LIST(PRODUCTION ORDERS SELECTION)

    ----


    FORM GET_EVENTS.

    CLEAR : W_EVENTS, I_EVENTS[].

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = I_EVENTS.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

    INTO W_EVENTS.

    IF SY-SUBRC EQ 0.

    MOVE 'TOP_OF_PAGE' TO W_EVENTS-FORM.

    MODIFY I_EVENTS FROM W_EVENTS INDEX SY-TABIX.

    ENDIF.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND

    INTO W_EVENTS.

    IF SY-SUBRC EQ 0.

    MOVE 'SUB_USER_COMMAND' TO W_EVENTS-FORM.

    MODIFY I_EVENTS FROM W_EVENTS INDEX SY-TABIX.

    ENDIF.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_PF_STATUS_SET

    INTO W_EVENTS.

    IF SY-SUBRC EQ 0.

    MOVE 'PF_STATUS_SET' TO W_EVENTS-FORM.

    MODIFY I_EVENTS FROM W_EVENTS INDEX SY-TABIX.

    ENDIF.

    ENDFORM. "get_events

    &----


    *& Form data_retrieval

    &----


    ****GETTING DATA INTO INTERNAL TABLE.

    ----


    FORM GET_DATA.

    IF S_PLNBEZ NE ' '.

    SELECT AUFNR

    GLTRP

    GSTRP

    GAMNG

    GMEIN

    PLNBEZ

    AUFPL

    FROM AFKO INTO TABLE I_AFKO

    WHERE PLNBEZ IN S_PLNBEZ

    AND GSTRP IN S_GSTRP.

    SORT I_AFKO BY AUFNR.

    ELSE.

    SELECT AUFNR

    GLTRP

    GSTRP

    GAMNG

    GMEIN

    PLNBEZ

    AUFPL

    FROM AFKO INTO TABLE I_AFKO

    WHERE GSTRP IN S_GSTRP.

    SORT I_AFKO BY AUFNR.

    ENDIF.

    IF NOT I_AFKO[] IS INITIAL.

    SELECT AUFNR

    AUART

    OBJID

    FROM AUFK INTO TABLE I_AUFK

    FOR ALL ENTRIES IN I_AFKO

    WHERE AUFNR = I_AFKO-AUFNR

    AND AUART = P_AUART

    AND WERKS = P_WERKS.

    SORT I_AUFK BY AUFNR.

    ENDIF.

    SELECT OBJID ARBPL

    FROM CRHD INTO TABLE I_CRHD

    WHERE ARBPL = P_ARBPL.

    IF NOT I_CRHD[] IS INITIAL.

    SELECT AUFPL

    PLNFL

    VORNR

    ARBID

    OBJNR

    FROM AFVC INTO TABLE I_AFVC

    FOR ALL ENTRIES IN I_CRHD

    WHERE ARBID = I_CRHD-OBJID.

    SORT I_AFVC BY AUFPL ARBID.

    ENDIF.

    IF NOT I_AFKO[] IS INITIAL.

    LOOP AT I_AFKO INTO W_AFKO.

    READ TABLE I_AFVC INTO W_AFVC

    WITH KEY AUFPL = W_AFKO-AUFPL BINARY SEARCH.

    CHECK SY-SUBRC NE 0.

    DELETE I_AFKO.

    ENDLOOP.

    SORT I_AFKO BY AUFNR.

    IF NOT I_AFVC[] IS INITIAL.

    LOOP AT I_AFVC INTO W_AFVC.

    READ TABLE I_AFKO INTO W_AFKO

    WITH KEY AUFPL = W_AFVC-AUFPL BINARY SEARCH.

    CHECK SY-SUBRC NE 0.

    DELETE I_AFVC.

    ENDLOOP.

    ENDIF.

    ENDIF.

    ************************************************************************

    • Filtering OBJNR number based on released status and not *

    • confirmed status of the production order *

    ************************************************************************

    IF NOT I_AFVC[] IS INITIAL.

    SELECT * FROM JEST INTO TABLE I_JEST

    FOR ALL ENTRIES IN I_AFVC

    WHERE OBJNR = I_AFVC-OBJNR.

    SORT I_JEST BY OBJNR.

    ENDIF.

    I_JEST11 = I_JEST.

    ****delete the P.O. which are having the confirmed status (I0009) and

    ****deletion flag (I0076) AND Deletion indicatior (I0013),and

    ***delivered orders (I0012).

    LOOP AT I_JEST INTO W_JEST.

    LOOP AT I_JEST11 INTO W_JEST11 WHERE OBJNR = W_JEST-OBJNR.

    IF W_JEST11-STAT = 'I0009' OR

    W_JEST11-STAT = 'I0010' OR

    W_JEST11-STAT = 'I0012' OR

    W_JEST11-STAT = 'I0045' OR

    W_JEST11-STAT = 'I0046' OR

    W_JEST11-STAT = 'I0076' OR

    W_JEST11-STAT = 'I0560'.

    DELETE I_JEST.

    ENDIF.

    ENDLOOP.

    ENDLOOP.

    ****Consider P.Os which are released and in active status.

    CLEAR W_JEST1.

    LOOP AT I_JEST INTO W_JEST.

    IF W_JEST-STAT = 'I0002' AND W_JEST-INACT = ' '.

    W_JEST1 = W_JEST.

    APPEND W_JEST1 TO I_JEST1.

    CLEAR W_JEST1.

    ENDIF.

    ENDLOOP.

    SORT I_JEST1 BY OBJNR.

    ***********************************************************************

    IF NOT I_AFKO[] IS INITIAL.

    IF P_MATNR NE ' '.

    SELECT MATNR

    BDMNG

    MEINS

    AUFNR

    DUMPS

    FROM RESB INTO CORRESPONDING FIELDS OF TABLE I_RESB

    FOR ALL ENTRIES IN I_AFKO

    WHERE AUFNR = I_AFKO-AUFNR

    AND MATNR = P_MATNR

    AND DUMPS = 'X'.

    SORT I_RESB BY AUFNR MATNR.

    ELSE.

    SELECT MATNR

    BDMNG

    MEINS

    AUFNR

    DUMPS

    FROM RESB INTO CORRESPONDING FIELDS OF TABLE I_RESB

    FOR ALL ENTRIES IN I_AFKO

    WHERE AUFNR = I_AFKO-AUFNR

    AND DUMPS = 'X'.

    SORT I_RESB BY AUFNR MATNR.

    ENDIF.

    ENDIF.

    IF NOT I_AFKO[] IS INITIAL.

    SELECT * FROM MAKT INTO TABLE I_MAKT1

    FOR ALL ENTRIES IN I_AFKO

    WHERE MATNR = I_AFKO-PLNBEZ

    AND SPRAS = SY-LANGU.

    SORT I_MAKT1 BY MATNR.

    ENDIF.

    IF NOT I_RESB[] IS INITIAL.

    SELECT * FROM MAKT INTO TABLE I_MAKT

    FOR ALL ENTRIES IN I_RESB

    WHERE MATNR = I_RESB-MATNR

    AND SPRAS = SY-LANGU.

    SORT I_MAKT BY MATNR.

    ENDIF.

    ENDFORM. "GET_DATA

    &----


    *& Form GET_VALUES

    &----


    ****TO DISPLAY THE LIST

    ----


    FORM GET_VALUES.

    ***BEGIN OF PHANTOM MATERIAL HEADER INTERNAL TABLE***

    CLEAR W_AUFK.

    CLEAR W_RESB.

    LOOP AT I_RESB INTO W_RESB.

    READ TABLE I_AFKO INTO W_AFKO

    WITH KEY AUFNR = W_RESB-AUFNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    READ TABLE I_AFVC INTO W_AFVC

    WITH KEY AUFPL = W_AFKO-AUFPL BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    READ TABLE I_JEST1 INTO W_JEST1

    WITH KEY OBJNR = W_AFVC-OBJNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    W_HHEADER-MATNR = W_RESB-MATNR.

    READ TABLE I_MAKT INTO W_MAKT

    WITH KEY MATNR = W_RESB-MATNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    W_HHEADER-MAKTX = W_MAKT-MAKTX.

    W_HHEADER-GMEIN = W_RESB-MEINS.

    APPEND W_HHEADER TO I_HHEADER.

    MODIFY I_HHEADER FROM W_HHEADER INDEX SY-TABIX.

    CLEAR W_HHEADER.

    CLEAR W_RESB.

    SORT I_HHEADER BY MATNR.

    DELETE ADJACENT DUPLICATES FROM I_HHEADER.

    ENDLOOP.

    ****END OF PHANTOM MATERIAL HEADER INTERNAL TABLE***

    **BEGIN OF PHANTOM MATERIAL ITEM DETAILS***************

    IF NOT I_HHEADER[] IS INITIAL.

    LOOP AT I_HHEADER INTO W_HHEADER.

    LOOP AT I_RESB INTO W_RESB WHERE MATNR = W_HHEADER-MATNR.

    READ TABLE I_AFKO INTO W_AFKO

    WITH KEY AUFNR = W_RESB-AUFNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    READ TABLE I_AFVC INTO W_AFVC

    WITH KEY AUFPL = W_AFKO-AUFPL BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    READ TABLE I_JEST1 INTO W_JEST1

    WITH KEY OBJNR = W_AFVC-OBJNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    W_HITEM-CHECK = CHECK.

    • W_HITEM-CHECK = '0'.

    W_HITEM-MATNR = W_HHEADER-MATNR.

    W_HITEM-AUFNR = W_AFKO-AUFNR.

    W_HITEM-PLNBEZ = W_AFKO-PLNBEZ.

    READ TABLE I_MAKT1 INTO W_MAKT1

    WITH KEY MATNR = W_AFKO-PLNBEZ BINARY SEARCH.

    W_HITEM-MAKTX = W_MAKT1-MAKTX.

    W_HITEM-GLTRP = W_AFKO-GLTRP.

    W_HITEM-GSTRP = W_AFKO-GSTRP.

    • W_HITEM-GAMNG = W_AFKO-GAMNG.

    W_HITEM-BDMNG = W_RESB-BDMNG.

    W_HITEM-GMEIN = W_RESB-MEINS.

    APPEND W_HITEM TO I_HITEM.

    SORT I_HITEM BY AUFNR.

    CLEAR W_HITEM.

    ENDLOOP.

    ENDLOOP.

    ENDIF.

    ***********END OF PHANTOM MATERIAL ITEM DETAILS.*********************

    ENDFORM. "get_item_DETAILS

    &----


    *& Form TOP_OF_PAGE

    &----


    • TO DISPLAY TOP_OF_PAGE FOR PRODUCTION ORDERS SELECTION SCREEN

    ----


    FORM TOP_OF_PAGE.

    FORMAT COLOR 5 ON .

    WRITE:/ 'PRODUCTION ORDERS SELECTION'.

    ENDFORM. " alv_top_of_page

    &----


    *& Form user_command

    &----


    • WRITING CODE FOR THE PUSH BUTTONS CUMMILATIVE QTY AND EXECUTE .

    ----


    • -->P_UCOMM text

    • -->P_SELFIELD text

    ----


    FORM DISPLAY_ALV_REPORT.

    SORT I_HHEADER BY MATNR.

    SORT I_HITEM BY MATNR AUFNR.

    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    I_CALLBACK_PROGRAM = GD_REPID

    • I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'

    • I_CALLBACK_USER_COMMAND = 'SUB_USER_COMMAND'

    IS_LAYOUT = GD_LAYOUT

    IT_FIELDCAT = I_FIELDCATALOG

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE = 'X'

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    IT_EVENTS = I_EVENTS[]

    • IT_EVENT_EXIT =

    I_TABNAME_HEADER = 'I_HHEADER'

    I_TABNAME_ITEM = 'I_HITEM'

    • i_structure_name_header =

    • i_structure_name_item =

    IS_KEYINFO = W_KEYINFO

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB_HEADER = I_HHEADER

    T_OUTTAB_ITEM = I_HITEM

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • OTHERS = 2

    .

    ENDFORM. "display_alv_report

    &----


    *& Form PF_STATUS_SET

    &----


    • SET PF-STATUS to place push buttons on the appplication toolbar

    ----


    • -->EXTAB text

    ----


    FORM PF_STATUS_SET USING EXTAB TYPE SLIS_T_EXTAB.

    SET PF-STATUS 'STANDARD1' EXCLUDING EXTAB.

    ENDFORM. "PF_STATUS_SET

    &----


    *& Form SUB_USEMR_COMMAND

    &----


    • text

    ----


    • -->P_UCOMM text

    • -->P_SELFIELD text

    ----


    FORM SUB_USER_COMMAND USING P_UCOMM LIKE SY-UCOMM

    P_SELFIELD TYPE SLIS_SELFIELD.

    CASE P_UCOMM.

    WHEN 'CUMM'.

    ******for finding the Cumulative quantity of production orders

    PERFORM SUM.

    WHEN 'EXEC'.

    ******for finding the Cumulative quantity of production orders

    PERFORM SUM.

    CLEAR W_HITEM.

    CLEAR W_HHEADER.

    REFRESH I_MHEAD.

    I_HITEM1 = I_HITEM.

    LOOP AT I_HITEM1 INTO W_HITEM1 WHERE CHECK NE 'X'.

    DELETE I_HITEM1.

    ENDLOOP.

    SORT I_HITEM1 BY MATNR.

    ****populating data into I_MHEAD

    IF NOT I_HITEM1[] IS INITIAL.

    CLEAR W_MHEAD.

    REFRESH I_MHEAD.

    LOOP AT I_HITEM1 INTO W_HITEM1.

    READ TABLE I_HHEADER INTO W_HHEADER

    WITH KEY MATNR = W_HITEM1-MATNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    W_MHEAD-PHANTA = W_HHEADER-MATNR.

    W_MHEAD-MAKTX = W_HHEADER-MAKTX.

    W_MHEAD-V_QTY = W_HHEADER-V_QTY.

    W_MHEAD-GMEIN = W_HHEADER-GMEIN.

    W_MHEAD-ARBPL = P_ARBPL.

    APPEND W_MHEAD TO I_MHEAD.

    CLEAR W_MHEAD.

    ENDLOOP.

    DELETE ADJACENT DUPLICATES FROM I_MHEAD.

    SORT I_MHEAD BY PHANTA.

    ENDIF.

    DESCRIBE TABLE I_MHEAD LINES LINES.

    IF LINES > 1.

    MESSAGE E001(ZMR).

    ENDIF.

    IF NOT I_MHEAD[] IS INITIAL.

    REFRESH I_RESB.

    CLEAR W_RESB.

    REFRESH I_MAKT.

    CLEAR I_MAKT.

    IF NOT I_MHEAD[] IS INITIAL.

    SELECT MATNR

    BDMNG

    AUFNR

    AUFST

    AUFWG

    FROM RESB INTO CORRESPONDING FIELDS OF TABLE I_RESBX

    FOR ALL ENTRIES IN I_MHEAD

    WHERE MATNR = I_MHEAD-PHANTA

    AND DUMPS = 'X'.

    ENDIF.

    SORT I_RESBX BY AUFNR.

    ENDIF.

    IF NOT I_RESBX[] IS INITIAL.

    LOOP AT I_RESBX INTO W_RESBX.

    READ TABLE I_HITEM1 INTO W_HITEM1

    WITH KEY AUFNR = W_RESBX-AUFNR BINARY SEARCH.

    CHECK SY-SUBRC NE 0.

    DELETE I_RESBX.

    ENDLOOP.

    SORT I_RESBX BY AUFNR.

    ENDIF.

    IF NOT I_RESBX[] IS INITIAL.

    SELECT MATNR

    BDMNG

    MEINS

    AUFNR

    FROM RESB INTO CORRESPONDING FIELDS OF TABLE I_RESB

    FOR ALL ENTRIES IN I_RESBX

    WHERE AUFNR = I_RESBX-AUFNR

    AND AUFST = I_RESBX-AUFST

    AND AUFWG = I_RESBX-AUFWG

    AND DUMPS = ' '.

    ENDIF.

    IF NOT I_RESB[] IS INITIAL.

    SELECT * FROM MAKT INTO TABLE I_MAKT

    FOR ALL ENTRIES IN I_RESB

    WHERE MATNR = I_RESB-MATNR

    AND SPRAS = SY-LANGU.

    SORT I_MAKT BY MATNR.

    ENDIF.

    CLEAR W_MITEM.

    REFRESH I_MITEM.

    ****POPULATING DATA INTO I_MITEM.

    LOOP AT I_MHEAD INTO W_MHEAD.

    READ TABLE I_HITEM1 INTO W_HITEM1

    WITH KEY MATNR = W_MHEAD-PHANTA BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    LOOP AT I_RESBX INTO W_RESBX

    WHERE MATNR = W_HITEM1-MATNR.

    CHECK SY-SUBRC = 0.

    LOOP AT I_RESB INTO W_RESB

    WHERE AUFNR = W_RESBX-AUFNR.

    CHECK SY-SUBRC = 0.

    W_MITEM-PHANTA = W_MHEAD-PHANTA.

    W_MITEM-MATNR = W_RESB-MATNR.

    READ TABLE I_MAKT INTO W_MAKT

    WITH KEY MATNR = W_RESB-MATNR BINARY SEARCH.

    W_MITEM-MAKTX = W_MAKT-MAKTX.

    W_MITEM-BDMNG = W_RESB-BDMNG.

    W_MITEM-MEINS = W_RESB-MEINS.

    COLLECT W_MITEM INTO I_MITEM.

    CLEAR W_MITEM.

    ENDLOOP.

    ENDLOOP.

    ENDLOOP.

    *****BUILDING FIELD CATALOG FOR MIXING REPORT

    PERFORM BUILD_MIXING_FLDCATALOG.

    *****GETTING EVENTS FOR THE MIXING REPORT

    PERFORM GET_EVENTS_MIXING.

    *****BUILDING LAYOUT FOR MIXING REPORT

    PERFORM BUILD_MIXING_LAYOUT.

    *****TO DISPLAY MIXING REPORT

    PERFORM DISPLAY_MIXNG_REPORT.

    ENDCASE.

    ENDFORM. "USER_COMMAND

    &----


    *& Form BUILD_MIXING_FLDCATALOG

    &----


    ****TEXT- BUILDING FIELD CATALOG FOR MIXING REPORT

    ----


    FORM BUILD_MIXING_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '1'.

    W_FLDCATALOG-FIELDNAME = 'PHANTA'.

    W_FLDCATALOG-TABNAME = 'I_MHEAD'.

    W_FLDCATALOG-SELTEXT_M = 'Pha.Mat.No.'.

    W_FLDCATALOG-OUTPUTLEN = '18'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '2'.

    W_FLDCATALOG-FIELDNAME = 'MAKTX'.

    W_FLDCATALOG-TABNAME = 'I_MHEAD'.

    W_FLDCATALOG-SELTEXT_L = 'Pha.Mat.Desc.'.

    W_FLDCATALOG-OUTPUTLEN = '40'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '3'.

    W_FLDCATALOG-FIELDNAME = 'V_QTY'.

    W_FLDCATALOG-TABNAME = 'I_MHEAD'.

    W_FLDCATALOG-SELTEXT_M = 'Total Ord.Qty'.

    W_FLDCATALOG-OUTPUTLEN = '16'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '4'.

    W_FLDCATALOG-FIELDNAME = 'GMEIN'.

    W_FLDCATALOG-TABNAME = 'I_MHEAD'.

    W_FLDCATALOG-SELTEXT_S = 'Unit'.

    W_FLDCATALOG-OUTPUTLEN = '4'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '5'.

    W_FLDCATALOG-FIELDNAME = 'ARBPL'.

    W_FLDCATALOG-TABNAME = 'I_MHEAD'.

    W_FLDCATALOG-SELTEXT_S = 'Wk.Ctr'.

    W_FLDCATALOG-OUTPUTLEN = '6'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '1'.

    W_FLDCATALOG-FIELDNAME = 'MATNR'.

    W_FLDCATALOG-TABNAME = 'I_MITEM'.

    W_FLDCATALOG-SELTEXT_M = 'Comp.Mat.No.'.

    W_FLDCATALOG-EMPHASIZE = 'C210'.

    W_FLDCATALOG-OUTPUTLEN = '18'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '2'.

    W_FLDCATALOG-FIELDNAME = 'MAKTX'.

    W_FLDCATALOG-TABNAME = 'I_MITEM'.

    W_FLDCATALOG-SELTEXT_L = 'Comp.Mat.Desc.'.

    W_FLDCATALOG-EMPHASIZE = 'C210'.

    W_FLDCATALOG-OUTPUTLEN = '40'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '3'.

    W_FLDCATALOG-FIELDNAME = 'BDMNG'.

    W_FLDCATALOG-TABNAME = 'I_MITEM'.

    W_FLDCATALOG-SELTEXT_M = 'Req.Qty.'.

    W_FLDCATALOG-EMPHASIZE = 'C210'.

    W_FLDCATALOG-OUTPUTLEN = '16'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '4'.

    W_FLDCATALOG-FIELDNAME = 'MEINS'.

    W_FLDCATALOG-TABNAME = 'I_MITEM'.

    W_FLDCATALOG-SELTEXT_M = 'Unit'.

    W_FLDCATALOG-EMPHASIZE = 'C210'.

    W_FLDCATALOG-OUTPUTLEN = '4'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    CLEAR W_FLDCATALOG .

    W_FLDCATALOG-COL_POS = '5'.

    W_FLDCATALOG-FIELDNAME = 'CHECK1'.

    W_FLDCATALOG-TABNAME = 'I_MITEM'.

    W_FLDCATALOG-EDIT = 'X'.

    W_FLDCATALOG-CHECKBOX = 'X'.

    W_FLDCATALOG-SELTEXT_M = 'Check'.

    W_FLDCATALOG-EMPHASIZE = 'C210'.

    W_FLDCATALOG-OUTPUTLEN = '5'.

    APPEND W_FLDCATALOG TO I_FLDCATALOG.

    ENDFORM. "BUILD_MIXING_FLDCATALOG

    &----


    *& Form BUILD_MIXING_LAYOUT

    &----


    **TEXT - BUILDING LAYOUT FOR MIXING REPORT

    ----


    FORM BUILD_MIXING_LAYOUT.

    M_KEYINFO-HEADER01 = 'PHANTA'.

    M_KEYINFO-ITEM01 = 'PHANTA'.

    ENDFORM. "BUILD_MIXING_LAYOUT

    &----


    *& Form DISPLAY_MIXNG_REPORT

    &----


    **TEXT - TO DISPLAY MIXING REPORT

    ----


    FORM DISPLAY_MIXNG_REPORT.

    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    I_CALLBACK_PROGRAM = GD_REPID

    • I_CALLBACK_PF_STATUS_SET = 'S_PF_STATUS_SET'

    • I_CALLBACK_USER_COMMAND = 'S_SUB_USER_COMMAND'

    IS_LAYOUT = M_LAYOUT

    IT_FIELDCAT = I_FLDCATALOG

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    IT_EVENTS = I_EVENTS

    • IT_EVENT_EXIT =

    I_TABNAME_HEADER = 'I_MHEAD'

    I_TABNAME_ITEM = 'I_MITEM'

    • I_STRUCTURE_NAME_HEADER =

    • I_STRUCTURE_NAME_ITEM =

    IS_KEYINFO = M_KEYINFO

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB_HEADER = I_MHEAD

    T_OUTTAB_ITEM = I_MITEM

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • OTHERS = 2

    .

    REFRESH I_FLDCATALOG.

    CLEAR M_LAYOUT.

    CLEAR M_KEYINFO.

    ENDFORM. "DISPLAY_MIXNG_REPORT

    &----


    *& Form SUM

    &----


    • for finding the Cumulative quantity of production orders

    ----


    FORM SUM.

    CLEAR W_HITEM.

    CLEAR W_HHEADER.

    CLEAR W_HHEADER-V_QTY.

    LOOP AT I_HHEADER INTO W_HHEADER.

    IF W_HHEADER-V_QTY NE ' '.

    CLEAR W_HHEADER-V_QTY.

    MODIFY I_HHEADER FROM W_HHEADER

    INDEX SY-TABIX TRANSPORTING V_QTY.

    ENDIF.

    ENDLOOP.

    DATA:LV_TABIX TYPE SY-TABIX.

    LOOP AT I_HITEM INTO W_HITEM.

    READ TABLE I_HHEADER INTO W_HHEADER

    WITH KEY MATNR = W_HITEM-MATNR BINARY SEARCH.

    IF SY-SUBRC = 0.

    LV_TABIX = SY-TABIX.

    IF W_HITEM-CHECK = 'X'.

    W_HHEADER-V_QTY = W_HHEADER-V_QTY + W_HITEM-BDMNG.

    MODIFY I_HHEADER FROM W_HHEADER

    INDEX LV_TABIX TRANSPORTING V_QTY.

    ENDIF.

    ENDIF.

    ENDLOOP.

    ENDFORM. "SUM

    &----


    *& Form TOP_OF_PAGE

    &----


    ***text - GETTING EVENTS FOR THE MIXING REPORT

    ----


    FORM GET_EVENTS_MIXING.

    CLEAR : W_EVENTS, I_EVENTS[].

    REFRESH I_EVENTS.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = I_EVENTS.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

    INTO W_EVENTS.

    IF SY-SUBRC EQ 0.

    MOVE 'TOP_OF_PAGE1' TO W_EVENTS-FORM.

    MODIFY I_EVENTS FROM W_EVENTS INDEX SY-TABIX.

    ENDIF.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_END_OF_LIST

    INTO W_EVENTS.

    IF SY-SUBRC EQ 0.

    MOVE 'END_OF_LIST1' TO W_EVENTS-FORM.

    MODIFY I_EVENTS FROM W_EVENTS INDEX SY-TABIX.

    ENDIF.

    ENDFORM. "get_events

    &----


    *& Form TOP_OF_PAGE

    &----


    • text - TO DISPLAY THE SEQUENCE DETAILS

    ----


    FORM TOP_OF_PAGE1.

    CLEAR W_RESBS.

    REFRESH I_RESBS.

    IF NOT I_HITEM1[] IS INITIAL.

    SELECT MATNR PLNFL VORNR AUFNR FROM RESB

    INTO CORRESPONDING FIELDS OF TABLE I_RESBS

    FOR ALL ENTRIES IN I_HITEM1

    WHERE MATNR = I_HITEM1-MATNR

    AND AUFNR = I_HITEM1-AUFNR

    AND DUMPS = 'X'.

    SORT I_RESBS BY AUFNR.

    SELECT AUFNR AUFPL FROM AFKO INTO TABLE I_AFKO1

    FOR ALL ENTRIES IN I_HITEM1

    WHERE AUFNR = I_HITEM1-AUFNR.

    SORT I_AFKO1 BY AUFNR.

    ENDIF.

    IF NOT I_AFKO1[] IS INITIAL.

    SELECT AUFPL PLNFL VORNR ARBID FROM AFVC INTO TABLE I_AFVC1

    FOR ALL ENTRIES IN I_AFKO1

    WHERE AUFPL = I_AFKO1-AUFPL.

    SORT I_AFVC1 BY AUFPL PLNFL.

    ENDIF.

    CLEAR W_MTOP.

    REFRESH I_MTOP.

    IF NOT I_HITEM1[] IS INITIAL.

    LOOP AT I_HITEM1 INTO W_HITEM1.

    READ TABLE I_RESBS INTO W_RESBS

    WITH KEY AUFNR = W_HITEM1-AUFNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    READ TABLE I_AFKO1 INTO W_AFKO1

    WITH KEY AUFNR = W_HITEM1-AUFNR BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    LOOP AT I_AFVC1 INTO W_AFVC1 WHERE AUFPL = W_AFKO1-AUFPL

    AND PLNFL = W_RESBS-PLNFL.

    • CHECK W_AFVC1-AUFPL = W_AFKO1-AUFPL

    • AND W_AFVC1-PLNFL = W_RESBS-PLNFL.

    READ TABLE I_CRHD INTO W_CRHD

    WITH KEY OBJID = W_AFVC1-ARBID BINARY SEARCH.

    CHECK SY-SUBRC = 0.

    W_MTOP-PLNFL = W_RESBS-PLNFL.

    W_MTOP-VORNR = W_AFVC1-VORNR.

    W_MTOP-AUFNR = W_HITEM1-AUFNR.

    APPEND W_MTOP TO I_MTOP.

    CLEAR W_MTOP.

    ENDLOOP.

    ENDLOOP.

    SORT I_MTOP BY PLNFL VORNR AUFNR.

    ENDIF.

    SKIP.

    WRITE:/ TEXT-006.

    WRITE:/ TEXT-005.

    IF I_MTOP[] IS NOT INITIAL.

    LOOP AT I_MTOP.

    MOVE I_MTOP TO W_MTOP.

    AT NEW PLNFL.

    FORMAT COLOR 1 ON.

    WRITE:/'SEQUENCE:', W_MTOP-PLNFL, 'OPERATION:', W_MTOP-VORNR.

    WRITE:/.

    FORMAT COLOR 4 ON.

    WRITE:'PRODUCTION ORDERS:'.

    ENDAT.

    FORMAT COLOR 3 ON.

    WRITE: W_MTOP-AUFNR.

    AT END OF PLNFL.

    WRITE:/.

    ENDAT.

    CLEAR W_MTOP.

    ENDLOOP.

    WRITE:/ TEXT-005,

    / 'DATE:', SY-DATUM,

    / TEXT-005.

    ENDIF.

    REFRESH I_HITEM1.

    REFRESH I_MTOP.

    ENDFORM. "TOP_OF_PAGE

    &----


    *& Form END_OF_PAGE1

    &----


    • text - END OF PAGE TO DISPLAY THE TEXT

    ----


    FORM END_OF_LIST1.

    WRITE:/ TEXT-005,

    / TEXT-003,

    TEXT-004,

    / TEXT-005.

    ENDFORM. "END_OF_PAGE1

    Rewards points if it is useful for you.

    Regards

    ramesh

    Add comment
    10|10000 characters needed characters exceeded