View on  vbuk,vbak,vbap,vbkd

hi all ,
        is there any view on vbuk,vbak,vbap,vbkd.
Regards
Martin

HI
/BEV1/LAHLIENR_V 
/BEV1/LAVMVA1_V  
/BEV1/LAVMVA1_V  
/BEV1/LAVMVL1_V  
/BEV1/SR_SLS_BWV 
EMVBAP           
ENT6466          
ENT6467          
ENT6468          
EVVBAKE          
HV_SDOC_ITEM     
J1IB             
LIKPUK           
MASSSDHEAD       
MASSSDPOSVBKD    
MASSVBAP         
MASSVBAP         
M_VMVAA          
SD_BACKORDER     
SD_BACKORDER     
U_16002          
U_16002          
U_16003          
U_16003          
U_16022          
U_16022          
U_16024          
U_16026          
U_16028          
U_16040          
U_16053          
U_16053          
WB2_V_VBAK_VBAP
WB2_V_VBAK_VBAP
WB2_V_VBAK_VBAP2
WB2_V_VBAK_VBAP2

Similar Messages

  • Is there any VIEW or FM for pulling data from VBAK, VBAP?also for VBEP,VBBE

    Hi Experts,
    1) Instaed of using JOINS and FOR ALL ENTRIES, am looking to use any view or FM for pullinmg the data from, VBAK & VBAP,
    So, pls let me knwo that, Is there any VIEW or FM for pulling the data from the above  of tables
    2) Instaed of using JOINS and FOR ALL ENTRIES, am looking to use any view or FM for pullinmg the data from, VBEP & VBBE,
    So, pls let me knwo that, Is there any VIEW or FM for pulling the data from the above  of tables
    3) Am guessing FOR ALL ENTRIES is better than JOINS in PERFORMENCE perspective, Is am I correct?
    thanq
    Edited by: Srinivas on May 9, 2008 5:36 PM

    Hi Srinivas,
    You can use the view WB2_V_VBAK_VBAP2 for fetching data from VBAK and VBAP instead of using a JOIN. Note that, in the view, item data fields will have a I following the field name (POSNRI, MATNR_I are the item data fields from VBAP). The master data fields of VBAK are the same.
    As far as i know, there are no standard views provided by SAP for VBEP and VBBE. Not sure if FM exists either.
    While using FOR ALL ENTRIES clause make sure that you specify the entire primary key (EX. if selecting from VBAP specify VBELN and POSNR) as fields for selection or in the selection criteria. Its much better if you have the primary key in both. This is really important because without specifying the entire key and using FOR ALL ENTRIES will drastically bring down the performance. And also, If you are fetching not more than 100 or 200 entries using the clause it is fine, beyond that its same as using a select statement within LOOP...ENDLOOP.
    So, you have to decide whether to use FOR ALL ENTRIES or a JOIN while selecting data depending on the requirement. If you don't have the entire key either in fields for selection or selection criteria, then its better to use a JOIN or VIEW.
    The following is an example for using FOR ALL ENTRIES clause effectively.
             Select VBELN
                        POSNR
                        MATNR
                From VBAP
                  into Table T_VBAP
              For All Entries in T_DATA
              Where VBELN eq T_DATA-VBELN
                  And POSNR eq T_DATA-POSNR.
    I hope this helps, Please let me know if you need further assistance.

  • Performance issue with joins on table VBAK, VBEP, VBKD and VBAP

    hi all,
    i have a report where there is a join on all 4 tables VBAK, VBEP, VBKD and VBAP.
    the report is giving performance issues because of this join.
    all the key fields are used for the joining of tables. but some of the non-key fields like vbap-vstel, vbap-abgru and vbep-wadat are also part of select query and are getting filled.
    because of these there is a performance issue.
    is there any way i can improve the performance of the join select query?
    i am trying "for all entries" clause...
    kindly provide any alternative if possible.
    thanks.

    Hi,
    Pls perform some of the below steps as applicable for the performance improvement:
    a) Remove join on all the tables and put joins only on header and item (VBAK & VBAP).
    b) code should have separate select for VBEP and VBKD.
    c) remove the non key fields from the where clause. Once you retrieve data from the database into the internal table, sort the table and delete the entries which are not part of the non-key fields like vstel, abgru and wadat.
    d) last option is you can create index in the VBAP & VBEP table with respect to the fields vstel, abgru & wadat ( not advisable)
    e) buffering option on database tables also possible.
    f) select only the fields into the internal table that are applicable for the processing logic and also the select query should contaian the field names in the same order as mentioned in the database table.
    Hope this helps.
    Regards
    JLN

  • Sales Document from VBAK ,VBAP and VEDA

    Hi ,
    I need to fetch the Sales Document from VBAK and VBAP and VEDA with the contract sign date for sales document line item .
    Contract sign date is in selection screen as select options.
    Please let me know how to fetch the sales Document per line item from these 3 tables considering that A sales document could have many line items and each can have a different sign date.
    Thanks
    Sachin

    Hi,
    The link between all the tables VBAK, VBAP and VEDA is VBELN i.e sales document number.
    However, while fetching from VBAP and VEDA you would need to consider POSNR as well.
    As your ABAPer to code the logic using 'for all entries' method.
    Regards,
    Amit
    Edited by: Amit Iyer on Jun 23, 2011 12:28 PM

  • VA02 Transaction VBAP & VBKD data sync

    Dear Friends
    VA02 Transaction, VBAP & VBKD data synchronization issue.
    For printing invoice I am retrieving data from VBAP & VBKD For Example I have 18 Records in VBAP table the same time I have only 16 entries in VBKD table the field POSNR not matching with VBKD table.  I am retrieving the field KDKG1 Customer Condition Group1.  I could not see the relevant data for all line items. Only few of them are available. 
    Is there any other way to get the field KDKG1 having relationship for VBAP all line items.
    Can anybody help me to solve the issue?
    Ashok Vengidapathy

    Hello,
    I think you want add to Additonal Tab A - You just need to add to VA01 no need to add VA02.  FYI there is no screen exit given by SAP There fore direct SAP screen modifiction is required here same many persons in this forum is discussed.
    1) add what ever fields you want to add to screen in VBAP as include structure.
    2) go se51 by taking access add what ever fields you have added in VBAP to screen.
    3) that's it you dont need any programming unless if u need any validations on those fields.
    let me know if you want any clarification.
    ***********Poorna************

  • How to update vbak,vbap in MV45AFZZ

    DATA:  lw_WZEIT TYPE marc-WZEIT,
                lw_date  type sy-datum.
    LOOP at XVBAP where PSTYV = 'ZRET'.
    SELECT single WZEIT
             into lw_WZEIT
             from marc
            where matnr = xvbap-matnr.
    IF sy-subrc = 0.
        lw_date = lw_WZEIT + sy-datum.
       if vbak-VDATU < lw_date.
         move 'Z1' to xvbak-LIFSK.
          move 'A' to xvbap-ABGRU .
       endif.
    ENDIF.
    ENDLOOP.
        how to update vbak vbap table in MV45AFZZ ( while saving va01).
    Thanks
    Suresh

    Hi Suresh,
    It is not recommended to code custom update to table VBAK and VBAP directly in MV45AFZZ ( i don't think that would work either since the lock is taking place ).
    Use the appropriate procedure instead ( that is USEREXIT_SAVE_DOCUMENT and USEREXIT_SAVE_DOCUMENT_PREPARE depend on requirement ) , and
    perform modifications you need to internal table vbak and xvbap. Standard SAP program will then update the database tables for you.
    XVBAK is available through all part of MV45AFZZ since this is defined globally to include non vbak header information.
    Rettung von VBAK Feldern nach AG-Änderung.
    DATA:    BEGIN OF XVBAK.
            INCLUDE STRUCTURE VBAK.
    DATA: AGUPDA LIKE RV02P-AGUPD,
              WEUPDA LIKE RV02P-WEUPD,
              AUARTUPDA,
              END OF XVBAK.
    Rgds,
    Tuwuh Sih Winedya

  • BAPI Extension - Sales Order(VBAK, VBAP)

    Hi all,
              Please help me in the issue .  I have added user custom fields for sales order va01 in header and item . i am using bapi for creating sales order . I need do use Extensionin struture for updating table vbak and vbap. Can anyone brief the procedure for acheiving the same.
    Thanks in advance,

    Hi Eric,
    Extensions for VBAK, VBAP can be filled like this:
    CLEAR e_extension.
    e_extension-structure     = 'BAPE_VBAK'.   ---> For VBAK
    e_extension-valuepart1+10 = VAL1
    e_extension-valuepart1+46 = VAL2.
    e_extension-valuepart1+56 = VAL3.
    e_extension-valuepart1+59 = VAL4
    APPEND e_extension TO t_extension.
    The same for VBAP
    CLEAR e_extension.
    e_extension-structure     = 'BAPE_VBAP'.   ---> For VBAP
    e_extension-valuepart1+10 = VAL1
    e_extension-valuepart1+46 = VAL2.
    e_extension-valuepart1+56 = VAL3.
    e_extension-valuepart1+59 = VAL4
    APPEND e_extension TO t_extension.
    CALL FUNCTION 'BAPI_SALESORDER...."
        TABLES
          extensionin        = t_extension.
    Hope this helps.
    Ernesto
    Edited by: Ernesto Caballero on Feb 24, 2010 3:03 PM

  • BAPI/RFC for Sales Order or Warehouse Order that retrives VBAK,VBAP,VBEP

    Hi,
       Is there any BAPI/RFC for Sales Order or Warehouse Order that retrives VBAK,VBAP,VBEP and VBPA tables for specified inputs.
       The BAPI or RFC should return the Sales Order details with tables VBAK,VBAP,VBEP and VBPA.
       Rewards if useful.
    Thanks,
    Mich

    Try creating an RFC calling FM: SD_SALES_DOCUMENT_PREFETCH with required details for Header, Item, Schedule and Partners.
    Below code can give you idea in handling the FM.
    PARAMETERS: p_vbeln TYPE vbeln_vl OBLIGATORY.
    CONSTANTS: c_x TYPE char01 VALUE 'X'.
    DATA: st_view TYPE order_view,
          i_vbak_key TYPE TABLE OF sales_key,
          i_vbak TYPE TABLE OF vbak,
          i_vbap TYPE TABLE OF vbapvb,
          i_vbep TYPE TABLE OF vbepvb,
          i_vbpa TYPE TABLE OF vbpavb.
    START-OF-SELECTION.
      MOVE c_x TO : st_view-header,
                    st_view-item,
                    st_view-sdschedule,
                    st_view-partner.
      APPEND p_vbeln TO i_vbak_key.
      CALL FUNCTION 'SD_SALES_DOCUMENT_PREFETCH'
        EXPORTING
          i_sales_view  = st_view
          i_memory_read = 'A'
        TABLES
          i_vbak_keytab = i_vbak_key " List of Sales Orders to extract
          fxvbak        = i_vbak     " Header
          fxvbap        = i_vbap     " Item
          fxvbep        = i_vbep     " Schedule Lines
          fxvbpa        = i_vbpa.    " Partners

  • Data inconsistency problem TABLES: VBUK/VBUP vs VBAK/VBAP

    Hi,
    I have the fun task of trying to solve a data inconsistency problem caused by a faulty network connection between R/3 and our SQL server.
    To add to the fun my knowledge of the outbound systems is pretty close to zero.
    Apparently our warehouse was booking stock and after booking they process the STO NO in VL10B.
    While posting the outbound in VL02n some of the lines did not generate.
    So they deleted the outbound and tried again.
    After they finished playing around and our connections acted funky, I now have data for the outbound in tables VBUP/VBUK (Outbound status tables), but seemingly nowhere else.
    There is no data in ekpo, lips, vbak or vbap.
    So the question is:
    How on earth do I get rid of these entries safely, or otherwise try to generate the missing data?
    Just changing the statuses to completed did not work as they end up having problems when trying to pick more stock on articles that had entries on the missing outbound.
    Any other ideas?
    What other tables do I need to check for entries?
    Thanks
    Charl
    Message was edited(typos) by:
            Charl Holtzhausen

    Hi,
    With the help of SAP we solved the problem.
    Apart from VBUP/VBUK there was data in table VBBE (stock movement).
    Deleting the entries in these cleared the problem.
    It was important to check that further STOs were not adversely affected, which it seems it was not.
    Regards

  • Query with tables VEPVG, VBAK, VBAP AND KONV

    hi all,
    I have a requirement, that is Open Sale Orders which is having Special Discount. I am trying to write a Query, But KONV table is not coming into the joins. my execution plans is bellow
    VEPVG  -->  VBAK         vbak-knumv = konv-knumv and konv-kschl = Special Discount
                        VBAP
    Please explain me, how to design the query with conditions.
    Thanks & Regards,
    Srinivas

    Hi,
    Have you referred this help document.
    http://help.sap.com/printdocu/core/Print46c/EN/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    Regards - Shree

  • RELATIONSHIP BETWEEN VBAK/VBAP AND V46R_HEAD TABLE

    Hi,
    can you please tell me that is there any relationship between VBAK and  V46R_HEAD TABLE or VBAP and V46R_HEAD TABLE table.
    where V46R_HEAD TABLE is a structure and i want to display sme fields of vbak and some of V46R_HEAD  and some of VBAP.
    I got the relation between VBAK and VBAP ie. the field VBELN. But i am not getting the relation with V46R_HEAD sturcture.
    Please help me to solve this problem.

    Hi,
    the field vbeln is present in V46R_HEAD also.
    Please check it!!  Please do a CTR+F and look for VBELN.
    Regards.

  • Reading VBAK, VBAP and VBFA table during a process

    Hi friends,
    I have an execution DUMP in a Z report, so I would be very thankful if you can give me your expert opinion.
    I have a Z report which collects some information into an internal table. After that, I need to go over each record and read VABK, VBAP and VBFA tables and compute some quantities. It is not possible to do this in another way because I need to get some information first.
    Of course, each table is being read in the corresponding sequence (1st VBAK, then VBAP and then VBFA and at the end LIPS table) using the key or part of it. The problem is that if the user wants to execute the report online, it will be finish in a dump at this routine.
    My question is if it is possible to skip the dump getting VBAK and VBAP tables in memory and instead of reading directly, read them from memory. Notice that if I do this I need to put almost the entire table into memory. So, do you think that I will earn time or it will be the same or worse?
    Thanks in advance & kind regards,
    MMP.

    Hi everybody!
    We applied the note but it doesn't help. We realized that we have a problem with records quantity, so the key user is going to analyze which other parameter could be helpful.
    Thank everybody very much!
    Kind regards.

  • Joining VBRK, VBRP, VBAK, VBAP, LIKP, LIPS

    Hello,
    I just wanted to ask how to join the above subject in one table? Or it isnt possible?
    I read that joining 3 or more tables would degrade the performance But i need to get the data in those tables. Any help would greatly appreciated. Thanks!

    Hi,
    Please take a look at my program below. There you can see how to join the tables that you mentioned. Hope it helps...
    P.S. Please award points if it helps...
    *=====================================================================
    * Program Name : ZSD_ORDERSTAGE_V2
    * Author       : Aris Hidalgo
    * Date Created : June 5, 2007
    * Description  : Display sales orders status for a given customer
    *=====================================================================
    REPORT  zsd_orderstage_v2
            NO STANDARD PAGE HEADING
            MESSAGE-ID zsd.
    * Data Dictionary Table/s                      *
    TABLES: vbak,
            vttp.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    * Global Data/s                                *
    DATA: gt_fieldcat         TYPE lvc_t_fcat,
          ok_code             TYPE syst-ucomm,
          save_ok             TYPE syst-ucomm,
          g_repid             TYPE syst-repid,
          gs_layout           TYPE lvc_s_layo,
          gv_container        TYPE scrfname VALUE 'CUSTOM_CONTROL',
          grid1               TYPE REF TO cl_gui_alv_grid,
          custom_container    TYPE REF TO cl_gui_custom_container,
          grid2               TYPE REF TO cl_gui_alv_grid,
          dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
          event_receiver      TYPE REF TO lcl_event_receiver.
    * Global Structure/s                           *
    TYPES: BEGIN OF t_output,
            creation_date  TYPE vbak-erdat,
            creation_time  TYPE vbak-erzet,
            sales_doc      TYPE vbak-vbeln,
            cust_code      TYPE vbak-kunnr,
            cust_desc      TYPE kna1-name1,
            ship_to_code   TYPE likp-kunnr,
            ship_to_desc   TYPE kna1-name1,
            po_num         TYPE vbak-bstnk,
            doc_type       TYPE vbak-auart,
            req_dlv_date   TYPE vbak-vdatu,
            so_status(02)  TYPE c,
            created_by     TYPE vbak-ernam,
            del_doc        TYPE likp-vbeln,
            bill_doc       TYPE vbrk-vbeln,
           END OF t_output.
    TYPES: BEGIN OF t_column,
            fname TYPE lvc_fname,
            level TYPE lvc_level,
           END OF t_column.
    * Global Internal Table/s                      *
    DATA: gt_output TYPE STANDARD TABLE OF t_output,
          gt_column TYPE STANDARD TABLE OF t_column.
    * Global Work Area/s                           *
    DATA: wa_output LIKE LINE OF gt_output.
    * SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:     p_kunnr TYPE vbak-kunnr OBLIGATORY.
    SELECT-OPTIONS: s_vkgrp FOR vbak-vkgrp,
                    s_auart FOR vbak-auart,
                    s_erdat FOR vbak-erdat  OBLIGATORY,
                    s_ernam FOR vbak-ernam.
    SELECTION-SCREEN END OF BLOCK b1.
    */ CLASS DEFINITION/S
    CLASS lcl_process_data DEFINITION DEFERRED.
    *       CLASS lcl_get_data DEFINITION
    CLASS lcl_get_data DEFINITION.
      PUBLIC SECTION.
        TYPES: BEGIN OF t_vbak,
                vbeln TYPE vbak-vbeln,
                erdat TYPE vbak-erdat,
                erzet TYPE vbak-erzet,
                ernam TYPE vbak-ernam,
                auart TYPE vbak-auart,
                vdatu TYPE vbak-vdatu,
                bstnk TYPE vbak-bstnk,
                kunnr TYPE vbak-kunnr,
               END OF t_vbak.
        TYPES: BEGIN OF t_kna1,
                kunnr TYPE kna1-kunnr,
                name1 TYPE kna1-name1,
               END OF t_kna1.
        TYPES: BEGIN OF t_delivery,
                vgbel TYPE lips-vgbel,
                vbeln TYPE likp-vbeln,
                kunnr TYPE likp-kunnr,
               END OF t_delivery.
        TYPES: BEGIN OF t_billing,
                vbelv   TYPE vbfa-vbelv,
                vbtyp_n TYPE vbfa-vbtyp_n,
                vbeln   TYPE vbfa-vbeln,
               END OF t_billing.
        TYPES: BEGIN OF t_status,
                vbeln TYPE vbuk-vbeln,      "Sales and Distribution Document Number
                cmgst TYPE vbuk-cmgst,      "Overall status of credit checks
                lfstk TYPE vbuk-lfstk,      "Delivery status
                kostk TYPE vbuk-kostk,      "Overall picking / putaway status
                fkstk TYPE vbuk-fkstk,      "Billing status
                trsta TYPE vbuk-trsta,      "Transportation planning status
               END OF t_status.
        TYPES: BEGIN OF t_status_do,
                vbeln TYPE vbuk-vbeln,      "Delivery Document Number
                kostk TYPE vbuk-kostk,      "Overall picking / putaway status
                fkstk TYPE vbuk-fkstk,      "Billing status
                trsta TYPE vbuk-trsta,      "Transportation planning status
               END OF t_status_do.
        METHODS: get_sales_docs    FINAL,
                 get_customer_desc FINAL,
                 get_ship_to_desc  FINAL,
                 get_delivery_docs FINAL,
                 get_billing_docs  FINAL,
                 get_so_status     FINAL.
      PROTECTED SECTION.
        CLASS-DATA: gt_vbak            TYPE STANDARD TABLE OF t_vbak,
                    gt_kna1            TYPE HASHED   TABLE OF t_kna1
                                       WITH UNIQUE KEY kunnr,
                    gt_kna2            TYPE HASHED   TABLE OF t_kna1
                                       WITH UNIQUE KEY kunnr,
                    gt_delivery        TYPE STANDARD TABLE OF t_delivery,
                    gt_billing         TYPE STANDARD TABLE OF t_billing,
                    gt_status          TYPE STANDARD TABLE OF t_status,
                    gt_status_do       TYPE STANDARD TABLE OF t_status_do,
                    o_lcl_process_data TYPE REF TO lcl_process_data.
      PRIVATE SECTION.
        CLASS-DATA: wa_status LIKE LINE OF gt_status.
    ENDCLASS.                    "lcl_get_data DEFINITION
    *       CLASS lcl_process_data DEFINITION
    CLASS lcl_process_data DEFINITION INHERITING FROM lcl_get_data.
      PUBLIC SECTION.
        METHODS: combine_data FINAL
                   IMPORTING
                     im_sales_tab LIKE gt_vbak
                     im_cust_tab  LIKE gt_kna1
                     im_desc_tab  LIKE gt_kna2     OPTIONAL
                     im_dlv_tab   LIKE gt_delivery OPTIONAL
                     im_bill_tab  LIKE gt_billing  OPTIONAL
                   EXPORTING
                     ex_output    LIKE gt_output,
                 get_status
                   IMPORTING
                     im_so        TYPE vbak-vbeln
                     im_do        TYPE likp-vbeln   OPTIONAL
                   EXPORTING
                     ex_status    TYPE crmchar2.
      PRIVATE SECTION.
        DATA: lv_vbelv    TYPE vbfa-vbelv,
              lv_bill_doc TYPE vbfa-vbeln,
              lv_kunnr    TYPE vbpa-kunnr,
              lv_name1    TYPE kna1-name1,
              lv_parvw    TYPE vbpa-parvw,
              lv_flag1    TYPE flag.
    ENDCLASS.                    "lcl_process_data DEFINITION
    *       CLASS lcl_alv_routines DEFINITION
    CLASS lcl_alv_routines DEFINITION INHERITING FROM lcl_process_data.
      PUBLIC SECTION.
        TYPES: BEGIN OF t_status_history,
                 cr_hold(50)        TYPE c,
                 cr_rel_on(10)      TYPE c,
                 cr_rel_at(10)      TYPE c,
                 do_created_on(10)  TYPE c,
                 do_created_time(8) TYPE c,
                 picked_on(10)      TYPE c,
                 picked_time(8)     TYPE c,
                 inv_created_on(10) TYPE c,
                 dispatched_on(10)  TYPE c,
                 dispatched_at(10)  TYPE c,
               END OF t_status_history.
        TYPES: BEGIN OF t_confirmation,
                 podat TYPE likp-podat,
                 potim TYPE likp-potim,
               END OF t_confirmation.
        CLASS-DATA: wa_fieldcat       LIKE LINE OF gt_fieldcat,
                    gt_status_history TYPE STANDARD TABLE OF t_status_history,
                    gt_confirmation   TYPE STANDARD TABLE OF t_confirmation,
                    wa_status_history LIKE LINE OF gt_status_history,
                    wa_confirmation   LIKE LINE OF gt_confirmation,
                    wa_column         LIKE LINE OF gt_column,
                    gt_domain_val     TYPE STANDARD TABLE OF dd07v,
                    wa_domain_val     LIKE LINE OF gt_domain_val.
        METHODS: build_fieldcat FINAL,
                 popup_routines
                   IMPORTING
                     im_column LIKE gt_column
                     im_output LIKE wa_output
                   EXPORTING
                     ex_status_history LIKE gt_status_history
                     ex_confirmation   LIKE gt_confirmation,
                 get_domain_values FINAL
                   IMPORTING
                     value(im_tabname)    TYPE ddobjname
                     value(im_fieldname)  TYPE dfies-fieldname
                   EXPORTING
                     value(ex_values_tab) LIKE gt_domain_val.
      PRIVATE SECTION.
        CLASS-DATA: lt_dfies_tab TYPE STANDARD TABLE OF dfies,
                    wa_dfies_tab LIKE LINE OF lt_dfies_tab.
    ENDCLASS.                    "lcl_alv_routines DEFINITION
    *       CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION INHERITING FROM lcl_alv_routines FINAL.
      PUBLIC SECTION.
        METHODS: handle_double_click
                   FOR EVENT double_click OF cl_gui_alv_grid
                     IMPORTING
                       e_row
                       e_column,
                 handle_close
                   FOR EVENT close OF cl_gui_dialogbox_container
                     IMPORTING
                       sender,
                 handle_hotspot_click
                   FOR EVENT hotspot_click OF cl_gui_alv_grid
                     IMPORTING
                       e_row_id
                       e_column_id
                       es_row_no,
                 create_detail_list
                   IMPORTING
                     im_column         LIKE gt_column
                     im_status         LIKE gt_status_history
                     im_confirmation   LIKE gt_confirmation.
      PRIVATE SECTION.
        CLASS-DATA: o_lcl_alv_routines TYPE REF TO lcl_alv_routines.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    */ CLASS IMPLEMENTATION/S
    *       CLASS lcl_get_data IMPLEMENTATION
    CLASS lcl_get_data IMPLEMENTATION.
    * METHOD get_sales_docs
      METHOD get_sales_docs.
        SELECT vbeln erdat erzet ernam auart vdatu bstnk kunnr
          FROM vbak
          INTO TABLE gt_vbak
         WHERE erdat IN s_erdat
           AND ernam IN s_ernam
           AND auart IN s_auart
           AND vkgrp IN s_vkgrp
           AND kunnr =  p_kunnr.
        IF NOT gt_vbak[] IS INITIAL.
          CALL METHOD: me->get_customer_desc,
                           get_delivery_docs,
                           get_so_status,
                           get_billing_docs.
          CREATE OBJECT o_lcl_process_data.
          CALL METHOD o_lcl_process_data->combine_data
            EXPORTING
              im_sales_tab = gt_vbak
              im_cust_tab  = gt_kna1
              im_desc_tab  = gt_kna2
              im_dlv_tab   = gt_delivery
              im_bill_tab  = gt_billing
            IMPORTING
              ex_output    = gt_output.
        ELSE.
          MESSAGE i000 WITH text-032.
          LEAVE LIST-PROCESSING.
        ENDIF.
      ENDMETHOD.                    "get_sales_docs
    * METHOD get_customer_desc
      METHOD get_customer_desc.
        SELECT kunnr name1
          FROM kna1
          INTO TABLE gt_kna1
           FOR ALL ENTRIES IN gt_vbak
         WHERE kunnr = gt_vbak-kunnr.
      ENDMETHOD.                    "get_customer_desc
    * METHOD get_ship_to_desc
      METHOD get_ship_to_desc.
        SELECT kunnr name1
          FROM kna1
          INTO TABLE gt_kna2
           FOR ALL ENTRIES IN gt_delivery
         WHERE kunnr = gt_delivery-kunnr.
      ENDMETHOD.                    "get_ship_to_desc
    * METHOD get_delivery_docs
      METHOD get_delivery_docs.
        SELECT lips~vgbel likp~vbeln likp~kunnr
          FROM likp
         INNER JOIN lips
            ON likp~vbeln = lips~vbeln
          INTO TABLE gt_delivery
           FOR ALL ENTRIES IN gt_vbak
         WHERE lips~vgbel = gt_vbak-vbeln.
        IF NOT gt_delivery[] IS INITIAL.
          SORT gt_delivery ASCENDING BY: vgbel vbeln kunnr.
          DELETE ADJACENT DUPLICATES FROM gt_delivery COMPARING vgbel vbeln kunnr.
    *     Get ship-to description
          CALL METHOD me->get_ship_to_desc.
    *     Get status of delivery documents
          SELECT vbeln kostk fkstk trsta
            FROM vbuk
            INTO TABLE gt_status_do
             FOR ALL ENTRIES IN gt_delivery
           WHERE vbeln = gt_delivery-vbeln.
        ENDIF.
      ENDMETHOD.                    "get_delivery_docs
    * METHOD get_billing_docs
      METHOD get_billing_docs.
        SELECT vbelv vbtyp_n vbeln
          FROM vbfa
          INTO TABLE gt_billing
           FOR ALL ENTRIES IN gt_delivery
         WHERE vbelv   = gt_delivery-vbeln
           AND vbtyp_n = 'M'.
        SORT gt_billing ASCENDING BY: vbelv vbtyp_n vbeln.
        DELETE ADJACENT DUPLICATES FROM gt_billing COMPARING vbelv vbtyp_n vbeln.
      ENDMETHOD.                    "get_billing_docs
    * METHOD get_so_status
      METHOD get_so_status.
        DATA: lv_curr_so TYPE vbak-vbeln,
              lv_lines   TYPE i.
        FIELD-SYMBOLS: <fs_status>    LIKE LINE OF gt_status,
                       <fs_delivery>  LIKE LINE OF gt_delivery,
                       <fs_status_do> LIKE LINE OF gt_status_do.
        SELECT vbeln cmgst lfstk
          FROM vbuk
          INTO CORRESPONDING FIELDS OF TABLE gt_status
           FOR ALL ENTRIES IN gt_vbak
         WHERE vbeln = gt_vbak-vbeln.
        SORT gt_status_do BY vbeln ASCENDING.
        DESCRIBE TABLE gt_status LINES lv_lines.
        LOOP AT gt_status ASSIGNING <fs_status>.
          IF sy-tabix > lv_lines.
            EXIT.
          ENDIF.
          LOOP AT gt_delivery ASSIGNING <fs_delivery> WHERE vgbel = <fs_status>-vbeln.
            IF lv_curr_so = <fs_delivery>-vgbel.
              wa_status-vbeln = <fs_status>-vbeln.
              wa_status-cmgst = <fs_status>-cmgst.
              wa_status-lfstk = <fs_status>-lfstk.
              READ TABLE gt_status_do ASSIGNING <fs_status_do> WITH KEY vbeln = <fs_delivery>-vbeln
                                                                                BINARY SEARCH.
              IF sy-subrc = 0.
                wa_status-kostk = <fs_status_do>-kostk.
                wa_status-fkstk = <fs_status_do>-fkstk.
                wa_status-trsta = <fs_status_do>-trsta.
              ENDIF.
              APPEND wa_status TO gt_status.
              CLEAR wa_status.
            ELSE.
              READ TABLE gt_status_do ASSIGNING <fs_status_do> WITH KEY vbeln = <fs_delivery>-vbeln
                                                                                BINARY SEARCH.
              <fs_status>-kostk = <fs_status_do>-kostk.
              <fs_status>-fkstk = <fs_status_do>-fkstk.
              <fs_status>-trsta = <fs_status_do>-trsta.
            ENDIF.
            lv_curr_so = <fs_delivery>-vgbel.
          ENDLOOP.
        ENDLOOP.
      ENDMETHOD.                    "get_do_status
    ENDCLASS.                    "lcl_get_data IMPLEMENTATION
    *       CLASS lcl_process_data IMPLEMENTATION
    CLASS lcl_process_data IMPLEMENTATION.
    * METHOD combine_data
      METHOD combine_data.
        FIELD-SYMBOLS: <fs_sales_tab> LIKE LINE OF im_sales_tab,
                       <fs_cust_tab>  LIKE LINE OF im_cust_tab,
                       <fs_desc_tab>  LIKE LINE OF im_desc_tab,
                       <fs_dlv_tab>   LIKE LINE OF im_dlv_tab,
                       <fs_bill_tab>  LIKE LINE OF im_bill_tab.
        SORT gt_status BY vbeln ASCENDING.
        LOOP AT im_sales_tab ASSIGNING <fs_sales_tab>.
          CLEAR: lv_flag1, wa_output,lv_vbelv,
                 lv_bill_doc, lv_kunnr,
                 lv_name1, lv_parvw.
          wa_output-creation_date = <fs_sales_tab>-erdat.  "SO creation date
          wa_output-creation_time = <fs_sales_tab>-erzet.  "SO creation time
          wa_output-sales_doc     = <fs_sales_tab>-vbeln.  "Sales document
          wa_output-cust_code     = <fs_sales_tab>-kunnr.  "SO customer code
    *     Customer description
          READ TABLE im_cust_tab ASSIGNING <fs_cust_tab> WITH KEY kunnr = <fs_sales_tab>-kunnr.
          IF sy-subrc = 0.
            MOVE <fs_cust_tab>-name1 TO: wa_output-cust_desc.    "SO customer description
          ENDIF.
          wa_output-po_num       = <fs_sales_tab>-bstnk.   "PO number
          wa_output-doc_type     = <fs_sales_tab>-auart.   "SO document type
          wa_output-req_dlv_date = <fs_sales_tab>-vdatu.   "SO req. delivery date
          wa_output-created_by   = <fs_sales_tab>-ernam.   "SO created by
          READ TABLE im_dlv_tab ASSIGNING <fs_dlv_tab> WITH KEY vgbel = <fs_sales_tab>-vbeln.
          IF sy-subrc <> 0.
            CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
              EXPORTING
                input  = 'SH'
              IMPORTING
                output = lv_parvw.
    */Get ship-to party and description based from sales document
    * if delivery document is non-existent
            SELECT SINGLE kunnr
              FROM vbpa
              INTO lv_kunnr
             WHERE vbeln = <fs_sales_tab>-vbeln
               AND parvw = lv_parvw.             "Ship-to party
            IF sy-subrc = 0.
              SELECT SINGLE name1
                FROM kna1
                INTO lv_name1
               WHERE kunnr = lv_kunnr.
              IF sy-subrc = 0.
                wa_output-ship_to_code = lv_kunnr.
                wa_output-ship_to_desc = lv_name1.
              ENDIF.
            ENDIF.
    *       Sales order status
            CALL METHOD me->get_status
              EXPORTING
                im_so     = wa_output-sales_doc
              IMPORTING
                ex_status = wa_output-so_status.
            APPEND wa_output TO ex_output.
            CLEAR wa_output.
            CONTINUE.
          ENDIF.
    *     Ship-to code/party and delivery document
          LOOP AT im_dlv_tab ASSIGNING <fs_dlv_tab> WHERE vgbel = <fs_sales_tab>-vbeln.
            CLEAR: lv_flag1.
            wa_output-ship_to_code = <fs_dlv_tab>-kunnr.   "Ship-to code
            wa_output-del_doc      = <fs_dlv_tab>-vbeln.   "Delivery document
    *       Ship-to description
            READ TABLE im_desc_tab ASSIGNING <fs_desc_tab> WITH KEY kunnr = <fs_dlv_tab>-kunnr.
            IF sy-subrc = 0.
              wa_output-ship_to_desc = <fs_desc_tab>-name1.
            ENDIF.
    *       Sales order and delivery order status
            CALL METHOD me->get_status
              EXPORTING
                im_so     = wa_output-sales_doc
                im_do     = wa_output-del_doc
              IMPORTING
                ex_status = wa_output-so_status.
    *       Billing document
            LOOP AT im_bill_tab ASSIGNING <fs_bill_tab> WHERE vbelv   = <fs_dlv_tab>-vbeln
                                                          AND vbtyp_n =  'M'.
              CLEAR lv_flag1.
              IF lv_vbelv    = <fs_bill_tab>-vbelv AND
                 lv_bill_doc = <fs_bill_tab>-vbeln.
                CONTINUE.
              ENDIF.
              lv_vbelv    = <fs_bill_tab>-vbelv.
              lv_bill_doc = <fs_bill_tab>-vbeln.
              wa_output-bill_doc = <fs_bill_tab>-vbeln.    "Billing document
              MOVE 'X' TO lv_flag1.
              APPEND wa_output TO ex_output.
              CLEAR: wa_output-ship_to_code, wa_output-del_doc,
                     wa_output-so_status, wa_output-bill_doc.
              EXIT.
            ENDLOOP.
            IF lv_flag1 = 'X'.
              CONTINUE.
            ELSE.
              APPEND wa_output TO ex_output.
              CLEAR: wa_output-ship_to_code, wa_output-del_doc,
                     wa_output-ship_to_desc, wa_output-so_status.
            ENDIF.
          ENDLOOP.
        ENDLOOP.
        SORT ex_output BY sales_doc.
      ENDMETHOD.                    "combine_data
    * METHOD get_status
      METHOD get_status.
        FIELD-SYMBOLS: <fs_status>    LIKE LINE OF gt_status,
                       <fs_status_do> LIKE LINE OF gt_status_do.
    */Check the current stage of a given sales order in descending order
    * starting with the shipment status
        READ TABLE gt_status_do ASSIGNING <fs_status_do> WITH KEY vbeln = im_do
                                                                          BINARY SEARCH.
        IF sy-subrc = 0.
    *     Shipment/dispatch status
          IF <fs_status_do>-trsta = 'B' OR
             <fs_status_do>-trsta = 'C'.
            ex_status = 'SH'.
    *     Invoice status
          ELSEIF <fs_status_do>-fkstk = 'B' OR
                 <fs_status_do>-fkstk = 'C'.
            ex_status = 'IN'.
    *     Picking status
          ELSEIF <fs_status_do>-kostk = 'B' OR
                 <fs_status_do>-kostk = 'C'.
            ex_status = 'PS'.
          ENDIF.
        ENDIF.
        IF ex_status IS INITIAL.
          READ TABLE gt_status ASSIGNING <fs_status> WITH KEY vbeln = im_so
                                                                      BINARY SEARCH.
          IF sy-subrc = 0.
    *       Delivery order status
            IF <fs_status>-lfstk = 'B' OR
               <fs_status>-lfstk = 'C'.
              ex_status = 'DO'.
    *       Credit released
            ELSEIF <fs_status>-cmgst = 'A' OR
                   <fs_status>-cmgst = 'D'.
              ex_status = 'CR'.
    *       Credit hold
            ELSEIF <fs_status>-cmgst = 'B' OR
                   <fs_status>-cmgst = 'C'.
              ex_status = 'CH'.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDMETHOD.                    "get_status
    ENDCLASS.                    "lcl_process_data IMPLEMENTATION
    *       CLASS lcl_alv_routines IMPLEMENTATION
    CLASS lcl_alv_routines IMPLEMENTATION.
    * METHOD build_fieldcat
      METHOD build_fieldcat.
        REFRESH: gt_fieldcat.
        CLEAR wa_fieldcat.
        DEFINE m_fieldcat.
          add 1 to wa_fieldcat-col_pos.
          wa_fieldcat-fieldname   = &1.
          wa_fieldcat-tabname     = &2.
          wa_fieldcat-coltext     = &3.
          wa_fieldcat-outputlen   = &4.
          wa_fieldcat-fix_column  = &5.
          wa_fieldcat-just        = &6.
          wa_fieldcat-do_sum      = &7.
          wa_fieldcat-emphasize   = &8.
          wa_fieldcat-hotspot     = &9.
          append wa_fieldcat to gt_fieldcat.
        END-OF-DEFINITION.
        IF wa_column-fname = 'SO_STATUS'.
          m_fieldcat 'CR_HOLD'         'GT_STATUS_HISTORY'  text-002  '50' 'X' '' '' '' ''.
          m_fieldcat 'CR_REL_ON'       'GT_STATUS_HISTORY'  text-003  '18' 'X' '' '' '' ''.
          m_fieldcat 'CR_REL_AT'       'GT_STATUS_HISTORY'  text-004  '18' 'X' '' '' '' ''.
          m_fieldcat 'DO_CREATED_ON'   'GT_STATUS_HISTORY'  text-005  '13' 'X' '' '' '' ''.
          m_fieldcat 'DO_CREATED_TIME' 'GT_STATUS_HISTORY'  text-030  '15' 'X' '' '' '' ''.
          m_fieldcat 'PICKED_ON'       'GT_STATUS_HISTORY'  text-006  '12' 'X' '' '' '' ''.
          m_fieldcat 'PICKED_TIME'     'GT_STATUS_HISTORY'  text-031  '12' 'X' '' '' '' ''.
          m_fieldcat 'INV_CREATED_ON'  'GT_STATUS_HISTORY'  text-007  '15' 'X' '' '' '' ''.
          m_fieldcat 'DISPATCHED_ON'   'GT_STATUS_HISTORY'  text-008  '13' 'X' '' '' '' ''.
          m_fieldcat 'DISPATCHED_AT'   'GT_STATUS_HISTORY'  text-009  '13' 'X' '' '' '' ''.
        ELSEIF wa_column-fname = 'BILL_DOC'.
          m_fieldcat 'PODAT'          'GT_CONFIRMATION'    text-010  '17' 'X' '' '' '' ''.
          m_fieldcat 'POTIM'          'GT_CONFIRMATION'    text-011  '17' 'X' '' '' '' ''.
        ELSE.
          m_fieldcat 'CREATION_DATE' 'GT_OUTPUT' text-012 '10' 'X' '' '' '' ''.
          m_fieldcat 'CREATION_TIME' 'GT_OUTPUT' text-013 '10' 'X' '' '' '' ''.
          m_fieldcat 'SALES_DOC'     'GT_OUTPUT' text-014 '10' 'X' '' '' 'X' 'X'.
          m_fieldcat 'CUST_CODE'     'GT_OUTPUT' text-015 '16' 'X' '' '' '' ''.
          m_fieldcat 'CUST_DESC'     'GT_OUTPUT' text-016 '40' 'X' '' '' '' ''.
          m_fieldcat 'SHIP_TO_CODE'  'GT_OUTPUT' text-017 '15' 'X' '' '' '' ''.
          m_fieldcat 'SHIP_TO_DESC'  'GT_OUTPUT' text-018 '40' 'X' '' '' '' ''.
          m_fieldcat 'PO_NUM'        'GT_OUTPUT' text-019 '24' 'X' '' '' '' ''.
          m_fieldcat 'DOC_TYPE'      'GT_OUTPUT' text-020 '16' 'X' '' '' '' ''.
          m_fieldcat 'REQ_DLV_DATE'  'GT_OUTPUT' text-021 '21' 'X' '' '' '' ''.
          m_fieldcat 'SO_STATUS'     'GT_OUTPUT' text-022 '09' 'X' '' '' 'C400' ''.
          m_fieldcat 'CREATED_BY'    'GT_OUTPUT' text-023 '13' 'X' '' '' '' ''.
          m_fieldcat 'DEL_DOC'       'GT_OUTPUT' text-024 '18' 'X' '' '' '' ''.
          m_fieldcat 'BILL_DOC'      'GT_OUTPUT' text-025 '11' 'X' '' '' 'C600' ''.
        ENDIF.
      ENDMETHOD.                    "build_fieldcat
    * METHOD popup_routines
      METHOD popup_routines.
        READ TABLE im_column INDEX 1 INTO wa_column.
        FIELD-SYMBOLS: <fs_status> LIKE LINE OF gt_status.
        DATA: lv_datum TYPE syst-datum,
              lv_uzeit TYPE syst-uzeit.
        CLEAR: wa_status_history, lv_datum, lv_uzeit.
        REFRESH gt_status_history.
    */Popup routine if user clicked on the SO status
        IF wa_column-fname = 'SO_STATUS'.
          CALL METHOD me->get_domain_values
            EXPORTING
              im_tabname    = 'VBUK'
              im_fieldname  = 'CMGST'
            IMPORTING
              ex_values_tab = gt_domain_val.
    *     Credit hold
          READ TABLE gt_status ASSIGNING <fs_status> WITH KEY vbeln = im_output-sales_doc.
          IF sy-subrc = 0.
            wa_status_history-cr_hold = <fs_status>-cmgst.
          ENDIF.
          READ TABLE gt_domain_val INTO wa_domain_val WITH
                                    KEY domvalue_l = wa_status_history-cr_hold
                                    TRANSPORTING ddtext.
          IF sy-subrc = 0.
            wa_status_history-cr_hold = wa_domain_val-ddtext.
          ENDIF.
    *     Credit released date and time
          SELECT SINGLE udate utime
            FROM cdhdr
            INTO (lv_datum, lv_uzeit)
           WHERE objectid = im_output-sales_doc
             AND tcode    = 'VKM3'.
          IF sy-subrc = 0.
            WRITE lv_datum TO wa_status_history-cr_rel_on
            USING EDIT MASK '__/__/____'.
            CLEAR lv_datum.
            WRITE lv_uzeit TO wa_status_history-cr_rel_at
            USING EDIT MASK '__:__:__'.
            CLEAR lv_uzeit.
          ENDIF.
    *     DO creation date and time
          IF NOT im_output-del_doc IS INITIAL.
            SELECT SINGLE erdat erzet
              FROM likp
              INTO (lv_datum, lv_uzeit)
             WHERE vbeln = im_output-del_doc.
            IF sy-subrc = 0.
              WRITE lv_datum TO wa_status_history-do_created_on
              USING EDIT MASK '__/__/____'.
              CLEAR lv_datum.
              WRITE lv_uzeit TO wa_status_history-do_created_time
              USING EDIT MASK '__:__:__'.
              CLEAR lv_uzeit.
            ENDIF.
    *       Picking date and time
            SELECT SINGLE bdatu bzeit
              FROM ltak
              INTO (lv_datum, lv_uzeit)
             WHERE vbeln = im_output-del_doc.
            IF sy-subrc = 0.
              WRITE lv_datum TO wa_status_history-picked_on
              USING EDIT MASK '__/__/____'.
              CLEAR lv_datum.
              WRITE lv_uzeit TO wa_status_history-picked_time
              USING EDIT MASK '__:__:__'.
              CLEAR lv_uzeit.
            ENDIF.
          ENDIF.
    *     Invoice created on
          SELECT SINGLE erdat
            FROM vbrk
            INTO lv_datum
           WHERE vbeln = im_output-bill_doc.
          WRITE lv_datum TO wa_status_history-inv_created_on
          USING EDIT MASK '__/__/____'.
          CLEAR lv_datum.
    *     Dispatched on and dispatched at
          SELECT SINGLE tknum
            FROM vttp
            INTO vttp-tknum
           WHERE vbeln = im_output-del_doc.
          IF sy-subrc = 0.
            SELECT SINGLE dtabf uzabf
              FROM vttk
              INTO (lv_datum, lv_uzeit)
             WHERE tknum = vttp-tknum.
            WRITE lv_datum TO wa_status_history-dispatched_on
            USING EDIT MASK '__/__/____'.
            CLEAR lv_datum.
            WRITE lv_uzeit TO wa_status_history-dispatched_at
            USING EDIT MASK '__:__:__'.
            CLEAR lv_uzeit.
          ENDIF.
          APPEND wa_status_history TO gt_status_history.
          ex_status_history[] = gt_status_history[].
          CLEAR wa_status_history.
    */Popup routine if the user clicked on the billing document
        ELSEIF wa_column-fname = 'BILL_DOC'.
          IF NOT im_output-del_doc IS INITIAL.
            SELECT SINGLE podat potim
              FROM likp
              INTO (wa_confirmation-podat, wa_confirmation-potim)
             WHERE vbeln = im_output-del_doc.
            APPEND wa_confirmation TO gt_confirmation.
            ex_confirmation[] = gt_confirmation[].
            CLEAR wa_confirmation.
          ENDIF.
        ENDIF.
      ENDMETHOD.                    "popup_routines
    * METHOD get_domain_values
      METHOD   get_domain_values.
        CALL FUNCTION 'DDIF_FIELDINFO_GET'
          EXPORTING
            tabname              = im_tabname
            fieldname            = im_fieldname
            langu                = sy-langu
    *       LFIELDNAME           = ' '
    *       ALL_TYPES            = ' '
    *       GROUP_NAMES          = ' '
    *       UCLEN                =
    *     IMPORTING
    *       X030L_WA             =
    *       DDOBJTYPE            =
    *       DFIES_WA             =
    *       LINES_DESCR          =
          TABLES
            dfies_tab            = lt_dfies_tab
    *       FIXED_VALUES         =
    *     EXCEPTIONS
    *       NOT_FOUND            = 1
    *       INTERNAL_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.
        READ TABLE lt_dfies_tab INDEX 1 INTO wa_dfies_tab
                                        TRANSPORTING domname.
        CALL FUNCTION 'GET_DOMAIN_VALUES'
           EXPORTING
             domname               = wa_dfies_tab-domname
    *       TEXT                  = 'X'
    *       FILL_DD07L_TAB        = ' '
           TABLES
             values_tab            = ex_values_tab
    *       VALUES_DD07L          =
    *     EXCEPTIONS
    *       NO_VALUES_FOUND       = 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.
      ENDMETHOD.                    "get_domain_values
    ENDCLASS.                    "lcl_alv_routines IMPLEMENTATION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    * METHOD handle_double_click
      METHOD handle_double_click.
        IF e_column = 'SO_STATUS' OR
           e_column = 'BILL_DOC'.
          CREATE OBJECT: o_lcl_alv_routines.
          CLEAR: wa_output.
          REFRESH: gt_fieldcat,
                   gt_column,
                   gt_status_history,
                   gt_confirmation.
          MOVE: e_column-fieldname TO wa_column-fname,
                e_column-hierlevel TO wa_column-level.
          APPEND wa_column TO gt_column.
    *     Get record based on what the user clicked
          READ TABLE gt_output INDEX e_row-index INTO wa_output.
    *     Build fieldcatalog depending on what the user clicked
          CALL METHOD o_lcl_alv_routines->build_fieldcat.
    *     Call popup routine/s
          CALL METHOD o_lcl_alv_routines->popup_routines
            EXPORTING
              im_column         = gt_column
              im_output         = wa_output
            IMPORTING
              ex_status_history = gt_status_history
              ex_confirmation   = gt_confirmation.
          CALL METHOD me->create_detail_list
            EXPORTING
              im_column       = gt_column
              im_status       = gt_status_history
              im_confirmation = gt_confirmation.
        ENDIF.
      ENDMETHOD.                    "handle_double_click
    * METHOD handle_close
      METHOD handle_close.
        CALL METHOD sender->set_visible
          EXPORTING
            visible = space.
      ENDMETHOD.                    "handle_close
    * METHOD handle_hotspot_click
      METHOD handle_hotspot_click.
        READ TABLE gt_output INDEX e_row_id INTO wa_output.
        IF NOT wa_output-sales_doc IS INITIAL
           AND e_column_id = 'SALES_DOC'.
          SET PARAMETER ID 'AUN' FIELD wa_output-sales_doc.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDMETHOD.                    "handle_hotspot_click
    * METHOD create_detail_list
      METHOD create_detail_list.
        DATA: lv_caption(200) TYPE c.
        CLEAR wa_column.
    *   Create popup window
        CREATE OBJECT dialogbox_container
            EXPORTING
              top = 100
              left = 150
              lifetime = cntl_lifetime_dynpro
              caption = lv_caption
              width = 800
              height = 200.
        CREATE OBJECT grid2
            EXPORTING i_parent = dialogbox_container.
    *   Trigger event when user closes the popup window
        SET HANDLER event_receiver->handle_close FOR dialogbox_container.
        READ TABLE im_column INDEX 1 INTO wa_column.
    *   Display popup window
        IF wa_column-fname = 'SO_STATUS'.
          gs_layout-grid_title = text-026.
          CALL METHOD grid2->set_table_for_first_display
           EXPORTING
    *        i_structure_name = 'T_OUTPUT'
             is_layout        = gs_layout
           CHANGING
             it_outtab        = gt_status_history
             it_fieldcatalog  = gt_fieldcat.
        ELSEIF wa_column-fname = 'BILL_DOC'.
          gs_layout-grid_title = text-027.
          CALL METHOD grid2->set_table_for_first_display
           EXPORTING
    *        i_structure_name = 'T_OUTPUT'
             is_layout        = gs_layout
           CHANGING
             it_outtab        = gt_confirmation
             it_fieldcatalog  = gt_fieldcat.
        ENDIF.
        CALL METHOD cl_gui_control=>set_focus
          EXPORTING
            control = grid2.
      ENDMETHOD.                    "create_detail_list
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    * START-OF-SELECTION                           *
    START-OF-SELECTION.
      DATA: o_lcl_get_data TYPE REF TO lcl_get_data.
      CREATE OBJECT o_lcl_get_data.
      CALL METHOD o_lcl_get_data->get_sales_docs.
    * END-OF-SELECTION                             *
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS '100'.
      SET TITLEBAR  'TITLE100'.
      DATA: o_lcl_alv_routines TYPE REF TO lcl_alv_routines,
            gv_text            TYPE string,
            gv_name1           TYPE kna1-name1,
            gv_date_low(10)    TYPE c,
            gv_date_high(10)   TYPE c.
      CREATE OBJECT o_lcl_alv_routines.
      g_repid = sy-repid.
      IF custom_container IS INITIAL.
        CREATE OBJECT custom_container
          EXPORTING
            container_name = gv_container
          EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc NE 0.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = g_repid
              txt2  = sy-subrc
              txt1  = text-028.
        ENDIF.
        CREATE OBJECT grid1
          EXPORTING
            i_parent = custom_container.
    *   Build fieldcatalog for initial display
        CALL METHOD o_lcl_alv_routines->build_fieldcat.
        SELECT SINGLE name1
          FROM kna1
          INTO gv_name1
         WHERE kunnr = p_kunnr.
        WRITE: s_erdat-low  TO gv_date_low  USING EDIT MASK '__/__/____',
               s_erdat-high TO gv_date_high USING EDIT MASK '__/__/____'.
        CONCATENATE: gv_name1 'from:' gv_date_low '-' gv_date_high
               INTO gv_text
          SEPARATED BY space.
        gs_layout-grid_title = gv_text.
    *   Display initial window
        CALL METHOD grid1->set_table_for_first_display
          EXPORTING
    *        i_structure_name = ''
            is_layout        = gs_layout
          CHANGING
            it_outtab        = gt_output
            it_fieldcatalog  = gt_fieldcat.
        CREATE OBJECT event_receiver.
    *   Trigger event when user double clicks initial window
        SET HANDLER event_receiver->handle_double_click FOR grid1.
    *   Trigger event when user clicks hotspot field
        SET HANDLER event_receiver->handle_hotspot_click FOR grid1.
      ENDIF.
      CALL METHOD cl_gui_control=>set_focus
        EXPORTING
          control = grid1.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CASE save_ok.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          CALL METHOD custom_container->free.
          CALL METHOD cl_gui_cfw=>flush.
          IF sy-subrc <> 0.
            CALL FUNCTION 'POPUP_TO_INFORM'
              EXPORTING
                titel = g_repid
                txt2  = sy-subrc
                txt1  = text-029.
          ENDIF.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT

  • How to join VBAK, VBAP with MARC materials flaged for deletion

    Hi,
    Iam have to extract only sales orders with materials which are not flagged for deletion.
    In MARC table, I have to use LVORM field to restrict materials which are not flagged for deletion. Can anybosy explain in this regard and combine with VBAP and VBAK tables.
    Thanks.

    Hi Raju,
    Check below code,
    SELECT f1 f2... INTO TABLE i_mara
    FROM mara
    WHERE ur conditions from selection screen if any
    AND lvorm EQ space.
    CHECK NOT i_mara[] IS INITIAL.
    SORT i_mara BY matnr.
    SELECT avbeln a.... bposnr b...
    INTO TABLE i_salesdata
    FROM vbak AS a INNER JOIN vbap AS b
    ON avbeln EQ bvbeln
    FOR ALL ENTRIES IN i_mara
    WHERE ur conditions from selection screen if any
    AND b~matnr EQ i_mara-matnr.
    CHECK NOT i_salesdata IS INITIAL.
    SORT i_salesdata BY vben.
    Hope u got the sulution for ur problem.
    Thanks,
    Vinod.

  • Reversal Indicator Field in View

    Hi All,
    I have created a View on VBAK, VBAP,VBKD, VBEP tables.
    DO i need to maintain reversal indicator field in This view.
    Can any body suggest me on this.
    Regards,
    Sri

    Hi
    I dont think you need to indicate.
    Regards,
    Chama.

Maybe you are looking for

  • Establishing E-mail Accounts

    [Hope complaining about services is OK on this forum. Please note: sarcasm is just one of my talents.] Great forum content. Too bad it can't be searched for more specific issues. For all I know, this question has been answered several times already.

  • URL should open in a new window for Oracle portal

    Hi Gurus, I am stucked in a problem related to Portal. I am developing a portal page under which many Links with URL's will be listed. I want all the URL's should be opened in a separate window. I am unable to do so. Appreciate any quick help on this

  • Macbookpro+wifi=error

    I know Apple will delete this posting, as they did it before: "I bought a macbook pro retina  today and I was eager to use it...no way to get wifi connection....what really makes me angry is that this seems to have been a problem for almost 4 years o

  • How to configure network on Oracle Solaris 10

    Hi All, I have created a new virtual machine on Windows Server 2003 and installed Oracle Solaris 10 on VMWare. Now I need to configure network on my Solaris virtual machine, So that i can access Solaris machine outside the VMWare. Can somebody help m

  • I get an E_STREAM_ERROR when trying to open an acsm file

    I use ADE 3.0  on Win8.1 x64 and open the acsm file. After some time without action the pgrogrm returns the message: E_STREAM_ERROR. What can I do?