I want  to create dynamic ALV report

Hi great abapers,
I want  to create dynamic ALV report.Please help me.
Regards,
Billa

Hi,
Please check the code below:
REPORT YMMR_PALLET_OVERVIEW MESSAGE-ID Y_MESSAGE_0001.
Short description:
To Display and sum up the Quantity of scanned materials on pallet for*
each Shipment number for the Packaging Materials. *
TYPE-POOLS : SLIS.
TABLES: YYLE0003. " Scanned SSCC No.
--Structure Declaration--
Structure for Shipment No. and Date.
TYPES : BEGIN OF T_VTTK_TAB ,
TKNUM LIKE VTTK-TKNUM, " Shipment number
ERDAT LIKE VTTK-ERDAT, " created Date
END OF T_VTTK_TAB .
Structure for Shipment No., Packaging Materials and Date.
TYPES: BEGIN OF T_ITAB2,
TKNUM LIKE YYLE0003-TKNUM, " Shipment number
VHILM LIKE YYLE0003-VHILM, " Packaging Materials
QUANTITY TYPE P,
ERDAT LIKE YYLE0003-ERDAT, " created Date
COUNT TYPE I,
END OF T_ITAB2.
Structure for Shipment No. and Packaging Materials.
TYPES: BEGIN OF T_ITAB3,
TKNUM LIKE YYLE0003-TKNUM, " Shipment number
VHILM LIKE YYLE0003-VHILM, " Packaging Materials
QUANTITY TYPE P, " Quantity
END OF T_ITAB3.
--Internal table Declaration--
*Internal tables for the above Declared structures
DATA: G_VTTK_TAB TYPE TABLE OF T_VTTK_TAB,
G_ITAB5_TAB TYPE TABLE OF T_ITAB2,
G_ITAB4_TAB TYPE TABLE OF T_ITAB3,
G_ITAB3_TAB TYPE TABLE OF T_ITAB2. "#EC NEEDED
*Internal table Holding Shipment No.and quantity
DATA: BEGIN OF G_TOTAL_TAB OCCURS 0 ,
TKNUM TYPE YYLE0003-TKNUM, " Shipment number
QUANTITY TYPE P,
COUNT TYPE I,
END OF G_TOTAL_TAB .
*Internal table for selection screen data
DATA: BEGIN OF G_SCANDATA_TAB OCCURS 0,
VHILM LIKE YYLE0003-VHILM, " Packaging Materials
EXIDV TYPE EXIDV, " External Handling Unit
TKNUM LIKE YYLE0003-TKNUM, " Shipment number
QUANTITY LIKE YYLE0003-QUANTITY, " Quantity
END OF G_SCANDATA_TAB.
DATA: BEGIN OF ST_SCANDATA_TAB,
VHILM LIKE YYLE0003-VHILM, " Packaging Materials
EXIDV TYPE EXIDV, " External Handling Unit
TKNUM LIKE YYLE0003-TKNUM, " Shipment number
QUANTITY LIKE YYLE0003-QUANTITY, " Quantity
END OF ST_SCANDATA_TAB.
DATA: BEGIN OF G_SCANDATA_COUNT_TAB OCCURS 0,
VHILM LIKE YYLE0003-VHILM, " Packaging Materials
TKNUM LIKE YYLE0003-TKNUM, " Shipment number
QUANTITY LIKE YYLE0003-QUANTITY, " Quantity
COUNT TYPE I,
END OF G_SCANDATA_COUNT_TAB.
DATA: L_COUNT TYPE I.
*Internal table for Packaging Materials and quantity
DATA: BEGIN OF G_ITAB6_TAB OCCURS 0,
VHILM LIKE YYLE0003-VHILM, " Packaging Materials
QUANTITY TYPE P, " Quantity
END OF G_ITAB6_TAB.
*- Field catalog
DATA: L_ALV_CAT1_TAB TYPE TABLE OF LVC_S_FCAT.
--Work area Declaration--
DATA: WA_VTTK TYPE T_VTTK_TAB,
WA_ITAB3 TYPE T_ITAB2,
WA_ITAB5 TYPE T_ITAB2,
WA_ITAB4 TYPE T_ITAB3,
WA_ITAB1 LIKE G_SCANDATA_TAB,
WA_ALV_CAT1 LIKE LINE OF L_ALV_CAT1_TAB.
----Variable Defnition -
DATA: G_CUSTOM_CONTAINER_0100 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_ALV_GRID_0100 TYPE REF TO CL_GUI_ALV_GRID,
G_CONTAINER_0100 TYPE SCRFNAME VALUE 'LIST',
G_MYLAYOUT TYPE LVC_S_LAYO, "#EC NEEDED
G_WA TYPE REF TO DATA.
DATA: G_VAR TYPE I, " No of records
G_VAR1 TYPE CHAR20. " Variable
--field symbols Declaration--
FIELD-SYMBOLS : <F_FS> TYPE TABLE,
<F_FS3> TYPE ANY,
<F_FS4> TYPE ANY,
<F_FS5> TYPE ANY,
<F_WA> TYPE ANY,
<F_FS15> TYPE ANY,
<F_FS16> TYPE SY-DATUM,
<F_FS2> TYPE T_ITAB2,
<F_FS6> TYPE ANY,
<F_FS7> TYPE ANY,
<F_FS12> TYPE ANY,
<F_FS13> TYPE ANY.
--Selection Parameters--
SELECTION-SCREEN: BEGIN OF BLOCK BLCK01 WITH FRAME TITLE TEXT-000.
"Select options
SELECT-OPTIONS :
S_TKNUM FOR YYLE0003-TKNUM , " Shipment number
S_YYREF FOR YYLE0003-YY_REFERENCE, " Packing reference
S_YYREFT FOR YYLE0003-YY_REFTP, " Reference type
S_EXIDV FOR YYLE0003-EXIDV, " External HU
S_MATNR FOR YYLE0003-MATNR, " Material number
S_VBELN FOR YYLE0003-VBELN, " SD number
S_POSNR FOR YYLE0003-POSNR, " Item number
S_LGTOR FOR YYLE0003-LGTOR, " Door for Wr Hs No
S_VHILM FOR YYLE0003-VHILM, " Packaging Mat
S_YYMEIN FOR YYLE0003-YY_MEINH, " Indicator for UOM
S_QUANTI FOR YYLE0003-QUANTITY, " Quantity
S_YCHECK FOR YYLE0003-YYCHECKED, " Destination_door
S_STATUS FOR YYLE0003-STATUS, " Packing status
S_STASHI FOR YYLE0003-STATUSSHIPTO, " Status on ship-to
S_LOADTR FOR YYLE0003-LOADTRUCK, " Load truck
S_ERDAT FOR YYLE0003-ERDAT , " Date
S_ERZET FOR YYLE0003-ERZET, " Entry time
S_AEDAT FOR YYLE0003-AEDAT, " Last changed on
S_ERNAM FOR YYLE0003-ERNAM, " Name of Person
S_AEZET FOR YYLE0003-AEZET, " Time last change
S_AENAM FOR YYLE0003-AENAM. " Name of person
SELECTION-SCREEN: END OF BLOCK BLCK01.
--INITIALIZATION--
INITIALIZATION.
Clear the variables and workarea
CLEAR :G_VAR,
G_VAR1,
WA_VTTK,
WA_ITAB3,
WA_ITAB5,
WA_ITAB4,
WA_ITAB1,
WA_VTTK,
WA_ITAB3,
WA_ITAB5,
WA_ITAB4,
WA_ITAB1.
--AT SELECTION-SCREEN--
AT SELECTION-SCREEN.
To validate the data entered in selection screen
PERFORM SUB_VALIDATE.
--START-OF-SELECTION--
START-OF-SELECTION.
*To fetch the data from table yyle0003
PERFORM GET_INPUT_DATA.
*To create the Dynamic Field Catalog
PERFORM GET_FIELDCAT.
To populate the data to final table
PERFORM GET_FINAL_DATA.
MODULE status_0100 OUTPUT *
MODULE STATUS_0100 OUTPUT.
*set title bar and PF status.
SET PF-STATUS 'ZVKS'.
SET TITLEBAR 'ZVKS'.
CHECK SY-UCOMM IS INITIAL.
SORT G_SCANDATA_TAB BY TKNUM VHILM.
*Create object for Custom container
CREATE OBJECT G_CUSTOM_CONTAINER_0100
EXPORTING
CONTAINER_NAME = G_CONTAINER_0100
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
*Create object for ALV grid
CREATE OBJECT G_ALV_GRID_0100
EXPORTING I_PARENT = G_CUSTOM_CONTAINER_0100.
G_MYLAYOUT-GRID_TITLE = 'Display Scanning data'.
*Call method for table Display
CALL METHOD G_ALV_GRID_0100->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = <F_FS>
IT_FIELDCATALOG = L_ALV_CAT1_TAB
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
User Interaction
MODULE USER_COMMAND_0100 INPUT.
CALL METHOD CL_GUI_CFW=>DISPATCH.
*To exit , back or cancel
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form get_input_data
This sub routine will get the data from yyle0003 table.
FORM GET_INPUT_DATA.
CONSTANTS: C_DOT TYPE C VALUE '.',
C_CHAR TYPE C VALUE 'D'.
CLEAR G_SCANDATA_TAB.
Get the data from yyle0003
SELECT VHILM " Packaging Materials
EXIDV " External Handling Unit
TKNUM " Shipment number
QUANTITY " Quantity
FROM YYLE0003
INTO TABLE G_SCANDATA_TAB
WHERE TKNUM IN S_TKNUM " Shipment number
AND YY_REFERENCE IN S_YYREF " Packing reference
AND YY_REFTP IN S_YYREFT " Reference type
AND EXIDV IN S_EXIDV " External Handling Unit
AND MATNR IN S_MATNR " Material number
AND VBELN IN S_VBELN " SD number
AND POSNR IN S_POSNR " Item number
AND LGTOR IN S_LGTOR " Door for warehouse No
AND VHILM IN S_VHILM " Packaging Materials
AND YY_MEINH IN S_YYMEIN " Indicator for UOM
AND QUANTITY IN S_QUANTI " Quantity
AND YYCHECKED IN S_YCHECK " Destination_door
AND STATUS IN S_STATUS " Packing status
AND STATUSSHIPTO IN S_STASHI " Status on ship-to
AND LOADTRUCK IN S_LOADTR " Load truck
AND ERDAT IN S_ERDAT " Date
AND ERZET IN S_ERZET " Entry time
AND AEDAT IN S_AEDAT " Last changed on
AND ERNAM IN S_ERNAM " Name of Person
AND AEZET IN S_AEZET " Time last change
AND AENAM IN S_AENAM. " Name of person
If VHILM contains any Decimal '.', replace it with D
LOOP AT G_SCANDATA_TAB.
REPLACE C_DOT WITH C_CHAR INTO G_SCANDATA_TAB-VHILM.
IF SY-SUBRC = 0.
MODIFY G_SCANDATA_TAB TRANSPORTING VHILM.
ENDIF.
CLEAR G_SCANDATA_TAB.
ENDLOOP.
*To get the Shipment No Creation date from VTTK.
SELECT TKNUM
ERDAT
FROM VTTK
INTO TABLE G_VTTK_TAB
WHERE TKNUM IN S_TKNUM.
SORT G_SCANDATA_TAB BY VHILM EXIDV. "TKNUM VHILM.
*To get the repeatition of Pacakaging material for each Shipment.
*--- to find the count of packaging materials under each shipment
LOOP AT G_SCANDATA_TAB.
READ TABLE G_SCANDATA_TAB INTO ST_SCANDATA_TAB INDEX SY-TABIX.
AT END OF EXIDV.
L_COUNT = L_COUNT + 1.
MOVE-CORRESPONDING ST_SCANDATA_TAB TO G_SCANDATA_COUNT_TAB.
G_SCANDATA_COUNT_TAB-COUNT = L_COUNT.
CLEAR: ST_SCANDATA_TAB, L_COUNT.
COLLECT G_SCANDATA_COUNT_TAB.
ENDAT.
CLEAR : G_SCANDATA_TAB.
ENDLOOP.
ENDFORM. " get_input_data
*& Form sub_validate
*This subroutine will validate the data eneterd in the selection screen
FORM SUB_VALIDATE.
*Varaiable declaration for Shipment number
DATA: L_TKNUM TYPE YYLE0003-TKNUM."#EC NEEDED " Shipment number
*- Condition will not qualify all primary key (IDENT)
SELECT TKNUM FROM YYLE0003 UP TO 1 ROWS
INTO L_TKNUM "wa_scandata
WHERE TKNUM IN S_TKNUM " Shipment number
AND YY_REFERENCE IN S_YYREF " Packing reference
AND YY_REFTP IN S_YYREFT " Reference type
AND EXIDV IN S_EXIDV " External Handling Unit
AND MATNR IN S_MATNR " Material number
AND VBELN IN S_VBELN " SD number
AND POSNR IN S_POSNR " Item number
AND LGTOR IN S_LGTOR " Door for warehouse No
AND VHILM IN S_VHILM " Packaging Materials
AND YY_MEINH IN S_YYMEIN " Indicator for UOM
AND QUANTITY IN S_QUANTI " Quantity
AND YYCHECKED IN S_YCHECK " Destination_door
AND STATUS IN S_STATUS " Packing status
AND STATUSSHIPTO IN S_STASHI " Status on ship-to
AND LOADTRUCK IN S_LOADTR " Load truck
AND ERDAT IN S_ERDAT " Date
AND ERZET IN S_ERZET " Entry time
AND AEDAT IN S_AEDAT " Last changed on
AND ERNAM IN S_ERNAM " Name of Person
AND AEZET IN S_AEZET " Time last change
AND AENAM IN S_AENAM. " Name of person
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E987 . " No data found for these selection criterias
ENDIF.
ENDFORM. " sub_validate
*& Form get_fieldcat
Preparing Field catalog
FORM GET_FIELDCAT.
DATA: L_REF TYPE REF TO DATA,
L_I TYPE I. " Variable
CONSTANTS: C_CENTER TYPE C VALUE 'C'. " Center Justified
LOOP AT G_SCANDATA_TAB INTO WA_ITAB1.
MOVE-CORRESPONDING WA_ITAB1 TO WA_ITAB3.
APPEND WA_ITAB3 TO G_ITAB3_TAB.
MOVE-CORRESPONDING WA_ITAB1 TO WA_ITAB4.
COLLECT WA_ITAB4 INTO G_ITAB4_TAB.
*To sum up the qunatity field for each TKNUM.
AT END OF TKNUM.
SUM.
MOVE WA_ITAB1-TKNUM TO G_TOTAL_TAB-TKNUM.
MOVE WA_ITAB1-QUANTITY TO G_TOTAL_TAB-QUANTITY .
APPEND G_TOTAL_TAB.
CLEAR G_TOTAL_TAB.
ENDAT.
CLEAR : WA_ITAB1,
WA_ITAB3,
WA_ITAB4.
ENDLOOP.
*--- Begin of change - SKR.EXT - EBDK986377
SORT G_ITAB4_TAB BY TKNUM.
*--- End of change - SKR.EXT - EBDK986377
LOOP AT G_ITAB4_TAB INTO WA_ITAB4.
MOVE-CORRESPONDING WA_ITAB4 TO WA_ITAB5.
MOVE-CORRESPONDING WA_ITAB4 TO G_ITAB6_TAB.
*---- to get the count
READ TABLE G_SCANDATA_COUNT_TAB WITH KEY TKNUM = WA_ITAB5-TKNUM
VHILM = WA_ITAB5-VHILM.
IF SY-SUBRC EQ 0.
WA_ITAB5-COUNT = G_SCANDATA_COUNT_TAB-COUNT.
ENDIF.
APPEND WA_ITAB5 TO G_ITAB5_TAB.
COLLECT G_ITAB6_TAB.
ENDLOOP.
CLEAR : WA_ITAB3.
SORT G_ITAB4_TAB BY TKNUM VHILM.
DELETE ADJACENT DUPLICATES FROM G_ITAB4_TAB COMPARING VHILM.
*To get the Number of fields to be displayed
DESCRIBE TABLE G_ITAB4_TAB LINES G_VAR.
L_I = '3'.
*Field catalog
WA_ALV_CAT1-FIELDNAME = 'TKNUM'(002).
WA_ALV_CAT1-COL_POS = 1.
WA_ALV_CAT1-COLTEXT ='ShipmentNo.'.
APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
CLEAR : WA_ALV_CAT1.
WA_ALV_CAT1-FIELDNAME = 'ERDAT'(003).
WA_ALV_CAT1-COL_POS = 2.
WA_ALV_CAT1-COLTEXT ='Creation_Date.'(005).
APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
CLEAR : WA_ALV_CAT1.
Create field catalog for each of VHILM
LOOP AT G_ITAB4_TAB INTO WA_ITAB4.
IF G_VAR >= 1.
CONDENSE WA_ITAB4-VHILM NO-GAPS.
WA_ALV_CAT1-FIELDNAME = WA_ITAB4-VHILM. "l_fieldname.
WA_ALV_CAT1-COL_POS = L_I.
WA_ALV_CAT1-COLTEXT = WA_ITAB4-VHILM.
WA_ALV_CAT1-JUST = C_CENTER. "'C'.
APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
CLEAR WA_ALV_CAT1.
L_I = L_I + 1.
ENDIF.
*TOTAL-last column in the field catalog
AT LAST.
WA_ALV_CAT1-FIELDNAME = 'TOTAL'(004).
WA_ALV_CAT1-COL_POS = L_I.
WA_ALV_CAT1-COLTEXT = 'TOTAL'(004).
WA_ALV_CAT1-JUST = C_CENTER. " 'C'.
APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
CLEAR WA_ALV_CAT1.
ENDAT.
SORT L_ALV_CAT1_TAB BY FIELDNAME.
*Non of the field name should not get repeated
DELETE ADJACENT DUPLICATES FROM L_ALV_CAT1_TAB.
ENDLOOP.
SORT L_ALV_CAT1_TAB BY COL_POS.
*Creating Dynamic Internal table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = L_ALV_CAT1_TAB
IMPORTING
EP_TABLE = L_REF.
Assigning the Dynamic field Catalog to field symbol.
ASSIGN L_REF->* TO <F_FS>.
CREATE DATA G_WA LIKE LINE OF <F_FS>.
ASSIGN G_WA->* TO <F_WA>.
DELETE ADJACENT DUPLICATES FROM <F_FS> COMPARING ALL FIELDS.
ENDFORM. " get_fieldcat
*& Form display_data
FORM GET_FINAL_DATA.
*variable declaration
DATA: L_TOTAL TYPE I, " Row wise total
L_FILL TYPE I, " Count
L_TOT TYPE I. " Grand total
*To get the TOTAL qunatity in the last line of out put.
LOOP AT G_ITAB6_TAB.
CLEAR WA_ITAB5.
WA_ITAB5-TKNUM = 'TOTAL'(004).
WA_ITAB5-ERDAT = SPACE.
MOVE-CORRESPONDING G_ITAB6_TAB TO WA_ITAB5 .
LOOP AT G_SCANDATA_COUNT_TAB WHERE VHILM = G_ITAB6_TAB-VHILM.
WA_ITAB5-COUNT = WA_ITAB5-COUNT + G_SCANDATA_COUNT_TAB-COUNT.
ENDLOOP.
APPEND WA_ITAB5 TO G_ITAB5_TAB.
CLEAR WA_ITAB5.
ENDLOOP.
DESCRIBE TABLE G_ITAB5_TAB LINES L_TOT.
*>>>>>>>>
****To get total qunatity of all TKNUM
LOOP AT G_TOTAL_TAB .
L_TOTAL = L_TOTAL + G_TOTAL_TAB-QUANTITY.
ENDLOOP.
*>>>>>>>>
*To assign ERDAT to g_itab5_tab
LOOP AT G_ITAB5_TAB INTO WA_ITAB5 .
READ TABLE G_VTTK_TAB INTO WA_VTTK WITH KEY TKNUM = WA_ITAB5-TKNUM.
IF SY-SUBRC = 0.
WA_ITAB5-ERDAT = WA_VTTK-ERDAT.
MODIFY G_ITAB5_TAB FROM WA_ITAB5 TRANSPORTING ERDAT.
ENDIF.
ENDLOOP.
*Assigning value in each field to respective Field symbols.
LOOP AT G_ITAB5_TAB ASSIGNING <F_FS2>.
CLEAR G_TOTAL_TAB-QUANTITY.
ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <F_FS2> TO <F_FS6>.
ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <F_WA> TO <F_FS7>.
<F_FS7> = <F_FS6>.
CONDENSE <F_FS2>-VHILM NO-GAPS.
ASSIGN COMPONENT 'VHILM' OF STRUCTURE <F_FS2> TO <F_FS3>.
ASSIGN COMPONENT 5 OF STRUCTURE <F_FS2> TO <F_FS4>.
MOVE <F_FS3> TO G_VAR1.
ASSIGN COMPONENT G_VAR1 OF STRUCTURE <F_WA> TO <F_FS5>.
<F_FS5> = <F_FS4>.
ASSIGN COMPONENT 'ERDAT' OF STRUCTURE <F_FS2> TO <F_FS16>.
ASSIGN COMPONENT 'ERDAT' OF STRUCTURE <F_WA> TO <F_FS15>.
WRITE <F_FS16> TO <F_FS15> .
Inorder not to display the date '00/00/000',
if there is no DATE .
IF ( <F_FS15> CP '00/*' )
OR ( <F_FS15> CP '00.*' )
OR ( <F_FS15> CP '00-*' ).
<F_FS15> = SPACE.
ELSEIF ( <F_FS15> CO ' / /' )
OR ( <F_FS15> CO ' . .' )
OR ( <F_FS15> CO ' - -' ) .
<F_FS15> = SPACE.
ENDIF.
READ TABLE G_TOTAL_TAB WITH KEY TKNUM = <F_FS6>.
IF SY-SUBRC = 0.
ASSIGN G_TOTAL_TAB-QUANTITY TO <F_FS12>.
ASSIGN COMPONENT 'COUNT' OF STRUCTURE <F_FS2> TO <F_FS12>.
ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <F_WA> TO <F_FS13>.
<F_FS13> = <F_FS13> + <F_FS12>.
L_TOTAL = L_TOTAL + <F_FS12>.
ENDIF.
L_FILL = L_FILL + 1.
IF L_FILL = L_TOT.
ASSIGN L_TOTAL TO <F_FS12>.
ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <F_WA> TO <F_FS13>.
<F_FS13> = <F_FS12>.
ENDIF.
AT END OF <F_FS2>-TKNUM.
APPEND <F_WA> TO <F_FS>.
CLEAR <F_WA>.
ENDAT.
ENDLOOP.
CLEAR: <F_FS6>,
<F_FS7>,
<F_WA>.
*Call the screen where Custom container is defined
CALL SCREEN 0100.
ENDFORM. " display_data
Regards
Kannaiah

