HOW TO KEEP FIELD NAMES IN GUI_DOWNLOAD

Hai,
can u answer this.

HI ravi,
pass all the column names in an internal table and pass the internal table in the field names parameter of the FIELDNAMES of tables parameters..
IMPORTING
  FILELENGTH                      =
  TABLES
    DATA_TAB                        = itab
FIELDNAMES                      = it_fieldnames
PLS CHECK THE SIMPLE CODE BELOW...
data: begin OF itab occurs 0,
      matnr like mara-matnr,
      end of itab.
      data : begin of it_fieldnames occurs 0,
             name(100),
             end of it_fieldnames.
  it_fieldnames-name = 'MATNR'.
  APPEND IT_FIELDNAMES.
select matnr from mara into table itab UP TO 10 ROWS.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
  BIN_FILESIZE                    =
    FILENAME                        = 'C:\Documents and Settings\sampath\Desktop\flatfile.txt'
    FILETYPE                        = 'ASC'
  APPEND                          = ' '
  WRITE_FIELD_SEPARATOR           = ' '
  HEADER                          = '00'
  TRUNC_TRAILING_BLANKS           = ' '
  WRITE_LF                        = 'X'
  COL_SELECT                      = ' '
  COL_SELECT_MASK                 = ' '
  DAT_MODE                        = ' '
  CONFIRM_OVERWRITE               = ' '
  NO_AUTH_CHECK                   = ' '
  CODEPAGE                        = ' '
  IGNORE_CERR                     = ABAP_TRUE
  REPLACEMENT                     = '#'
  WRITE_BOM                       = ' '
  TRUNC_TRAILING_BLANKS_EOL       = 'X'
  WK1_N_FORMAT                    = ' '
  WK1_N_SIZE                      = ' '
  WK1_T_FORMAT                    = ' '
  WK1_T_SIZE                      = ' '
IMPORTING
  FILELENGTH                      =
  TABLES
    DATA_TAB                        = itab
   FIELDNAMES                      = IT_FIELDNAMES
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
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
hope this helps u a bit,
all the best,
regards,
sampath
mark helpful answers
Message was edited by:
        sampath pilla

