Interactive report in SD

report zsdtest.
 
TYPE-POOLS: VRM,SLIS.
 
TABLES: VBRK,VBRP,KONV,MAKT,T001,T001W.
 
DATA : BEGIN OF ITAB OCCURS 0,
        BUKRS LIKE VBRK-BUKRS,
        VBELN LIKE VBRK-VBELN,
        VKORG LIKE VBRK-VKORG,
        SPART LIKE VBRK-SPART,
        KNUMV LIKE VBRK-KNUMV,
        WAERK LIKE VBRK-WAERK,
        FKDAT LIKE VBRK-FKDAT,
        FKART LIKE VBRK-FKART,
        KURRF LIKE VBRK-KURRF,
        WERKS LIKE VBRP-WERKS,
        MATKL LIKE VBRP-MATKL,
        KONDM LIKE VBRP-KONDM,
        MATNR LIKE VBRP-MATNR,
        POSNR LIKE VBRP-POSNR,
        UECHA LIKE VBRP-UECHA,
        FKIMG LIKE VBRP-FKIMG,
        MEINS LIKE VBRP-MEINS,
        VRKME LIKE VBRP-VRKME,
        KZWI1 LIKE VBRP-KZWI1,
        KZWI3 LIKE VBRP-KZWI3,
        KZWI4 LIKE VBRP-KZWI4,
       FKIMG1 LIKE VBRP-FKIMG,
        MAKTX LIKE MAKT-MAKTX,
        KBETR LIKE KONV-KBETR,
       BVALUE LIKE KONV-KWERT,
       EXDUTY LIKE KONV-KWERT,
       EDCESS LIKE KONV-KWERT,
       SALTAX LIKE KONV-KWERT,
       SURCHG LIKE KONV-KWERT,
       VALUE1 LIKE KONV-KWERT,
       VALUE3 LIKE KONV-KWERT,
       VALUE4 LIKE KONV-KWERT,
        ERATE TYPE P DECIMALS 2,
        WGBEZ LIKE T023T-WGBEZ,
        VTEXT LIKE T178T-VTEXT,
       END OF ITAB.
 
DATA : PTAB LIKE ITAB OCCURS 0 WITH HEADER LINE.
DATA : DTAB LIKE ITAB OCCURS 0 WITH HEADER LINE.
 
DATA : BEGIN OF STAB OCCURS 0,
       MATKL LIKE VBRP-MATKL,
       WGBEZ LIKE T023T-WGBEZ,
       BVALUE LIKE KONV-KWERT,
       EXDUTY LIKE KONV-KWERT,
       EDCESS LIKE KONV-KWERT,
       SALTAX LIKE KONV-KWERT,
       SURCHG LIKE KONV-KWERT,
       KZWI4 LIKE VBRP-KZWI4,
       FKIMG1 LIKE VBRP-FKIMG,
       END OF STAB.
 
DATA: BEGIN OF TYPETAB OCCURS 10,
       TYPE(2),
       DESCRP(20),
      END OF TYPETAB.
 
RANGES : FKART FOR VBRK-FKART.
 
DATA : LIST TYPE VRM_VALUES.
DATA : VALUE LIKE LINE OF LIST.
DATA : IT_KONV LIKE KONV OCCURS 0 WITH HEADER LINE.
DATA : I_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE,
       FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
       G_LAYOUT        TYPE SLIS_LAYOUT_ALV,
       I_EVENT_EXIT    TYPE SLIS_T_EVENT_EXIT,
       I_LIST_COMMENTS TYPE SLIS_T_LISTHEADER,
       I_EXCLUDING     TYPE SLIS_T_EXTAB.
 
DATA : LAYOUT TYPE SLIS_LAYOUT_ALV,
       G_EVENTS LIKE LINE OF I_EVENTS,
       LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
       G_CALLBACK_UCOMM   TYPE SLIS_FORMNAME.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:     BUKRS LIKE VBRK-BUKRS OBLIGATORY.
SELECT-OPTIONS: SPART FOR VBRK-SPART OBLIGATORY,
                WERKS FOR VBRP-WERKS.
