How to display the data in PDF format

hi all,
i will give input in my selection screen and i will execute my report then it has to display data in PDF file in some directory (like c or d directory). i refered existingthreads . most of then saying using spool req we can download pdf file i.e. not my requirement. my requirement is when i click on execute button it has to display the data in pdf file with headings.
Anybody can send me the sample code please.
thanks,
maheedhar

Hi Easwar,
i am sending my code. in this one records is splitting into 2 records.
report zmaheedhar.
maheedhar-start
TABLES : vbak.
parameters : p_vbeln type vbak-vbeln.
data : begin of itab occurs 0,
        vbeln type vbak-vbeln,
        ERDAT type vbak-erdat,
        ERZET type vbak-erzet,
        ERNAM type vbak-ernam,
        ANGDT type vbak-angdt,
        BNDDT type vbak-bnddt,
        AUDAT type vbak-audat,
        VBTYP type vbak-vbtyp,
        TRVOG type vbak-trvog,
        AUART type vbak-auart,
        AUGRU type vbak-augru,
        GWLDT type vbak-gwldt,
        SUBMI type vbak-submi,
        LIFSK type vbak-lifsk,
        FAKSK type vbak-faksk,
        NETWR type vbak-netwr,
        WAERK type vbak-waerk,
        VKORG type vbak-vkorg,
       end of itab.
maheedhar-end
DATA: pripar TYPE pri_params,
      arcpar TYPE arc_params,
      lay TYPE pri_params-paart,
      lines TYPE pri_params-linct,
      rows TYPE pri_params-linsz.
DATA: val(1), val1(1).
*---> Local Printer Name defined in SAP, Change NHREMOTE to your local printer
DATA: dest TYPE pri_params-pdest VALUE 'ZNUL'.
DATA: name TYPE pri_params-plist VALUE 'Testing'.
DATA: i_pdf TYPE STANDARD TABLE OF tline.
DATA: spono TYPE tsp01-rqident.
maheedhar-start
top-of-page.
write: 'Sales Document' , 'C Date', 'Entry time', 'Created By','Quotation date',
       'Date','Document Date','SD document category','Transaction group','Sales Document Type',
       'Order reason'.
start-OF-SELECTION.
      select vbeln  ERDAT ERZET ERNAM ANGDT BNDDT AUDAT
              VBTYP  TRVOG AUART AUGRU GWLDT SUBMI LIFSK
              FAKSK  NETWR WAERK VKORG from vbak
        into table itab
        where vbeln = p_vbeln.
maheedhar-end
--- Retreive local printer details
CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    destination            = dest
    no_dialog              = 'X'
    immediately            = ' '
  IMPORTING
    out_archive_parameters = arcpar
    out_parameters         = pripar
    valid                  = val
    valid_for_spool_creation = val1
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.
IF sy-subrc NE 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*-- Set Spool printer details w.r.t local printer
pripar-prdsn = 'DSN'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    in_archive_parameters    = arcpar
    in_parameters            = pripar
    no_dialog                = 'X'
    list_name                = name
  IMPORTING
    out_archive_parameters   = arcpar
    out_parameters           = pripar
    valid                    = val
    valid_for_spool_creation = val1
  EXCEPTIONS
    archive_info_not_found   = 1
    invalid_print_params     = 2
    invalid_archive_params   = 3
    OTHERS                   = 4.
IF sy-subrc EQ 0.
---> Triggers the spool creation in the sense all the write statements from hereon will be written to spool instead of screen
  NEW-PAGE PRINT ON
  NEW-SECTION
  PARAMETERS pripar
  ARCHIVE PARAMETERS arcpar
  NO DIALOG.
ELSE.
  WRITE:/ 'Unable to create spool'.
ENDIF.
*--- Output statements
*WRITE:/ 'First Line', 'mahee','lklk','kikik','lokiuj','fffff','kijuyh','fgfgfgfg','gtgtgtgtgtgtgtgtggggggggggggggggggggggggggggggg'.
*WRITE:/ 'Second Line'.
LOOP at itab.
write: itab-vbeln,
        itab-ERDAT,
        itab-ERZET,
        itab-ERNAM,
        itab-ANGDT,
        itab-BNDDT,
        itab-AUDAT,
        itab-VBTYP.
ENDLOOP.
"---> Close spool
NEW-PAGE PRINT OFF.
spono = sy-spono.
Convert ABAP Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
  EXPORTING
    src_spoolid                    = spono
    no_dialog                      = 'X'
TABLES
   pdf                            = i_pdf
EXCEPTIONS
   err_no_abap_spooljob           = 1
   err_no_spooljob                = 2
   err_no_permission              = 3
   err_conv_not_possible          = 4
   err_bad_destdevice             = 5
   user_cancelled                 = 6
   err_spoolerror                 = 7
   err_temseerror                 = 8
   err_btcjob_open_failed         = 9
   err_btcjob_submit_failed       = 10
   err_btcjob_close_failed        = 11
   OTHERS                         = 12.
Download PDF contents to presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename                        = 'c:\test.pdf'
    filetype                        = 'BIN'
  TABLES
    data_tab                        = i_pdf
EXCEPTIONS
   file_write_error                = 1
   no_batch                        = 2
   gui_refuse_filetransfer         = 3
   invalid_type                    = 4
   no_authority                    = 5
   unknown_error                   = 6
   header_not_allowed              = 7
   separator_not_allowed           = 8
   filesize_not_allowed            = 9
   header_too_long                 = 10
   dp_error_create                 = 11
   dp_error_send                   = 12
   dp_error_write                  = 13
   unknown_dp_error                = 14
   access_denied                   = 15
   dp_out_of_memory                = 16
   disk_full                       = 17
   dp_timeout                      = 18
   file_not_found                  = 19
   dataprovider_exception          = 20
   control_flush_error             = 21
   OTHERS                          = 22.
thanks,
maheedhar

