ALV display Variant

hi,
I wrote a code for allowing the user to choose a display variant in the selection screen. The user chooses the required variant in the selection screen and views the ALV grid accordingly. This code is working fine in the development server but as it was transported to the quality server, somehow it has stopped working.
Any new variants that are created are displayed in the selection screeN F4 help, but somehow the variants are not working.
Could anyone suggest where i am going wrong?
Thanks,
Aviroop

try to comment it and see./
it will work..
you are telling that alv Fm set the default variant.
if you don't want then comment it, then what ever you choose in selection screen will come in the output otherwise defaut variant overrides the selected one.
Regards
vijay

Similar Messages

  • ALV Display Variant copying between programs

    There is a report program say PROGRAM1 whose ALV display variants we want to copy to the ALV display variants of another program say PROGRAM2.
    Both these program share the same ALV output structure design. My questions are
    1) Can the display variants of an ALV be copied into another program.?
    2) Can this be managed programatically?

    Hi,
      Try using LVC_VARIANT_SELECT and LVC_VARIANT_SAVE fms.
      First call LVC_VARIANT_SELECT to read variant from the first program and then call LVC_VARIANT_SAVE to save it for the second program.
      Take a look at report BCALV_GRID_11 for reference
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • Copying ALV Display Variants between different programs

    Is there a way to copy the ALV Display Variants from one program to another?  I am NOT referring to selection screen variants.
    An SAP standard program was copied to a Z program.  Some changes were made to the logic.  The original SAP program has many (100+) ALV Display Variants.  I do not want to manually re-create them.  Is there a way to copy these from one program to another (without using a custom program to manipulate the tables)?
    Thanks.
    Norm

    Hi norman,
    even i was thinking the same while you passing the alv parameter is_variant, give the the program which is having 100 variants.
    is_variant-REPORT = 'STANDARDPRG'.
    this will import all varaints from it, but when you save any new one it will  save in the same standard program.
    regards
    vijay

  • Copy User Specific ALV Display Variants

    Does anyone know if it is possible to copy one user's ALV display variant (that has been saved as a user-specific variant) for a particular program (in this case VA05) to another user?

    Hi Eric,
    I'm a bit busy now and I cannot give you a complete solution, but sure can give you some c(l)ue. Just see if you have some success. If you do not, then i wuill get back to you later.
    Refer to the follwoing SAP Tables and see if you have some luck.
    ==========================================================
    LTDX  --> Generic storage of display variants
    LTDXD --> Default display variants
    LTDXS --> SAP Default Display Variants
    LTDXT --> Display variant texts
    ==========================================================
    The idea is to try and manipulate the table entries for various users.
    Regards,
    Anand Mandalika.

  • Problem in saving ALV display variant with filter

    Hello,
    I'm displaying an ALV grid with function 'REUSE_ALV_GRID_DISPLAY'. When I load a diplay variant and apply a filter, I could save new layout. But when I run the report without a display variant, then apply a filter to the result, I couldn't save filter option when saving display variant. In the "save" tab of save layout dialog, filter checkbox is not displayed. This happens in 4.6C version. Is it a bug or am i missing a point.
    Thanks,
    Mustafa.

    Slm Burak,
    'IT_FILTER' parameter is empty. Users apply a filter but couldn't save filtered list variant. When they run the report with saved display variant, list is displayed without filters.

  • Select OO ALV Display Variants in a Sel Screen.

    Hi, Abapers.
    I'm wondering whether is possible to make a selection (in a sel-screen) over a field of the display variants which are further managed in an OO ALV.
    If it's possible, from where shoud I read them?
    Best regards.

    what do you means with "managed"?
    what do you think to do with the selected field?

  • OOPs :  SAVE and ALV Display Variant

    Can you please send me the code for 'Save and Display Variant' in ALV OOPs.

    DATA :  l_layout TYPE disvariant.
      l_layout-report = sy-repid.
    l_layouth-zebra = 'X'.   
    CALL METHOD gr_alvgrid->set_table_for_first_display
           EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
         i_structure_name              =  'ZQM01'    
    <b>     is_variant                    =  l_layout
         i_save                        = 'A'</b>
       I_DEFAULT                     = 'X'
        is_layout                     =  gs_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
          CHANGING
             it_outtab                     = gt_list[]
             it_fieldcatalog               = gt_fieldcat
       IT_SORT                       =
       IT_FILTER                     =
           EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

  • How to transport display variants in alv

    Hi,
    Can any one please help me in transporting alv display variants?Actually I have transported the variants ,but only selection variants are getting transported.I want to transport ALV display variants accross the clients.
    Please reply soon.It is very urgent.

    Hi,
    Please use the following :
    First execute the report .
    Then Menubar Settings> Layout> layout management>select your variant> menubar layout--> transport
    This will work only when your variant management is activve in your ALV report.

  • Display Variants in ALV

    Hi,
    I copied an existing Z report program to a new program to conform to the naming standards and deleted the old program. (I could do renaming as well but did it this way)
    When copying the program, all object including the selection variants were copied but the ALV display variants were not copied to the target program.  Any thoughts on this please?
    I tried using a simple program to copy the LTDX (Generic storage of display variants) and LTDXT (Display Variant Texts) entries of the old program to the new program. I checked that all entries in LTDX of the old program now exist for the new program too. When I execute the program, only the global ALV display variants are available for selection i.e all display variants that start with u2018/u2019. The user specific variants are not available although all entries in LTDX and LTDXT for the user display are in the respective tables
    Thanks for respondinding.

    Thanks Satyasuresh. I used a similar program that copies variant entries from tables ltdx and ltdxt for a source program to new entries in the same table for the target program.
    parameters report like ltdx-report obligatory.
    parameters report2 like ltdx-report obligatory.
    select * into table lt_ltdx from ltdx
                    where report = report.
      select * into table lt_ltdxt from ltdxt
                    where report = report.
      loop at lt_ltdx.
        lt_ltdx-report = report2.
        modify ltdx from lt_ltdx..
      endloop.
      loop at lt_ltdxt.
        lt_ltdxt-report = report2.
        modify ltdxt from lt_ltdxt..
      endloop.

  • Display variant in  ALV grid

    Hi ,
    i have developed an interactive report in which form the first grid display i will move to the second grid display.
    Problem:
                 For the first list there is an display variant. when i navigate to the second list it is using the same display variant form the first list ( this should not hapen ). so many of the fields are not be displayed in the second list.
                Is there any way to differentiate the display variant from first and second list.
    Please help me. sample code will be more helpful.
    Patil

    hi santhosh
        You can very well create 2 variants in your report for grid display...just restrict some fields n create 2 variants and while executing jus choose which variant you need to run..
    REWARD IT IF USEFUl...!!!!

  • ALV layout variant missing in background job.

    hi guys,
    Having problem on getting the default ALV layout variant when run the job in backgorund. Please advise any correction needed in the following code.
    Thanks.
    *&  Include           Z_MM_KBR_AGSUBCONINV_MOD2                        *
    MODULE status_0100 OUTPUT.
      SET PF-STATUS '100'.
      SET TITLEBAR '100'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  display_data  OUTPUT
          text
    MODULE display_data OUTPUT.
    IF sy-batch IS INITIAL. "Foreground
      IF w_container IS INITIAL.
        IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    *Creating the container
          CREATE OBJECT w_container
            EXPORTING
              container_name              = c_container
            EXCEPTIONS
              cntl_error                  = 1
              cntl_system_error           = 2
              create_error                = 3
              lifetime_error              = 4
              lifetime_dynpro_dynpro_link = 5
              OTHERS                      = 6.
          IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
        ENDIF.
    *Creating the ALV GRID
        CREATE OBJECT w_grid
          EXPORTING
            i_parent          = w_container
            i_appl_events     = c_check
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        else.
         exit.
        ENDIF.
      ELSE.
    *Creating the ALV GRID
        CREATE OBJECT w_grid
          EXPORTING
            i_parent          = go_dock_container
            i_appl_events     = c_check
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
          WRITE:/ 'Error in grid'.
        ENDIF.
         CREATE OBJECT w_grid
          EXPORTING  i_parent = go_dock_container.
      ENDIF.
    *getting the variant option
        wa_variant-report     = sy-repid.
        wa_variant-username   = sy-uname.
        wa_layout-grid_title  = sy-title.
        wa_layout-cwidth_opt  = c_check.
        wa_layout-zebra       = c_check.
        wa_layout-no_f4       = c_check.
        wa_layout-sel_mode    = 'D'.
    *Excluding the unwanted buttons
         PERFORM exclude_toolbar_buttons.
    build field catalog.
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_buffer_active        = c_check
            i_structure_name       = c_fcat_str
            i_bypassing_buffer     = c_check
          CHANGING
            ct_fieldcat            = t_fieldcat
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        loop at t_fieldcat into w_fieldcat.
         if w_fieldcat-FIELDNAME = 'AGING1'.
          W_FIELDCAT-NO_ZERO = 'X'.
          MODIFY t_fieldcat FROM W_FIELDCAT INDEX SY-TABIX.
         ENDIF.
        endloop.
    Generate sort critria
        PERFORM generate_sort.
    Create object of class lcl_event_receiver.
        CREATE OBJECT w_event.
    Handler for events.
       SET HANDLER w_event->handle_top_of_page       FOR w_grid.
       SET HANDLER w_event->handle_print_top_of_page FOR w_grid.
       SET HANDLER w_event->handle_print_end_of_list FOR w_grid.
        SET HANDLER w_event->handle_hotspot_click     FOR w_grid.
    *Displaying the alv
       IF NOT sy-batch IS INITIAL.
         PERFORM create_snp.
       ENDIF.
    t_data = i_final.
        CALL METHOD w_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'A'
            is_layout                     = wa_layout
            is_variant                    = wa_variant
          CHANGING
            it_outtab                     = t_data
            it_fieldcatalog               = t_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
        ENDIF.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " display_data  OUTPUT
    *&      Module  user_command_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      DATA: lt_rows TYPE lvc_t_row,
             w_rows TYPE lvc_s_row.
      CASE sy-ucomm.
        WHEN c_back.
          LEAVE TO SCREEN 0.
        WHEN c_exit.
          LEAVE TO SCREEN 0.
        WHEN c_cancel.
          LEAVE TO SCREEN 0.
       WHEN 'BILDET'.
         CALL METHOD w_grid->get_selected_rows
           IMPORTING
             et_index_rows = lt_rows.
         CALL METHOD cl_gui_cfw=>flush.
         IF sy-subrc EQ 0.
           READ TABLE lt_rows INTO w_rows INDEX 1.
           READ TABLE i_vbfa INTO w_vbfa INDEX w_rows-index.
           IF sy-subrc EQ 0.
             CLEAR i_zbw_br_nf4.
             LOOP AT i_zbw_br_nf3 INTO w_zbw_br_nf3 WHERE
                         refkey = w_vbfa-v_vbeln.
               APPEND w_zbw_br_nf3 TO i_zbw_br_nf4.
             ENDLOOP.
    call dialog screen and display new alv control
             CALL SCREEN 101 STARTING AT 10 5.
           ENDIF.
         ENDIF.
         WHEN 'NOTAF'.
         CALL METHOD w_grid->get_selected_rows
           IMPORTING
             et_index_rows = lt_rows.
         CALL METHOD cl_gui_cfw=>flush.
         IF sy-subrc EQ 0.
           READ TABLE lt_rows INTO w_rows INDEX 1.
           READ TABLE i_zbw_br_nf3 INTO w_zbw_br_nf3 INDEX w_rows-index.
           DATA docnum LIKE j_1bdydoc-docnum.
           docnum = w_zbw_br_nf3-docnum.
           SET PARAMETER ID 'JEF' FIELD docnum.
           CALL TRANSACTION 'J1B3N' AND SKIP FIRST SCREEN.
         ENDIF.
      ENDCASE.
      ENDMODULE.                 " user_command_0100  INPUT
    *&      Form  modify_col_name
          text
         -->P_<FCAT>  text
         -->P_TEXT_H01  text
    FORM modify_col_name  USING  pwa_fcat TYPE lvc_s_fcat
                                 value(pw_text) TYPE any.
      pwa_fcat-coltext   = pw_text.
      pwa_fcat-scrtext_l = pw_text.
      pwa_fcat-scrtext_m = pw_text.
      pwa_fcat-scrtext_s = pw_text.
    ENDFORM.                    " modify_col_name
          FORM display_hotspot                                          *
    FORM display_hotspot USING pw_row_id    TYPE lvc_s_row
                               pw_column_id TYPE lvc_s_col.
      FIELD-SYMBOLS <l_data> TYPE zbrforecast.
    READ TABLE t_br_nf_acum ASSIGNING <l_data> INDEX pw_row_id-index.
    CHECK sy-subrc = 0.
    IF pw_column_id = ' '.
    ENDIF.
    ENDFORM.                    "display_hotspot
    *&      Form  generate_sort
          Genereate Sort criteria
    FORM generate_sort.
    Local variables
    DATA: wal_sort TYPE lvc_s_sort,
           wl_pos   TYPE numc2.
    wl_pos = 01.
    sort ORDER
    wal_sort-spos      = wl_pos.
    wal_sort-fieldname = c_aufnr.
    wal_sort-up        = c_check.
    APPEND wal_sort TO t_sort.
    ENDFORM.                    "generate_sort
    *&      Form  f4_variant
          text
         <--PW_VARI  text
    FORM f4_variant CHANGING pw_vari TYPE disvariant-variant.
    wa_variant-report = sy-cprog.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = wa_variant
          i_save        = c_u
        IMPORTING
          es_variant    = wa_variant
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc IS INITIAL.
        pw_vari = wa_variant-variant.
      ELSE.
        MESSAGE s208(00) WITH text-t04.
      ENDIF.
    ENDFORM.                    " f4_variant
    *&      Form  validate_layout
    *This subroutine is to validate the layout
    No parameters are passed to this subroutine
    FORM validate_layout.
    IF NOT p_layout IS INITIAL.
      Check Layout
       wa_variant-report   = sy-repid.
       wa_variant-username = sy-uname.
       wa_variant-variant  = p_layout.
       CALL FUNCTION 'LVC_VARIANT_EXISTENCE_CHECK'
         EXPORTING
           i_save     = c_u
         CHANGING
           cs_variant = wa_variant
         EXCEPTIONS
           OTHERS     = 01.
       IF NOT sy-subrc IS INITIAL.
         SET CURSOR FIELD 'P_LAYOUT'.
         MESSAGE s001(00) WITH text-t06 p_layout.
         STOP.
       ENDIF.
    ELSE.
      clear wa_variant.
    ENDIF.
    ENDFORM.                    " validate_layout
    *&      Form  validate_data
          text
    FORM validate_data .
    PERFORM validate_layout.
    ENDFORM.                    " validate_data

    Hi,
    Before the call to method set_table_for_first_display, populate
    wa_variant-report = sy-repid.
    Best regards,
    Prashant

  • Page-break in alv background job for alv output variant not coming correctl

    Hi,
    I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1.  I have already build the sort criteria and using:
    gs_sort-group = '* '.     "New-Page
    Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
    Regards,
    Rakesh

    Hello Everyone,
    I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
    gs_sort-group = '* '.     "New-Page
    If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
    *C-- Process separately for jobs running in Background. Actually
    *C-- sortcat-group solves the problem only in Foreground. In background
    *C-- when ALV layout variant is not selected then it works otherwise it
    *C-- fails. So for background jobs we are reading the fieldcat and then
    *C-- passing the same in the display FM.
      IF sy-batch = 'X'.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
           i_dialog                  = ' '
           i_user_specific           = ' '
           i_default                 = ' '
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
            it_default_fieldcat       = gt_fieldcat
            i_layout                  = gs_layout
    *   I_BYPASSING_BUFFER        =
    *   I_BUFFER_ACTIVE           =
         IMPORTING
    *   E_EXIT                    =
           et_fieldcat               = lt_fieldcat
    *     et_sort                   = gt_sort[]
    *   ET_FILTER                 =
    *     es_layout                 = gs_layout
         CHANGING
           cs_variant                = gs_disvariant
         EXCEPTIONS
           wrong_input               = 1
           fc_not_complete           = 2
           not_found                 = 3
           program_error             = 4
           OTHERS                    = 5
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CLEAR gs_fieldcat.
        LOOP AT gt_fieldcat INTO gs_fieldcat.
    *C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
          CLEAR ls_fieldcat.
          READ TABLE lt_fieldcat
                INTO ls_fieldcat
                WITH KEY fieldname = gs_fieldcat-fieldname.
          IF sy-subrc = 0.
            gs_fieldcat-row_pos = ls_fieldcat-row_pos.
            gs_fieldcat-col_pos = ls_fieldcat-col_pos.
            gs_fieldcat-no_out = ls_fieldcat-no_out.
            MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
            CLEAR gs_fieldcat.
          ENDIF.
        ENDLOOP.
    *C-- Clear the disvariant for the background job as it contains the ALV
    *C-- layout varinat
        CLEAR gs_disvariant.
        gs_disvariant-report = 'ZGPPMP0001'.
    Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
    The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
    One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
    I was getting ABAP runtime errors    MESSAGE_TYPE_X in the following part of the standard code.
    000310     LOOP AT CT_SORT INTO LS_SORT.
    000320
    000330       READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
    000340            WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
    000350       IF SY-SUBRC NE 0.
         >         MESSAGE X000(0K).
    000370       ENDIF.
    000380
    000390       LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
    i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons.

  • How to get the fields in a display variant

    Hello gurus,
    I have created variants for an ALV display that I can select on my selection. This works fine.
    Now I need to know during the execution of the program what are the fields that have been selected in the display variant so that I can export the selected fields in an excel sheet that I send by mail. The file is currently being sent with all the possible fields .
    Is there a module function that allows the program to know which field is present in the display variant?
    Thanks,
    Parvez

    Hi,
    Try these:     REUSE_ALV_VARIANT_DEFAULT_GET.
         REUSE_ALV_VARIANT_F4.
    .also see the link for more Details:
    http://www.abapcode.info/2008/09/selecting-variants-for-initial-alv-list.html.
    Hope it helps.
    Regards,
    Rahul

  • ALV  display for  row  s   and columns in this format.have ur full points..

    Hi ALL
      I have to dispalay data in the ALV format as :
    Basic
    DA
    HRA
    PF
    VPF
    20000
    500
    5000
    | 1500     | 600  |          |
    Details :  Basic   HRA in one Row and   PF , VPF in  second Row.
    The Amount  regarding htese fields are also displayed in the next rows for all  emp. numbers.
    its urgent for me and need helpful answers...
    Regards
    Lakhan

    see the attached code it will display the hierarchial display as per your need
    change the internal tables with dat of your own orgn structure and pass it to the fun module.
    Description : Pick Status Report
    This is an ALV report using the heirarchical ALV list display. The
    report selects all deliveries that fulfil the selection criteria
    and displays a summary of all items in that delivery with reference
    to certain statuses: overall status, goods issue status, transfer
    order status, load to pallet status, pallet count status, loaded to
    van status, van manifest printed status and end of day manifest
    printed status. These statuses have been defined by the business.
    There is extra functionality required to trigger printing of the van
    and end of day manifests from this report, and to set the loading
    end status of a shipment if the last handling unit of a particular
    shipment has been loaded onto a van for which the van manifest has
    been triggered.
    REPORT zwmr_pick_status_report NO STANDARD PAGE HEADING
    MESSAGE-ID zw.
    Type Pools
    TYPE-POOLS: icon, slis.
    Tables
    TABLES: tvst,
    likp,
    t30b,
    vekp,
    *{ INSERT UKMK900355 4
    zhu_to_link, "AS03
    *} INSERT
    zpallettr,
    vttk, "MB01
    zvantr.
    Types
    TYPES:
    BEGIN OF ty_data,
    lgtor LIKE likp-lgtor, " door
    vbeln LIKE likp-vbeln, " delivery
    wbstk LIKE vbuk-wbstk, " Goods movement status
    kostk LIKE vbuk-kostk, " Picking status
    posnr LIKE lips-posnr, " item
    route LIKE likp-route, " route
    wadat LIKE likp-wadat, " goods issue date
    lvsta LIKE vbup-lvsta, " warehouse status
    packvorschr LIKE vekp-packvorschr, " pack mnemonic
    exidv LIKE vekp-exidv, " handling unit
    zpallet_no(10), "like zpallettr-zpallet_no, " pallet no
    zdep_point LIKE zpallettr-zdep_point, "Departur Point "Jvdm01
    zcount_check LIKE zpallettr-zcount_check," count check flag
    zvan_no(10), "like zvantr-zvan_no, " van no
    zvan_print LIKE zvantr-zvan_print, " van manifest print
    tknum LIKE vttk-tknum, " Shipment No "ANV 11523
    zeod_print LIKE zvantr-zeod_print, " eod manifest print
    zzpackclass LIKE vekp-zzpackclass, " package class
    zzti LIKE vekp-zzti, " T.I. value
    vstel LIKE likp-vstel, "Shipping point RM050906
    anzpk TYPE znopack, "No of packages in dlv MB01+
    END OF ty_data.
    TYPES:BEGIN OF x_likp ,
    vbeln LIKE likp-vbeln,
    vstel LIKE likp-vstel, "RM050906
    lgtor LIKE likp-lgtor,
    zzroute2lgtor LIKE likp-zzroute2lgtor, "MB01
    route LIKE likp-route,
    wadat LIKE likp-wadat,
    zz2route LIKE likp-zz2route, "MB01+
    zzexproute LIKE likp-zzexproute, "MB01+
    zzroute2 LIKE likp-zzroute2, "MB01+
    anzpk LIKE likp-anzpk,
    END OF x_likp.
    TYPES: BEGIN OF x_vbuk,
    vbeln TYPE vbuk-vbeln,
    wbstk TYPE vbuk-wbstk, " Goods movement status
    kostk TYPE vbuk-kostk, " Picking status
    END OF x_vbuk.
    TYPES: BEGIN OF x_lips,
    vbeln TYPE lips-vbeln, " delivery
    posnr TYPE lips-posnr, " item
    pstyv TYPE lips-pstyv,
    matnr TYPE lips-matnr,
    charg TYPE lips-charg,
    END OF x_lips.
    TYPES: BEGIN OF x_vbup,
    vbeln TYPE vbup-vbeln, " delivery
    posnr TYPE vbup-posnr, " item
    lvsta TYPE vbup-lvsta, " warehouse status
    END OF x_vbup.
    TYPES: BEGIN OF x_vepo,
    venum TYPE vepo-venum, "Internal Handling Unit
    Number
    vepos TYPE vepo-vepos, "Handling Unit Item
    vbeln TYPE vepo-vbeln, " delivery
    posnr TYPE vepo-posnr, " item
    exidv TYPE vekp-exidv,
    END OF x_vepo.
    TYPES: BEGIN OF x_vepo1,
    venum TYPE vekp-venum, "Internal Handling Unit
    Number
    exidv TYPE vekp-exidv,
    END OF x_vepo1.
    Start of changes by ANV SR#11523
    TYPES: BEGIN OF x_vttp,
    tknum TYPE tknum, " Shipment No
    tpnum TYPE tpnum, " Item No
    vbeln TYPE vbup-vbeln, " delivery
    laufk LIKE vttk-laufk, " leg indicator MB01+
    END OF x_vttp.
    End of changes by ANV SR#11523
    Data
    RANGES: r_del FOR likp-vbeln,
    r_lgtor FOR likp-lgtor.
    RANGES: r_vanno FOR zvantr-zvan_no,
    r_palno FOR zpallettr-zpallet_no.
    DATA: BEGIN OF number_range OCCURS 0,
    mark(1),
    id(3),
    num(10) TYPE n,
    desc LIKE zpalletmd-zdesc,
    END OF number_range.
    DATA: t_disp_tab TYPE STANDARD TABLE OF zpickdisp,
    t_data_tab TYPE ty_data OCCURS 0 WITH HEADER LINE,
    it_likp TYPE x_likp OCCURS 0 WITH HEADER LINE, "SUM
    it_vbuk TYPE x_vbuk OCCURS 0 WITH HEADER LINE, "SUM
    it_lips TYPE x_lips OCCURS 0 WITH HEADER LINE, "SUM
    it_vbup TYPE x_vbup OCCURS 0 WITH HEADER LINE, "SUM
    it_vepo TYPE x_vepo OCCURS 0 WITH HEADER LINE, "SUM
    it_vepo2 TYPE x_vepo OCCURS 0 WITH HEADER LINE, "SUM
    *{ INSERT UKMK900355 3
    t_vepo_low TYPE x_vepo OCCURS 0 WITH HEADER LINE, " AS01
    *} INSERT
    it_vepo1 TYPE x_vepo1 OCCURS 0 WITH HEADER LINE, "SUM
    it_vttp TYPE x_vttp OCCURS 0 WITH HEADER LINE, "ANV SR#11523
    t_disp_head TYPE STANDARD TABLE OF zpickhead.
    DATA wa_item_tab TYPE zpickdisp OCCURS 0 WITH HEADER LINE.
    "ANV SR#11113
    DATA: w_numrnge LIKE number_range,
    w_number(10) TYPE n.
    DATA: t_likp LIKE likp OCCURS 0 WITH HEADER LINE,
    t_lips LIKE lips OCCURS 0 WITH HEADER LINE,
    t_vbuk LIKE vbuk OCCURS 0 WITH HEADER LINE,
    t_vbup LIKE vbup OCCURS 0 WITH HEADER LINE,
    t_vepo LIKE vepo OCCURS 0 WITH HEADER LINE,
    t_vekp LIKE vekp OCCURS 0 WITH HEADER LINE,
    t_vantr LIKE zvantr OCCURS 0 WITH HEADER LINE,
    t_pallettr LIKE zpallettr OCCURS 0 WITH HEADER LINE,
    w_likp like likp,
    w_lips LIKE lips,
    w_vbuk LIKE vbuk,
    w_vbup LIKE vbup,
    w_vepo LIKE vepo,
    w_vekp LIKE vekp,
    w_vepo TYPE x_vepo1,
    w_vbup TYPE x_vbup,
    w_vttp TYPE x_vttp, " ANV SR#11523
    w_lips TYPE x_lips,
    w_vbuk TYPE x_vbuk,
    w_likp TYPE x_likp, "MB01-+
    w_tplst LIKE vttk-tplst. "MB01+
    DATA: s_variant LIKE disvariant, "MB01+
    def_variant LIKE disvariant.
    ALV DATA *****
    DATA:
    g_grid TYPE REF TO cl_gui_alv_grid,
    g_sort TYPE slis_t_sortinfo_alv,
    g_custom_container TYPE REF TO cl_gui_custom_container,
    g_layout TYPE slis_layout_alv,
    gt_fieldcat TYPE slis_t_fieldcat_alv,
    t_fldcat LIKE LINE OF gt_fieldcat,
    g_keyinfo TYPE slis_keyinfo_alv,
    gt_events TYPE slis_t_event,
    gs_event TYPE slis_alv_event,
    w_sy_repid LIKE sy-repid.
    DATA: BEGIN OF seltab OCCURS 0.
    INCLUDE STRUCTURE rsparams.
    DATA: END OF seltab.
    SYSTEM GENERATED TABLE CONTROL DATA ********
    DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
    CONTROLS: tc_tabcon TYPE TABLEVIEW USING SCREEN 0100.
    LINES OF TABLECONTROL 'TC_TABCON'
    DATA: g_tc_tabcon_lines LIKE sy-loopc.
    DATA: ok_code LIKE sy-ucomm.
    Constants
    CONSTANTS: c_data_class LIKE klah-class VALUE 'DG_DATA',
    c_mat_class LIKE rmclf-klart VALUE '001',
    c_pack LIKE lips-mtart VALUE 'VERP',
    c_a(1) VALUE 'A',
    c_b(1) VALUE 'B',
    c_c(1) VALUE 'C',
    c_yes(1) VALUE 'X',
    c_no(1) VALUE ' '.
    Selection screen
    standard report select options block
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-002.
    SELECT-OPTIONS:
    s_wadat FOR likp-wadat NO-EXTENSION OBLIGATORY. " Goods Issue Date
    *parameters: "TR01-
    p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
    SELECT-OPTIONS: "TR01+
    p_vstel FOR tvst-vstel. " Shipping Point "TR01+
    SELECT-OPTIONS:
    s_lfart FOR likp-lfart, " Delivery type
    s_lgtor FOR t30b-lgtor, " Door selection
    s_exidv FOR vekp-exidv, " Handling Unit
    s_vbeln FOR likp-vbeln, " Delivery "MB01-+
    s_lfdat FOR likp-lfdat. " Delivery date
    PARAMETERS:
    p_exdata AS CHECKBOX. " Show extra columns flag
    SELECTION-SCREEN END OF BLOCK a.
    van/pallet specific select options block
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001.
    SELECT-OPTIONS:
    s_palno FOR zpallettr-zpallet_no, " no-extension,
    s_vanno FOR zvantr-zvan_no. " no-extension.
    SELECT-OPTIONS:
    s_deppnt FOR zpallettr-zdep_point, "Jvdm01
    s_tplst FOR vttk-tplst. "MB01
    SELECTION-SCREEN END OF BLOCK b.
    MB01 - START - Display variant
    SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-019.
    PARAMETERS: p_vari LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK c.
    MB01 - END
    Value Request Events
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-low.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_pal_nos.
    s_palno-low = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-high.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_pal_nos.
    s_palno-high = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-low.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_van_nos.
    s_vanno-low = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-high.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_van_nos.
    s_vanno-high = w_number.
    MB01 - START - display variant
    F4-Help for variant
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    MB01 - END
    At Selection Screen
    AT SELECTION-SCREEN.
    PERFORM validate_selections.
    Initialization
    INITIALIZATION.
    MB01 - START INSERT
    1. Transportation planning point
    Import transportation planning point from user parameters and
    populate
    select option.
    GET PARAMETER ID 'TDP' FIELD w_tplst.
    MOVE: 'I' TO s_tplst-sign,
    'EQ' TO s_tplst-option,
    w_tplst TO s_tplst-low.
    APPEND s_tplst.
    2. Display variant
    CLEAR s_variant.
    s_variant-report = sy-repid.
    Get default variant
    s_def_variante = s_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save = 'A'
    CHANGING
    cs_variant = s_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 0.
    p_vari = s_variant-variant.
    ENDIF.
    MB01 - END INSERT
    Start of selection
    START-OF-SELECTION.
    clear all data tables
    CLEAR: t_likp,
    it_likp,
    t_lips,
    t_vbuk,
    t_vbup,
    t_vepo,
    t_vantr,
    t_pallettr,
    w_likp,
    w_lips,
    w_vbuk,
    w_vbup,
    w_vepo,
    w_vekp.
    REFRESH: t_likp,
    it_likp,
    t_lips,
    t_vbuk,
    t_vbup,
    t_vepo,
    t_vantr,
    t_pallettr.
    select data for ALV
    due to different input parameters being used, to streamline the data
    selection process, different selection methods are required
    IF NOT s_vanno IS INITIAL
    OR NOT s_palno IS INITIAL
    OR NOT s_deppnt IS INITIAL. "Jvdm01
    if selecting by van/pallet number, need to select the data from the
    handling unit upwards to delivery
    PERFORM select_data_up.
    ELSE.
    otherwise the data can be selected from the delivery downwards
    PERFORM select_data_down.
    ENDIF.
    End of selection
    END-OF-SELECTION.
    call hierarchical ALV display function module
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
    i_callback_program = 'ZWMR_PICK_STATUS_REPORT'
    i_callback_pf_status_set = 'SET_STATUS'
    i_callback_user_command =
    'USER_COMMAND' "custom gui status form
    is_layout = g_layout "user command form
    it_fieldcat = gt_fieldcat
    it_sort = g_sort
    i_save = 'X' "MB01+
    is_variant = s_variant
    it_events = gt_events
    i_tabname_header = 't_disp_head'
    i_tabname_item = 't_disp_tab'
    i_structure_name_header = 'ZPICKHEAD'
    i_structure_name_item = 'ZPICKDISP'
    is_keyinfo = g_keyinfo
    TABLES
    t_outtab_header = t_disp_head
    t_outtab_item = t_disp_tab.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    FORMS
    Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
    INCLUDE zwmr_pick_o01.
    INCLUDE zwmr_pick_status_reporto01 .
    INCLUDE zwmr_pick_i01.
    INCLUDE zwmr_pick_status_reporti01 .
    INCLUDE zwmr_pick_f01.
    INCLUDE zwmr_pick_status_reportf01 .
    *& Form select_pal_nos
    select pallet numbers for search help
    FORM select_pal_nos.
    DATA: BEGIN OF t_palno OCCURS 0,
    zpallet_no LIKE zpallettr-zpallet_no,
    END OF t_palno.
    select all available pallet numbers
    SELECT DISTINCT zpallet_no FROM zpallettr
    INTO CORRESPONDING FIELDS OF TABLE t_palno.
    LOOP AT t_palno.
    get pallet id
    SELECT SINGLE zpallet_id FROM zpallettr
    INTO number_range-id
    WHERE zpallet_no = t_palno-zpallet_no.
    get pallet description
    SELECT SINGLE zdesc FROM zpalletmd
    INTO number_range-desc
    WHERE zpallet_id = number_range-id.
    number_range-num = t_palno-zpallet_no.
    append to search help table
    APPEND number_range.
    ENDLOOP.
    call pop up dialog box
    CALL SCREEN 0100 STARTING AT 5 5.
    ENDFORM. " select_pal_nos
    *& Form select_van_nos
    select van numbers for search help
    FORM select_van_nos.
    DATA: BEGIN OF t_vanno OCCURS 0,
    zvan_no LIKE zvantr-zvan_no,
    END OF t_vanno.
    select available van numbers
    SELECT DISTINCT zvan_no FROM zvantr
    INTO CORRESPONDING FIELDS OF TABLE t_vanno.
    LOOP AT t_vanno.
    select van id
    SELECT SINGLE zvan_id FROM zvantr
    INTO number_range-id
    WHERE zvan_no = t_vanno-zvan_no.
    select van description (maintained in pallet tables)
    SELECT SINGLE zdesc FROM zpalletmd
    INTO number_range-desc
    WHERE zpallet_id = number_range-id.
    number_range-num = t_vanno-zvan_no.
    append to search help table
    APPEND number_range.
    ENDLOOP.
    call pop up dialog box
    CALL SCREEN 0100 STARTING AT 5 5.
    ENDFORM. " select_van_nos
    *& Form select_data_down
    select data if selecting from delivery down
    FORM select_data_down.
    select all deliveries from LIKP that fulfill selection criteria
    Start SU01 optmization changes
    SELECT vbeln vstel lgtor route wadat "RM050906
    SELECT vbeln vstel lgtor route wadat
    zzroute2lgtor zz2route zzexproute zzroute2 anzpk "MB01-+
    FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp"MB01-+
    WHERE vbeln IN s_vbeln
    AND vstel IN p_vstel
    AND lfart IN s_lfart
    AND wadat IN s_wadat
    AND lfdat IN s_lfdat "MB01+
    AND
    ( lgtor IN s_lgtor OR zzroute2lgtor IN s_lgtor ) ."MB01+
    IF sy-subrc NE 0.
    no data found
    MESSAGE i007.
    EXIT.
    ENDIF.
    IF NOT t_likp[] IS INITIAL. "SUM
    IF NOT it_likp[] IS INITIAL.
    SORT it_likp BY vbeln. "SUM
    select sales document headers from VBUK
    SELECT vbeln wbstk kostk
    FROM vbuk INTO TABLE it_vbuk
    FOR ALL ENTRIES IN it_likp "SUM
    WHERE vbeln EQ it_likp-vbeln. "SUM
    SORT it_vbuk BY vbeln.
    select all relevant delivery items from LIPS
    SELECT vbeln posnr pstyv matnr charg
    FROM lips INTO TABLE it_lips
    FOR ALL ENTRIES IN it_likp
    WHERE vbeln EQ it_likp-vbeln
    AND pckpf NE 'B' "cannot be packed "AS05
    AND pstyv NE 'ZPAC' "AS05
    AND pstyv NE 'ZGDP' "TR02+ "AS05
    AND lfimg GT 0. "TR01+
    ENDIF.
    IF NOT it_lips[] IS INITIAL.
    select all sales document line items from VBUP
    SORT it_lips BY vbeln posnr. "SUM
    SELECT vbeln posnr lvsta
    FROM vbup INTO TABLE it_vbup
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln EQ it_lips-vbeln
    AND posnr = it_lips-posnr.
    SORT it_vbup BY vbeln posnr.
    select corresponding handling unit ID's (venum)
    TR03 Replace
    start
    select * from vepo appending corresponding fields of table t_vepo
    for all entries in t_lips
    where vbeln = t_lips-vbeln
    and posnr = t_lips-posnr
    and matnr = t_lips-matnr
    and charg = t_lips-charg.
    SELECT vepoVENUM vepoVEPOS vepovbeln vepoposnr
    FROM vepo as vepo
    INNER JOIN vekp as vekp ON vepovenum = vekpvenum
    APPENDING corresponding fields of table it_vepo
    FOR ALL ENTRIES IN it_lips
    WHERE vepo~vbeln = it_lips-vbeln
    AND vepo~posnr = it_lips-posnr
    AND vepo~matnr = it_lips-matnr
    AND vepo~charg = it_lips-charg
    AND vekp~exidv IN s_exidv.
    SELECT venum vepos vbeln posnr
    FROM vepo INTO TABLE it_vepo2
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln = it_lips-vbeln
    AND posnr = it_lips-posnr
    AND matnr = it_lips-matnr
    AND charg = it_lips-charg.
    SORT it_vepo2 BY venum vepos.
    *{ INSERT UKMK900355 1
    Ice-multis: replace lower-level HUs with highest level " AS01
    PERFORM replace_highest_hu. " AS01
    *} INSERT
    Start of changes by ANV SR#11523
    MB01 - extract shipment header as well to populate leg indicator
    Therefore, join vttp with vttk
    Limit as well by transportation planning point
    SELECT vttptknum vttptpnum vttpvbeln vttklaufk
    FROM vttp INNER JOIN vttk
    ON vttptknum = vttktknum
    INTO TABLE it_vttp
    FOR ALL ENTRIES IN it_lips
    WHERE vttp~vbeln = it_lips-vbeln
    AND vttk~tplst IN s_tplst.
    MB01 - END
    End of changes by ANV SR#11523
    IF NOT it_vepo2[] IS INITIAL.
    SELECT venum exidv
    FROM vekp INTO TABLE it_vepo1
    FOR ALL ENTRIES IN it_vepo2
    WHERE venum = it_vepo2-venum
    AND exidv IN s_exidv.
    ENDIF.
    SORT it_vepo1 BY venum.
    CLEAR: w_vepo, it_vepo.
    LOOP AT it_vepo1.
    READ TABLE it_vepo2 WITH KEY venum = it_vepo1-venum.
    IF sy-subrc = 0.
    it_vepo2-exidv = it_vepo1-exidv.
    MODIFY it_vepo2 TRANSPORTING exidv
    WHERE venum = it_vepo1-venum .
    ENDIF.
    ENDLOOP.
    DELETE it_vepo2 WHERE exidv IS initial.
    it_vepo[] = it_vepo2[].
    TR03 Replace end
    ENDIF.
    build process table
    PERFORM move_to_table.
    ENDFORM. "select_data_down
    *& Form select_data_up
    select data if selecting from van/pallet up
    FORM select_data_up.
    IF NOT s_vanno IS INITIAL.
    if van then select van numbers and hence pallet numbers
    SELECT * FROM zvantr INTO TABLE t_vantr
    WHERE zvan_no IN s_vanno.
    and vstel eq p_vstel."TR01-
    IF NOT t_vantr[] IS INITIAL.
    SORT t_vantr BY zvan_id zvan_no vstel zpallet_no. "SUM
    SELECT * FROM zpallettr INTO TABLE t_pallettr
    FOR ALL ENTRIES IN t_vantr
    WHERE zpallet_no EQ t_vantr-zpallet_no
    AND zdep_point IN s_deppnt. "Jvdm01
    and vstel eq p_vstel."TR01-
    ENDIF.
    ELSE.
    otherwise can get pallet numbers directly
    SELECT * FROM zpallettr INTO TABLE t_pallettr
    WHERE zpallet_no IN s_palno
    AND zdep_point IN s_deppnt. "Jvdm01
    and vstel eq p_vstel."TR01-
    ENDIF.
    IF NOT t_pallettr[] IS INITIAL.
    from the pallet nos. we can select the handling units
    SORT t_pallettr BY zpallet_id zpallet_no vstel exidv. "SUM
    SELECT * FROM vekp INTO TABLE t_vekp
    FOR ALL ENTRIES IN t_pallettr
    WHERE exidv EQ t_pallettr-exidv
    AND exidv NE space
    AND exidv IN s_exidv "TR03+
    AND ( exida = 'E' "TR01+
    OR exida = 'F' ). "TR01+
    ENDIF.
    SORT t_vekp BY venum. "SUM
    IF NOT t_vekp[] IS INITIAL.
    build vbeln range from t_vekp.
    LOOP AT t_vekp.
    r_del-sign = 'I'.
    r_del-option = 'EQ'.
    r_del-low = t_vekp-vpobjkey.
    APPEND r_del.
    ENDLOOP.
    select all deliveries from LIKP that correspond to HU's
    SELECT * FROM likp INTO TABLE t_likp
    WHERE vbeln IN r_del
    AND wadat IN s_wadat
    AND lfart IN s_lfart.
    ENDIF.
    MB01- START
    SELECT vbeln lgtor route wadat
    FROM likp INTO TABLE it_likp
    WHERE vbeln IN r_del
    AND wadat IN s_wadat
    AND lfart IN s_lfart.
    SELECT vbeln vstel lgtor route wadat
    zzroute2lgtor zz2route zzexproute zzroute2 anzpk "MB01-+
    FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp
    WHERE vbeln IN r_del
    AND lfart IN s_lfart
    AND wadat IN s_wadat "MB01-+
    AND lfdat IN s_lfdat. "MB01+
    MB01- END
    ENDIF.
    IF NOT it_likp[] IS INITIAL.
    SORT it_likp BY vbeln . "SUM
    select sales document headers from VBUK
    SELECT * FROM vbuk INTO TABLE t_vbuk
    FOR ALL ENTRIES IN t_likp
    WHERE vbeln EQ t_likp-vbeln.
    SELECT vbeln wbstk kostk
    FROM vbuk INTO TABLE it_vbuk
    FOR ALL ENTRIES IN it_likp
    WHERE vbeln EQ it_likp-vbeln.
    SORT it_vbuk BY vbeln. "SUM
    select all relevant delivery items from LIPS
    SELECT * FROM lips INTO TABLE t_lips
    FOR ALL ENTRIES IN t_likp
    WHERE vbeln EQ t_likp-vbeln
    AND pstyv NE 'ZPAC'
    AND pstyv NE 'ZGDP' "TR02+
    AND lfimg GT 0. "TR01+
    SELECT vbeln posnr pstyv matnr charg
    FROM lips INTO TABLE it_lips
    FOR ALL ENTRIES IN it_likp
    WHERE vbeln EQ it_likp-vbeln
    AND pckpf NE 'B' "cannot be packed "AS05
    AND pstyv NE 'ZPAC' "AS05
    AND pstyv NE 'ZGDP' "TR02+ "AS05
    AND lfimg GT 0. "TR01+
    ENDIF.
    IF NOT it_lips[] IS INITIAL.
    SORT it_lips BY vbeln posnr. "SUM
    select all sales document line items from VBUP
    SELECT * FROM vbup INTO TABLE t_vbup
    FOR ALL ENTRIES IN t_lips
    WHERE vbeln EQ t_lips-vbeln
    AND posnr = t_lips-posnr.
    Start of changes by ANV SR#11523
    MB01 - START
    join vttp with vttk to obtain leg indicator
    SELECT tknum tpnum vbeln
    FROM vttp INTO TABLE it_vttp
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln = it_lips-vbeln.
    SELECT vttptknum vttptpnum vttpvbeln vttklaufk
    FROM vttp INNER JOIN vttk
    ON vttptknum = vttktknum
    INTO TABLE it_vttp
    FOR ALL ENTRIES IN it_lips
    WHERE vttp~vbeln = it_lips-vbeln
    AND vttk~tplst IN s_tplst.
    MB01 - END
    End of changes by ANV SR#11523
    SELECT vbeln posnr lvsta
    FROM vbup INTO TABLE it_vbup
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln EQ it_lips-vbeln
    AND posnr = it_lips-posnr.
    SORT t_vbup BY vbeln posnr. "SUM
    select corresponding handling unit ID's (venum)
    SELECT * FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE t_vepo
    FOR ALL ENTRIES IN t_lips
    WHERE vbeln = t_lips-vbeln
    AND posnr = t_lips-posnr
    AND matnr = t_lips-matnr
    AND charg = t_lips-charg.
    SELECT venum vepos vbeln posnr
    FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE it_vepo
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln = it_lips-vbeln
    AND posnr = it_lips-posnr
    AND matnr = it_lips-matnr
    AND charg = it_lips-charg.
    *{ INSERT UKMK900355 1
    it_vepo2[] = it_vepo[]. " DS01
    PERFORM replace_highest_hu. " DS01
    it_vepo[] = it_vepo2[]. " DS01
    *} INSERT
    ENDIF.
    build process table
    PERFORM move_to_table.
    ENDFORM. "select_data_up
    *& Form move_to_table
    move data to processing table
    FORM move_to_table.
    LOOP AT it_vepo.
    CLEAR t_data_tab.
    delivery lines.
    CLEAR w_lips.
    READ TABLE it_lips WITH KEY vbeln = it_vepo-vbeln
    posnr = it_vepo-posnr
    INTO w_lips BINARY SEARCH. "SUM
    MOVE-CORRESPONDING w_lips TO t_data_tab.
    sales document line items
    CLEAR w_vbup.
    READ TABLE it_vbup WITH KEY vbeln = it_vepo-vbeln
    posnr = it_vepo-posnr
    INTO w_vbup BINARY SEARCH. "SUM
    if w_vbup-kosta = space. "TR01-
    not relevant for picking
    delete t_vepo. "TR01-
    continue. "TR01-
    else. "TR01-
    MOVE-CORRESPONDING w_vbup TO t_data_tab.
    endif. "TR01-
    sales doc header
    CLEAR w_vbuk.
    READ TABLE it_vbuk WITH KEY vbeln = it_vepo-vbeln
    INTO w_vbuk BINARY SEARCH. "SUM
    MOVE-CORRESPONDING w_vbuk TO t_data_tab.
    delivery header
    CLEAR w_likp.
    READ TABLE it_likp WITH KEY vbeln = it_vepo-vbeln
    INTO w_likp BINARY SEARCH. "SUM
    MOVE-CORRESPONDING w_likp TO t_data_tab.
    MB01 - START
    DATA: w_routetype TYPE i. "0=non-global,1=1st route,2=2nd
    route,3=both
    At this point move DOOR2 if it falls within the global route scenario
    and the door2 is satisfies the selection criteria for door
    1. Does delivery fall within global route scenario
    CLEAR w_routetype.
    IF w_likp-zz2route = 'Y' .
    1.a. First route - does door1 satisfy the selection criteria
    IF w_likp-lgtor IN s_lgtor.
    w_routetype = 1.
    MOVE w_likp-zzexproute TO t_data_tab-route.
    1.b. Second route - does door2 satisfy the selection criteria
    ELSEIF w_likp-zzroute2lgtor IN s_lgtor.
    here we need to move door2 to lgtor
    w_routetype = 2.
    MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
    MOVE w_likp-zzroute2 TO t_data_tab-route.
    ENDIF.
    If both routes satsify the criteria, append for 2nd leg ***REVISIT!
    IF w_likp-lgtor IN s_lgtor AND w_likp-zzroute2lgtor IN s_lgtor.
    w_routetype = 3.
    ENDIF.
    ENDIF.
    MB01 - END
    Start of changes by ANV SR#11523
    MB01 - If the delivery falls within the global route scenario... need
    to select either preliminary shipment leg OR subsequent leg
    when laufk= 1 (prelim) and linked to route1, if laufk = 2 (subseq) &
    linked to route2
    Shipment Number
    SORT it_vttp BY vbeln laufk.
    CLEAR w_vttp.
    CASE w_routetype.
    WHEN 0.
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    INTO w_vttp BINARY SEARCH.
    WHEN 1.
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '1'
    INTO w_vttp BINARY SEARCH.
    WHEN 2.
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '3'
    INTO w_vttp BINARY SEARCH.
    WHEN 3. "REVISIT
    ENDCASE.
    MOVE w_vttp-tknum TO t_data_tab-tknum.
    MB01 - END
    End of changes by ANV SR#11523
    select handling unit info using vepo entry
    CLEAR w_vekp.
    IF t_vekp[] IS INITIAL.
    SELECT SINGLE * FROM vekp INTO w_vekp
    WHERE venum = it_vepo-venum.
    ELSE.
    READ TABLE t_vekp WITH KEY venum = it_vepo-venum
    INTO w_vekp BINARY SEARCH. "SUM
    IF sy-subrc NE 0.
    SELECT SINGLE * FROM vekp INTO w_vekp
    WHERE venum = t_vepo-venum.
    ENDIF.
    ENDIF.
    MOVE-CORRESPONDING w_vekp TO t_data_tab.
    *{ INSERT UKMK900355 2
    WM status for HU "AS03
    SELECT SINGLE * FROM zhu_to_link WHERE lgnum EQ w_vekp-lgnum"AS03
    AND exidv EQ w_vekp-exidv."AS03
    IF sy-subrc EQ 0. "AS03
    IF zhu_to_link-zpick_comp EQ space. "AS03
    t_data_tab-lvsta = 'B'. "AS03
    ELSE. "AS03
    t_data_tab-lvsta = 'C'. "AS03
    ENDIF. "AS03
    ENDIF. "AS03
    *} INSERT
    select pallet / van load information "Jvdm01-
    SELECT SINGLE zpallet_no zcount_check FROM zpallettr "Jvdm01-
    INTO (t_data_tab-zpallet_no, "Jvdm01-
    t_data_tab-zcount_check) "Jvdm01-
    WHERE exidv EQ w_vekp-exidv. "Jvdm01-
    PERFORM read_pallet. "MB01+
    SELECT SINGLE zpallet_no zcount_check zdep_point "Jvdm01+
    FROM zpallettr "Jvdm01+
    INTO (t_data_tab-zpallet_no, "Jvdm01+
    t_data_tab-zcount_check, "Jvdm01+
    t_data_tab-zdep_point) "Jvdm01+
    WHERE exidv EQ w_vekp-exidv. "Jvdm01+
    WHERE exidv EQ w_vekp-exidv "MB01-+
    AND zpallet_id = t_data_tab-lgtor."MB01+
    MB01 - INSERT START
    If pallet number specified and
    we are in the global route scenario & both doors fall within the
    selection criteria, we need to copy the one that is currently in a
    specified pallet
    IF NOT s_palno IS INITIAL AND not t_data_tab-zpallet_no in s_palno
    AND w_routetype = '3' .
    Switch doors & get 2nd shipment
    MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
    MOVE w_likp-zzroute2 TO t_data_tab-route.
    Read subsequent leg shipment
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '3'
    INTO w_vttp BINARY SEARCH.
    IF sy-subrc = 0.
    MOVE w_vttp-tknum TO t_data_tab-tknum.
    ENDIF.
    PERFORM read_pallet. "MB01+
    ENDIF.
    MB01 - INSERT END
    IF NOT t_data_tab-zpallet_no IN s_palno. "TR01+
    CONTINUE. "TR01+
    ENDIF. "TR01+
    IF sy-subrc = 0. "mb01+
    perform read_van. "MB01+
    SELECT SINGLE zvan_no zvan_print zeod_print FROM zvantr
    INTO (t_data_tab-zvan_no,
    t_data_tab-zvan_print,
    t_data_tab-zeod_print)
    WHERE zpallet_no EQ t_data_tab-zpallet_no.
    MB01 - INSERT START
    If van number specified and
    we are in the global route scenario & both doors fall within the
    selection criteria, we need to copy the one that is currently on a
    specified van
    IF NOT s_vanno IS INITIAL AND not t_data_tab-zvan_no in s_vanno AND
    w_routetype = '3' .
    Switch doors & get 2nd shipment
    MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
    MOVE w_likp-zzroute2 TO t_data_tab-route.
    Read subsequent leg shipment
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '3'
    INTO w_vttp BINARY SEARCH.
    IF sy-subrc = 0.
    MOVE w_vttp-tknum TO t_data_tab-tknum.
    ENDIF.
    PERFORM read_pallet. "MB01+
    perform read_van.
    ENDIF. "mb01-
    MB01 - INSERT END
    IF NOT t_data_tab-zvan_no IN s_vanno. "TR01+
    CONTINUE. "TR01+
    ENDIF. "TR01+
    ENDIF.
    APPEND t_data_tab.
    ENDLOOP.
    *-----> TR01+ start
    If the delivery has yet to be packed, then need to include in report
    Thus delete t_lips here and if any entries left after looping through
    t_vepo, these will also need to be added to t_data_tab
    if the selection is by handling unit though we do not want
    these"TR03+
    IF s_exidv IS INITIAL. "TR03+
    *{ REPLACE UKMK900355 1
    *\ LOOP AT it_vepo.
    *\ READ TABLE it_lips WITH KEY vbeln = it_vepo-vbeln
    *\ posnr = it_vepo-posnr
    *\ BINARY SEARCH. "SUM
    *\ IF sy-subrc = 0.
    *\ DELETE it_lips INDEX sy-tabix.
    *\ ENDIF.
    *\ ENDLOOP.
    Higher-level HUs can contain more than one delivery item " AS01
    LOOP AT it_lips. " AS01
    READ TABLE t_vepo_low WITH KEY vbeln = it_lips-vbeln " AS01
    posnr = it_lips-posnr. " AS01
    CHECK sy-subrc EQ 0. " AS01
    DELETE it_lips. " AS01
    ENDLOOP. " AS01
    *} REPLACE
    IF NOT it_lips[] IS INITIAL.
    move any unpacked items to the data table
    PERFORM move_lips_to_table.
    ENDIF.
    ENDIF. "TR03+
    *<---- TR01+ End
    get relevant status icons
    PERFORM select_icons.
    prepare ALV data
    PERFORM prepare_alv.
    ENDFORM. " select_data
    *& Form select_icons
    select icons for display and move data to display table
    FORM select_icons.
    DATA: w_disp_tab LIKE zpickdisp,
    w_disp_head LIKE zpickhead,
    w_color LIKE zpickdisp-color,
    ov_icon LIKE zpickdisp-ov_icon,
    gi_icon LIKE zpickdisp-gi_icon,
    to_icon LIKE zpickdisp-to_icon,
    lp_icon LIKE zpickdisp-lp_icon,
    pc_icon LIKE zpickdisp-pc_icon,
    lv_icon LIKE zpickdisp-lv_icon,
    vm_icon LIKE zpickdisp-vm_icon,
    em_icon LIKE zpickdisp-em_icon,
    sp_icon LIKE zpickdisp-sp_icon, " ANV SR#11523
    t_ovst_tab LIKE t_disp_tab WITH HEADER LINE.
    CONSTANTS: c_col1(3) VALUE 'C10',
    c_col2(3) VALUE 'C20'.
    SORT t_data_tab BY lgtor vbeln.
    w_color = c_col2.
    LOOP AT t_data_tab.
    AT NEW lgtor.
    fill ALV header table
    CLEAR w_disp_head.
    w_disp_head-lgtor = t_data_tab-lgtor.
    APPEND w_disp_head TO t_disp_head.
    ENDAT.
    goods issue status & overall amber/green only
    CASE t_data_tab-wbstk.
    WHEN c_c.
    MOVE icon_green_light TO gi_icon.
    MOVE icon_green_light TO ov_icon.
    WHEN OTHERS.
    MOVE icon_red_light TO gi_icon.
    MOVE icon_yellow_light TO ov_icon.
    ENDCASE.
    transfer order status
    CASE t_data_tab-lvsta.
    WHEN c_a.
    MOVE icon_red_light TO to_icon.
    WHEN c_b.
    MOVE icon_yellow_light TO to_icon.
    WHEN c_c.
    MOVE icon_green_light TO to_icon.
    WHEN space.
    write N/A
    to_icon = 'N/A'.
    ENDCASE.
    loaded to pallet status
    IF NOT t_data_tab-zpallet_no IS INITIAL.
    MOVE icon_green_light TO lp_icon.
    ELSE.
    MOVE icon_red_light TO lp_icon.
    ENDIF.
    pallet count status
    IF NOT t_data_tab-zcount_check IS INITIAL.
    MOVE icon_green_light TO pc_icon.
    ELSE.
    MOVE icon_red_light TO pc_icon.
    ENDIF.
    loaded to van status
    IF NOT t_data_tab-zvan_no IS INITIAL.
    MOVE icon_green_light TO lv_icon.
    ELSE.
    MOVE icon_red_light TO lv_icon.
    ENDIF.
    van manifest status
    IF NOT t_data_tab-zvan_print IS INITIAL.
    MOVE icon_green_light TO vm_icon.
    ELSE.
    MOVE icon_red_light TO vm_icon.
    ENDIF.
    Start of changes by ANV SR#11523
    Shipment status
    IF NOT t_data_tab-tknum IS INITIAL.
    MOVE icon_green_light TO sp_icon.
    ELSE.
    MOVE icon_red_light TO sp_icon.
    ENDIF.
    End of changes by ANV SR#11523
    end of day manifest status
    IF NOT t_data_tab-zeod_print IS INITIAL.
    MOVE icon_green_light TO em_icon.
    ELSE.
    MOVE icon_red_light TO em_icon.
    ENDIF.
    move working data table to display table
    MOVE-CORRESPONDING t_data_tab TO w_disp_tab.
    w_disp_tab-ov_icon = ov_icon.
    w_disp_tab-gi_icon = gi_icon.
    w_disp_tab-to_icon = to_icon.
    w_disp_tab-lp_icon = lp_icon.
    w_disp_tab-pc_icon = pc_icon.
    w_disp_tab-lv_icon = lv_icon.
    w_disp_tab-vm_icon = vm_icon.
    w_disp_tab-em_icon = em_icon.
    w_disp_tab-sp_icon = sp_icon. "ANV SR#11523
    w_disp_tab-color = w_color.
    fill N/A values for initial fields for display
    IF w_disp_tab-packvorschr IS INITIAL.
    w_disp_tab-packvorschr = 'N/A'.
    ENDIF.
    IF w_disp_tab-exidv IS INITIAL.
    w_disp_tab-exidv = 'N/A'.
    ENDIF.
    IF w_disp_tab-zpallet_no IS INITIAL.
    WRITE 'N/A' TO w_disp_tab-zpallet_no.
    ENDIF.
    IF w_disp_tab-zvan_no IS INITIAL.
    WRITE 'N/A' TO w_disp_tab-zvan_no.
    ENDIF.
    display different color for new doc number
    AT END OF vbeln.
    IF w_color = c_col1.
    w_color = c_col2.
    ELSEIF w_color = c_col2.
    w_color = c_col1.
    ENDIF.
    ENDAT.
    APPEND w_disp_tab TO t_disp_tab.
    CLEAR w_disp_tab.
    ENDLOOP.
    we have all the icons in display but need to check the overall status
    as this refers to the line items
    green and amber statuses already set and use the same criteria as the
    goods issue status unless detected as red here
    DATA: ov_stat_red(1).
    CLEAR w_disp_tab.
    SORT t_disp_tab BY vbeln.
    LOOP AT t_disp_tab INTO w_disp_tab.
    AT NEW vbeln.
    check all line items for delivery
    LOOP AT t_data_tab WHERE vbeln = w_disp_tab-vbeln.
    IF t_data_tab-lvsta = c_a.
    set overall status to red
    ov_stat_red = c_yes.
    EXIT.
    ELSE.
    leave green/amber status icon as previosly determined
    ENDIF.
    ENDLOOP.
    IF ov_stat_red = c_yes.
    set overall status to red for all items in that delivery
    CLEAR ov_stat_red.
    MOVE icon_red_light TO w_disp_tab-ov_icon.
    MODIFY t_disp_tab FROM w_disp_tab TRANSPORTING ov_icon
    WHERE vbeln = w_disp_tab-vbeln.
    ENDIF.
    ENDAT.
    ENDLOOP.
    ENDFORM. " select_icons
    *& Form fill_layout
    fill ALV layout parameters
    FORM fill_layout.
    CLEAR g_layout.
    g_layout-colwidth_optimize = c_yes. " column width optimisation
    g_layout-zebra = space. " alternate line colors
    g_layout-box_fieldname = 'MARK'. " checkbox fieldname
    g_layout-info_fieldname = 'COLOR'. " highlight row indicator
    g_layout-no_vline = space. " vertical line
    g_layout-key_hotspot = space. " hotspot field
    g_layout-f2code = 'PICK'. " F2 ok_code
    g_layout-numc_sum = c_yes. " sum numc fields
    g_layout-box_tabname = 't_disp_head'. " checkbox table name
    g_layout-expand_fieldname = 'EXPAND'. " expand field name
    ENDFORM. " fill_layout
    *& Form fill_sort
    fill ALV sort table
    FORM fill_sort.
    DATA: w_g_sort TYPE slis_sortinfo_alv.
    w_g_sort-spos = 1.
    w_g_sort-fieldname = 'LGTOR'.
    w_g_sort-tabname = 't_disp_tab'.
    w_g_sort-up = c_yes.
    APPEND w_g_sort TO g_sort.
    w_g_sort-spos = 2.
    w_g_sort-fieldname = 'VBELN'.
    w_g_sort-tabname = 't_disp_tab'.
    w_g_sort-up = c_yes.
    APPEND w_g_sort TO g_sort.
    w_g_sort-spos = 3.
    w_g_sort-fieldname = 'POSNR'.
    w_g_sort-tabname = 't_disp_tab'.
    w_g_sort-up = c_yes.
    APPEND w_g_sort TO g_sort.

  • Regarding ALV display

    Hi ,
    I am making ALV Report. I am displaying 4  similar ALV grids in a screen.
    I would like to know how to give them some names so that they can be distinguished from each other by there name.
    Pls help .

    Hi Jaison,
    the easiest way to achive this, is to do the subtotaling with or without detailed lines by changing the ALV variant when in display.
    When you save the ALV layout(variant), in the popup you have a "Save with" tab. There is "Breakdwn to totals lvl:" entry. You ca select the level of sum displayed.
    After saving layout variant, you can pass it depending on  users input in structured parameter IS_VARIANT. Yo need to fill report field with report name and variant with layout name.
    Best is, to have a layout selection parameter. In Initialization, fill it using FM REUSE_ALV_VARIANT_DEFAULT_GET, AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_layout, use REUSE_ALV_VARIANT_F4.
    This makes your report far more flexible.
    Regards,
    Clemens

Maybe you are looking for

  • Best approach for setting up iCloud for a child

    Hi, I have bought my son an iPad Air for his birthday. We already have an iMac in the house which is shared by us all, with each person having their own login. My original question was going to be how I can create an iCloud login for him. I tried cre

  • In OUT Bound of a Jaxws provider, how can we stop the provider invoking its endpoint and send a response back?

    Hi One & All While we are working on Delegate(provider) for JAXWS client handler in Weblogic10 , we have some technical issues and need some assistance. Problem Description In OUTBound of a provider, how can we stop the provider invoking its endpoint

  • Cursor move event dicrease frequency

    Hello! A long time ago I remember I saw a forum post or a community doc, where it was explained how to decrease a certain Event to be triggered too frequently. I have a graph with a cursor, and when the user starts to move the cursor, I do some minor

  • Menu module error run time

    I've created a menu module as normal at forms 9i once i ran it , I got the follwoing error : Error opening Oracle*Terminal file fmrweb. Any idea to overcome this error? Thanks in advance

  • Best way to upgrade from FCS2 to FCS3?

    I will assume others may ask this, so hopefully this can help others. I will be purchasing FCS3 when it is available, and currently have FCS2 installed. I will not erase my drive and start over fresh just to install the software. I think for me the b