SELECTION-SCREEN: END OF BLOCK B1.
 
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: MATKL FOR VBRP-MATKL,
                KONDM FOR VBRP-KONDM,
                MATNR FOR VBRP-MATNR.
SELECTION-SCREEN: END OF BLOCK B2.
 
SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS: VBELN FOR VBRK-VBELN,
                FKDAT FOR VBRK-FKDAT OBLIGATORY.
PARAMETERS: BTYPE(2) AS LISTBOX VISIBLE LENGTH 14
                            OBLIGATORY DEFAULT '01'.
SELECTION-SCREEN: END OF BLOCK B3.
 
SELECTION-SCREEN: BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-004.
PARAMETER : RPT1  RADIOBUTTON  GROUP GRP,
            RPT2  RADIOBUTTON  GROUP GRP .
SELECTION-SCREEN: END OF BLOCK B4.
 
 
 
INITIALIZATION.
*initialization.
  REFRESH: TYPETAB.
  CLEAR: TYPETAB.
 
  TYPETAB-TYPE = '01'.
  TYPETAB-DESCRP = 'All'.
  APPEND TYPETAB.
 
  TYPETAB-TYPE = '02'.
  TYPETAB-DESCRP = 'Domestic'.
  APPEND TYPETAB.
 
  TYPETAB-TYPE = '03'.
  TYPETAB-DESCRP = 'Export'.
  APPEND TYPETAB.
 
  TYPETAB-TYPE = '04'.
  TYPETAB-DESCRP = 'Samples'.
  APPEND TYPETAB.
 
  TYPETAB-TYPE = '05'.
  TYPETAB-DESCRP = 'Scrap Sale'.
  APPEND TYPETAB.
 
  LOOP AT TYPETAB.
    VALUE-KEY = TYPETAB-TYPE.
    VALUE-TEXT = TYPETAB-DESCRP.
    APPEND VALUE TO LIST.
  ENDLOOP.
 
AT SELECTION-SCREEN OUTPUT.
  CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            ID              = 'BTYPE'
            VALUES          = LIST
       EXCEPTIONS
            ID_ILLEGAL_NAME = 1
            OTHERS          = 2.
  IF SY-SUBRC  0.
 
  ENDIF.
 
END-OF-SELECTION.
 
START-OF-SELECTION.
 
********************Authority check***************
***** Modified by Balameenakshi on 04.07.2006*****
 
AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
         ID 'BUKRS' FIELD BUKRS
         ID 'ACTVT' DUMMY.
 
IF SY-SUBRC NE 0.
    PERFORM CALLERR1 USING
  'You have no Authorisation for this Company code'.
    STOP.
  ENDIF.
 
*********************
  DATA : FLAG1(1).
  SELECT * FROM T001W WHERE WERKS IN WERKS.
    AUTHORITY-CHECK OBJECT 'M_MATE_WRK'
             ID 'ACTVT' DUMMY
             ID 'WERKS' FIELD T001W-WERKS.
 
    IF SY-SUBRC NE 0.
      FLAG1 = 'X'.
    ENDIF.
 
  ENDSELECT.
  IF FLAG1 EQ 'X'.
    PERFORM CALLERR USING
  'You have no Authorisation for this Plant'.
    STOP.
  ENDIF.
***
*****************************************************************
* MODIFICATION FOR PERFORMANCE TUNING ( ORIGINAL )
*****************************************************************
*IF BTYPE = '02'.
*    FKART-SIGN   = 'I'.
*    FKART-OPTION = 'EQ'.
*    FKART-LOW    = 'ZFF2'.
*    APPEND FKART.
*    CLEAR FKART.
 
*    FKART-SIGN   = 'I'.
*    FKART-OPTION = 'EQ'.
*    FKART-LOW    = 'ZAF2'.
*    APPEND FKART.
*    CLEAR FKART.
 
* ELSEIF BTYPE = '03'.
*    FKART-SIGN   = 'I'.
*    FKART-OPTION = 'EQ'.
*    FKART-LOW    = 'ZEF2'.
*    APPEND FKART.
*    CLEAR FKART.
 