Similar Messages

  • How can i download dynamic alv report into excel  ?

    when i create dynamic alv report and try to download it
    to my pc ( to excel file ) the data is not set in the
    write position , also i get message in the excel
    "Dynamic List Display " .
    how can i set the data like the alv display ?

    ALV has standard download functionality to Excel. Aren't you able to use this functionality? Have you written your own custom code for DOWNLOAD?

  • Problem in Data Display in Dynamic ALV Report

    Hi all,
    I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    DO 20 TIMES.
       DO p_colms TIMES.
         l_index = sy-index.
         CONCATENATE 'FIELD' l_index INTO l_fieldname.
         ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
         <l_field> = sy-index.
       ENDDO.
       INSERT <fs_dyntable> INTO TABLE <gt_table>.
    ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    CLEAR: l_fieldname,
            l_tabname,
            l_fieldtext,
            l_index.
    DO  p_colms TIMES.
       CLEAR l_index.
       l_index = sy-index.
       CONCATENATE 'FIELD' l_index INTO l_fieldname.
       CONCATENATE 'Field' l_index INTO l_fieldtext.
       l_tabname = '<GT_TABLE>'.
       PERFORM fieldcatalog USING: l_fieldname
                                   l_tabname
                                   l_fieldtext.
    ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    v_srlno.
    LOOP AT it_itab.
       v_srlno = v_srlno + 1.
    ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    1st Field
    l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    Please guide me how my problem will solve.
    Thanks & Regards
    Nirmal

    Hi all, I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    *& Report  ZDYNAMIC_TEST                                               *
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    *  DO 20 TIMES.
    *    DO p_colms TIMES.
    *      l_index = sy-index.
    *      CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *      ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
    *      <l_field> = sy-index.
    *    ENDDO.
    *    INSERT <fs_dyntable> INTO TABLE <gt_table>.
    *  ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    *  CLEAR: l_fieldname,
    *         l_tabname,
    *         l_fieldtext,
    *         l_index.
    *  DO  p_colms TIMES.
    *    CLEAR l_index.
    *    l_index = sy-index.
    *    CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *    CONCATENATE 'Field' l_index INTO l_fieldtext.
    *    l_tabname = '<GT_TABLE>'.
    *    PERFORM fieldcatalog USING: l_fieldname
    *                                l_tabname
    *                                l_fieldtext.
    *  ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    * Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
    *  DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    *  v_srlno.
    *  LOOP AT it_itab.
    *    v_srlno = v_srlno + 1.
    *  ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    * 1st Field
    *  l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    * Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    ENDFORM.                    " SELECT_DATA

  • How to create dynamic Invoice report based on Tax calculations

    Hi Ppl,
    I have an invoice report requirement. There are multiple line items in invoice and each line item will have a tax % and discount associated with it. Discount has to be applied at line item level. Tax will be applicable on resultant amount which respect to tax share on total amount. Below is example
    Part# Tax     Qty     UnitPrice Amount     Discount     Net Value
    1     12.5%     40     10          400          100          300
    2     12.5%     50     20          1000          200          800
    3     4%     10     30          300          50          250
                             SubTotal                    1350
                             VAT 12.5% on 1100(300+800)     137.50
                             VAT 4% on 250               10
                             Total Amount               1497.5
    I have created a static rtf which does all calculations correctly. I have hardcoded 12.5 and 4 % tax values for calculations. But issue is that taxes are changeable in future so I want to create dynamic template which takes care for tax calculations. I thought of to create an array to store distinct tax values from XML data and then to perform calculation but don’t know how to do that.
    Can some body help me out as this is very critical and urgent?
    Note: Tax calculation can be done at line item level itself but there are some scenarios where additional discounts are there so tax calculation can not be done at line item level.
    Below is the sample XML data
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ListOfBipActionTest>
    - <Action>
    <AccountId>1</AccountId>
    <PartName>17211KCC900LS</PartName>
    <TAX>12.5</TAX>
    <QTY>40</QTY>
    <UNITPRICE>47.06</UNITPRICE>
    <DIS>15.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>2</AccountId>
    <PartName>17213KCC900LS</PartName>
    <TAX>12.5</TAX>
    <QTY>50</QTY>
    <UNITPRICE>19.53</UNITPRICE>
    <DIS>8.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>3</AccountId>
    <PartName>28302KAG900S</PartName>
    <TAX>12.5</TAX>
    <QTY>50</QTY>
    <UNITPRICE>59.49</UNITPRICE>
    <DIS>15.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>4</AccountId>
    <PartName>2830AKAG900S</PartName>
    <TAX>12.5</TAX>
    <QTY>10</QTY>
    <UNITPRICE>168.7</UNITPRICE>
    <DIS>15.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>4</AccountId>
    <PartName>91001GF6000S</PartName>
    <TAX>4.00</TAX>
    <QTY>60</QTY>
    <UNITPRICE>115.34</UNITPRICE>
    <DIS>17.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    </ListOfBipActionTest>
    Thanks
    Ashish

    Dear Efstratios Kara,
    I installed SAP Integration Kit 3.1. Yes I installed the integration kit after installing CR.
    I have uninstalled the earlier version and i have reinstalled CR with (12.3.0.601) version.
    But still i cant view the SAP connectivity. can u tell me from which version they have included this connectivity option in CR.
    If CR going to support SAP Table connectivity on specific version, what is that version.
    Waiting for your reply.
    Regards,
    Suman

  • I want to create an ALV  with two row fields name

    Hi
    I want to create an ALV  with two row fields name. please suggest how to do it or send some sample code
    thanks

    Hi,
    see this link
    http://****************/Tutorials/ALV/ALVMainPage.htm
    http://www.alvrobot.com.ar/tutorial.php
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b09ac4d5-e3ad-2910-6a81-96d1b861928c
    http://abapprogramming.blogspot.com/2007/11/alv-check-boxes-sample-code.html
    REPORT zalv5 NO STANDARD PAGE HEADING.
    Description----
    TOPICS INTRODUCED:
    1. Learn about the u2018Standardu2019 PF-Status that comes as default.
    2. Exclude function codes from u2018Standardu2019 PF-Status and customize it.
    TYPE-POOLS: slis.
    DATA: BEGIN OF i_data OCCURS 0,
    qmnum LIKE qmel-qmnum,
    qmart LIKE qmel-qmart,
    qmtxt LIKE qmel-qmtxt,
    ws_row TYPE i,
    ws_char(5) TYPE c,
    chk,
    END OF i_data.
    DATA: report_id LIKE sy-repid.
    DATA: ws_title TYPE lvc_title VALUE 'An ALV Report'.
    DATA: i_layout TYPE slis_layout_alv.
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: i_events TYPE slis_t_event.
    DATA: i_header TYPE slis_t_listheader.
    DATA: i_extab TYPE slis_t_extab.
    SELECT qmnum
    qmart
    qmtxt
    INTO TABLE i_data
    FROM qmel
    WHERE qmnum <= '00030000010'. LOOP AT i_data. i_data-ws_row = sy-tabix. i_data-ws_char = 'AAAAA'. MODIFY i_data. ENDLOOP. report_id = sy-repid. PERFORM f1000_layout_init CHANGING i_layout. PERFORM f2000_fieldcat_init CHANGING i_fieldcat. PERFORM f3000_build_header CHANGING i_header. PERFORM f4000_events_init CHANGING i_events. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = * I_BUFFER_ACTIVE = ' ' i_callback_program = report_id * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * i_structure_name = ' ' * I_BACKGROUND_ID = ' ' i_grid_title = ws_title * I_GRID_SETTINGS = is_layout = i_layout it_fieldcat = i_fieldcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' i_save = 'A' * IS_VARIANT = it_events = i_events * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * IT_ALV_GRAPHICS = * IT_ADD_FIELDCAT = * IT_HYPERLINK = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = i_data 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.
    *& Form F1000_Layout_Init
    FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.
    CLEAR i_layout.
    i_layout-colwidth_optimize = 'X'.
    i_layout-edit = 'X'.
    ENDFORM. " F1000_Layout_Init
    *& Form f2000_fieldcat_init
    FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: line_fieldcat TYPE slis_fieldcat_alv.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'QMNUM'. " The field name and the table
    line_fieldcat-tabname = 'I_DATA'. " name are the two minimum req.
    line_fieldcat-key = 'X'. " Specifies the column as a key (Blue)
    line_fieldcat-seltext_m = 'Notification No.'. " Column Header
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'QMART'.
    line_fieldcat-ref_tabname = 'I_DATA'.
    line_fieldcat-hotspot = 'X'. " Shows the field as a hotspot.
    line_fieldcat-seltext_m = 'Notif Type'.
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'QMTXT'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_m = 'Description'.
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'WS_ROW'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_m = 'Row Number'.
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'WS_CHAR'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_l = 'Test Character Field'.
    line_fieldcat-datatype = 'CHAR'.
    line_fieldcat-outputlen = '15'. " You can specify the width of a
    APPEND line_fieldcat TO i_fieldcat. " column.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'CHK'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_l = 'Checkbox'.
    line_fieldcat-checkbox = 'X'. " Display this field as a checkbox
    line_fieldcat-edit = 'X'. " This option ensures that you can
    " edit the checkbox. Else it will
    " be protected.
    APPEND line_fieldcat TO i_fieldcat.
    ENDFORM. " f2000_fieldcat_init
    *& Form f3000_build_header
    FORM f3000_build_header USING i_header TYPE slis_t_listheader.
    DATA: gs_line TYPE slis_listheader.
    CLEAR gs_line.
    gs_line-typ = 'H'.
    gs_line-info = 'This is line of type HEADER'.
    APPEND gs_line TO i_header.
    CLEAR gs_line.
    gs_line-typ = 'S'.
    gs_line-key = 'STATUS 1'.
    gs_line-info = 'This is line of type STATUS'.
    APPEND gs_line TO i_header.
    gs_line-key = 'STATUS 2'.
    gs_line-info = 'This is also line of type STATUS'.
    APPEND gs_line TO i_header.
    CLEAR gs_line.
    gs_line-typ = 'A'.
    gs_line-info = 'This is line of type ACTION'.
    APPEND gs_line TO i_header.
    ENDFORM. " f3000_build_header
    *& Form f4000_events_init
    FORM f4000_events_init CHANGING i_events TYPE slis_t_event.
    DATA: line_event TYPE slis_alv_event.
    CLEAR line_event.
    line_event-name = 'TOP_OF_PAGE'.
    line_event-form = 'F4100_TOP_OF_PAGE'.
    APPEND line_event TO i_events.
    CLEAR line_event.
    line_event-name = 'PF_STATUS_SET'.
    line_event-form = 'F4200_PF_STATUS_SET'.
    APPEND line_event TO i_events.
    ENDFORM. " f3000_events_init
    FORM F4100_TOP_OF_PAGE *
    FORM f4100_top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = i_header.
    ENDFORM.
    FORM F4200_PF_STATUS_SET *
    FORM f4200_pf_status_set USING i_extab TYPE slis_t_extab.
    REFRESH i_extab.
    PERFORM f4210_exclude_fcodes CHANGING i_extab.
    SET PF-STATUS 'STANDARD' OF PROGRAM 'SAPLSALV' EXCLUDING i_extab.
    ENDFORM.
    *& Form f4210_exclude_fcodes
    FORM f4210_exclude_fcodes USING i_extab TYPE slis_t_extab.
    DATA: ws_fcode TYPE slis_extab.
    CLEAR ws_fcode.
    ws_fcode = '&EB9'. " Call up Report.
    APPEND ws_fcode TO i_extab.
    ws_fcode = '&ABC'. " ABC Analysis.
    APPEND ws_fcode TO i_extab.
    ws_fcode = '&NFO'. " Info Select.
    APPEND ws_fcode TO i_extab.
    ws_fcode = '&LFO'. " Information.
    APPEND ws_fcode TO i_extab.
    ENDFORM. " f4210_exclude_fcodes
    thanks
    karthik
    reward me if usefull

  • Steps to create interactive alv report

    plz tell me the steps needed to create interactive alv report. explaining the importance of events. please tell me with suitable example

    Hello Yogesh,
    I did not see as you mentioned Interactive ALV , sorry for wrong reply.
    Please use proper parameter to function module ,here you need to use user command,this user command will call form routine(Dynamic) ,here you can do whatever ,below example one interactive ,if user clicks on material it will goto MM02 transaction.
    See the simple example one in ALV :
    REPORT Z_GET_REFRESH no standard page heading.
    type-pools : slis.
    tables : makt,
             mara.
    data : i_fieldcat type slis_t_fieldcat_alv.
    data : begin of i_makt occurs 0,
           matnr like makt-matnr,
           maktx like makt-maktx,
           end of i_makt.
    data : v_repid like sy-repid,
           g_user_command type slis_formname value 'USER_COMMAND',
           g_status_set   type slis_formname value 'SET_PF_STATUS'.
    DATA:LC_GLAY TYPE LVC_S_GLAY.
    select-options s_matnr for mara-matnr .
    start-of-selection.
      select matnr maktx from makt into table i_makt
                                  where matnr in s_matnr.
    end-of-selection.
    Fill the fieldcatlog
      perform fill_field.
    Call the FM
      perform call_fm.
    *&      Form  fill_field
          text
    -->  p1        text
    <--  p2        text
    FORM fill_field.
      data wa_fieldcat type slis_fieldcat_alv.
      clear : wa_fieldcat.
      wa_fieldcat-tabname = 'I_MAKT'.
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-outputlen = '18'.
      wa_fieldcat-seltext_l = 'Material #'.
      wa_fieldcat-col_pos = '1'.
      append wa_fieldcat to i_fieldcat.
      clear : wa_fieldcat.
      wa_fieldcat-tabname = 'I_MAKT'.
      wa_fieldcat-fieldname = 'MAKTX'.
      wa_fieldcat-outputlen = '40'.
      wa_fieldcat-seltext_l = 'Material Desc'.
      wa_fieldcat-col_pos = '2'.
      append wa_fieldcat to i_fieldcat.
    ENDFORM.                    " fill_field
    *&      Form  call_fm
          text
    -->  p1        text
    <--  p2        text
    FORM call_fm.
      v_repid = sy-repid.
      LC_GLAY-EDT_CLL_CB = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                =
      I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = v_repid
          I_CALLBACK_PF_STATUS_SET          = g_status_set
          I_CALLBACK_USER_COMMAND           = g_user_command
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
        I_GRID_SETTINGS                   = LC_GLAY
      IS_LAYOUT                         =
          IT_FIELDCAT                       = i_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_ADD_FIELDCAT                   =
      IT_HYPERLINK                      =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
      IT_EXCEPT_QINFO                   =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = i_makt
       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.                    " call_fm
          FORM USER_COMMAND                                             *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                rs_selfield TYPE slis_selfield.                 "#EC CALLED
      data i_RSPARAMS like RSPARAMS occurs 0.
      CASE R_UCOMM.
        WHEN '&IC1'.
          read table i_makt index rs_selfield-tabindex.
          SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
          if not i_makt-matnr is initial.
            call transaction 'MM02' and skip first screen.
          endif.
        when 'REFRESH'.
          CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
            EXPORTING
              CURR_REPORT           = v_repid
    IMPORTING
      SP                    =
            TABLES
             SELECTION_TABLE       = i_RSPARAMS
           EXCEPTIONS
             NOT_FOUND             = 1
             NO_REPORT             = 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.
          submit z_get_refresh with selection-table i_RSPARAMS.
          rs_selfield-refresh = 'X'.
      ENDCASE.
      MOVE 'REFRESH' TO r_ucomm.
    ENDFORM.
          FORM set_pf_status                                            *
    FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
      SET TITLEBAR  sy-tcode.
    ENDFORM.
    Thanks
    Seshu

  • Create a ALV report with fields editable and  entry to be saved in ztable

    Hello Experts,
    I have created the ALV report which has two of the fields editable. Now whenever user puts an entry in the ALV it has to be saved in the ZTABLE.
    The report is displayed with editable fields but i'm not sure what has to be written in the 'USER COMMAND' subroutine to save the entries in ztable.
    Please see my code belwo:-
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'ALV_USER_COMM'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               it_events               = gt_events
               is_print                = gd_prntparams
                 i_save                  = 'X'
               is_variant              = z_template
           TABLES
                t_outtab                = it_bg2
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    Thanks,
    Naveen
    Edited by: jaikrishna on Sep 4, 2010 8:13 AM

    Hi,
    I have worked on similar requirement. You can do that on sy-ucomm value only and you have to call a FM and a method. For that end user has to click on a button which you need to create in the application toolbar. Say that button function code is 'SAVE'. Write the following code in your user command :
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
            RS_SELFIELD TYPE SLIS_SELFIELD.
    *Code to reflect the changes done in the internal table
      DATA : REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA: L_VALID TYPE C.
      IF REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = REF_GRID.
      ENDIF.
      IF NOT REF_GRID IS INITIAL.
        CALL METHOD REF_GRID->CHECK_CHANGED_DATA
          IMPORTING
            E_VALID = L_VALID.
      ENDIF.
      CASE SY-UCOMM.
        WHEN 'SAVE'.
    *Data will come with the edited values from ALV
    *Here you write your code to save entries into Z table
    ENDCASE.
    ENDFORM. "USER_COMMAND
    Thanks & Regards,
    Rock.

  • I want to create a interaractive reporting in that i want to create 3 repor

    I want to create a interaractive reporting in that i want to create 3 reporrs...I created one interactive report,,after than can I use at-line selection again or else plz help me in thsi reg ..

    Hello,
      You can write at line-selection one time only.
      After that depending upon the system field you can get the reports.
    For example , the sample code will be like this,
    At line-selection.
      case sy-lsind.
                when 1 .
                               / Code for first secodary list /
                when 2.
                               /Code for the second list/
                when 3.  / code for the third list/
                 when 20 . / code for the 20 th list/
       endcase
    Regards,
      Satya

  • Want to create dynamic SQL with table join

    I want to create a dynamic SQL query so that the user can enter any two table names on the selection screen and two field names that he wants to join. After which i should be able to dynamically generate the SQL (native or open) and show the result as report. I have already read the forum threads and know how to create dynamic SQL for single table, what i m struggling with is how to do inner join. I know i can use nested select but that will make the query very slow because i want to extend it to more than 2 tables later.
    Will give points to useful answer for sure, thanks for reading.

    Hi,
    Following is a piece of code which I have used in my program.
    DATA: ws_flds(72)   TYPE c.
    DATA: ftab  LIKE TABLE OF ws_flds.
    ws_flds = 'rbukrs rprctr racct ryear '.
      APPEND ws_flds TO ftab.
       SELECT (ftab)
        INTO CORRESPONDING FIELDS OF TABLE it_grp_glpca
        FROM glpca FOR ALL ENTRIES IN i_cert_item
        WHERE kokrs = c_kokrs
            AND rldnr = '8A'
            AND rrcty IN ('0','2')
            AND rvers  = '000'
            AND rbukrs = i_cert_item-bukrs
            AND ryear  = p_ryear
            AND rprctr = i_cert_item-prctr
            AND racct  = i_cert_item-saknr
            AND ( poper BETWEEN '001' AND ws_poper )
            AND aufnr IN s_aufnr
            AND kostl IN s_kostl
            AND rfarea IN s_fkber
            AND rmvct IN s_rmvct
            AND sprctr IN s_sprctr
            AND ( racct BETWEEN c_low AND c_high ).
    You can now pass your table name as (p_table) or append fieldnames to the internal table (ftab). if it is join then you can append this table like abukrs asaknr..etc.
    Regards
    Subramanian

  • Want to create dynamic link with ActionEvent

    Hi all,
    I am developing an application in JSF. I want to create links dynamically with their action event. I can create links dynamically, but I don't know how to provide actionEvent OR actionListener to those links.
    Any help will be appreciated. ( If possible, give me an example / sample code. )
    Thanks in advance,
    JSF GEEKS
    Edited by: jsfgeeks on Nov 24, 2009 10:15 AM

    commandLink?
    What do you mean when you say: "I want to create links dynamically with their action event."
    Do you need parameters? Or different action events?

  • How to create dynamic web report in 10G Grid Control

    Hi experts..
    In OEM 9i, it provides a OEMgenerationServlet servlet to generate dynamic Web reports, my company uses the servlet to generate many OEM report, those reports cal also take parameters, such as dabatase name. the generated web reports are viewable to public end users. I am looking for a similar function in 10G Grid control...
    Does anyone have the similar requirement, any suggestion will be highly appreciated..
    Regards,
    Jinsen

    Hi,
    Thank you for the reply. I read about Clear and Purge from Oracle Doc about 10gR2, but nothing about R1. I drilled down all the way, can't find any thing to click for clear and purge. And I can't find anything from Oracle Doc, either.
    Laura

  • Looking for some help in creating dynamic rdlc report for Desktop Application

    Hello ,
     I currently have the syncfusion reportviewer running in my desktop application, now what I am looking to do is create a report where my users, can select and deselect what columns and Items they want to print out. Is there any way to do this ?
    Thanks
    David.

    Hi David,
    We can integrate Syncfusion with LightSwitch application, if you want to customize column when create a report using syncfusion reportviewer, since I didn't try this third party
    extension before, I think you could consider getting help from
    syncfusion forum, more syncfusion experts can help you on this issue.
    Thanks for your understanding.
    Best regards,
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Create a ALV Report without manual FieldCat definition (OO)

    Hi ABAP'ers!!!
    To use the class CL_GUI_ALV_GRID for display the content of a internal table (not a structure) i need to create a fieldcat object manually to perform it...??? Has a way to do it without a hand's on work...???
    Can i inherit this class to add a functionality (method) for made it for me....???
    Thank's...
    Flavio Rasseli

    As an alternative you could use set_table_for_first_display and pass the structure name. Then use get_frontend_fieldcatalog to get the field catalogue.  Then modify the field catalogue.  Then set the field catalogue using set_frontend_fieldcatalog and finally update the screen using refresh_table_display.  It's a bit long winded but tidier than using the FM to generate the ALV.  See the example below.
    CREATE OBJECT go_alv_100
          EXPORTING
            i_parent = cl_gui_container=>screen0.
        CALL METHOD go_alv_100->set_table_for_first_display
           EXPORTING
    *         i_buffer_active               =
    *         i_bypassing_buffer            =
    *         i_consistency_check           =
             i_structure_name              = 'ZVEND_CONTACTS'
    *         is_variant                    =
            i_save                        = 'A'
    *         i_default                     = 'X'
             is_layout                     = gv_alv_100_layo
    *         is_print                      =
    *         it_special_groups             =
    *         it_toolbar_excluding          =
    *         it_hyperlink                  =
    *         it_alv_graphics               =
    *         it_except_qinfo               =
    *         ir_salv_adapter               =
          CHANGING
            it_outtab                     = gt_existing_contacts
    *         it_fieldcatalog               =
    *         it_sort                       =
    *         it_filter                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc = 0.
          CALL METHOD go_alv_100->get_frontend_fieldcatalog
            IMPORTING
              et_fieldcatalog = gt_fieldcat_100.
          LOOP AT gt_fieldcat_100 INTO gv_fieldcat.
            CASE gv_fieldcat-fieldname.
              WHEN 'LIFNR'.
                gv_fieldcat-key = 'X'.
            ENDCASE.
            MODIFY gt_fieldcat_100 FROM gv_fieldcat.
          ENDLOOP.
          CALL METHOD go_alv_100->set_frontend_fieldcatalog
            EXPORTING
              it_fieldcatalog = gt_fieldcat_100.
          CALL METHOD go_alv_100->refresh_table_display
                EXPORTING
    *        is_stable      =
                  i_soft_refresh = 'X'
                EXCEPTIONS
                  finished       = 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.

  • Create Dynamically Crsytal report

    Hello All,
    I need to make an application in which super admin can create crystal report  which is display to user.
    Thanks

    hi Vidya,
    question...why do you need to create an application to do this? if you've got a copy of the crystal reports designer (crw32.exe) then the "super admin" can create .rpt files which can be placed on a file share. users can download the free crystal reports viewer from here and then view those reports.
    the reports can be designed with some interactivity that will work in the free viewer...you can use parameters to change up Saved Data filters, charts, interactive sort controls, etc.
    -jamie

  • Tab Strip Selection Screen in ALV Report

    Hi All,
    I want to create a ALV report with TABStrip selection screen. How to proceede.
    Is there any necessary to create dailog program for the screens.
    Please advise.
    Thank You,
    ANu.

    Hi
    You can create it using module pool program in an easy way. Have the tab strip in main screen and use the sub-screens for display. By this way you can do it. If you wish, you could refer the following link, where they have given step by step procedure.
    <<Link-farm removed>>
    Hope this helps you.
    Regards
    Vinodh
    Edited by: kishan P on Nov 1, 2010 3:00 PM