Similar Messages

  • How to keep file name in print queue when printing crystal report

    We are using VB .Net 2003 + Crystal Report 2008 SP2 up to Fix Pack 2.6
    When the VB program spools crystal report files to print queue, the print queue only shows "Crystal Report" for each document.  How to keep the original file name?  In the past when we were using Crystal Report 11, the original file name can be shown in the print queue.
    Please help because it's so important for operation to see which report is failed in printing when reports are printed in batch.
    Thanks

    Hello,
    Set the PrintOption.JobTitle value for the print job. Here's C# code on how to:
                   System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
                CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptionsClass();
                CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions newOpts = new PrintOptionsClass();
                   pDoc.PrinterSettings.PrinterName = cboCurrentPrinters.Text;          
                   rasPROpts.PrinterName = cboCurrentPrinters.Text;               
                   rasPROpts.PaperSize = (CrPaperSizeEnum)
                        pDoc.PrinterSettings.PaperSizes[cboCurrentPaperSizes.SelectedIndex].Kind;
                // this sets the name of the print job
                rasPROpts.JobTitle = "MYPrintJob";
                   rptClientDoc.PrintOutputController.PrintReport(rasPROpts);
                   MessageBox.Show("Printing report.", "RAS", MessageBoxButtons.OK,MessageBoxIcon.Information );
    Thank you
    Don

  • Not able to download the field names in GUI_DOWNLOAD(very urgent)

    Hi All,
    I am downloading the file contents to the presentation server.i am able to get the file contents proeprly but not able to download the field names into text file.
    Can anybody please help me in this issue..? its very urgent. Valuable answers will be rewarded.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = w_filename
          filetype                = 'DAT'
         write_field_seperator   = c_x
          col_select              = c_x
          COL_SELECT_MASK         = t_mask
        TABLES
          data_tab                = t_tab
          fieldnames              = t_colnames
        EXCEPTIONS
    Thanks & Regards,
    Satish.

    Hi,
    I have tried in both ways its not working.
    while a ran the program it is going to the dump.
    I am working in mySAP ECC6.0
    Can pl you suggest other way..
    Thanks & Regards,
    Satish.

  • How to keep field as mandatory in function module

    I have one field in import parameter can you please suggest how to keep it as mandatory
    Thnx

    In IMPORT parameter tab you have one checkbox OPTIONAL, if you check it that field will be optional otherwise it is mandatory.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • How to view field name for a field in Oracle form?

    I was told you can do this but I forgot how.
    If you want to build a report, but don't know what the field name is in Oracle, you can open up the Oracle form and find the screen with that field name and do a trick that tells you the Oracle field name. Any help?

    Try this....
    REPORT ZZDYNAMIC_FIELD.
    DATA: BEGIN OF it1 OCCURS 0,
    printer(10) TYPE c,
    paper1(20) TYPE c,
    paper2(20) TYPE c,
    paper3(20) TYPE c,
    END OF it1.
    DATA: descr_ref TYPE REF TO cl_abap_tabledescr,
          i         TYPE i.
    FIELD-SYMBOLS:
      <key_comp_wa> TYPE abap_keydescr,
      <field>       TYPE ANY.
    it1-printer = 'MUC123'.
    it1-paper1 = 'KBLOGO'.
    it1-paper2 = 'BLANK'.
    it1-paper3 = 'DINA5'.
    APPEND it1.
    it1-printer = 'MUC123'.
    it1-paper3 = 'KBLOGO'.
    it1-paper2 = 'BLANK'.
    it1-paper1 = 'DINA5'.
    APPEND it1.
    TRY.
        descr_ref ?= cl_abap_typedescr=>describe_by_data( it1[] ).
      CATCH cx_root.
    ENDTRY.
    LOOP AT it1.
      i = 0.
      WHILE 1 = 1.
        i = i + 1.
        ASSIGN COMPONENT i OF STRUCTURE it1 TO <field>.
        if <field> is not assigned.
          EXIT.
        endif..
        IF <field> IS ASSIGNED AND <field> EQ 'KBLOGO'.
          READ TABLE descr_ref->key INDEX i ASSIGNING <key_comp_wa>.
          WRITE <key_comp_wa>-name.
          exit.
        ENDIF.
      ENDWHILE.

  • How to identify field names and table names as per the client requirement

    Dear All,
    i am preparing reports for my client of their own requirement, but in sap how can i find the field name, table names like  for eg: doc.no, issue,revision no, revision date, date of issue,date of completion, job card no,identificatin no, part no , accept,inspected,testedby, remarks, issue, process.
    so please tell what is the path to find the field names and table nae

    Hi,
    You can select the field which field name and table you want to know, just press F1 button, one more window will open. There you need to select the technical information icon, then you will get the required field name and its table.
    Regards,
    V. Suresh

  • How to find Field Name and Table Name

    Hi All,
    I got some output values from the legacy system with me but need to know whats the actual field name and table name to which i need to transfer these values. How can i do it, since which theres is not field name or despcription given for the data.
    Is there any way i can do it.
    Points will be rewarded for all useful answers.
    Regards
    AB

    Hi All,
    I got some output values from the legacy system with me but need to know whats the actual field name and table name to which i need to transfer these values. How can i do it, since which theres is not field name or despcription given for the data.
    Is there any way i can do it.
    Points will be rewarded for all useful answers.
    Regards
    AB
    Hi Abuser,
            now u have legacy data. now u want to do upload this data from legacy to r/3 by using one sap transaction. yes ok na..
      first of all u want to know the data is relevant to the which transaction...
       without knowing the transaction u cant trasfer the data..
    then open transaction put cursor on i/p field and click on f1
    and find out the field name & table..
    this is one method to find the field name and table name.

  • How to extract field name, length, descrip & field type out of repository

    How can I  extract field name, length, descrip & field type out of repository?  Or is it possible?

    Hi Victor,
    To get any info about any field you should know the code of that field that we specify in console while  creating field.
    Using this code you will get property whatever you defined in consloe.
    RepositorySchemaEx repositoryschema= MetadataManager.getInstance().getRepositorySchema(usrCtx);
    where usrctx is usersession context that you create to access yr repository
    FieldProperties fProp = repositoryschema.getField(tableName,fieldCode);
    where tablename is tablecode in which field belong
    field code is code of field that you define in console for that field
    if you check with frop then it will show  the general properties like type etc.
    suppose yr field of type text field then you can acces all properties that is coomon as well that is respective to text type field.
    FixedWidthTextFieldProperties textField = ( FixedWidthTextFieldProperties) fProp
    if you have other field type then that use thta properties . you will get in java api docs on help.sap.com whatever the properties MDM supporting.
    Hope ot helps  you get the solution
    thanks,
    sudhanshu

  • In sets (t-code GS01-04): How to change Field name

    HI,
    I have created sets for rule in validation by t-code GS01. Where I have given Tbale name BSEG and Field name KOSTL(Cost Center No). Now, I want to change field name SAKNR (GL NO) instead of cost center. When I am trying to change field name t-code GS02, there is field name is in display mode and no way to change it.
    As I have lot of entries in each set, so that creation of new sets is very hard job again. Further when I trying to create new sets by reference it didnt change the table name and field name.
    Please provide me a solution.
    Khalid

    Hi,
    Hope it is not possible, logically total field is changing and the dependent entrie will not stay as it is. I don't think this is possible.
    Eventhough the values are same but the fields are different.
    VVR

  • How to translate field names in SAP R/3 (SE63)?

    Hi gurus,
    I actually have an unsolved with my translation job in SAP R/3. It's urgent and I just can't find a solution for that:
    I'm using the translation menu with transaction SE63.
    Though I have translated the object types domain (DOM), data elements (DTEL) and table descriptions (TABT), I get no translated field name (e.g. in selection screens for summary tables).
    Which object type do I have to translate? Or is there another SAP transaction or a table where I can translate the field names?
    Thank you for answering!
    Best regards
    T. Duong

    Dear T. Duong,
    In SE63 -> Repository Texts.
    Also, visit Note 585116.
    WebAs Support Package 25 converts the SAP translation environment (SE63) to a Unicode-enabled version for short text translation. This conversion requires some system adjustments before translation can continue.
    If you never translated in your system before Support Package 25 was imported, you can simply ignore this note because your system does not contain any translation data that needs converting.
    Please download the current documentation attached to this note:
    Choose file UC-SE63_DE.PDF or UC-SE63_EN.PDF if you want to read the end user documentation.
    Choose file UC-TransAdmin-DE.PDF or UC-TransAdmin-EN.PDF if you want to learn more about translation system setup and coordination.
    If your system does not yet run on a Unicode basis, you must make the
    technical adjustments described on the first page of the documentation.
    If yours is already a Unicode system, create an OSS message and assign it to the component BC-DOC-TTL.
    Should you have to translate from a Business Warehouse (BW) environment, please refer to the Quick Guide to generating worklists in transaction SLWB attached to this note (files QuickGuideTransAdmin-DE.PDF or QuickGuideTransAdmin-EN.PDF).
    Regards,
    Naveen.

  • How to find field name for BDC

    Hi,
    to find out the field name for BDC ,
    1. press F1 for that field
    2. click technical info
    3. use SCRREN FIELD name given in Field desc for batch input.
    NOw what to do if SCREEN field name in "Field desc for batch input." is not given...Even During BDC recording if we input values in those fields,values are saved in appropritae tables but not inn BDC recording fields

    Hi again,
    1. ABSOLUTELY Sure.
    2. Container (Container Control)
       is nothing but an EMPTY control
       to place controls inside it.
        eg. Its a FRAME
        inside which, there are contros!
    3. Container does not have any INPUT VALUE !
    regards,
    amit m.

  • How to give field name to Receiver File Name.

    Hi ,
    In my source target structure there is a field name
    "job id" .
    I need that value coming in that field name to be given to
    Receiver File Name.
    Thanks in Advance

    Hi,
    You could use the field name to the File Name. For that you could go ahead with variable substituiton in receiver communication channel.
    In receiver Communication channel use variable substitution as
    In file name -- %Var1%
    In Variable substitution parameter give Var1 ---> payload:<field Name>
    Refer
    SAP Network Blog: An interesting usage of Variable Substitution in XI
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    variable substitution
    http://help.sap.com/saphelp_nw2004s/helpdata/en/8e/464442c1a1c253e10000000a1550b0/content.htm
    Also see the below links to use the dynamic variable substitution
    /people/michal.krawczyk2/blog/2005/03/29/xi-error--unable-to-convert-the-sender-service-to-an-ale-logical-system
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Also
    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1
    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2
    Thanks
    swarup

  • How to find field name based on screen field name

    Hi all,
    I need to find field name at run time based on screen field name for doing some check.
    Eg, if i have P_CUST on screeen which refers to KUNNR . Then i should be able to find KUNNR based on screen name ie P_CUST during run time.
    Thanks in advance.
    Thanks and Regards,
    Taranam

    Hi
    ex:
    PARAMETERS :
      p_carrid LIKE spfli-carrid,
      p_connid LIKE spfli-connid.
    DATA:
      T_DYNPRO TYPE
      STANDARD TABLE
            OF DYNPREAD
          WITH HEADER LINE,
      W_PROG LIKE D020S-PROG,
      W_DYNP LIKE D020S-DNUM.
    CLEAR: FIELD_VALUE, T_DYNPRO.
      FIELD_VALUE-FIELDNAME = 'P_CARRID'.
      APPEND FIELD_VALUE TO T_DYNPRO.
    w_prog = sy-repid.
    w_dynp = sy-dynnr.
    ***TO READ VALUES on screen
    CALL FUNCTION 'DYNP_VALUES_READ'
           EXPORTING
                DYNAME                   = W_PROG
                DYNUMB                   = W_DYNP
                TRANSLATE_TO_UPPER       = 'X'
           TABLES
                DYNPFIELDS               =  T_DYNPRO.
    Reward if helpful.
    Best Wishes,
    Chandralekha

  • How to get field name dynamically of a table

    Hi,
    I have a table which has 5 fields, now i want to know the name of the fields dynamically at run time
    not the values each fields hold.
    I have tried field symbols, get reference but all i got the value of the field not the field name.
    is there any way  i can get the field name.
    regards,
    mayank

    1. If it is a DDIC table, you can use the FM 'DDIF_FIELDINFO_GET'. Search in SDN for details.
    2. If it is an internal table, check this code:
    TYPE-POOLS: abap.
    PARAMETERS p_table TYPE tabname .
    DATA: lcl_table TYPE REF TO cl_abap_tabledescr,
          lcl_struc TYPE REF TO cl_abap_structdescr,
          it_fields TYPE abap_compdescr_tab,
          wa_fields TYPE abap_compdescr.
    DATA: dref TYPE REF TO data.
    FIELD-SYMBOLS: <itab> TYPE ANY.
    CREATE DATA dref TYPE STANDARD TABLE OF (p_table).
    ASSIGN dref->* TO <itab>.
    START-OF-SELECTION.
    * Get the Table details
      lcl_table ?= cl_abap_typedescr=>describe_by_data( <itab> ).
    * Get the table line type i.e., structure details
      lcl_struc ?= lcl_table->get_table_line_type( ).
    * Get the components(fields) of the table line
      it_fields = lcl_struc->components.
      LOOP AT it_fields INTO wa_fields.
        WRITE: / wa_fields-name.
      ENDLOOP.
    BR,
    Suhas

  • Reg: Field Names in GUI_DOWNLOAD

    Hi Sapers,
    I want to keep the Field Headings in XLS file.Here I am using the FM GUI_DOWNLOAD, and passing the Tables parameter(i.e, fieldnames) .But my heading is truncated to 10 char.
    as the way the FM does.
    How can I satisfy my client.Plz help me out.
    regards,
    sri...

    yah, sure.
    here is my code, from type-pools....
    *---- TYPE-POOLS DECLARATION -*
    TYPE-POOLS:truxs.
    *---- SELECTION SCREEN BLOCK -*
    SELECTION-SCREEN BEGIN OF BLOCK sri. " WITH FRAME TITLE INPUT'.
    PARAMETERS   p_bukrs TYPE t001-bukrs OBLIGATORY VALUE CHECK.
    PARAMETERS : pperiod(2) TYPE c,
                 pyear(4)   TYPE c,
                 p_file TYPE rlgrap-filename OBLIGATORY default 'C:\Documents and Settings\srikanth\Desktop\rep1.xls'.
    PARAMETERS : csvfile  RADIOBUTTON GROUP rg1,     "factfile RADIOBUTTON GROUP rg1,
                 excel    RADIOBUTTON GROUP rg1 default 'X',
                 text     RADIOBUTTON GROUP rg1.
    SELECTION-SCREEN END OF BLOCK sri.
    *---- TYPES DECLARATION -*
    TYPES : BEGIN OF ty_faglflext,
              tslvt TYPE faglflext-tslvt,
              tsl01 TYPE faglflext-tsl01,
              tsl02 TYPE faglflext-tsl02,
              tsl03 TYPE faglflext-tsl03,
              tsl04 TYPE faglflext-tsl04,
              tsl05 TYPE faglflext-tsl05,
              tsl06 TYPE faglflext-tsl06,
              tsl07 TYPE faglflext-tsl07,
              tsl08 TYPE faglflext-tsl08,
              tsl09 TYPE faglflext-tsl09,
              tsl10 TYPE faglflext-tsl10,
              tsl11 TYPE faglflext-tsl11,
              tsl12 TYPE faglflext-tsl12,
              zzetbrnum TYPE zetbrmap-zzetbrnum,
            END OF ty_faglflext.
    TYPES :BEGIN OF ty_bukrs,
              bukrs TYPE bukrs,
           END OF ty_bukrs.
    TYPES :BEGIN OF ty_etbrtot,
              zzetbrnum TYPE zetbrmap-zzetbrnum,
              totamt TYPE tslxx12,
           END OF ty_etbrtot.
    TYPES :BEGIN OF ty_currtostr,
             dfld(1) type c,
              zzetbrnum LIKE zetbrmap-zzetbrnum,
              totamt(26) TYPE c,
           END OF ty_currtostr.
    TYPES : BEGIN OF ty_csv,
              comma(80) TYPE c,
            END OF ty_csv.
    TYPES : BEGIN OF ty_txt,
              hfld(1) TYPE c,
              dfld(1) TYPE c,
              zzetbrnum LIKE zetbrmap-zzetbrnum,
              totamt(26) TYPE c,
              tfld(1) TYPE c,
            END OF ty_txt.
    TYPES : BEGIN OF header_record,
              hfld(1) TYPE c,
              filler1(13) TYPE c,
              loc(5) TYPE c,
              filler2(10) TYPE c,
              ppyy(4) TYPE c,
              filler3(47) TYPE c,
            END OF header_record.
    TYPES : BEGIN OF detail_record,
              dfld(1) TYPE c,
              gl(4) TYPE c,
              subbacc(5) TYPE c,
              bal(18) TYPE n,
              sign(1) TYPE c,
              filler(4) TYPE c,
              code(2) TYPE c,
              filler1(45) TYPE c,
            END OF detail_record.
    TYPES : BEGIN OF trailer_record,
              tfld(1) TYPE c,
              filler(79) TYPE c,
            END OF trailer_record.
    *---- DATA DECLARATION -*
    *---- Work Area Declaration -*
    DATA : wa_infaglflext TYPE ty_faglflext,
           wa_inetbrtot TYPE ty_etbrtot,
           wa_currtostr TYPE ty_currtostr,
           wa_csv TYPE ty_csv,
           wa_txt TYPE ty_txt,
           wa_header_record TYPE header_record,
           wa_detail_record TYPE detail_record,
           wa_trailer_record TYPE trailer_record.
          wa_xls type ty_xls.
    *---- Internal Tables Declaration -*
    DATA : infaglflext TYPE STANDARD TABLE OF ty_faglflext,
           inetbrtot TYPE STANDARD TABLE OF ty_etbrtot,
           i_currtostr TYPE TABLE OF ty_currtostr,
           i_csv TYPE STANDARD TABLE OF ty_csv,
           i_txt TYPE STANDARD TABLE OF ty_txt.
          i_xls type table of ty_xls.
    DATA: BEGIN OF dlpivot OCCURS 1.
              INCLUDE STRUCTURE excelpivot.
    DATA: END OF dlpivot.
    DATA : t_bukrs TYPE STANDARD TABLE OF ty_bukrs WITH HEADER LINE.
    DATA : BEGIN OF infieldnames OCCURS 1,   " Internal Table to Hold Headings in file.
            text(50),
           END OF infieldnames.
    *---- Variables -*
    DATA : v_temp TYPE tslxx12,
           v_amt TYPE tslxx12.
    DATA : v_mon(2) TYPE c,
           v_year(4) TYPE c,
           v_yr(4) TYPE c.
    DATA : v_pfile TYPE string.
          p_filetyp type string.
    DATA : v_len TYPE i,
           v_ext(4),
           v_exts(4),
           v_fpath TYPE string.
    *---- INITIALIZING PARAMETERS -*
    INITIALIZATION.
      v_mon   = sy-datum+4(2).
      v_year  = sy-datum+0(4).
      pperiod = v_mon.
      pyear   = v_year.
    *---- VALIDATIONS -*
    *---- COMPANY CODE VALIDATION -*
    AT SELECTION-SCREEN ON p_bukrs.
      SELECT bukrs FROM t001 INTO TABLE t_bukrs WHERE bukrs = p_bukrs. " COMP CODE
      IF sy-subrc NE 0.
        MESSAGE 'enter valid company code' TYPE 'E'.
      ENDIF.
    *---- MONTH VALIDATION -*
    AT SELECTION-SCREEN ON pperiod.
      IF ( pperiod LT 1 OR pperiod GT 12 ).
        MESSAGE 'Enter valid month ' TYPE 'E'.
      ENDIF.
    *---- YEAR VALIDATION -*
    AT SELECTION-SCREEN ON pyear.
      v_yr = v_year - 2.
      IF ( pyear GT v_year OR pyear LT  v_yr ).
        MESSAGE 'Enter valid Year(Not less than current minus 2 or Greater than current) ' TYPE 'E'.
      ENDIF.
    *---- File Extension Validation -*
    AT SELECTION-SCREEN.
      PERFORM get_ext.
      IF ( ( NOT ( excel EQ 'X' AND v_ext EQ '.xls' ) ) and
      ( NOT ( csvfile EQ 'X' AND v_ext EQ '.csv' ) ) and
      ( NOT ( text EQ 'X' AND v_ext EQ '.txt' ) ) ).
        MESSAGE e001(zgmam_msg).   "'choose the correct file format' TYPE 'E'.
      ENDIF.
    *---- F4 FUNCTIONALITY FOR FILE PATH -*
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = 'P_FILE'
        IMPORTING
          file_name     = p_file.
    *---- START-OF-SELECTION -*
    START-OF-SELECTION.
      SELECT a~tslvt
             a~tsl01
             a~tsl02
             a~tsl03
             a~tsl04
             a~tsl05
             a~tsl06
             a~tsl07
             a~tsl08
             a~tsl09
             a~tsl10
             a~tsl11
             a~tsl12
             b~zzetbrnum
         INTO TABLE infaglflext
         FROM faglflext AS a
           INNER JOIN zetbrmap AS b
             ON arbukrs = bbukrs  AND
                aracct  = bhkont
         WHERE a~ryear   = pyear.
      IF sy-subrc EQ 0.
        LOOP AT infaglflext INTO wa_infaglflext.
         CLEAR v_amt.
          v_amt = v_amt + wa_infaglflext-tslvt.
          DO pperiod TIMES
            VARYING v_temp
            FROM   wa_infaglflext-tsl01
              NEXT wa_infaglflext-tsl02.
            v_amt = v_amt + v_temp.
          ENDDO.
          wa_inetbrtot-zzetbrnum = wa_infaglflext-zzetbrnum.
          wa_inetbrtot-totamt    = v_amt .
          APPEND wa_inetbrtot TO inetbrtot.
          CLEAR : wa_inetbrtot,
                  wa_infaglflext,
                  v_amt.
        ENDLOOP.
        PERFORM header.
        IF ( excel EQ 'X' AND v_ext EQ '.xls' ).
          PERFORM download_to_xls.
        ELSE.
          IF ( csvfile EQ 'X' AND v_ext EQ '.csv' ).
            PERFORM download_to_csv.
          ELSE.
            IF ( text EQ 'X' AND v_ext EQ '.txt' ).
              PERFORM download_to_text.
            ENDIF.
          ENDIF.
        ENDIF.
      ELSE.
        WRITE :/ 'NO RECORDS FOUND'.
      ENDIF.
    -------------------SUBROUTINES----------------------------------**
    *&      Form  download_to_xls
          text
    FORM download_to_xls.
    *wa_xls-head1 = 'GENERAL LEDGER'.
    *wa_xls-head2 = 'AMOUNT'.
    *APPEND WA_XLS TO I_CSV.
    *CLEAR WA_XLS.
    *loop at inetbrtot into wa_inetbrtot.
    wa_xls-zzetbrnum = wa_inetbrtot-zzetbrnum.
    wa_xls-totamt    = wa_inetbrtot-totamt.
    append wa_xls to i_CSV.
    clear wa_xls.
    *endloop.
    CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
      EXPORTING
        file_name                       = p_file
      CREATE_PIVOT                    = 0
       DATA_SHEET_NAME                 = 'EXCEL'
      PIVOT_SHEET_NAME                = ' '
      PASSWORD                        = ' '
      PASSWORD_OPTION                 = 0
    TABLES
       PIVOT_FIELD_TAB                 = dlpivot
       DATA_TAB                        = inetbrtot
       FIELDNAMES                      = infieldnames
    EXCEPTIONS
       FILE_NOT_EXIST                  = 1
       FILENAME_EXPECTED               = 2
       COMMUNICATION_ERROR             = 3
       OLE_OBJECT_METHOD_ERROR         = 4
       OLE_OBJECT_PROPERTY_ERROR       = 5
       INVALID_PIVOT_FIELDS            = 6
       DOWNLOAD_PROBLEM                = 7
       OTHERS                          = 8
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
         filename                      = v_pfile
         filetype                      = 'DBF'
         WK1_N_SIZE                    = 15
         WK1_T_SIZE                    = 15
         append                       = 'X'
      CONFIRM_OVERWRITE               = 'X'
       TABLES
         data_tab                      = inetbrtot
         fieldnames                    = infieldnames.
    ENDFORM.                    "download_to_xls
    *&      Form  download_to_csv
          text
    FORM download_to_csv.
      DATA : v_data TYPE string.
      CLEAR wa_inetbrtot.
      LOOP AT inetbrtot INTO wa_inetbrtot.
        v_data = wa_inetbrtot-totamt.
        CONDENSE  v_data NO-GAPS.
        CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
          EXPORTING
            betrg                         = v_data
        WAERS                         = ' '
        NEW_DECIMAL_SEPARATOR         =
        NEW_THOUSANDS_SEPARATOR       =
         IMPORTING
           string                        = wa_currtostr-totamt
        wa_currtostr-zzetbrnum = wa_inetbrtot.
        APPEND wa_currtostr TO i_currtostr.
        CLEAR wa_currtostr.
      ENDLOOP.
      LOOP AT i_currtostr INTO wa_currtostr.
        CONCATENATE wa_currtostr-zzetbrnum
                    wa_currtostr-totamt
                    INTO wa_csv-comma
                    SEPARATED BY ','.
        APPEND wa_csv TO i_csv.
        CLEAR wa_csv.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                      = v_pfile
       filetype                         = 'ASC'
      WRITE_FIELD_SEPARATOR           = 'X'
        TABLES
          data_tab                      = i_csv
         fieldnames                   = infieldnames.
    ENDFORM.                    "download_to_csv
    *&      Form  DOWNLOAD_TO_TEXT
          text
    -->  p1        text
    <--  p2        text
    FORM download_to_text. " using p_filetyp type string.
      DATA : BEGIN OF head OCCURS 1,                             " Internal Table to Hold Headings in file.
              text(1) VALUE 'H',
             END OF head.
      DATA : v_data TYPE string.
      CLEAR wa_inetbrtot.
      CLEAR wa_header_record.
      wa_header_record = space.
      wa_header_record-hfld = 'H'.
    wa_txt-hfld = 'H'.
      wa_header_record-ppyy+0(2) = pperiod.
      wa_header_record-ppyy2(2) = pyear2(2).
      APPEND wa_header_record TO i_csv.
      APPEND wa_txt TO i_txt.
      CLEAR wa_txt.
      LOOP AT inetbrtot INTO wa_inetbrtot.
        CLEAR wa_detail_record.
        wa_detail_record = space.
        wa_detail_record-dfld = 'D'.
       wa_txt-dfld         = 'D'.
       wa_txt-zzetbrnum    = wa_inetbrtot-zzetbrnum.
        wa_detail_record-bal = '0000000000000000000000'.
       wa_detail_record-bal = wa_
        v_data              = wa_inetbrtot-totamt.
        wa_detail_record-gl = wa_inetbrtot-zzetbrnum.
        CONDENSE  v_data NO-GAPS.
        CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'           "CONVERT ITAB-DATA TO STRING, AS THE ITAB CONTAINS A CURRENCY FIELD.
          EXPORTING
            betrg                         = v_data
        WAERS                           = ' '
        NEW_DECIMAL_SEPARATOR           =
        NEW_THOUSANDS_SEPARATOR         =
         IMPORTING
           string                         = wa_txt-totamt
        wa_detail_record-bal = wa_txt-totamt.
        IF ( wa_inetbrtot-totamt LT 0 ).
          wa_detail_record-sign = '-'.
        ELSE.
          wa_detail_record-sign = ' '.
        ENDIF.
        APPEND wa_detail_record TO i_csv.
        APPEND wa_txt TO i_txt.
        CLEAR wa_txt.
      ENDLOOP.
      wa_trailer_record-tfld = 'T'.
      APPEND wa_trailer_record TO i_csv.
      CLEAR wa_txt.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                      =
         filename                         = v_pfile
         filetype                         = 'DAT'
        append                          = 'X'
         header                         = 'abcd'
         replacement                    = '#'
      WRITE_FIELD_SEPARATOR             = ','
      CONFIRM_OVERWRITE                 = 'X'
        TABLES
          data_tab                        = i_csv
        fieldnames                      = HEAD.
    ENDFORM.                    " DOWNLOAD_TO_FILE
    *&      Form  header
          text
    -->  p1        text
    <--  p2        text
    FORM header .
      infieldnames-text = 'GeneralLedger Account'.
      APPEND infieldnames.
      CLEAR infieldnames.
      infieldnames-text = 'Amount'.
      APPEND infieldnames.
      CLEAR infieldnames.
    ENDFORM.                    "header
    *&      Form  get_ext
          text
    FORM get_ext.
      v_pfile = p_file.
      v_len   = STRLEN( v_pfile ).
      v_len   = v_len - 4.
      v_ext   = v_pfile+v_len(4).
    ENDFORM.                    "get_ext
    Message was edited by:
            srikanth vadlamani