*ELSEIF BTYPE = '04'.
*    FKART-SIGN   = 'I'.
*    FKART-OPTION = 'EQ'.
*    FKART-LOW    = 'ZMEX'.
*    APPEND FKART.
*    CLEAR FKART.
 
*ELSEIF BTYPE = '05'.
*    FKART-SIGN   = 'I'.
*    FKART-OPTION = 'EQ'.
*    FKART-LOW    = 'ZRF2'.
*    APPEND FKART.
*    CLEAR FKART.
*  ENDIF.
 
*****************************************************************
* MODIFICATION FOR PERFORMANCE TUNING ( MODIFIED )
*****************************************************************
 
  CASE BTYPE.
   WHEN '02'.
    FKART-SIGN   = 'I'.
    FKART-OPTION = 'EQ'.
    FKART-LOW    = 'ZFF2'.
    APPEND FKART.
    CLEAR FKART.
 
    FKART-SIGN   = 'I'.
    FKART-OPTION = 'EQ'.
    FKART-LOW    = 'ZAF2'.
    APPEND FKART.
    CLEAR FKART.
 
   WHEN '03'.
    FKART-SIGN   = 'I'.
    FKART-OPTION = 'EQ'.
    FKART-LOW    = 'ZEF2'.
    APPEND FKART.
    CLEAR FKART.
 
  WHEN '04'.
    FKART-SIGN   = 'I'.
    FKART-OPTION = 'EQ'.
    FKART-LOW    = 'ZMEX'.
    APPEND FKART.
    CLEAR FKART.
 
  WHEN '05'.
    FKART-SIGN   = 'I'.
    FKART-OPTION = 'EQ'.
    FKART-LOW    = 'ZRF2'.
    APPEND FKART.
    CLEAR FKART.
 
ENDCASE.
************************************************************************
************************************************************************
  PERFORM DATA_GATHER.
  IF RPT1 = 'X'.
    PERFORM BMFIELDCAT.
    PERFORM PRINT_LIST TABLES PTAB.
  ELSE.
    PERFORM BMFIELDCAT_SUMM.
    PERFORM PRINT_LIST TABLES STAB.
  ENDIF.
 
END-OF-SELECTION.
 
*---------------------------------------------------------------------*
*       FORM data_gather                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM DATA_GATHER.
  IF BTYPE EQ '01'.
    SELECT A~BUKRS A~VBELN A~VKORG A~SPART A~KNUMV A~WAERK A~KURRF
           A~FKDAT A~FKART B~WERKS B~MATKL B~KONDM B~MATNR B~MEINS
           B~VRKME B~KZWI1 B~POSNR B~UECHA B~FKIMG B~KZWI3 B~KZWI4
                           INTO CORRESPONDING FIELDS OF TABLE ITAB
          FROM VBRK AS A INNER JOIN VBRP AS B ON A~VBELN = B~VBELN
                                           WHERE A~BUKRS = BUKRS
                                             AND A~VBELN IN VBELN
      AND A~FKART IN ('ZAF2','ZFF2','ZEF2','ZMEX','ZRF2','ZCF2','ZDF2',
*   Changed by Sampath Kumar katta requested by Ravi Shankar******
                               'ZAB2','ZDB2','ZEB2','ZCB2','ZFB2')
                                             AND A~SPART IN SPART
                                             AND A~FKDAT IN FKDAT
                                             AND B~MATKL IN MATKL
                                             AND B~MATNR IN MATNR
                                             AND B~WERKS IN WERKS.
  ELSE.
    SELECT A~BUKRS A~VBELN A~VKORG A~SPART A~KNUMV A~WAERK A~KURRF
           A~FKDAT A~FKART B~WERKS B~MATKL B~KONDM B~MATNR B~MEINS
           B~VRKME B~KZWI1 B~POSNR B~UECHA B~FKIMG B~KZWI3 B~KZWI4
                           INTO CORRESPONDING FIELDS OF TABLE ITAB
          FROM VBRK AS A INNER JOIN VBRP AS B ON A~VBELN = B~VBELN
                                           WHERE A~BUKRS = BUKRS
                                             AND A~VBELN IN VBELN
                                             AND A~FKART IN FKART
                                             AND A~SPART IN SPART
                                             AND A~FKDAT IN FKDAT
                                             AND B~MATKL IN MATKL
                                             AND B~MATNR IN MATNR
                                             AND B~WERKS IN WERKS.
 
  ENDIF.
 
  IF ITAB[] IS INITIAL.
    PERFORM CALLERR USING 'Data not available'.
  ENDIF.
 
  PTAB[] = ITAB[].
 
  SORT PTAB BY VBELN.
  DELETE ADJACENT DUPLICATES FROM PTAB COMPARING VBELN.
 
  LOOP AT ITAB.
    SELECT * FROM KONV INTO TABLE IT_KONV WHERE KNUMV = ITAB-KNUMV.
