Skip to Content
author's profile photo
Former Member

Reading Multiple Values from ALV

Hi all,

I am creating an ALV List in which i am using checkboxes so that i can select multiple rows, and i also have a button on Application Toolbar that will give details of all selected Rows.

My Prob. is:

1. I am not been able to read checkbox values. when i tried to read it Using READ LINE it is giving me SY-SUBRC = 4.

2. If i use selection using buttons then again i can read one value by rs_fieldvalue-value but again, reading multiple values is giving error.

Any Help will be Rewarded.

Regards,

Sachin.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • author's profile photo
    Former Member
    Posted on Aug 16, 2007 at 04:00 PM

    Hi sachin,

    i have done the same thing today and it is working fine. Hope it helps u out.

    internal table has got four fields which includes BOX(1) TYPE c apart from these three fields. use layout-box_fname = 'BOX'.

    and when u will click onto the box when alv is displayed, the internal table will have box = 'X' after u click onto button. Please try out..award points if helpful. Feel free to ask any details regarding this. use 'REUSE_ALV_GRID_DISPLAY_LVC'.

    CLEAR wa_fcat.

    wa_fcat-fieldname = 'R3BATCHID'.

    wa_fcat-tabname = 'I_COM_TA_R3_ID'.

    wa_fcat-scrtext_m = 'Batch Number'.

    wa_fcat-outputlen = 12.

    APPEND wa_fcat TO i_fcat.

    CLEAR wa_fcat.

    wa_fcat-fieldname = 'MAMODEL'.

    wa_fcat-tabname = 'I_COM_TA_R3_ID'.

    wa_fcat-scrtext_m = 'Model Number'.

    wa_fcat-outputlen = 18.

    APPEND wa_fcat TO i_fcat.

    CLEAR wa_fcat.

    wa_fcat-fieldname = 'MESSAGE'.

    wa_fcat-tabname = 'I_COM_TA_R3_ID'.

    wa_fcat-scrtext_m = 'MESSAGE'.

    wa_fcat-outputlen = 46.

    APPEND wa_fcat TO i_fcat.

    CLEAR wa_layout.

    <b> wa_layout-box_fname = 'BOX'.</b>

    wa_layout-zebra = 'X'.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

    EXPORTING

    i_callback_program = sy-repid

    is_layout_lvc = wa_layout

    it_fieldcat_lvc = i_fcat[]

    it_events = i_events

    TABLES

    t_outtab = i_com_ta_r3_id

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 16, 2007 at 04:10 PM

    Hi,

    Copy and paste this code, and execute,. You will get the answer.

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

    • *

    • PROGRAM NAME: Zhier_list *

    • *

    • DESCRIPTIONS: PP Ticket#XXXXX Mixing Recipe *

    • *

    • DATE : 05/12/2007 *

    • *

    • AUTHOR : IGROUP(RAMESH MAVILLA) *

    • *

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

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

    • Date Programmer Task # Description *

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

    • 05/12/2007 RAMESH MAVILLA DEVK928235 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 = 'I0012' OR

    W_JEST11-STAT = 'I0045' OR

    W_JEST11-STAT = 'I0076' OR

    W_JEST11-STAT = 'I0009'.

    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

    Reward me the points, if it is useful for you .

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 16, 2007 at 04:15 PM
    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 16, 2007 at 04:24 PM

    hi

    u need not explicitly read the list for chk boxes..

    when ever u select the chk box the itab containing the chkbox gets automatically set to 'X'.

    so u can directly access the internal table..

    if chk = 'X'.

    logic......

    endif.

    hope it helps u

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 08:54 AM

    There is another Function Module for doing this.

    Add comment
    10|10000 characters needed characters exceeded