Maybe you are looking for

  • ICC Color Profiles

    Im trying to colorsync my macbook pro with my office designers macs. They setup their color profiles...and then sent me the Color.ICC profile that was created. I added this to my Macbook in Library > ColorSync > Profiles I am able to select this in m

  • Migration and DVD/CD Sharing Update Problem

    Hi, my Mac OS 10.4.11 has a software update on 10-19-2008. It installed the update Migration and DVD/CD Sharing Update, since then, my sharing panel stopped working, I can`t set any option of Services tab and my Firewall tab does not open, it is gray

  • Error in XIDemo: HTTP response contains status code 401 with the descriptio

    Hi Gurus I try to configure the XI DEMO, in the fase of "Check Flight Seat Availability" the system show the next Error: Error Information Unable to check flight availability.       Error Type:      XI system error Error Details: HTTP response contai

  • Constraint for insertion in a table if inserted rows should not more than 2

    Problem: A Teacher only can assigned for maximum 2 Subjects in the same class Standard. actually i want to create a table like following create table teaches teacherid int, standard varchar(10), subjectcode varchar(10), constraint cpk_teaches primary

  • UPDATE - New JSF 1.1 Milestone Release

    Announcement: https://javaserverfaces.dev.java.net/servlets/NewsItemView?newsItemID=1387 Download: https://javaserverfaces.dev.java.net/servlets/ProjectDocumentList?folderID=2138&expandFolder=2138&folderID=0 New release includes bug fixes and a compl