*                                        and kposn = itab-posnr.
    LOOP AT IT_KONV.
      CASE IT_KONV-KSCHL.
        WHEN 'PR00' OR 'ZR00' OR 'ZA00' OR 'ZS00'.
          ADD IT_KONV-KWERT TO ITAB-BVALUE.
          MOVE IT_KONV-KBETR TO ITAB-KBETR.
 
        WHEN 'JEX2'.
          ADD IT_KONV-KWERT TO ITAB-EXDUTY.
 
        WHEN 'JIN1' OR 'JIN2' OR 'JIN6' OR 'JIN7'.
          ADD IT_KONV-KWERT TO ITAB-SALTAX.
 
        WHEN 'JECX'.
          ADD IT_KONV-KWERT TO ITAB-EDCESS.
 
        WHEN 'JIN4' OR 'JIN5' OR 'JIN8'.
          ADD IT_KONV-KWERT TO ITAB-SURCHG.
      ENDCASE.
    ENDLOOP.
    MODIFY ITAB.
  ENDLOOP.
 
  LOOP AT PTAB .
    LOOP AT ITAB WHERE VBELN = PTAB-VBELN.
      ADD :  ITAB-FKIMG  TO PTAB-FKIMG1,
             ITAB-KZWI1  TO PTAB-VALUE1,
             ITAB-KZWI3  TO PTAB-VALUE3,
             ITAB-KZWI4  TO PTAB-VALUE4.
 
      MOVE : ITAB-KURRF  TO PTAB-ERATE,
             ITAB-BVALUE TO PTAB-BVALUE,
             ITAB-EXDUTY TO PTAB-EXDUTY,
             ITAB-SALTAX TO PTAB-SALTAX,
             ITAB-EDCESS TO PTAB-EDCESS,
             ITAB-SURCHG TO PTAB-SURCHG,
             ITAB-KBETR  TO PTAB-KBETR,
             ITAB-MEINS  TO PTAB-MEINS,
             ITAB-VRKME  TO PTAB-VRKME.
    ENDLOOP.
    MODIFY PTAB.
    CLEAR PTAB.
  ENDLOOP.
 
  LOOP AT PTAB.
    IF ( PTAB-FKART EQ 'ZEF2' ) AND ( PTAB-VALUE3 IS INITIAL ).
      PTAB-KZWI4 = PTAB-VALUE1.
    ELSE.
      PTAB-KZWI4 = PTAB-VALUE3.
    ENDIF.
    MODIFY PTAB.
    CLEAR PTAB.
  ENDLOOP.
 
  LOOP AT PTAB.
    SELECT SINGLE * FROM MAKT WHERE MATNR = PTAB-MATNR.
    IF SY-SUBRC EQ 0.
      MOVE : MAKT-MAKTX TO PTAB-MAKTX.
    ENDIF.
    SELECT SINGLE WGBEZ INTO PTAB-WGBEZ  FROM T023T
           WHERE MATKL = PTAB-MATKL AND SPRAS = SY-LANGU.
    SELECT SINGLE VTEXT INTO PTAB-VTEXT FROM T178T
           WHERE KONDM = PTAB-KONDM AND SPRAS = SY-LANGU.
 
    MULTIPLY:      PTAB-BVALUE BY PTAB-ERATE,
                   PTAB-EXDUTY BY PTAB-ERATE,
                   PTAB-EDCESS BY PTAB-ERATE,
                   PTAB-SALTAX BY PTAB-ERATE,
                   PTAB-SURCHG BY PTAB-ERATE,
                   PTAB-KZWI4 BY PTAB-ERATE.
 
    MODIFY PTAB.
    CLEAR : STAB.
 