Similar Messages

  • How to display the data in PDF format : problem is splitting into 2 lines

    Hi ,
    I developed one report which downloads the data into PDF format and saved in C drive but my problem is
    in my program : Line size of the report is 255 in PDF it is splitting into 2 lines. it has to show in a single line. how to do it. how to reduce the width of the output? i am sending my code below. anybody can suggest me how to do it. if possible please send me the code.
    my code:
    report zmaheedhar.
    maheedhar-start
    TABLES : vbak.
    parameters : p_vbeln type vbak-vbeln.
    data : begin of itab occurs 0,
            vbeln type vbak-vbeln,
            ERDAT type vbak-erdat,
            ERZET type vbak-erzet,
            ERNAM type vbak-ernam,
            ANGDT type vbak-angdt,
            BNDDT type vbak-bnddt,
            AUDAT type vbak-audat,
            VBTYP type vbak-vbtyp,
            TRVOG type vbak-trvog,
            AUART type vbak-auart,
            AUGRU type vbak-augru,
            GWLDT type vbak-gwldt,
            SUBMI type vbak-submi,
            LIFSK type vbak-lifsk,
            FAKSK type vbak-faksk,
            NETWR type vbak-netwr,
            WAERK type vbak-waerk,
            VKORG type vbak-vkorg,
           end of itab.
    maheedhar-end
    DATA: pripar TYPE pri_params,
          arcpar TYPE arc_params,
          lay TYPE pri_params-paart,
          lines TYPE pri_params-linct,
          rows TYPE pri_params-linsz.
    DATA: val(1), val1(1).
    *---> Local Printer Name defined in SAP, Change NHREMOTE to your local printer
    DATA: dest TYPE pri_params-pdest VALUE 'ZNUL'.
    DATA: name TYPE pri_params-plist VALUE 'Testing'.
    DATA: i_pdf TYPE STANDARD TABLE OF tline.
    DATA: spono TYPE tsp01-rqident.
    maheedhar-start
    top-of-page.
    write: 'Sales Document' , 'C Date', 'Entry time', 'Created By','Quotation date',
           'Date','Document Date','SD document category','Transaction group','Sales Document Type',
           'Order reason'.
    start-OF-SELECTION.
          select vbeln  ERDAT ERZET ERNAM ANGDT BNDDT AUDAT
                  VBTYP  TRVOG AUART AUGRU GWLDT SUBMI LIFSK
                  FAKSK  NETWR WAERK VKORG from vbak
            into table itab
            where vbeln = p_vbeln.
    maheedhar-end
    --- Retreive local printer details
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        destination            = dest
        no_dialog              = 'X'
        immediately            = ' '
      IMPORTING
        out_archive_parameters = arcpar
        out_parameters         = pripar
        valid                  = val
        valid_for_spool_creation = val1
      EXCEPTIONS
        archive_info_not_found = 1
        invalid_print_params   = 2
        invalid_archive_params = 3
        OTHERS                 = 4.
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *-- Set Spool printer details w.r.t local printer
    pripar-prdsn = 'DSN'.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        in_archive_parameters    = arcpar
        in_parameters            = pripar
        no_dialog                = 'X'
        list_name                = name
      IMPORTING
        out_archive_parameters   = arcpar
        out_parameters           = pripar
        valid                    = val
        valid_for_spool_creation = val1
      EXCEPTIONS
        archive_info_not_found   = 1
        invalid_print_params     = 2
        invalid_archive_params   = 3
        OTHERS                   = 4.
    IF sy-subrc EQ 0.
    ---> Triggers the spool creation in the sense all the write statements from hereon will be written to spool instead of screen
      NEW-PAGE PRINT ON
      NEW-SECTION
      PARAMETERS pripar
      ARCHIVE PARAMETERS arcpar
      NO DIALOG.
    ELSE.
      WRITE:/ 'Unable to create spool'.
    ENDIF.
    *--- Output statements
    *WRITE:/ 'First Line', 'mahee','lklk','kikik','lokiuj','fffff','kijuyh','fgfgfgfg','gtgtgtgtgtgtgtgtggggggggggggggggggggggggggggggg'.
    *WRITE:/ 'Second Line'.
    LOOP at itab.
    write: itab-vbeln,
            itab-ERDAT,
            itab-ERZET,
            itab-ERNAM,
            itab-ANGDT,
            itab-BNDDT,
            itab-AUDAT,
            itab-VBTYP.
    ENDLOOP.
    "---> Close spool
    NEW-PAGE PRINT OFF.
    spono = sy-spono.
    Convert ABAP Spool to PDF
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid                    = spono
        no_dialog                      = 'X'
    TABLES
       pdf                            = i_pdf
    EXCEPTIONS
       err_no_abap_spooljob           = 1
       err_no_spooljob                = 2
       err_no_permission              = 3
       err_conv_not_possible          = 4
       err_bad_destdevice             = 5
       user_cancelled                 = 6
       err_spoolerror                 = 7
       err_temseerror                 = 8
       err_btcjob_open_failed         = 9
       err_btcjob_submit_failed       = 10
       err_btcjob_close_failed        = 11
       OTHERS                         = 12.
    Download PDF contents to presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = 'c:\test.pdf'
        filetype                        = 'BIN'
      TABLES
        data_tab                        = i_pdf
    EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       OTHERS                          = 22.
    thanks,
    maheedhar

    hi tripat,
    actual problem is what u said it is decreased the wiidht of the output.
    now the output is:
    Sales Document C Date Entry time Created By Quotation date Date Document Date
    SD document category Transaction group Sales Document Type Order reason
    62741 07/29/1996 11:54:38 DARLENE 00/00/0000 00/00/0000 07/29/1996 C
    actual output is:
    output should come in a single line. it is splitting into 2 lines.
    thanks,
    maheedhar

  • How to display the data in XML files into JSP using Jdeveloper.

    Hi All,
    I have two XML files one XML file has the view names and the other has the table names of a particular views, how to display the data in JSP using JDeveloper where when i click a particular view the list of tables of that particular view from XML file two should be displayed in JSP Page.
    Are there any reference documents, regarding the above process please can anyone guide through how to do it.

    Let the servlet ask your business tier to provide the data, then stuff it into beans, and pack those into the Session instance. Then forward the request to the JSP, let the JSP get those beans and display them.

  • How to send the output to PDF format in reports 6i?

    Hi,
    How to send the output to PDF format in reports 6i? I given Mode = BITMAP.
    DESTYPE = File, DESFORMAT = PDF, DESNAME = C:\x.pdf.
    Report is running fine. But PDF file not generated. I don't know what i missed. Any one can help this?
    Thanks
    Kavitha

    Hello,
    Do you get this problem only for DESFORMAT=PDF ?
    Test with :
    DESFORMAT = RTF, DESNAME = C:\x.rtf
    or
    DESFORMAT = HTMLCSS, DESNAME = C:\x.html
    does it work ?
    Check if DESNAME is modified in the reports itself.
    Regards

  • How to display the data of CJ2C(T-CODE) using web dynpro abap

    Hi all:
        How to display the data of CJ2C(T-CODE) using web dynpro abap.
        CJ2C used to display a Gantt Chart.
        Thanks.

    Hi,
    Create a Value attribute (resource) of type Resource, bind it with the property of File Upload UI element.
    On action place the code and Deploy the application
    byte[] bytes = new byte[ 1024];
    FileOutputStream out = new FileOutputStream( new File( <path in server>));
    InputStream in = resource.read( true);
    int len;
    while( ( len = in.read( bytes)) > 0)
         out.write( bytes, 0, len);
    in.close();
    out.close();
    Regards
         Vinod V

  • How to arrange the data in vertical format?

    Hi All,
    I am working on BI answer.Can it be possible to arrange data in vertical format?
    Actually, when we select fields , then they got arranged horizontally.
    Like :
    Customer ID | Customer Name
    But i need to display the data in vertical format like :
    Customer ID
    Customer Name
    Is it possible while displaying data? Pls help me.
    Thanks

    Use
    Customer_ID||'Less than Symbol br Greater Than Symbol'||Customer_Name
    in the Answers Formula column and change the data format to HTML. That will print the Customer ID and Customer Name one below the other.
    HTML is not allowed in the forum. So, change the Less than and Greater than Symbols above to the actual symbols while entering the formula.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • How to display the data from database(MS access) to a textbox

    anyone know ?

    how to display the data from database(MS access) to a
    textboxThe reply hasn't changed over these years. Read the tuutorial on how to fetch the data. You can display it anywhere you feel like. :)
    http://java.sun.com/docs/books/tutorial/jdbc/

  • How to display the Data labels in Chartobject Dynamically?

    Hi
    i am using Crystal Report Server XI R2 -  ReportClientDocument to generate reports dynamically.
    i want to display the data labels on the chart object in runtime. how it is possible?
    is there any way to achieve this? since it is possible in designer, i hope that there must be WAY.....
    Regards,
    Padmanaban V

    The chart analyzer is a third party tool that Crystal is licensed to use in the designer. That means in the Crystal Designer you have a lot of chart functionality, but at runtime the chart exists as part of the report object and the analyzer is not present. Therefore you have a few formatting options but not as many as in the designer.
    For details of what options you have with the chart at runtime, see these links:
    [1|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crlrfCrystalDecisionsCrystalReportsEngineChartObject_MembersTopic.htm]
    [2|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crlrfCrystalDecisionsCrystalReportsEngineChartObject_PropertiesTopic.htm]
    [3|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crlrfCrystalDecisionsCrystalReportsEngineChartObjectClassTopic.htm]
    Ludek

  • How to set the Date and Currency Formats Based on Country

    Hi Friends,
    I am designing the one Global Form it will use for all countries.
    in that Form i want to print the date and currnecy Formats based on country.
    Like
    For US i want print the date and Currency Like This.
    Date -  MM/DD/YYYY
    Curremcy - XX,XXX,XX.XX
    For DE i want print the date and Currency Like This.
    Date -  DD.MM.YYYY
    Curremcy - XX.XXX.XX,XX
    Please suggest how i can control these things through Java Script or Formcalc....

    Hi Nitin,
    thanks For ur reply,
    i tried with this solution,
    But it is displaying the default Format like bellow formats.
    For short - mm/dd/yy
    For Medium - mmm dd , yyyy
    For Long     - thursday ,mmm dd , yyyy
    it was prinitng in above mentioned format,
    but here i want to print my own format for USA like MM/DD/YYYY.

  • Camileo S20 - How to display the date and time

    Hi, to all. I have got as Christmas present the Camileo S20 and I am not able to display the date and time at video. In manual is no mention about this, just how to set the correct date and time. But what is intention of setting the date and time into camera, if it is not possible to display them on video ?

    Hi,
    of course, I did it repeatly, it is written in my question above. I am not stupid.
    This question is aimed to owners of camera Camileo S20 and also Camileo S10 - Camileo S20 is derived of Camileo S10, may be any of them discovered the way how to get the date and time into video.

  • How to set the date and time format from Windows Server 2008 R2

    Hi,
    I want to control my client's date and time format as dd/mm/yyyy format and I need to do it using the windows server 2008 R2. How can I achieve this goal?
    Yoshika04

    Hi,
    In Windows Server 2008 R2, you can use Regional Options Extension in Group Policy Preferences to configure the date and
    time format. For more information, please refer to:
    Regional Options Extension
    http://technet.microsoft.com/en-us/library/cc754496.aspx
    Regards,
    Bruce

  • How to display the data according to the search criteria

    Hi ,
    I want to display the order data in my application.
    I have certain search criteria in my application like
    ordernumber , date etc.
    If I click the submit button without giving any criteria , all the data is getting displayed properly in the table.
    But,If I want to display the data according to the order number, all the orders present are getting displayed , but actually it should display the order only for that particular order number.
    The code is  like : onActionSearch()
    wdThis.wdComponentController().executeGetlist_Input();
    Can any one tell me how to display the orders depending upon the search criteria.
    Ideas & suggestions are truely welcome.
    Thanks & Regards
    Neha Mahanty

    Hi Neha,
    Design ur RFC in such a way that it should display the result according to your search criteria.
    If you are making a search on "Order Number" pass some input(search criteria along with some parameter, if order number is not null then pass "X" as parameter) to RFC so that it will return the result accordingly. And same with date also.
    Thanks n Regards,
    Jhansi Miryala

  • How to display the data in row wise in smartform

    Hi,
        I have to make a modification a smartform of poprinting and i want to display the row wise . At present it is displaying the  
        column wise. Actually there is a text which i want to display the data row wise.
        It is possible to display the data in row wise of the text .
    Edited by: nav009 on Oct 8, 2009 10:39 AM

    Hello ,
    I  assume that your requiremen is related to smartform.the below is the solution i suggest.
    As per my understanding of your requirement ,It's clear that as of now there is some description field which is also getting displayed along with other PO fields.
    However you would like to display the description field in a new line since the length of this field is longer than other fields as a result the data is getting scattered .
    Therefore one better option could be: since the whole data from PO would be in a loop you can display all other fields in one line type of the table as per the intial requirement and you display the description line alone in a new line type wth the desired length so that data would not be scattered and no data loss would happen.
    I assume you are aware of creating of line types for table.
    Thanks
    M.Naveen.

  • How to display the data monthwise in the following report

    see the following report. i will give u the code
    if we go to fd10n then we see the monthwise debit,credit and the outstanding amount . i want to display the data monthwise in my report. means if i select the first month then it will dislpay only month of april debit, credit, and the outstanding amount.
    if anyone know the answer then please help me.
    Thanks.
    Dinesh
    *& Report  ZCUSTOMER_GROUP
    REPORT  ZCUSTOMER_GROUP NO STANDARD PAGE HEADING.
    TABLES: KNA1,KNVV,KNB1,T151T,T685T,KNVI,TSKDT,BSID,T001,KNC1,KNC3.
    TYPE-POOLS: SLIS.
    TYPES: BEGIN OF IT_FINAL,
                BZIRK LIKE KNVV-BZIRK,
                VKBUR LIKE KNVV-VKBUR,
                KDGRP LIKE KNVV-KDGRP,
                KUNNR LIKE KNVV-KUNNR,
                VKORG LIKE KNVV-VKORG,
                VTWEG LIKE KNVV-VTWEG,
                SPART LIKE KNVV-SPART,
                KTGRD LIKE KNVV-KTGRD,
                NAME1 LIKE KNA1-NAME1,
                ORT01 LIKE KNA1-ORT01,
                STCEG LIKE KNA1-STCEG,
                REGIO LIKE KNA1-REGIO,
                STRAS LIKE KNA1-STRAS,
                TELF1 LIKE KNA1-TELF1,
                WERKS LIKE KNA1-WERKS,
                SPRAS TYPE SPRAS,
                GFORM LIKE KNA1-GFORM,
                LAND1 LIKE KNA1-LAND1,
                ALTKN LIKE KNB1-ALTKN,
                AKONT LIKE KNB1-AKONT,
                VZSKZ TYPE KNB1-VZSKZ,
               VTEXT LIKE T685T-VTEXT,
                KTEXT LIKE T151T-KTEXT,
                TATYP TYPE KNVI-TATYP,
                TAXKD TYPE KNVI-TAXKD,
              taxkd type tskdt-taxkd,
              tatyp type tskdt-tatyp,
               VTEXT TYPE TSKDT-VTEXT,
               UMSKZ LIKE BSID-UMSKZ,
               DMBTR TYPE BSID-DMBTR,
              coll LIKE bsid-dmbtr,
              coll1 LIKE bsid-dmbtr,
              coll2 LIKE bsid-dmbtr,
              coll3 LIKE bsid-dmbtr,
              advance LIKE bsid-dmbtr,
              deposit LIKE bsid-dmbtr,
              amount type bsid-dmbtr,
              shkzg type bsid-shkzg,
              blart type bsid-blart,
               BUDAT TYPE BSID-BUDAT,
               BLDAT TYPE BSID-BLDAT,
              GJAHR LIKE BSID-GJAHR,
              outstand LIKE bsid-dmbtr,
              debit like bsid-dmbtr,
               UM01S LIKE KNC1-UM01S,
               UM02S LIKE KNC1-UM02S,
               UM03S LIKE KNC1-UM03S,
               UM04S LIKE KNC1-UM04S,
               UM05S LIKE KNC1-UM05S,
               UM06S LIKE KNC1-UM06S,
               UM07S LIKE KNC1-UM07S,
               UM08S LIKE KNC1-UM08S,
               UM09S LIKE KNC1-UM09S,
               UM10S LIKE KNC1-UM10S,
               UM11S LIKE KNC1-UM11S,
               UM12S LIKE KNC1-UM12S,
               UM13S LIKE KNC1-UM13S,
               UM14S LIKE KNC1-UM14S,
               UM15S LIKE KNC1-UM15S,
               UM16S LIKE KNC1-UM16S,
              DEBIT LIKE KNC1-UM01S,
               GJAHR LIKE KNC1-GJAHR,
                DEBIT TYPE STRING,
               UM01H LIKE KNC1-UM01H,
               UM02H LIKE KNC1-UM02H,
               UM03H LIKE KNC1-UM03H,
               UM04H LIKE KNC1-UM04H,
               UM05H LIKE KNC1-UM05H,
               UM06H LIKE KNC1-UM06H,
               UM07H LIKE KNC1-UM07H,
               UM08H LIKE KNC1-UM08H,
               UM09H LIKE KNC1-UM09H,
               UM10H LIKE KNC1-UM10H,
               UM11H LIKE KNC1-UM11H,
               UM12H LIKE KNC1-UM12H,
               UM13H LIKE KNC1-UM13H,
               UM14H LIKE KNC1-UM14H,
               UM15H LIKE KNC1-UM15H,
               UM16H LIKE KNC1-UM16H,
               CREDIT TYPE STRING,
               UMSAV LIKE KNC1-UMSAV,
             GJAHR LIKE KNC1-GJAHR,
               SHBKZ LIKE KNC3-SHBKZ,
               SALDV LIKE KNC3-SALDV,
               SOLLL LIKE KNC3-SOLLL,
               HABNL LIKE KNC3-HABNL,
               DOWN TYPE STRING,
               DEPOSIT TYPE STRING,
               COLL TYPE STRING,
       END OF IT_FINAL.
    TYPES : BEGIN OF IT_KNVV ,
                BZIRK LIKE KNVV-BZIRK,
                VKBUR LIKE KNVV-VKBUR,
                KDGRP LIKE KNVV-KDGRP,
                KUNNR LIKE KNVV-KUNNR,
                VKORG LIKE KNVV-VKORG,
                VTWEG LIKE KNVV-VTWEG,
                SPART LIKE KNVV-SPART,
                KTGRD LIKE KNVV-KTGRD,
    END OF IT_KNVV.
    TYPES: BEGIN OF IT_KNA1 ,
                NAME1 LIKE KNA1-NAME1,
                ORT01 LIKE KNA1-ORT01,
                STCEG LIKE KNA1-STCEG,
                REGIO LIKE KNA1-REGIO,
                STRAS LIKE KNA1-STRAS,
                TELF1 LIKE KNA1-TELF1,
                WERKS LIKE KNA1-WERKS,
                KUNNR LIKE KNA1-KUNNR,
                GFORM LIKE KNA1-GFORM,
                SPRAS TYPE SPRAS,
                LAND1 LIKE KNA1-LAND1,
    END OF IT_KNA1.
    TYPES: BEGIN OF IT_KNB1 ,
            ALTKN LIKE KNB1-ALTKN,
            AKONT LIKE KNB1-AKONT,
            VZSKZ TYPE KNB1-VZSKZ,
            KUNNR LIKE KNB1-KUNNR,
    END OF IT_KNB1.
    TYPES: BEGIN OF IT_T151T ,
           KTEXT LIKE T151T-KTEXT,
           KDGRP LIKE T151T-KDGRP,
           SPRAS TYPE SPRAS,
      END OF IT_T151T.
    DATA: BEGIN OF IT_T685T OCCURS 0,
          VTEXT LIKE T685T-VTEXT,
          spras type spras,
    END OF IT_T685T.
    TYPES: BEGIN OF IT_KNVI ,
          TAXKD TYPE KNVI-TAXKD,
          TATYP TYPE KNVI-TATYP,
          KUNNR TYPE KNVI-KUNNR,
    END OF IT_KNVI.
    TYPES: BEGIN OF IT_TSKDT ,
          TAXKD TYPE TSKDT-TAXKD,
         TATYP TYPE tskdt-TATYP,
          VTEXT TYPE TSKDT-TATYP,
          SPRAS TYPE SPRAS,
    END OF IT_TSKDT.
    TYPES: BEGIN OF IT_BSID ,
          UMSKZ TYPE BSID-UMSKZ,
          DMBTR TYPE BSID-DMBTR,
          COLL LIKE BSID-DMBTR,
          COLL1 LIKE BSID-DMBTR,
          COLL2 LIKE BSID-DMBTR,
          COLL3 LIKE BSID-DMBTR,
          ADVANCE LIKE BSID-DMBTR,
          DEPOSIT LIKE BSID-DMBTR,
           SHKZG TYPE BSID-SHKZG,
           KUNNR TYPE BSID-KUNNR,
           BUDAT TYPE BSID-BUDAT,
           BLART TYPE BSID-BLART,
           OUTSTAND LIKE BSID-DMBTR,
           GJAHR LIKE BSID-GJAHR,
       END OF IT_BSID.
    TYPES : BEGIN OF IT_KNC1,
               UM01S LIKE KNC1-UM01S,
               UM02S LIKE KNC1-UM02S,
               UM03S LIKE KNC1-UM03S,
               UM04S LIKE KNC1-UM04S,
               UM05S LIKE KNC1-UM05S,
               UM06S LIKE KNC1-UM06S,
               UM07S LIKE KNC1-UM07S,
               UM08S LIKE KNC1-UM08S,
               UM09S LIKE KNC1-UM09S,
               UM10S LIKE KNC1-UM10S,
               UM11S LIKE KNC1-UM11S,
               UM12S LIKE KNC1-UM12S,
               UM13S LIKE KNC1-UM13S,
               UM14S LIKE KNC1-UM14S,
               UM15S LIKE KNC1-UM15S,
               UM16S LIKE KNC1-UM16S,
              DEBIT LIKE KNC1-UM01S,
                DEBIT TYPE STRING,
               UM01H LIKE KNC1-UM01H,
               UM02H LIKE KNC1-UM02H,
               UM03H LIKE KNC1-UM03H,
               UM04H LIKE KNC1-UM04H,
               UM05H LIKE KNC1-UM05H,
               UM06H LIKE KNC1-UM06H,
               UM07H LIKE KNC1-UM07H,
               UM08H LIKE KNC1-UM08H,
               UM09H LIKE KNC1-UM09H,
               UM10H LIKE KNC1-UM10H,
               UM11H LIKE KNC1-UM11H,
               UM12H LIKE KNC1-UM12H,
               UM13H LIKE KNC1-UM13H,
               UM14H LIKE KNC1-UM14H,
               UM15H LIKE KNC1-UM15H,
               UM16H LIKE KNC1-UM16H,
               CREDIT TYPE STRING,
            UMSAV LIKE KNC1-UMSAV,
            KUNNR LIKE KNC1-KUNNR,
            GJAHR LIKE KNC1-GJAHR,
    END OF IT_KNC1.
    TYPES : BEGIN OF IT_KNC3,
            SHBKZ LIKE KNC3-SHBKZ,
            SALDV LIKE KNC3-SALDV,
            SOLLL LIKE KNC3-SOLLL,
            HABNL LIKE KNC3-HABNL,
            KUNNR LIKE KNC3-KUNNR,
            GJAHR LIKE KNC3-GJAHR,
            DOWN TYPE STRING,
            DEPOSIT TYPE STRING,
    END OF IT_KNC3.
    *INTERNAL TABLE DECLARATION
    DATA: I_FINAL TYPE STANDARD TABLE OF IT_FINAL,
          I_KNVV  TYPE STANDARD TABLE OF IT_KNVV,
          I_KNA1  TYPE STANDARD TABLE OF IT_KNA1,
          I_KNB1  TYPE STANDARD TABLE OF IT_KNB1,
          I_T151T  TYPE STANDARD TABLE OF IT_T151T,
          I_KNVI  TYPE STANDARD TABLE OF IT_KNVI,
          I_TSKDT  TYPE STANDARD TABLE OF IT_TSKDT,
          I_BSID  TYPE STANDARD TABLE OF IT_BSID,
          I_KNC1  TYPE STANDARD TABLE OF IT_KNC1,
          I_KNC3  TYPE STANDARD TABLE OF IT_KNC3.
    *DECLARATION FOR THE WORK AREA
    DATA: WA_FINAL TYPE IT_FINAL,
           WA_KNVV TYPE IT_KNVV,
           WA_KNA1 TYPE IT_KNA1,
           WA_KNB1 TYPE IT_KNB1,
           WA_T151T TYPE IT_T151T,
           WA_KNVI TYPE IT_KNVI,
           WA_TSKDT TYPE IT_TSKDT,
           WA_BSID TYPE IT_BSID,
           WA_KNC1 TYPE IT_KNC1,
           WA_KNC3 TYPE IT_KNC3.
    DECLARATION FOR THE FIELD CATALOG.
    DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          WA_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA  GD_REPID LIKE SY-REPID.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    BREAK-POINT.
    SELECT-OPTIONS: CUST_GRP FOR KNVV-KDGRP.
    SELECT-OPTIONS: SALES_OF FOR KNVV-VKBUR.
    SELECT-OPTIONS: REGION FOR KNA1-REGIO.
    SELECT-OPTIONS: DATE FOR BSID-BLDAT.
    SELECT-OPTIONS: YEAR FOR KNC1-GJAHR.
    SELECT-OPTIONS: CUST_NO FOR KNVV-KUNNR.
    SELECTION-SCREEN :END OF BLOCK B1.
    * DECLARATION FOR THE SUBROUTIN FOR BASIC LIST.
    PERFORM data_retrival.
    PERFORM F_GET_I_KNVV_DATA.
    PERFORM F_GET_I_KNA1_DATA.
    PERFORM F_GET_I_KNB1_DATA.
    PERFORM F_GET_I_T151T_DATA.
    *PERFORM F_GET_IT_T685T_DATA.
    PERFORM F_GET_I_KNVI_DATA.
    PERFORM F_GET_I_TSKDT_DATA.
    PERFORM F_GET_I_BSID_DATA.
    PERFORM F_GET_I_KNC1_DATA.
    PERFORM F_GET_I_KNC3_DATA.
    PERFORM F_GET_I_FINAL_DATA.
      PERFORM DATA_BUILD.
      PERFORM DATA_CALL.
    FORM F_GET_I_KNVV_DATA.
    SELECT BZIRK KDGRP KTGRD KUNNR SPART VKBUR VKORG VTWEG
    FROM KNVV
    INTO CORRESPONDING FIELDS OF TABLE I_KNVV
    WHERE KDGRP IN CUST_GRP AND VKBUR IN SALES_OF AND KUNNR IN CUST_NO.
    ENDFORM.
    FORM F_GET_I_KNA1_DATA.
    SELECT KUNNR NAME1 ORT01 REGIO STCEG STRAS TELF1 WERKS  GFORM SPRAS LAND1
    FROM KNA1
    INTO CORRESPONDING FIELDS OF TABLE I_KNA1 FOR ALL ENTRIES IN I_KNVV
      WHERE KUNNR = I_KNVV-KUNNR AND  REGIO IN REGION AND LAND1 = 'IN' .
    ENDFORM.
    FORM F_GET_I_KNB1_DATA.
    SELECT ALTKN AKONT VZSKZ KUNNR
    FROM KNB1
    INTO CORRESPONDING FIELDS OF TABLE I_KNB1 FOR ALL ENTRIES IN I_KNVV
    WHERE KUNNR = I_KNVV-KUNNR.
      ENDFORM.
    FORM F_GET_I_T151T_DATA.
    SELECT KTEXT KDGRP SPRAS
    FROM T151T
    INTO CORRESPONDING FIELDS OF TABLE I_T151T FOR ALL ENTRIES IN I_KNVV
    WHERE KDGRP = I_KNVV-KDGRP AND SPRAS = 'E' .
    ENDFORM.
    *FORM F_GET_IT_T685T_DATA.
    *select vtext spras
    *from t685t
    *into CORRESPONDING FIELDS OF TABLE it_t685t for all entries in it_kna1
    where spras = it_kna1-spras and spras = 'E'.
    *endform.
    FORM F_GET_I_KNVI_DATA.
    SELECT TAXKD TATYP KUNNR
    FROM KNVI
    INTO CORRESPONDING FIELDS OF TABLE I_KNVI FOR ALL ENTRIES IN I_KNVV
    WHERE KUNNR = I_KNVV-KUNNR
    AND TAXKD = '8' OR TAXKD = '3' OR TAXKD = '0'
    AND TATYP = 'Z1AU' OR TATYP = 'ZCST'.
    *and ( taxkd = '8' or taxkd = '0' or taxkd = '3')
    and ( tatyp = 'Z1AU' OR TATYP = 'ZCST' ).
    ENDFORM.
    FORM F_GET_I_TSKDT_DATA.
    SELECT VTEXT TAXKD SPRAS FROM
    TSKDT
    INTO CORRESPONDING FIELDS OF TABLE I_TSKDT FOR ALL ENTRIES IN I_KNVI
    WHERE TAXKD = I_KNVI-TAXKD AND SPRAS = 'E'.
    ENDFORM.
    FORM F_GET_I_BSID_DATA.
    *DATA: DMBTR TYPE BSID-DMBTR,
         OUTSTAND LIKE BSID-DMBTR.
    SELECT UMSKZ DMBTR SHKZG KUNNR BLART GJAHR BUDAT BLDAT
    FROM BSID
    INTO CORRESPONDING FIELDS OF TABLE I_BSID
    FOR ALL ENTRIES IN I_KNVV
    WHERE KUNNR = I_KNVV-KUNNR AND BLDAT IN DATE.
    *AND  ( BLART = 'HR' OR BLART = 'DZ' OR BLART = 'P1'  )
    *and umskz = 'A' or umskz = 'L' OR UMSKZ = ''
    *AND SHKZG = 'S' OR SHKZG = 'H'.
    ENDFORM.
    FORM F_GET_I_KNC1_DATA.
    SELECT UM01S UM02S UM03S UM04S UM05S UM06S UM07S UM08S UM09S UM10S UM11S UM12S UM13S UM14S UM15S UM16S
           UM01H UM02H UM03H UM04H UM05H UM06H UM07H UM08H UM09H UM10H UM11H UM12H UM13H UM14H UM15H UM16H
           UMSAV KUNNR GJAHR
    FROM KNC1
    INTO CORRESPONDING FIELDS OF TABLE I_KNC1
    FOR ALL ENTRIES IN I_KNVV
    WHERE KUNNR = I_KNVV-KUNNR AND GJAHR IN YEAR .
    ENDFORM.
    FORM F_GET_I_KNC3_DATA.
    SELECT KUNNR GJAHR SHBKZ SALDV SOLLL HABNL
    FROM KNC3
    INTO CORRESPONDING FIELDS OF TABLE I_KNC3
    FOR ALL ENTRIES IN I_KNVV
    WHERE KUNNR = I_KNVV-KUNNR
    AND SHBKZ = 'A' OR SHBKZ = 'L'.
    ENDFORM.
    FORM F_GET_I_FINAL_DATA.
    *BREAK-POINT.
    LOOP AT I_KNVV INTO WA_KNVV.
    CLEAR WA_FINAL.
    WA_FINAL-BZIRK = WA_KNVV-BZIRK.
    WA_FINAL-VKBUR = WA_KNVV-VKBUR.
    WA_FINAL-KDGRP = WA_KNVV-KDGRP.
    WA_FINAL-KUNNR = WA_KNVV-KUNNR.
    WA_FINAL-VKORG = WA_KNVV-VKORG.
    WA_FINAL-VTWEG = WA_KNVV-VTWEG.
    WA_FINAL-SPART = WA_KNVV-SPART.
    WA_FINAL-KTGRD = WA_KNVV-KTGRD.
    READ TABLE I_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_KNVV-KUNNR.
    WA_FINAL-NAME1 = WA_KNA1-NAME1.
    WA_FINAL-ORT01 = WA_KNA1-ORT01.
    WA_FINAL-STCEG = WA_KNA1-STCEG.
    WA_FINAL-REGIO = WA_KNA1-REGIO.
    WA_FINAL-STRAS = WA_KNA1-STRAS.
    WA_FINAL-TELF1 = WA_KNA1-TELF1.
    WA_FINAL-WERKS = WA_KNA1-WERKS.
    WA_FINAL-GFORM = WA_KNA1-GFORM.
    WA_FINAL-LAND1 = WA_KNA1-LAND1.
    IF SY-SUBRC = 0.
    ENDIF.
    READ TABLE I_KNB1 INTO WA_KNB1 WITH KEY KUNNR = WA_KNVV-KUNNR.
    IF SY-SUBRC = 0.
    WA_FINAL-ALTKN = WA_KNB1-ALTKN.
    WA_FINAL-AKONT = WA_KNB1-AKONT.
    WA_FINAL-VZSKZ = WA_KNB1-VZSKZ.
    ENDIF.
    READ TABLE I_T151T INTO WA_T151T WITH KEY KDGRP = WA_KNVV-KDGRP .
    IF SY-SUBRC = 0.
    WA_FINAL-KTEXT = WA_T151T-KTEXT.
    ENDIF.
    READ TABLE I_KNVI INTO WA_KNVI  WITH KEY KUNNR = WA_KNVV-KUNNR.
    IF SY-SUBRC = 0.
    WA_FINAL-TAXKD = WA_KNVI-TAXKD.
    WA_FINAL-TATYP = WA_KNVI-TATYP.
    ENDIF.
    READ TABLE I_TSKDT INTO WA_TSKDT WITH KEY TAXKD = WA_KNVI-TAXKD
    WA_FINAL-VTEXT = WA_TSKDT-VTEXT.
    *UP TO THIS POINT REPORT IS OK
    *read table I_bsid INTO WA_BSID with key kunnr = WA_kna1-kunnr
                               UMSKZ = 'A' .
    *if sy-subrc = 0.
    *WA_final-DOWN = WA_bsid-dmbtr * -1.
    **modify i_final.
    **clear it_bsid.
    *endif.
    *read table i_bsid INTO WA_BSID with key kunnr = WA_kna1-kunnr
                               UMSKZ = 'L'  .
    *if sy-subrc = 0.
    *WA_final-deposit = WA_bsid-dmbtr * -1.
    *endif.
    *read table i_bsid INTO WA_BSID with key kunnr = WA_kna1-kunnr
                               blart = 'DZ' .
    **IF BLART = 'HR' OR BLART = 'DZ' OR BLART = 'P1'.
    *if sy-subrc = 0.
    *WA_final-coll1 = WA_bsid-dmbtr * -1.
    *ENDIF.
    *read table i_bsid INTO WA_BSID with key kunnr = WA_kna1-kunnr
                               blart = 'HR' .
    **IF BLART = 'HR' OR BLART = 'DZ' OR BLART = 'P1'.
    *if sy-subrc = 0.
    *WA_final-coll2 = WA_bsid-dmbtr * -1.
    *ENDIF.
    *read table i_bsid INTO WA_BSID with key kunnr = WA_kna1-kunnr
                               blart = 'P1' .
    **IF BLART = 'HR' OR BLART = 'DZ' OR BLART = 'P1'.
    *if sy-subrc = 0.
    *WA_final-coll3 = WA_bsid-dmbtr * -1.
    *ENDIF.
    *read table i_bsid INTO WA_BSID with key kunnr = WA_kna1-kunnr.
    **IF BLART = 'HR' OR BLART = 'DZ' OR BLART = 'P1'.
    *if sy-subrc = 0.
    *WA_final-coll = ( WA_final-coll1 + WA_final-coll2 + WA_final-coll3 ) - ( wa_final-deposit ) * -1.
    *ENDIF.
    *read table i_bsid INTO WA_BSID with key kunnr = WA_kna1-kunnr
                               UMSKZ = 'L'  .
    *if sy-subrc = 0.
    *WA_final-deposit = WA_bsid-dmbtr * -1.
    *endif.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM01S = WA_KNC1-UM01S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM02S = WA_KNC1-UM02S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM03S = WA_KNC1-UM03S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM04S = WA_KNC1-UM04S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM05S = WA_KNC1-UM05S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM06S = WA_KNC1-UM06S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM07S = WA_KNC1-UM07S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM08S = WA_KNC1-UM08S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM09S = WA_KNC1-UM09S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM10S = WA_KNC1-UM10S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM11S = WA_KNC1-UM11S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM12S = WA_KNC1-UM12S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM13S = WA_KNC1-UM13S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM14S = WA_KNC1-UM14S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM15S = WA_KNC1-UM15S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM16S = WA_KNC1-UM16S.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR  .
    IF SY-SUBRC = 0.
    WA_FINAL-DEBIT = WA_KNC1-UM01S + WA_KNC1-UM02S + WA_KNC1-UM03S + WA_KNC1-UM04S + WA_KNC1-UM05S + WA_KNC1-UM06S + WA_KNC1-UM07S +
                     WA_KNC1-UM08S + WA_KNC1-UM09S + WA_KNC1-UM10S + WA_KNC1-UM11S + WA_KNC1-UM12S + WA_KNC1-UM13S + WA_KNC1-UM14S +
                     WA_KNC1-UM15S + WA_KNC1-UM16S .
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR.
    IF SY-SUBRC = 0.
    WA_FINAL-UM01H = WA_KNC1-UM01H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM02H = WA_KNC1-UM02H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM03H = WA_KNC1-UM03H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM04H = WA_KNC1-UM04H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM05H = WA_KNC1-UM05H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM06H = WA_KNC1-UM06H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM07H = WA_KNC1-UM07H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM08H = WA_KNC1-UM08H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM09H = WA_KNC1-UM09H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM10H = WA_KNC1-UM10H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM11H = WA_KNC1-UM11H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM12H = WA_KNC1-UM12H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM13H = WA_KNC1-UM13H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM14H = WA_KNC1-UM14H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM15H = WA_KNC1-UM15H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-UM16H = WA_KNC1-UM16H.
    ENDIF.
    READ TABLE I_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNVV-KUNNR
    IF SY-SUBRC = 0.
    WA_FINAL-CREDIT = WA_KNC1-UM01H + WA_KNC1-UM02H + WA_KNC1-UM03H + WA_KNC1-UM04H + WA_KNC1-UM05H + WA_KNC1-UM06H + WA_KNC1-UM07H +
                     WA_KNC1-UM08H + WA_KNC1-UM09H + WA_KNC1-UM10H + WA_KNC1-UM11H + WA_KNC1-UM12H + WA_KNC1-UM13H + WA_KNC1-UM14H +
                     WA_KNC1-UM15H + WA_KNC1-UM16H .
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                                SHBKZ  = 'A' .
    IF SY-SUBRC = 0.
    WA_FINAL-SALDV = WA_KNC3-SALDV  .
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                                 SHBKZ = 'A' .
    IF SY-SUBRC = 0.
    WA_FINAL-SOLLL = WA_KNC3-SOLLL  .
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                                 SHBKZ = 'A' .
    IF SY-SUBRC = 0.
    WA_FINAL-HABNL = WA_KNC3-HABNL  .
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                        SHBKZ = 'A'  .
    IF SY-SUBRC = 0.
    WA_FINAL-DOWN =   WA_KNC3-SALDV + WA_KNC3-SOLLL + WA_KNC3-HABNL  * -1.
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                SHBKZ = 'L' .
    IF SY-SUBRC = 0.
    WA_FINAL-SALDV = WA_KNC3-SALDV  .
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                SHBKZ = 'L' .
    IF SY-SUBRC = 0.
    WA_FINAL-SOLLL = WA_KNC3-SOLLL  .
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                SHBKZ = 'L' .
    IF SY-SUBRC = 0.
    WA_FINAL-HABNL = WA_KNC3-HABNL  .
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR
                                SHBKZ = 'L'  .
    IF SY-SUBRC = 0.
    WA_FINAL-DEPOSIT =  WA_KNC3-SALDV + WA_KNC3-SOLLL + WA_KNC3-HABNL * -1.
    ENDIF.
    READ TABLE I_KNC3 INTO WA_KNC3 WITH KEY KUNNR = WA_KNVV-KUNNR GJAHR = WA_KNC1-GJAHR.
    IF SY-SUBRC = 0.
    WA_FINAL-COLL =  WA_FINAL-DOWN - WA_FINAL-DEPOSIT.
    ENDIF.
    APPEND WA_FINAL TO I_FINAL.
    ENDLOOP.
    ENDFORM.
    FORM DATA_BUILD.
      CLEAR WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'NAME1'.
      WA_FIELDCATALOG-SELTEXT_M = 'NAME'.
    fieldcatalog-col_pos = 1.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'ORT01'.
      WA_FIELDCATALOG-SELTEXT_M = 'CITY'.
    fieldcatalog-col_pos = 2.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
    WA_FIELDCATALOG-FIELDNAME = 'STCEG'.
      WA_FIELDCATALOG-SELTEXT_M = 'VAT. REG. NO.'.
    fieldcatalog-col_pos = 3.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
    WA_FIELDCATALOG-FIELDNAME = 'REGIO'.
      WA_FIELDCATALOG-SELTEXT_M = 'REGION'.
    fieldcatalog-col_pos = 4.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
    WA_FIELDCATALOG-FIELDNAME = 'STRAS'.
      WA_FIELDCATALOG-SELTEXT_M = 'STREET'.
    fieldcatalog-col_pos = 5.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
    WA_FIELDCATALOG-FIELDNAME = 'TELF1'.
      WA_FIELDCATALOG-SELTEXT_M = 'TELEPHONE'.
    fieldcatalog-col_pos = 6.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
    WA_FIELDCATALOG-FIELDNAME = 'WERKS'.
      WA_FIELDCATALOG-SELTEXT_M = 'PLANT'.
    fieldcatalog-col_pos = 7.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
    WA_FIELDCATALOG-FIELDNAME = 'BZIRK'.
      WA_FIELDCATALOG-SELTEXT_M = 'SALES DISTRICT'.
    fieldcatalog-col_pos = 8.
      WA_FIELDCATALOG-OUTPUTLEN = 15 .
    fieldcatalog-emphasize = 'X'. " COLOR OF THIS COLUMN.
      APPEND WA_FIELDCATALOG TO FIELDCATALOG.
    CLEAR WA_FIELDCATALOG.
    WA_FIELDCATALOG-FIELDNAME = 'VKBUR'.
      WA_FIELDCATALOG-SELTEXT_M = 'SALES OFFICE'.

    hi dinesh......
    please use  'INTO TABLE' instead of  ' INTO CORRESPONDING FIELDS OF TABLE '.  and use ' FOR ALL ENTRIES '............based on relavence ....coz when I set break point  over the select queries it took me long time to execute .......
    becoz u didnt used the for all entries  in select query ............ u r read statement
    READ TABLE I_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_KNVV-KUNNR.  ..... 
    it is reading wrong kunnr value .............even it took long time to execute ......
    use sort where ever required...
    use for all entries .......and check weather the table initial or not......
    use sy-subrc check where ever reqired ..............

  • How to display the data of a structure in a report

    i want to display the data of a structure resbd.
    i know it does not have data.
    but it contains data at runtime
    plz help
    thanx

    Hi,
       For displaying the data of a structure you can use the write statement.
    WRITE : structurename - fieldname.
    eg : write : resbd-rsnum.
    Before that you need to declare the structure name inside the report.
                  Please refer the following code for your querry
    REPORT ZSTRUCTDATA .
    Table Declaration
    tables : resbd.
    Assigning Values to Structure Fields
    resbd-rsnum = 1234.
    resbd-rspos = 12.
    Displaying Values
    write : / resbd-rsnum.
    write : / resbd-rspos.
    This report will give the output like this.
    0000001234
    0012
    Regards,
    LIJO JOHN.

Maybe you are looking for