Maybe you are looking for

  • Adapter engine empty in Integration Directory

    Hi when I try to create a Business System in Integration Directory and I am configuring the communication channel (for example File Adapter or RFC ) the field "Adapter Engine" is empty and has no selection to choose from. Is there a problem in config

  • Re: Missing: (Photoshop CC 2014) Filter "Blur Gallery

    I updated all my Adobe applications this morning. Missing is Photoshop > Filter > Blur Gallery Attached is screen shot. I read there is a new feature in Photoshop CC 2014: Spin Blur Where is my Photoshop CC 2014 "Blur Gallery"??? Please advise. Thank

  • Where is Content-Aware Age Tool in Photoshop CS6?

    Was it suppose to be in the final release of Photoshop CS6?  If you go to this link http://www.practicalphotoshopmag.com/2012/04/01/photoshop-cs6-to-feature-content-aware-age -tool/ It states it was on beta version of Photoshop CS6 but no one have a

  • Form text box problems please help???

    I am creating a form in adobe XI and am having some problems with a text field I am trying to get the text field to allow me to add multi-line text with rich text editing and I am unable with the setting I have checked. I have gone to properties for

  • Call popup with ITS

    Hello, I am trying to modify a specific popup generation in order to send back to SAP that this popup is definetely closed. I have currently an error when opening this popup more than 10 times. This situation occurs when we assign cost centers in ite