*****************************************************************
* MODIFICATION FOR PERFORMANCE TUNING ( ORIGINAL )
*****************************************************************
 
*    MOVE-CORRESPONDING PTAB TO STAB.
 
*****************************************************************
* MODIFICATION FOR PERFORMANCE TUNING ( MODIFIED )
*****************************************************************
 
  MOVE : PTAB-MATKL TO STAB-MATKL,
         PTAB-WGBEZ TO STAB-WGBEZ,
         PTAB-BVALUE TO STAB-BVALUE,
         PTAB-EXDUTY TO STAB-EXDUTY,
         PTAB-EDCESS TO STAB-EDCESS,
         PTAB-SALTAX TO STAB-SALTAX,
         PTAB-SURCHG TO STAB-SURCHG,
         PTAB-KZWI4 TO STAB-KZWI4,
         PTAB-FKIMG1 TO STAB-FKIMG1.
 
************************************************************************
************************************************************************
 
    COLLECT STAB.
  ENDLOOP.
ENDFORM.
 
*&---------------------------------------------------------------------*
*&      Form  callerr
*&---------------------------------------------------------------------*
FORM CALLERR USING TEXT.
  CALL FUNCTION 'FC_POPUP_ERR_WARN_MESSAGE'
       EXPORTING
            POPUP_TITLE  = 'Sales Report'
            IS_ERROR     = 'X'
            MESSAGE_TEXT = TEXT
            START_COLUMN = 30
            START_ROW    = 8.
  STOP.
ENDFORM.         "callerr
 
*---------------------------------------------------------------------*
*       FORM bmfieldcat                                               *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM BMFIELDCAT.
  REFRESH FIELDCAT.
  CLEAR: FIELDCAT.
 
  G_CALLBACK_UCOMM   = 'CALLBACK_UCOMM'.
 
  LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
 
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 1
  'FKART' 'PTAB' 'FKART' ''
  '' '' '' '' '' 'Bill Type' 'X' '09' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 2
  'VBELN' 'PTAB' 'VBELN' 'VBRK'
  'X'  '' '' '' '' '' 'X' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 3
  'FKDAT' 'PTAB' 'FKDAT' ''
  ''  '' '' '' '' 'Inv.Date' 'X' '10' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 4
  'WGBEZ' 'PTAB' 'WGBEZ' 'T023T'
  ''  '' '' '' '' '' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 5
  'VTEXT' 'PTAB' 'VTEXT' 'T178T'
  ''  '' '' '' '' 'MPG Description' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 6
  'MATNR' 'PTAB' 'MATNR' 'VBRP'
  ''  '' '' '' '' '' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 7
  'MAKTX' 'PTAB' 'MAKTX' 'MAKT'
  ''  '' '' '' '' '' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 8
  'KBETR' 'PTAB' 'KBETR' 'KONV'
  ''  '' '' '' '' 'Rate' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 9
'WAERK' 'PTAB' 'KURRF' ''
''  '' '' '' '' 'Currency' '' '10' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 10
  'ERATE' 'PTAB' '' ''
  ''  '' '' '' '' 'Exchange Rate' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 11
  'FKIMG1' 'PTAB' 'FKIMG' 'VBRP'
  ''  '' '' '' 'X' 'Quantity' '' '' '' ''.
