Skip to Content
author's profile photo Former Member
Former Member

ALV button - events

Hi,

How to receive function code buttons frim ALV Grid. I talking about standard buttons, not those, which we can add to toolbar.

For example it could be : sorting, filtering, button information.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on Jun 06, 2008 at 01:05 PM

    hi daniel,

    here is an example using OOP.

    *----------------------------------------------------------------------
    * CLASS DECLARATION
    *----------------------------------------------------------------------
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    
    *----------------------------------------------------------------------
    *       CLASS lcl_event_receiver DEFINITION
    *----------------------------------------------------------------------
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_user_command
              for event user_command of cl_gui_alv_grid
              importing e_ucomm.
    ENDCLASS.
    
    *----------------------------------------------------------------------
    *       CLASS lcl_event_receiver IMPLEMENTATION
    *----------------------------------------------------------------------
    CLASS lcl_event_receiver IMPLEMENTATION.
       method handle_user_command.
       case e_ucomm.
        when '&SAVE'  " handles the save button click
       endcase.
       endmethod.
    ENDCLASS.
    

    declare your event handler like this

     data: go_event type ref to lcl_event_receiver. 

    use the event handler

      CREATE OBJECT go_event.
    
      SET HANDLER:
        go_event->handle_user_command FOR go_alvg1.
    

    regards,

    Peter

    Edited by: Peter Ruiz on Jun 6, 2008 9:05 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 01:14 PM

    hi go to tcode---->se41

    program------>SAPLSALV

    status----


    > STANDARD

    then you will get the status of the buttons..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 02:10 PM

    Daniel,

    You never stated if you are using ALV OO or the ALV REUSE option.

    This makes a difference how to handle it.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 04:38 PM

    Hello Daniel,

    I doubt you can capture fcode of standard buttons as it will not stop in user command and OK code will also be blank.

    Could you please let me know exactly what are you tring to achieve with those buttons, there might be different way to get your problem solved.

    thnx,

    ags.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 07:12 PM

    Hi,

    Below is the list of function codes from ALV:

    &ILT - Filter

    &ODN - Sort descending

    &OUP - Sort ascending

    &UMC - Summation

    &XPA - Expand

    &AVE - SAve layout

    &OAD - Choose Layout

    &OLO - change Layout

    %PC - Import

    %SL - Mail

    &XXL - Excel download

    &ETA - Choose

    &ALL - Select all

    &SAL - Deselect all

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2008 at 04:35 AM

    hi,

    In case u r using the Normal Alv that is REUSE_ALV_GRID_DISPLAY to display ALV grid then u can check the function code in sy-ucomm or in ok_code

    do /h where u type the TCode and then press on the button whose function code u want to knw .....it will take u to debug mode and u can type sy-ucomm or ok_code and check its value which is the function code of the button clicked by u ....

    in case of OOPS ALV

    the variable name which contains function code is fcodes_entry-fcode

    reward points of useful....... 😊

    and mark the post answered once the problem is solved

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      So I have ALV grid and chart. Chart behavior depends from this, what we will filter in ALV.

      This code

          CLASS-METHODS event_toolbar_click
            FOR EVENT toolbar OF cl_gui_alv_grid
              IMPORTING e_object e_interactive.
      

      enables me event, that I have pressed toolbar button from ALV, problem is, that this function starts up when we press each of this buttons.

      regards

  • author's profile photo Former Member
    Former Member
    Posted on Jun 09, 2008 at 07:11 AM

    Hi,

    Sending u a code, it may help u.

    ----


    *Tables

    ----


    TABLES:mkpf, j_1iexchdr,j_1iexcdtl,lfa1, j_1ipart1, j_1ipart2,

    ekko,konv,bkpf.

    ----


    *Internal Table Declaration

    ----


    TYPE-POOLS: slis.

    DATA:BEGIN OF i_j_1iexcdtl OCCURS 0,

    trntyp LIKE j_1iexcdtl-trntyp,

    docyr LIKE j_1iexcdtl-docyr,

    docno LIKE j_1iexcdtl-docno,

    zeile LIKE j_1iexcdtl-zeile,

    exnum LIKE j_1iexcdtl-exnum, "4

    exdat LIKE j_1iexcdtl-exdat, "5

    lifnr LIKE j_1iexcdtl-lifnr, "6

    matnr LIKE j_1iexcdtl-matnr, "8

    maktx LIKE j_1iexcdtl-maktx, "9

    chapid LIKE j_1iexcdtl-chapid, "10

    menge LIKE j_1iexcdtl-menge, "11

    meins LIKE j_1iexcdtl-meins, "12

    exbas LIKE j_1iexcdtl-exbas, "13

    exbed LIKE j_1iexcdtl-exbed, "14

    rdoc1 LIKE j_1iexcdtl-rdoc1, "17

    rdoc2 LIKE j_1iexcdtl-rdoc2,

    ryear2 LIKE j_1iexcdtl-ryear2,

    ecs LIKE j_1iexcdtl-ecs, "15

    exaddtax1 LIKE j_1iexcdtl-exaddtax1, "16

    END OF i_j_1iexcdtl.

    DATA:BEGIN OF i_mkpf OCCURS 0,

    mblnr LIKE mkpf-mblnr,

    mjahr LIKE mkpf-mjahr,

    budat LIKE mkpf-budat, "2

    xblnr LIKE mkpf-xblnr, "3

    exnum LIKE j_1iexcdtl-exnum,

    ryear2 LIKE j_1iexcdtl-ryear2,

    END OF i_mkpf.

    DATA: BEGIN OF i_mseg OCCURS 0,

    mblnr LIKE mseg-mblnr,

    mjahr LIKE mseg-mjahr,

    zeile LIKE mseg-zeile,

    matnr LIKE mseg-matnr,

    ebeln LIKE mseg-ebeln,

    ebelp LIKE mseg-ebelp,

    END OF i_mseg.

    DATA:BEGIN OF i_lfa1 OCCURS 0,

    lifnr LIKE lfa1-lifnr,

    name1 LIKE lfa1-name1, "7

    END OF i_lfa1.

    DATA:BEGIN OF i_j_1ipart2 OCCURS 0,

    serialno LIKE j_1ipart2-serialno,

    trntyp LIKE j_1ipart2-trntyp,

    docyr LIKE j_1ipart2-docyr,

    docno LIKE j_1ipart2-docno,

    fawref LIKE j_1ipart2-fawref, "18

    fayear LIKE j_1ipart2-fayear,

    END OF i_j_1ipart2 .

    DATA:BEGIN OF i_j_1ipart1 OCCURS 0,

    exgrp LIKE j_1ipart1-exgrp,

    mblnr LIKE j_1ipart1-mblnr, "1

    mjahr LIKE j_1ipart1-mjahr,

    zeile LIKE j_1ipart1-zeile,

    bwart LIKE j_1ipart1-bwart,

    trntyp LIKE j_1ipart1-trntyp,

    cpudt LIKE j_1ipart1-cpudt,

    END OF i_j_1ipart1 .

    DATA: BEGIN OF i_ekko_ekpo OCCURS 0,

    ebeln LIKE ekko-ebeln,

    ebelp LIKE ekpo-ebelp,

    netpr LIKE ekpo-netpr,

    knumv LIKE ekko-knumv,

    kposn LIKE konv-kposn,

    END OF i_ekko_ekpo.

    DATA: BEGIN OF i_konv OCCURS 0,

    knumv LIKE konv-knumv,

    kposn LIKE konv-kposn,

    kwert LIKE konv-kwert,

    kbetr LIKE konv-kbetr,

    END OF i_konv.

    DATA:BEGIN OF itab OCCURS 0,

    • chk1 TYPE c,

    mblnr LIKE j_1ipart1-mblnr, "1

    ck(1), " TYPE C,

    sr_no(5),

    budat LIKE mkpf-budat, "2

    xblnr LIKE mkpf-xblnr, "3

    exnum LIKE j_1iexcdtl-exnum, "4

    exdat LIKE j_1iexcdtl-exdat, "5

    lifnr LIKE j_1iexcdtl-lifnr, "6

    name1 LIKE lfa1-name1, "7

    matnr LIKE j_1iexcdtl-matnr, "8

    maktx LIKE j_1iexcdtl-maktx, "9

    chapid LIKE j_1iexcdtl-chapid, "10

    menge LIKE j_1iexcdtl-menge, "11

    meins LIKE j_1iexcdtl-meins, "12

    exbas LIKE j_1iexcdtl-exbas, "13

    exbed LIKE j_1iexcdtl-exbed, "14

    ecs LIKE j_1iexcdtl-ecs, "15

    exaddtax1 LIKE j_1iexcdtl-exaddtax1, "16

    rdoc1 LIKE j_1iexcdtl-rdoc1, "17

    fawref LIKE j_1ipart2-fawref, "18

    fayear LIKE j_1ipart2-fayear,

    total_excise TYPE p DECIMALS 2, "19

    serialno LIKE j_1ipart2-serialno,

    exgrp LIKE j_1ipart1-exgrp,

    cpudt LIKE j_1ipart1-cpudt,

    bwart LIKE j_1ipart1-bwart,

    trntyp LIKE j_1ipart1-trntyp,

    docyr LIKE j_1iexcdtl-docyr,

    docno LIKE j_1iexcdtl-docno,

    rdoc2 LIKE j_1iexcdtl-rdoc2,

    ryear2 LIKE j_1iexcdtl-ryear2,

    END OF itab.

    DATA: BEGIN OF itab1 OCCURS 0.

    INCLUDE STRUCTURE itab.

    DATA: amt1 LIKE j_1iexcdtl-exbas,

    amt2 LIKE j_1iexcdtl-exbas,

    amt3 LIKE j_1iexcdtl-exbas,

    amt4 LIKE j_1iexcdtl-exbas,

    END OF itab1.

    DATA: BEGIN OF i_result1 OCCURS 0,

    mblnr LIKE mkpf-mblnr,

    exnum LIKE j_1iexchdr-exnum,

    serialno LIKE j_1ipart2-serialno,

    message(100),

    END OF i_result1.

    DATA: i_result2 LIKE i_result1 OCCURS 0 WITH HEADER LINE.

    DATA:sl TYPE sy-tabix,

    slno TYPE sy-tabix,

    vendor LIKE lfa1-lifnr,

    exciseno LIKE j_1iexchdr-exnum,

    excisedt LIKE j_1iexchdr-exdat,

    pono LIKE j_1iexcdtl-rdoc1,

    cnt TYPE i,

    amt TYPE p DECIMALS 2.

    ----


    • ALV Data Declaration *

    ----


    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,

    • gd_tab_group TYPE slis_t_sp_group_alv,

    gd_layout TYPE slis_layout_alv,

    gd_repid LIKE sy-repid.

    • gt_events TYPE slis_t_event,

    • gd_prntparams TYPE slis_print_alv.

    DATA:fcat TYPE slis_t_fieldcat_alv,

    fcat1 TYPE slis_t_fieldcat_alv,

    fcat2 TYPE slis_t_fieldcat_alv,

    eve TYPE slis_t_event,

    eve1 TYPE slis_t_event,

    subtot TYPE slis_t_sortinfo_alv,

    g_subtot LIKE LINE OF subtot,

    wfieldcat TYPE slis_fieldcat_alv,

    t_header TYPE slis_t_listheader,

    ieventdetail TYPE slis_t_event,

    ieventsummary TYPE slis_t_event,

    wevent TYPE slis_alv_event.

    DATA :v_pgm LIKE sy-repid.

    DATA :col_pos TYPE i,

    date LIKE sy-datum,

    line TYPE i,

    line1 TYPE i.

    DATA : bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,

    errtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

    ----


    *Selection Screen

    ----


    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

    SELECT-OPTIONS:s_exgrp FOR j_1ipart1-exgrp,

    s_cpudt FOR j_1ipart1-cpudt OBLIGATORY.

    SELECTION-SCREEN END OF BLOCK b1.

    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

    PARAMETERS:p_excise RADIOBUTTON GROUP rad1, "Post Excise Invoice.

    p_doc RADIOBUTTON GROUP rad1. "Posted Document.

    SELECTION-SCREEN END OF BLOCK b2.

    ----


    *Initialization.

    ----


    INITIALIZATION.

    v_pgm = sy-repid.

    ----


    *Start-of-selection

    ----


    *--


    At Selection Screen--

    *

    *AT SELECTION-SCREEN ON s_werks.

    • PERFORM validate_plant.

    ----


    START-OF-SELECTION.

    IF p_excise = 'X'.

    PERFORM get_data.

    PERFORM process_data.

    PERFORM built_fieldcat.

    PERFORM display_alv.

    ELSEIF p_doc = 'X'.

    PERFORM get_data.

    PERFORM process_data.

    PERFORM built_fieldcat1.

    PERFORM display_alv.

    ENDIF.

    &----


    *& Form get_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM get_data .

    *Get data from j_1ipart1 (1)

    SELECT exgrp mblnr mjahr zeile bwart trntyp cpudt FROM j_1ipart1

    INTO TABLE i_j_1ipart1

    WHERE exgrp IN s_exgrp

    AND cpudt IN s_cpudt

    AND trntyp = 'GRPO'

    AND bwart IN ('101','105').

    *Get data from MKPF (2,3)

    IF NOT i_j_1ipart1[] IS INITIAL.

    CLEAR:i_mkpf.REFRESH:i_mkpf.

    SELECT mblnr mjahr budat xblnr FROM mkpf INTO TABLE i_mkpf

    FOR ALL ENTRIES IN i_j_1ipart1

    WHERE mblnr = i_j_1ipart1-mblnr

    AND mjahr = i_j_1ipart1-mjahr.

    ENDIF.

    LOOP AT i_mkpf.

    i_mkpf-exnum = i_mkpf-xblnr(10).

    i_mkpf-ryear2 = i_mkpf-mjahr.

    MODIFY i_mkpf TRANSPORTING exnum ryear2.

    ENDLOOP.

    *Get data from J_1IEXCDTL (4,5,6,8,9,10,11,12,13,14,15,16,17)

    IF NOT i_mkpf[] IS INITIAL.

    CLEAR:i_j_1iexcdtl.REFRESH:i_j_1iexcdtl.

    SELECT trntyp

    docyr

    docno

    zeile

    exnum

    exdat

    lifnr

    matnr

    maktx

    chapid

    menge

    meins

    exbas

    exbed

    rdoc1

    rdoc2

    ryear2

    ecs

    exaddtax1 FROM j_1iexcdtl INTO TABLE i_j_1iexcdtl

    FOR ALL ENTRIES IN i_mkpf

    WHERE rdoc2 = i_mkpf-mblnr

    AND ryear2 = i_mkpf-ryear2

    AND trntyp = 'GRPO'.

    ENDIF.

    *Get data from LFA1 (6)

    IF NOT i_j_1iexcdtl[] IS INITIAL.

    CLEAR:i_lfa1.REFRESH:i_lfa1.

    SELECT lifnr name1 FROM lfa1 INTO TABLE i_lfa1

    FOR ALL ENTRIES IN i_j_1iexcdtl

    WHERE lifnr = i_j_1iexcdtl-lifnr.

    ENDIF.

    *Get data from J_1IPART2 (18)

    IF NOT i_j_1iexcdtl[] IS INITIAL.

    CLEAR:i_j_1ipart2.REFRESH:i_j_1ipart2.

    SELECT serialno trntyp docyr docno fawref fayear FROM j_1ipart2

    INTO TABLE i_j_1ipart2

    FOR ALL ENTRIES IN i_j_1iexcdtl

    WHERE trntyp = i_j_1iexcdtl-trntyp

    AND docyr = i_j_1iexcdtl-docyr

    AND docno = i_j_1iexcdtl-docno.

    ENDIF.

    ENDFORM. " get_data

    &----


    *& Form process_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM process_data .

    sl = 0.

    LOOP AT i_j_1iexcdtl.

    itab-trntyp = i_j_1iexcdtl-trntyp.

    itab-docyr = i_j_1iexcdtl-docyr.

    itab-docno = i_j_1iexcdtl-docno.

    itab-exnum = i_j_1iexcdtl-exnum.

    itab-exdat = i_j_1iexcdtl-exdat.

    itab-lifnr = i_j_1iexcdtl-lifnr.

    itab-matnr = i_j_1iexcdtl-matnr.

    itab-maktx = i_j_1iexcdtl-maktx.

    itab-chapid = i_j_1iexcdtl-chapid.

    itab-menge = i_j_1iexcdtl-menge.

    itab-meins = i_j_1iexcdtl-meins.

    itab-exbas = i_j_1iexcdtl-exbas.

    itab-exbed = i_j_1iexcdtl-exbed.

    itab-rdoc1 = i_j_1iexcdtl-rdoc1.

    itab-rdoc2 = i_j_1iexcdtl-rdoc2.

    itab-ryear2 = i_j_1iexcdtl-ryear2.

    itab-ecs = i_j_1iexcdtl-ecs.

    itab-exaddtax1 = i_j_1iexcdtl-exaddtax1.

    READ TABLE i_mkpf WITH KEY mblnr = itab-rdoc2

    mjahr = itab-ryear2.

    IF sy-subrc = 0.

    itab-budat = i_mkpf-budat.

    itab-xblnr = i_mkpf-xblnr.

    READ TABLE i_j_1ipart1 WITH KEY mblnr = i_mkpf-mblnr

    mjahr = i_mkpf-mjahr

    zeile = i_j_1iexcdtl-zeile.

    IF sy-subrc = 0.

    SELECT SINGLE * FROM j_1ipart1

    WHERE docno = itab-docno

    AND docyr = itab-docyr

    AND zeile = i_j_1ipart1-zeile

    AND bwart IN ('102','106','161').

    IF sy-subrc NE 0.

    itab-mblnr = i_j_1ipart1-mblnr.

    itab-exgrp = i_j_1ipart1-exgrp.

    itab-cpudt = i_j_1ipart1-cpudt.

    itab-bwart = i_j_1ipart1-bwart.

    READ TABLE i_lfa1 WITH KEY lifnr = itab-lifnr.

    IF sy-subrc = 0.

    itab-name1 = i_lfa1-name1.

    ENDIF.

    READ TABLE i_j_1ipart2 WITH KEY trntyp = itab-trntyp

    docyr = itab-docyr

    docno = itab-docno.

    IF sy-subrc = 0.

    itab-serialno = i_j_1ipart2-serialno.

    itab-fawref = i_j_1ipart2-fawref.

    itab-fayear = i_j_1ipart2-fayear.

    ENDIF.

    itab-total_excise = itab-exbed + itab-ecs + itab-exaddtax1.

    --


    For Serial No.(Sr.No.)--

    *----


    IF p_excise = 'X'.

    SELECT SINGLE * FROM j_1iexcdtl

    WHERE trntyp = i_j_1iexcdtl-trntyp

    AND docyr = i_j_1iexcdtl-docyr

    AND docno = i_j_1iexcdtl-docno

    AND zeile = i_j_1iexcdtl-zeile

    AND exnum = i_j_1iexcdtl-exnum

    AND status = ''.

    IF sy-subrc = 0.

    slno = slno + 1.

    itab-sr_no = slno.

    APPEND itab.

    CLEAR itab.

    ENDIF.

    ELSE.

    SELECT SINGLE * FROM j_1iexcdtl

    WHERE trntyp = i_j_1iexcdtl-trntyp

    AND docyr = i_j_1iexcdtl-docyr

    AND docno = i_j_1iexcdtl-docno

    AND zeile = i_j_1iexcdtl-zeile

    AND exnum = i_j_1iexcdtl-exnum

    AND status = 'P'.

    IF sy-subrc = 0.

    slno = slno + 1.

    itab-sr_no = slno.

    APPEND itab.

    CLEAR itab.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDLOOP.

    DELETE itab WHERE NOT exgrp IN s_exgrp.

    DELETE itab WHERE NOT cpudt IN s_cpudt.

    SORT itab by mblnr.

    clear slno.

    loop at itab.

    slno = slno + 1.

    itab-sr_no = slno.

    modify itab transporting sr_no.

    endloop.

    LOOP AT itab.

    line = line + 1.

    line1 = line1 + 1.

    vendor = itab-lifnr.

    exciseno = itab-exnum.

    excisedt = itab-exdat.

    pono = itab-rdoc1.

    AT END OF mblnr.

    IF line1 GT 1.

    line = line + 1.

    SUM.

    CLEAR: itab-sr_no,itab-lifnr,itab-exnum,itab-exdat,itab-matnr,

    itab-maktx,itab-name1,itab-meins,itab-rdoc1,itab-budat,

    itab-xblnr,itab-chapid,itab-fawref,itab-serialno.

    itab-lifnr = vendor.

    itab-exnum = exciseno.

    itab-exdat = excisedt.

    itab-rdoc1 = pono.

    INSERT itab INDEX line.

    line = line - 1.

    ENDIF.

    CLEAR line1.

    ENDAT.

    ENDLOOP.

    ---- -For Exceptional Records ----

    • IF p_except = 'X' or p_excise = 'X'.

    • IF NOT i_j_1ipart1[] IS INITIAL.

    • SELECT mblnr

    • mjahr

    • zeile

    • matnr

    • ebeln

    • ebelp

    • INTO TABLE i_mseg

    • FROM mseg

    • FOR ALL ENTRIES IN i_j_1ipart1

    • WHERE mblnr = i_j_1ipart1-mblnr

    • AND mjahr = i_j_1ipart1-mjahr

    • AND zeile = i_j_1ipart1-zeile.

    • ENDIF.

    *

    • IF NOT i_mseg[] IS INITIAL.

    • SELECT a~ebeln

    • b~ebelp

    • b~netpr

    • a~knumv

    • INTO CORRESPONDING FIELDS OF TABLE i_ekko_ekpo

    • FROM ( ekko AS a INNER JOIN ekpo AS b ON

    • aebeln = bebeln )

    • FOR ALL ENTRIES IN i_mseg

    • WHERE a~ebeln = i_mseg-ebeln

    • AND b~ebelp = i_mseg-ebelp.

    • ENDIF.

    *

    • LOOP AT itab.

    • READ TABLE i_mseg WITH KEY mblnr = itab-mblnr

    • MJAHR = itab-MJAHR

  • matnr = itab-matnr.

  • IF sy-subrc = 0.

  • READ TABLE i_ekko_ekpo WITH KEY ebeln = i_mseg-ebeln

  • ebelp = i_mseg-ebelp.

  • IF sy-subrc = 0.

  • MOVE-CORRESPONDING itab TO itab1.

  • itab1-amt2 = i_ekko_ekpo-netpr * 29 / 200 .

  • itab1-amt3 = itab1-amt2 * 2 / 100.

  • itab1-amt4 = itab1-amt3 / 2.

  • itab1-amt1 = itab1-amt2 + itab1-amt3 + itab1-amt4.

  • amt = itab1-amt1 - ( itab-exbed + itab-ecs + itab-exaddtax1

  • )

    *.

    • IF amt < 0.

    • amt = amt * -1.

    • ENDIF.

    • IF amt GT 2.

    • APPEND itab1.

    • CLEAR itab1.

    • ENDIF.

    • ENDIF.

    • ENDIF.

    • ENDLOOP.

    *

    • if p_excise = 'X'.

    • loop at itab1.

    • delete itab where mblnr = itab1-mblnr

    • and xblnr = itab1-xblnr

    • and matnr = itab1-matnr..

    • endloop.

    • endif.

    • ENDIF.

    ENDFORM. " process_data

    &----


    *& Form built_fieldcat

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM built_fieldcat .

    clear : col_pos.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'CK'.

    fieldcatalog-seltext_m = 'Select'.

    fieldcatalog-col_pos = col_pos.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-checkbox = 'X'.

    fieldcatalog-edit = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'SR_NO'.

    fieldcatalog-seltext_m = 'Sr No.'.

    fieldcatalog-col_pos = col_pos.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MBLNR'.

    fieldcatalog-seltext_m = 'GRN No.(105)'.

    fieldcatalog-col_pos = col_pos.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'BUDAT'.

    fieldcatalog-seltext_m = 'Date'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXNUM'.

    fieldcatalog-seltext_m = 'Excise Doc.No.'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXDAT'.

    fieldcatalog-seltext_m = 'Excise Date'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MENGE'.

    fieldcatalog-seltext_m = 'Quantity'.

    • fieldcatalog-do_sum = 'X'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MEINS'.

    fieldcatalog-seltext_m = 'Unit'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    *

    • col_pos = col_pos + 1.

    • fieldcatalog-fieldname = 'SERIALNO'.

    • fieldcatalog-seltext_m = 'Serial No'.

    • fieldcatalog-col_pos = col_pos.

    • APPEND fieldcatalog TO fieldcatalog.

    • CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXBAS'.

    fieldcatalog-seltext_m = 'Excise Base'.

    • fieldcatalog-do_sum = 'X'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXBED'.

    fieldcatalog-seltext_m = 'BED Value'.

    • fieldcatalog-do_sum = 'X'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'ECS'.

    fieldcatalog-seltext_m = 'Edu. Cess Value'.

    • fieldcatalog-do_sum = 'X'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXADDTAX1'.

    fieldcatalog-seltext_m = 'SH & Edu Cess value'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'XBLNR'.

    fieldcatalog-seltext_m = 'Ref.Doc.No.'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'LIFNR'.

    fieldcatalog-seltext_m = 'Vendor Code'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'NAME1'.

    fieldcatalog-seltext_m = 'Description'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MATNR'.

    fieldcatalog-seltext_m = 'Material.No'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MAKTX'.

    fieldcatalog-seltext_m = 'Material Description'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'CHAPID'.

    fieldcatalog-seltext_m = 'Chapter ID'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'RDOC1'.

    fieldcatalog-seltext_m = 'PO No.'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    ENDFORM. " built_fieldcatalog

    &----


    *& Form display_alv

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM display_alv .

    IF itab[] IS INITIAL.

    MESSAGE 'No Data Exist' TYPE 'I'.

    ENDIF..

    DATA: title TYPE lvc_title

    , datelow(10) TYPE c

    , datehigh(10) TYPE c

    .

    DATA: gd_repid LIKE sy-repid

    , gd_layout TYPE slis_layout_alv

    .

    gd_repid = sy-repid.

    ***************Layout Formatting***************

    gd_layout-no_input = 'X'.

    gd_layout-colwidth_optimize = 'X'.

    gd_layout-zebra = 'X'.

    gd_layout-totals_text = 'Totals'(201).

    gd_layout-totals_only = 'X'.

    gd_layout-f2code = 'DISP'. "Sets fcode for when double

    "click(press f2)

    ***************Layout Formatting***************

    MOVE sy-title TO title.

    IF p_excise = 'X'.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = v_pgm

    i_callback_top_of_page = 'ALV_TOP_OF_PAGE' "see FORM

    i_callback_pf_status_set = 'STATUS'

    i_callback_user_command = 'USER_COMMAND'

    "'ALV_USER_COMMAND'

    i_grid_title = title

    is_layout = gd_layout

    it_fieldcat = fieldcatalog[]

    • it_special_groups = gd_tabgroup

    • it_events = gt_events

    • is_print = gd_prntparams

    • i_save = 'X'

    it_sort = subtot

    • is_variant = z_template

    TABLES

    t_outtab = itab

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

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

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

    ENDIF.

    ELSE.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = v_pgm

    i_callback_top_of_page = 'ALV_TOP_OF_PAGE' "see FORM

    • i_callback_pf_status_set = 'STATUS'

    i_callback_user_command = 'USER_COMMAND'

    *"'ALV_USER_COMMAND'

    i_grid_title = title

    is_layout = gd_layout

    it_fieldcat = fieldcatalog[]

    • it_special_groups = gd_tabgroup

    • it_events = gt_events

    • is_print = gd_prntparams

    • i_save = 'X'

    it_sort = subtot

    • is_variant = z_template

    TABLES

    t_outtab = itab

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

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

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

    ENDIF.

    ENDIF.

    ENDFORM. " display_alv

    *

    &----


    &----


    *& Form ALV_TOP_OF_PAGE

    &----


    • ALV Report Header *

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM alv_top_of_page .

    *ALV Header declarations

    DATA: t_header TYPE slis_t_listheader,

    wa_header TYPE slis_listheader,

    t_line LIKE wa_header-info,

    ld_lines TYPE i,

    ld_linesc(10) TYPE c.

    • Title

    wa_header-typ = 'H'.

    wa_header-info = sy-title.

    APPEND wa_header TO t_header.

    CLEAR wa_header.

    • FORM alv_top_of_page1 .

    DATA: i_header TYPE slis_t_listheader,

    wa1_header TYPE slis_listheader,

    i_line LIKE wa1_header-info,

    lld_lines TYPE i,

    lld_linesc(10) TYPE c.

    • Title

    wa1_header-typ = 'H'.

    wa1_header-info = 'AUTOMATION EXCISE CENVAT'.

    APPEND wa1_header TO i_header.

    CLEAR wa1_header.

    • Date

    wa_header-typ = 'S'.

    wa_header-key = 'Date: '.

    CONCATENATE sy-datum+6(2) '.'

    sy-datum+4(2) '.'

    sy-datum(4) INTO wa_header-info. "todays date

    APPEND wa_header TO t_header.

    CLEAR: wa_header.

    wa_header-typ = 'S'.

    wa_header-key = 'Time: '.

    CONCATENATE

    sy-uzeit(2) ':'

    sy-uzeit+2(2) ':'

    sy-uzeit+4(2) INTO wa_header-info. "time

    APPEND wa_header TO t_header.

    CLEAR: wa_header.

    wa_header-typ = 'A'.

    wa_header-info = t_line.

    APPEND wa_header TO t_header.

    CLEAR: wa_header, t_line.

    • Total No. of Rows Displayed

    DESCRIBE TABLE itab LINES ld_lines.

    ld_linesc = ld_lines.

    CONCATENATE 'Total No. of Rows: ' ld_linesc

    INTO t_line SEPARATED BY space.

    wa_header-typ = 'A'.

    wa_header-info = t_line.

    APPEND wa_header TO t_header.

    CLEAR: wa_header, t_line.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = t_header

    • i_logo = 'Z_LOGO'

    .

    ENDFORM. "alv_top_of_page

    &----


    *& Form STATUS

    &----


    • text

    ----


    • -->P_EXTAB text

    ----


    FORM status USING p_extab TYPE slis_t_extab.

    IF p_excise = 'X'.

    SET PF-STATUS 'ZMMR063_STAT' EXCLUDING p_extab.

    ENDIF.

    ENDFORM. "STATUS

    *&----


    *

    *& Form user_command

    *&----


    *

    • text

    *----


    *

    • -->L_UCOMM text

    • -->LS_SELFIELD text

    *----


    *

    FORM user_command USING l_ucomm LIKE sy-ucomm

    ls_selfield TYPE slis_selfield.

    DATA: ref1 TYPE REF TO cl_gui_alv_grid.

    IF p_doc = 'X'.

    IF ls_selfield-fieldname = 'FAWREF'.

    READ TABLE itab INDEX ls_selfield-tabindex.

    DATA: l_fawref TYPE j_1ipart2-fawref.

    DATA: bukrs type bkpf-bukrs.

    bukrs = '1000'.

    l_fawref = itab-fawref.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    EXPORTING

    input = l_fawref

    IMPORTING

    output = l_fawref.

    SET PARAMETER ID 'BLN' FIELD l_fawref.

    SET PARAMETER ID 'GJR' FIELD itab-fayear.

    SET PARAMETER ID 'BUK' FIELD bukrs.

    CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDIF.

    IF p_excise = 'X'.

    CASE l_ucomm.

    WHEN 'SELECTALL'.

    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

    IMPORTING

    e_grid = ref1.

    CALL METHOD ref1->check_changed_data.

    LOOP AT itab.

    itab-ck = 'X'.

    MODIFY itab.

    ENDLOOP.

    IF sy-lsind GE 1.

    sy-lsind = 0.

    ENDIF.

    *PERFORM built_fieldcat.

    PERFORM display_alv.

    WHEN 'DE'.

    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

    IMPORTING

    e_grid = ref1.

    CALL METHOD ref1->check_changed_data.

    LOOP AT itab.

    itab-ck = ''.

    MODIFY itab.

    ENDLOOP.

    IF sy-lsind GE 1.

    sy-lsind = 0.

    ENDIF.

    *PERFORM built_fieldcat.

    PERFORM display_alv.

    WHEN 'EXC'.

    PERFORM bdc_j1iex.

    ENDCASE.

    ENDIF.

    ENDFORM. " USER_COMMAND

    &----


    *& Form built_fieldcat1

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM built_fieldcat1 .

    clear : col_pos.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'SR_NO'.

    fieldcatalog-seltext_m = 'Sr No.'.

    fieldcatalog-col_pos = col_pos.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MBLNR'.

    fieldcatalog-seltext_m = 'GRN No.(105)'.

    fieldcatalog-col_pos = col_pos.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'BUDAT'.

    fieldcatalog-seltext_m = 'Date'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXNUM'.

    fieldcatalog-seltext_m = 'Excise Doc.No.'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXDAT'.

    fieldcatalog-seltext_m = 'Excise Date'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MENGE'.

    fieldcatalog-seltext_m = 'Quantity'.

    fieldcatalog-do_sum = 'X'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MEINS'.

    fieldcatalog-seltext_m = 'Unit'.

    fieldcatalog-do_sum = 'X'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'FAWREF'.

    fieldcatalog-seltext_m = 'FI Doc.No.'.

    fieldcatalog-col_pos = col_pos.

    fieldcatalog-hotspot = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'SERIALNO'.

    fieldcatalog-seltext_m = 'Serial No'.

    fieldcatalog-col_pos = col_pos.

    • fieldcatalog-hotspot = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXBAS'.

    fieldcatalog-seltext_m = 'Excise Base'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXBED'.

    fieldcatalog-seltext_m = 'BED Value'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'ECS'.

    fieldcatalog-seltext_m = 'Edu. Cess Value'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'EXADDTAX1'.

    fieldcatalog-seltext_m = 'SH & Edu Cess Value'.

    fieldcatalog-col_pos = col_pos.

    • fieldcatalog-row_pos = 0.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'TOTAL_EXCISE'.

    fieldcatalog-seltext_m = 'Total Excise'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'XBLNR'.

    fieldcatalog-seltext_m = 'Ref.Doc.No.'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'LIFNR'.

    fieldcatalog-seltext_m = 'Vendor Code'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'NAME1'.

    fieldcatalog-seltext_m = 'Description'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MATNR'.

    fieldcatalog-seltext_m = 'Material.No'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'MAKTX'.

    fieldcatalog-seltext_m = 'Material Description'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'CHAPID'.

    fieldcatalog-seltext_m = 'Chapter ID'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    col_pos = col_pos + 1.

    fieldcatalog-fieldname = 'RDOC1'.

    fieldcatalog-seltext_m = 'PO No.'.

    fieldcatalog-col_pos = col_pos.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    ENDFORM. " built_fieldcat1

    &----


    *& Form BDC_J1IEX

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM bdc_j1iex .

    refresh: i_result1, i_result2.

    DATA: ref1 TYPE REF TO cl_gui_alv_grid.

    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

    IMPORTING

    e_grid = ref1.

    CALL METHOD ref1->check_changed_data.

    LOOP AT itab.

    cnt = cnt + 1.

    AT END OF mblnr.

    CLEAR cnt.

    ENDAT.

    IF cnt IS INITIAL.

    IF itab-ck = 'X'.

    CLEAR date.

    WRITE itab-exdat TO date.

    REFRESH bdcdata.

    PERFORM bdc_dynpro USING 'SAPLJ1IEX' '0001'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=J1IEX_OK_ACTION'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'J_1IEXDYNPRO-ACTION'.

    PERFORM bdc_field USING 'J_1IEXDYNPRO-ACTION'

    'A04'.

    PERFORM bdc_field USING 'J_1IEXDYNPRO-REFDOC'

    'R08'.

    PERFORM bdc_dynpro USING 'SAPLJ1IEX' '0001'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=J1IEX_OK_GO'.

    PERFORM bdc_field USING 'J_1IEXDYNPRO-EXNUM'

    itab-exnum.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'J_1IEXDYNPRO-LIFNR'.

    PERFORM bdc_field USING 'J_1IEXDYNPRO-EXDAT'

    date.

    PERFORM bdc_field USING 'J_1IEXDYNPRO-LIFNR'

    itab-lifnr.

    PERFORM bdc_dynpro USING 'SAPLJ1IEX' '0001'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=OK_POST'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'J_1IEXDYNPRO-SEARCH_STRING'.

    CALL TRANSACTION 'J1IEX' USING bdcdata MODE 'N' MESSAGES INTO

    errtab.

    READ TABLE errtab WITH KEY msgtyp = 'E'.

    IF sy-subrc = 0.

    i_result2-mblnr = itab-mblnr.

    i_result2-exnum = itab-exnum.

    SELECT SINGLE text INTO i_result2-message

    FROM t100

    WHERE sprsl = 'EN'

    AND arbgb = errtab-msgid

    AND msgnr = errtab-msgnr.

    APPEND i_result2.

    CLEAR i_result2.

    ELSE.

    READ TABLE errtab WITH KEY msgtyp = 'A'.

    IF sy-subrc = 0.

    i_result2-mblnr = itab-mblnr.

    i_result2-exnum = itab-exnum.

    SELECT SINGLE text INTO i_result2-message

    FROM t100

    WHERE sprsl = 'EN'

    AND arbgb = errtab-msgid

    AND msgnr = errtab-msgnr.

    APPEND i_result2.

    CLEAR i_result2.

    ELSE.

    select single serialno into i_result1-serialno

    from j_1ipart2

    where docno = itab-docno

    and docyr = itab-docyr.

    i_result1-mblnr = itab-mblnr.

    i_result1-exnum = itab-exnum.

    APPEND i_result1.

    CLEAR i_result1.

    ENDIF.

    ENDIF.

    REFRESH errtab.

    ENDIF.

    ENDIF.

    ENDLOOP.

    IF i_result1[] IS NOT INITIAL OR i_result2[] IS NOT INITIAL.

    PERFORM fieldcat_result.

    PERFORM build_event_tab.

    PERFORM write_result.

    ENDIF.

    ENDFORM. "bdc_j1iex

    *&----


    *

    *& Form bdc_field

    *&----


    *

    • text

    *----


    *

    • -->P_0329 text

    • -->P_0330 text

    *----


    *

    FORM bdc_field USING fnam fval.

    CLEAR bdcdata.

    bdcdata-fnam = fnam.

    bdcdata-fval = fval.

    APPEND bdcdata.

    ENDFORM. " bdc_field

    *&----


    *

    *& Form bdc_dynpro

    *&----


    *

    • text

    *----


    *

    • -->P_0374 text

    • -->P_0375 text

    *----


    *

    FORM bdc_dynpro USING program dynpro.

    CLEAR bdcdata.

    bdcdata-program = program.

    bdcdata-dynpro = dynpro.

    bdcdata-dynbegin = 'X'.

    APPEND bdcdata.

    ENDFORM. " bdc_dynpro

    &----


    *& Form FIELDCAT_RESULT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM fieldcat_result .

    REFRESH fieldcatalog.

    fieldcatalog-fieldname = 'MBLNR'.

    fieldcatalog-seltext_m = 'MATERIAL DOC'.

    fieldcatalog-col_pos = 1.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'EXNUM'.

    fieldcatalog-seltext_m = 'EXCISE DOC'.

    fieldcatalog-col_pos = 2.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'SERIALNO'.

    fieldcatalog-seltext_m = 'SERIAL NO'.

    fieldcatalog-col_pos = 2.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    REFRESH fcat1.

    fieldcatalog-fieldname = 'MBLNR'.

    fieldcatalog-seltext_m = 'MATERIAL DOC'.

    fieldcatalog-col_pos = 1.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fcat1.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'EXNUM'.

    fieldcatalog-seltext_m = 'EXCISE DOC'.

    fieldcatalog-col_pos = 2.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fcat1.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'MESSAGE'.

    fieldcatalog-seltext_m = 'MESSAGE'.

    fieldcatalog-col_pos = 3.

    fieldcatalog-outputlen = 30.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fcat1.

    CLEAR fieldcatalog.

    ENDFORM. " FIELDCAT_RESULT

    &----


    *& Form WRITE_RESULT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM write_result .

    ---- -Block List -----

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

    EXPORTING

    i_callback_program = v_pgm

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • IT_EXCLUDING =

    .

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    is_layout = gd_layout

    it_fieldcat = fieldcatalog[]

    i_tabname = 'I_RESULT1'

    it_events = ieventdetail

    • IT_SORT =

    • I_TEXT = ' '

    TABLES

    t_outtab = i_result1

    EXCEPTIONS

    program_error = 1

    maximum_of_appends_reached = 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.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    is_layout = gd_layout

    it_fieldcat = fcat1[]

    i_tabname = 'I_RESULT2'

    it_events = ieventsummary

    • IT_SORT =

    • I_TEXT = ' '

    TABLES

    t_outtab = i_result2

    EXCEPTIONS

    program_error = 1

    maximum_of_appends_reached = 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.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

    • EXPORTING

    • I_INTERFACE_CHECK = ' '

    • IS_PRINT =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    EXCEPTIONS

    program_error = 1

    OTHERS = 2

    .

    IF sy-subrc <> 0.

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

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

    ENDIF.

    ENDFORM. " WRITE_RESULT

    &----


    *& Form BUILD_EVENT_TAB

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM build_event_tab .

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = ieventdetail

    EXCEPTIONS

    list_type_wrong = 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.

    ieventsummary = ieventdetail.

    READ TABLE ieventdetail INTO wevent WITH KEY name = 'TOP_OF_PAGE'.

    IF sy-subrc = 0.

    wevent-form = 'TOPOFPAGEDETAIL'.

    MODIFY ieventdetail FROM wevent INDEX sy-tabix.

    ENDIF.

    READ TABLE ieventsummary INTO wevent WITH KEY name = 'TOP_OF_PAGE'.

    IF sy-subrc = 0.

    wevent-form = 'TOPOFPAGESUMMARY'.

    MODIFY ieventsummary FROM wevent INDEX sy-tabix.

    ENDIF.

    ENDFORM. " BUILD_EVENT_TAB

    &----


    *& Form TOPOFPAGEDETAIL

    &----


    • text

    ----


    FORM topofpagedetail.

    DATA : ilist TYPE slis_t_listheader,

    wlist TYPE slis_listheader.

    wlist-info = 'Successfully Processed Records'.

    wlist-typ = 'H'.

    APPEND wlist TO ilist.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = ilist

    • I_LOGO =

    • I_END_OF_LIST_GRID =

    .

    ENDFORM. "TOPOFPAGEDETAIL

    &----


    *& Form TOPOFPAGESUMMARY

    &----


    • text

    ----


    FORM topofpagesummary.

    DATA : ilist TYPE slis_t_listheader,

    wlist TYPE slis_listheader.

    wlist-info = 'Records with Errors'.

    wlist-typ = 'H'.

    APPEND wlist TO ilist.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = ilist

    • I_LOGO =

    • I_END_OF_LIST_GRID =

    .

    ENDFORM. "TOPOFPAGESUMMARY

    regards,

    Seevangi

Add a comment
10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.