*  perform appfieldcat tables fieldcat using 12
*  'MEINS' 'PTAB' 'MEINS' 'VBRP'
*  ''  '' '' '' '' '' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 12
  'VRKME' 'PTAB' 'VRKME' 'VBRP'
  ''  '' '' '' '' '' '' '' '' ''.
 
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 13
  'BVALUE' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Basic Value (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 14
  'EXDUTY' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Excise Duty (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 15
  'EDCESS' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Edc.Cess (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 16
  'SALTAX' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Sales Tax (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 17
  'SURCHG' 'PTAB' 'KWERT' ''
  '' '' '' '' 'X' 'Sur.Charge (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 18
  'KZWI4' 'PTAB' 'KZWI4' ''
  ''  '' '' '' 'X' 'Total Value (INR)' '' '15' '' ''.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM print_list                                               *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM PRINT_LIST TABLES PTAB.
  I_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
  I_EVENTS-FORM = 'TOP_OF_PAGE'.
  APPEND I_EVENTS.
 
 
 
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM       = SY-CPROG
            I_CALLBACK_USER_COMMAND  = G_CALLBACK_UCOMM
            I_CALLBACK_PF_STATUS_SET = ' '
            I_CALLBACK_TOP_OF_PAGE   = ' '
            IS_LAYOUT                = LAYOUT
            IT_FIELDCAT              = FIELDCAT[]
            I_SAVE                   = 'A'
            IT_EVENTS                = I_EVENTS[]
       TABLES
            T_OUTTAB                 = PTAB.
ENDFORM.
 
*&---------------------------------------------------------------------*
*&      Form  appfieldcat
*&---------------------------------------------------------------------*
FORM APPFIELDCAT TABLES   P_MFIELDCAT STRUCTURE FIELDCAT
                 USING    PPOS TYPE I
                          FIELDNAME
                          TABNAME
                          REF_FIELDNAME
                          REF_TABNAME
                          HOTSPOT
                          INTTYPE
                          INTLEN
                          NO_SUM
                          DO_SUM
                          SEL_TEXT
                          KEY
                          OLEN
                          CHECK
                          IN.
 
  P_MFIELDCAT-COL_POS = PPOS.
  P_MFIELDCAT-FIELDNAME = FIELDNAME.
  P_MFIELDCAT-TABNAME = TABNAME.
  P_MFIELDCAT-REF_FIELDNAME = REF_FIELDNAME.
  P_MFIELDCAT-REF_TABNAME = REF_TABNAME.
  P_MFIELDCAT-HOTSPOT = HOTSPOT.
  P_MFIELDCAT-NO_SUM = NO_SUM.
  P_MFIELDCAT-DO_SUM = DO_SUM.
  P_MFIELDCAT-SELTEXT_L = SEL_TEXT.
  P_MFIELDCAT-KEY = KEY.
  P_MFIELDCAT-OUTPUTLEN = OLEN.
  P_MFIELDCAT-CHECKBOX = CHECK.
  P_MFIELDCAT-INPUT = IN.
 
  IF REF_FIELDNAME IS INITIAL.
    P_MFIELDCAT-INTTYPE = INTTYPE.
    P_MFIELDCAT-INTLEN = INTLEN.
    P_MFIELDCAT-SELTEXT_L = SEL_TEXT.
  ENDIF.
  APPEND P_MFIELDCAT.
  CLEAR: P_MFIELDCAT.
ENDFORM.                    " bmfieldcat
 
*---------------------------------------------------------------------*
*       FORM TOP_OF_PAGE                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE.
  PERFORM TOP_OF_PAGE1.
ENDFORM.
 
*---------------------------------------------------------------------*
*       FORM top_of_page1                                             *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE1.
  CLEAR T001.
 
  SELECT SINGLE * FROM T001 WHERE BUKRS = BUKRS.
  IF NOT BUKRS IS INITIAL.
    WRITE:/2 'Company              :', BUKRS, '-', T001-BUTXT.
  ENDIF.
  IF NOT WERKS-HIGH IS INITIAL.
    WRITE:/2 'Plant                :', WERKS-LOW, 'to', WERKS-HIGH.
  ELSE.
    WRITE:/2 'Plant                :', WERKS-LOW.
  ENDIF.
  IF NOT FKDAT IS INITIAL.
    WRITE:/2 'Invoice Date         :', FKDAT-LOW, 'to', FKDAT-HIGH.
  ENDIF.
  SKIP.
  WRITE:/2 'Sales Report'.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM callback_ucomm                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  R_UCOMM                                                       *
*  -->  RS_SELFIELD                                                   *
*---------------------------------------------------------------------*
FORM CALLBACK_UCOMM  USING R_UCOMM LIKE SY-UCOMM
                           RS_SELFIELD TYPE SLIS_SELFIELD.
  CASE R_UCOMM.
    WHEN '&IC1'.
      CASE RS_SELFIELD-TABNAME.
        WHEN 'PTAB'.
          IF RS_SELFIELD-FIELDNAME = 'VBELN'.
            READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
            IF SY-SUBRC = 0.
              SET PARAMETER ID 'VF' FIELD RS_SELFIELD-VALUE.
              CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
            ENDIF.
          ENDIF.
      ENDCASE.
  ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  bmfieldcat_summ
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM BMFIELDCAT_SUMM.
  REFRESH FIELDCAT.
  CLEAR: FIELDCAT.
 
  G_CALLBACK_UCOMM   = 'DRILL'.
 
  LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
 
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 4
  'WGBEZ' 'PTAB' 'WGBEZ' 'T023T'
  ''  '' '' '' '' '' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 9
 'FKIMG1' 'PTAB' 'FKIMG' 'VBRP'
 ''  '' '' '' 'X' 'Quantity' '' '' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 13
  'BVALUE' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Basic Value (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 14
  'EXDUTY' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Excise Duty (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 15
  'EDCESS' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Edc.Cess (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 16
  'SALTAX' 'PTAB' 'KWERT' ''
  ''  '' '' '' 'X' 'Sales Tax (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 17
  'SURCHG' 'PTAB' 'KWERT' ''
  '' '' '' '' 'X' 'Sur.Charge (INR)' '' '15' '' ''.
  PERFORM APPFIELDCAT TABLES FIELDCAT USING 18
  'KZWI4' 'PTAB' 'KZWI4' ''
  ''  '' '' '' 'X' 'Total Value (INR)' '' '15' '' ''.
 
ENDFORM.                    " bmfieldcat_summ
 
 
*---------------------------------------------------------------------*
*       FORM drill                                                    *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  R_UCOMM                                                       *
*  -->  RS_SELFIELD                                                   *
*---------------------------------------------------------------------*
FORM DRILL  USING R_UCOMM LIKE SY-UCOMM
                           RS_SELFIELD TYPE SLIS_SELFIELD.
  CASE R_UCOMM.
    WHEN '&IC1'.
      IF RS_SELFIELD-FIELDNAME = 'WGBEZ'.
        READ TABLE STAB INDEX RS_SELFIELD-TABINDEX.
        IF SY-SUBRC = 0.
          REFRESH DTAB.
          DTAB[] = PTAB[].
          DELETE DTAB WHERE NOT MATKL = STAB-MATKL.
          PERFORM BMFIELDCAT.
          PERFORM PRINT_LIST TABLES DTAB.
        ENDIF.
      ENDIF.
  ENDCASE.
ENDFORM.
***************Modified on 04.07.2006***************************
*&---------------------------------------------------------------------*
*&      Form  callerr1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0727   text
*----------------------------------------------------------------------*
 
FORM CALLERR1 USING TEXT.
 
  CALL FUNCTION 'FC_POPUP_ERR_WARN_MESSAGE'
       EXPORTING
            POPUP_TITLE  = 'Uploading of Lead Time'
            IS_ERROR     = 'X'
            MESSAGE_TEXT = TEXT
            START_COLUMN = 30
            START_ROW    = 8.
  STOP.
ENDFORM.

RELATED POST

BAPI SAMPLE CODE FOR SALES ORDER
SAP ABAP INTERVIEW ROUND ONE FAQ'S PART TWO

SAP ABAP INTERVIEW ROUND ONE FAQ'S PART THREE


SAP ABAP INTERVIEW ROUND ONE FAQ'S PART FOUR

SAP ABAP INTERVIEW QUESTIONS ON INTERNAL TABLE

SAP ABAP INTERVIEW QUESTIONS ON REPORT FORMATION AND EVENTS

No comments:

Post a Comment