I have a problem in formatting cells in Excel while using OLE method.

Hi All,
I have a problem in formatting cells in Excel while using OLE method.
My requirement is to have certain fields of a cell as text and amount fields should be in number format.
How to format a cell in Excel in OLE method of downloading data to excel.
For example I have plant field whose value is 0002 in internal table while coming to excel it is showing as 2 .
I want that field to be shown as 0002.(text format)
Material field whose value in internal table is 000000000000000051 is shown as 51 which has to be shown as
000000000000000051.(text format).
Amount field should be in number format so that totalling is possible .
So I need some cells in text format and some in number format.
Please suggest a sloution.
Thanks in advance,
Regards,
vidyulatha.U

https://forums.sdn.sap.com/click.jspa?searchID=21931962&messageID=6852860
hope this helps.

Similar Messages

  • Problem with format displayed in output while using Pivot table

    Hi All,
    I am using Pivot table in 10.1.3.4.1 version for displaying dynamic type data. Data is coming fine but it is coming in very strange format. I have following two tables in my RTF Template.
    Table1 using Pivot table
    !http://farm3.static.flickr.com/2570/4092137243_924cca92ca.jpg!
    Table 2 - A normal table
    !http://img5.imageshack.us/img5/6651/table3p.jpg!
    In the output PDF, “Table 2” shows data fine but “Table 1” shows very strange kind of behaviour if the columns exceed more than 5 in “Table 1” . If columns in Pivot table output are more than 5[at present according to my Table1 size] then columns more than 5 are shown on next page after Table 2 instead of displaying inside outer table “Table1“. Anyone has any idea what is the reason behind this strange behavior and how can I avoid it ?
    Thanks
    -Sookie

    Hi All,
    I tried including following piece of code in RTF as mentioned here: [http://winrichman.blogspot.com/2009/05/cross-tab-by-limiting-number-of-colums.html] but as a result it showed blank page in report. Nothing else.
    <?variable:G11;count(xdoxslt:distinct_values(/CUST_SUMMARY/LIST_CLIENT/CLIENT/LIST_OVERALL_ASSET_ALLOC/OVERALL_ASSET_ALLOC/ASSET_LIAB_DESC))?> <?variable:numcol;5?>
    <?template:table1?><?param:cellvalue;1?><?param:maxcolvalue;5?>
    <?choose:?>
    <?when:$cellvalue < $maxcolvalue?>
    !http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
    <?call@inlines:table1?><?with-param:cellvalue;(number($cellvalue) + $numcol)?><?with-param:maxcolvalue;$maxcolvalue?><?end call?>
    <?end when?>
    <?end choose?>
    <?end template?>
    Also modified RTf as
    C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
    H
    G <?for-each@column:$c594//C1?><?if@column:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
    ASSET_LIAB_DESC <?./H?>
    E <?end if?><?end for-each?>
    G <?for-each:$c594//R1?>
    PORTFOLIO_NAME <?./H?>
    G <?for-each@cell:.//R1C1?><?if@cell:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
    99.00% <?./M1?>
    E <?end if?><?end for-each?>
    E <?end for-each?>I have this as my xml
    <?xml version="1.0" encoding="UTF-8"?>
    <CUST_SUMMARY>
    <CLIENTID>1034</CLIENTID>
    <LIST_CLIENT>
    <CLIENT>
    <CLIENT_ID>1034</CLIENT_ID>
    <LIST_OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID>1110</PORTFOLIO_ID>
    <PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
    <PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID>1110</PORTFOLIO_ID>
    <PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
    <PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID>1110</PORTFOLIO_ID>
    <PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
    <PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID>1110</PORTFOLIO_ID>
    <PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
    <PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID>1110</PORTFOLIO_ID>
    <PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
    <PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
    <PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
    <PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
    <PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
    <PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
    <PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
    <PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
    <PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
    <PERCENT>-3.6085338841885100259678951503326304942E-01</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
    <PERCENT>2.71946226825880885538778864840827563226E-01</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
    <PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
    <PERCENT>.3</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
    <PERCENT>.4</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
    <PERCENT>.3</PERCENT>
    </OVERALL_ASSET_ALLOC>
    <OVERALL_ASSET_ALLOC>
    <PORTFOLIO_ID/>
    <PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
    <ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
    <PERCENT>.3</PERCENT>
    </OVERALL_ASSET_ALLOC>
    </LIST_OVERALL_ASSET_ALLOC>
    </CLIENT>
    </LIST_CLIENT>
    </CUST_SUMMARY>and Original RTF looks like !http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
    with code as
    C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
    H <?horizontal-break-table:1?>
    G <?for-each@column:$c594//C1?>
    ASSET_LIAB_DESC <?./H?>
    E <?end for-each?>
    G <?for-each:$c594//R1?>
    PORTFOLIO_NAME <?./H?>
    G <?for-each@cell:.//R1C1?>
    99.00% <?./M1?>
    E <?end for-each?>
    E <?end for-each?>Anyone can now tell my mistake? What wrong I am doing? Why it is showing blank page in output? How to solve this page breaking problem?
    Thanks
    -Sookie

  • When i paste some copied color text or formatted cells from excel to my mail draft while composing a mail, it is being pasted as plain text. No back groud or text colors are copied to it. Please suggest a possible solution for this issue.

    Colors & Formatted Cells from Excel application can not be copied to my mail composer as it is. Only Plain text is copied.

    Wish I could be king. But you described the problem perfectly and I am still but a pawn. All I can say is that I trashed the mail preferences (com.apple.mail.plist) on my Mac Mini, and now my MacBook seems to work right.
    Sorry. :>) But that is the truth... The MacBook now has actually sometimes displayed pasted text in its actual, different, font and style as I paste it into a partially composed new mail message.
    In other (more rational) words, the problem seems to be tied to pasting only certain types of text. I have not been able yet to pinpoint what. Yes, frustrating indeed. The only work-around has been to re-train my fingers to command-option-shift V, for "paste and match style" (like you, I do not want to always use only plain text). Maybe someone else will eventually weigh in with a real solution. The solution I want is just to be able to consistently see any font variations within my message before I send the email.
    The info about the different ppi scales between Windows and Mac is interesting, although not relevant to this particular problem. It does explain the apparent overall size differences I have seen before.

  • I have an Apple TV . My husband has an I-pad 2  and I Have an I-Pad 3. When my I-Pad 3 is used we have no problems. However when we try to use my husbands I-Pad 2 video mirrioing lags behind  for minutes. We checked settings and both I-pads are the same.

    I have an Apple TV . My husband has an I-pad 2  and I Have an I-Pad 3. When my I-Pad 3 is used we have no problems. However when we try to use my husbands I-Pad 2 video mirrioing lags behind  for minutes. We checked settings and both I-pads are the same. What can one do to use the I-Pad 2 without any mirroring lag. Thank you All in advance.

    try restarting
    both ipad http://support.apple.com/kb/ht1430
    and atv
    restarting ios devices cure 80% of all troubles users have

  • Firefox have some promlems and it block when is opeining hotmail, in my laptop always have that problem, so i need check my email using another programs...that problem is in my laptop or it´s a problem of navigator??

    Firefox have some problems and it block when is opening hotmail, in my laptop always have that problem, so i need check my email using another programs...that problem is in my laptop or it´s a problem of navigator??

    I know you can't help with my Yahoo problem, however, apparently at some time in the past I have went to the Sync and tried to figure it out on both my laptop and my desktop, because I have the long snyc key information. However, when I go to try to sync both computers I never get the box to enter that key on either one. That is my problem. So should I try and get a new sync key and see if that works.

  • Hi, dears i have a problem in itunes is not opening while i am trying to open it nothing happens i also tried to remove the sc info file but still i have the same problem

    hi dera i have a problem whit itunes is not opening.
    whil i am trying to open it nothing happens.
    i also removed sc info files still i have the same problem
    i any one know to how plz..........

    You can try mp3val, that might fix them up.
    Alternatively, if the files are in a standard <Artist>\<Album>\## <Name> layout then turn off Copy to iTunes Media folder when adding to library and use my script TagFromFilename to fill in the missing information.
    iTunes often has an issue handling files with multiple tags. These may be introduced by other software such as Windows Media Player, Winamp, or MediaMonkey. Files may have both ID3v1 and ID3v2.x tags, and if I read the ID3 specification correctly, there is also support for multiple ID3v2.x tags each coded for a different language. When there are multiple tags iTunes behaviour can sometimes be unpredictable. In some cases edits to the metadata can be written to one tag, and visible in Windows Explorer, but iTunes insists on reading back unchanged values from the other. In such cases you can use Convert ID3 Tag > None several times followed by Convert ID3 Tag > v2.3 and whatever iTunes knows about the file will be written back to a clean tag. Embedded artwork is erased so needs to be reattached. Using my script CreateFolderArt before and then after the tag conversions is one way to workaround that part of the problem.
    Also of note is that certain pre-defined genres are represented by a code number rather than text so that they can be presented in the local system language. There is always a possibility that Windows and iTunes have slightly different values in the look-up tables for some of these.
    tt2

  • Hi. I have a problem with downloading from app store while last three days. An error did mot allow me to that. It's number is 1009.

    I have a problem with downloading from app store while last three days. An error does not allow me to take any app. The error number is 1009.

    Thats the ugliest code I've seen in a while and may be hampering your abilities to debug it. No offense - you have to start somewhere - think of it as somewhat constructive criticism.
    However, I cannot find any place where this is happening. Its happening on line 193.
    Also, this only happens when you try to move certain pieces to certain squaresThat might be a clue. Try printing out the indexes before line 193 and see what happens. Maybe use a debugger to step through your code.

  • I have a problem sending mail via smtp. I use a satellite system and the average return time for a ping is 675ms. Is this a problem with mail? If so can I change Mail to accept it. The problem also exists with Lion

    I have a problem sending mail via smtp. I use a satellite system and the average return time for a ping is 675ms. Is this a problem with mail? If so can I change Mail to accept it. The problem also exists with Lion and on both my MacPro and my wife's Imac. I also see my mailboxes randomly disconnecting and reconnecting. Any other ideas of a possible cause?

    I solved it myself, after the "note" which came back from FF/Mozilla just as I finished my message, commenting on what it was that my system had , I wnnt back to check my plug-ins etc. I downloaded the latest Java, BOTH 32bit AND 64 bit versions and latest Firefox.
    Now all is working.
    Thanks,
    B.

  • Problem  in  excel  download using  OLE concept

    Hi ,
        i am trying to  create two sheets using OLE concept.
    i am able to create the excel successfully but i can't save it .
    i have one problem .
    GET PROPERTY OF excel 'ActiveSheet' = sheet.
    CALL METHOD OF sheet 'FILESAVEAS' EXPORTING #1 = w_filename1.
    IF sy-subrc eq 0.
    the sy-subrc value comes as  2.
    i am passing 'C:\SKD.XLS'  to  w_filename.
    is anything wrong.
    how can check  this method  and it's exceptions.

    i am getting the file name from user input using the  method
    *"Calling method for getting file name as saved by the user.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = w_title
        CHANGING
          filename             = w_filnam
          path                 = w_path
          fullpath             = w_filename1
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
    w_filename1 is of sting type .
    i am passing the  full  path to  it .
    please  let  me  i am doing anything wrong .

  • Call Excel SpreadSheet using OLE and set format = text

    Hi All,
    I am working on an object, where I need to call Excel SpreadSheet using OLE.
    In SpreadSheet, I need to show data as text (Without Excel Internal Modifications).
    i.e
    if i pass 03/2007 as month in excel, it should show  01/2007 not jan-07.
    I am trying to use the code as below.
    call method of cell 'SET_FORMAT' = text.
    set property of text 'CATEGORY' = 4.
    this code is not giving me desired output.
    Is there any other method i can call? or property I can set?
    can somebody pls send me a document with list of all formattiong methods and properties. I will really appreciate the help.
    Regards,
    Hardik

    Hi, you should concatenate the character ( ' ) into your text, example
    CONCATENATE '''' text INTO text.
    Then print the variable Text into excel and you will see the format as Text,
    Thanks and regards.
    David Carballido
    PD: Sry for my bad English

  • I seem to have multiple problems related or unrelated.  I cannot use Apple Mail for blueyonder and mostly for gmail as both show that the server is off line.  My pop up blocker doesn't work and I am blitzed with pop up windows on nearly every command

    Firstly I am unable to use Apple mail except for hotmail, for blueyonder, gmail or Sky as the server shows as (off line) and I have no idea how to get them on line even though I tell them to go there. 
    My pop up blocker doesn't work and I am blitzed with advertising windows virtually on ever command I make, one seems to be impossible to unsubscribe from. 
    When I am in an email with a web link the web link doesn't work and I get a window saying that I must have a pop up blocker, but if I switch it off it is no different, what does work is switching the "enable Java script off", then when I get to the web site I can't use it until I switch the java script back on.
    I can't do a screen shot either full or partial, when I try it changes the web site that is on screen to another.
    So what have I done that might have caused problems, downloading Yosemite seemed to be the start of the problems.  Since then I have started to install Mackeeper, after checking with a family members who should know, that MacPaw is safe.  I decided that I didn't want to pay the subscription, so went through the uninstall instructions but it comes up as a pop up with considerable regularity.
    My stress levels have gone through the roof with pop ups happening so regularly and not being able to use Apple mail.o can anyone help please?
    S

    Mail troubleshooting - Yosemite
    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages
    SMTP servers keep going offline

  • Will an Excel file retain formatted cells as a PDF using Acrobat XI Pro?

    Can Acrobat XI Pro create a form that will retain Excel formatted cells for filling in?
    Also, can it create a fillable cell that accepts an actual written signature?

    You will need to set the form in the PDF.
    Facsimile signatures are acceptable for legal purposes. You need to use a digital certificate that 3rd parties can verify but they maybe able to contain a signature image.

  • I have a problem creating a pdf from within Firefox using the print to function.

    I have a problem creating a PDF from within Firefox. I get an error message stating that Adobe PDF creation cannot continue because Acrobat is not activated. Acrobat Pro then opens. If it try to create the PDF again, the same problem. I have FF ver 3.6.10 and Acrobat Pro 8 (from Acrobat CS3).

    This is an Apple user forum, no-one from Apple is here.

  • How can I merge the cells of excel with using DOI technique?????

    Hello,everybody
    I met a quesetion.
    Now I'm impoving the performance of one program which is used to output data into the excel file.
    Old program used OLE technique, so it runned a very very long time.
    Now I want to change it by using the DOI technique.But I don't know how to merge the excel's cells with
    this technique(DOI).
    Can somebody give me some useful advices?
    I will deeply appreciate for your help.
    Chen

    Hi JUNHUA,
    Check with the [merge cell in DOI|merge cell in DOI ?]
    hope it helps you.
    Regards!

  • Problem in Checkbox on/off in ALV using OO method

    Hi,
    I am working on an ALV display using OO method.The first field is check box in the display.
    I declared the internal table type  as
    TYPES: BEGIN OF ty_output,
             chk_box(1) TYPE c,
             id_rech    TYPE yyeft1200-id_rech,
             bprefnr    TYPE yyeft1201-bprefnr,
             lfdat      TYPE yyeft1201-lfdat,
             artnr_bp   TYPE yyeft1201-artnr_bp,
               end of ty_output.
    and in fieldcatalog i have used
    Check Box
            CLEAR ls_fcat.
            ls_fcat-fieldname  = 'CHK_BOX'.
            ls_fcat-datatype   = 'CHAR'.
            ls_fcat-intlen     = '1'.
            ls_fcat-edit       = kc_x.
            ls_fcat-coltext    = text-014.
            ls_fcat-checkbox   = kc_x.
            ls_fcat-outputlen  = '5'.
            APPEND ls_fcat TO pit_fieldcat. 
    All the check boxes are in editable mode.
    Now the requirement is that for some records of the internal table it should be editable and for some records it should be non-editable.
    can you please help me how to do it.

    Hi,
              You might want to look at the example programs. Any program which begins with <b>BCALV_EDIT*</b>
    You can find the code in this program 'BCALV_FIELDCAT_TEST'
    *& Report  BCALV_FIELDCAT_TEST                                         *
    This report allows to modify the fieldcatalog of a corresponding
    output table and to view the effects of your changes directly.
    Note that for some changes you need to newly display the whole
    ALV Grid Control, e.g., DDIC-Fields are read only the first time
    you call SET_READY_FOR_FIRST_DISPLAY.
    Note also that not all scenarios can be tested since the output
    table does not comprise all fields to test available features
    of the fieldcatalog. Copy this program and extend the output
    table accordingly if you want to test such a special feature.
    (The field CARRNAME in 'gt_sflight' was added to test field REF_FIELD
    and TXT_FIELD of the fieldcatalog - see what happens if you
    calculate subtotals by carrier-id).
    report  bcalvt_fieldcatalog           .
    data: ok_code               type sy-ucomm,
          save_ok_code          type sy-ucomm,
    fieldcatalog for output table
          gt_fieldcat           type lvc_t_fcat,
    fieldcatalog for fieldcatalog itself:
          gt_fcatfcat           type lvc_t_fcat,
          gs_fcatlayo           type lvc_s_layo.
    Output table
    data: begin of gt_sflight occurs 0.
    data: carrname type s_carrname.
            include structure sflight.
    data: end of gt_sflight.
    data: g_max type i value 100.
    data: g_all type c value SPACE.
    Controls to display gt_sflight and corresponding fieldcatalog
    data: g_docking type ref to cl_gui_docking_container,
          g_alv     type ref to cl_gui_alv_grid.
    data: g_custom_container type ref to cl_gui_custom_container,
          g_editable_alv     type ref to cl_gui_alv_grid.
    LOCAL CLASS Definition
    class lcl_event_receiver definition.
      public section.
        methods handle_data_changed
          for event data_changed of cl_gui_alv_grid
          importing er_data_changed.
    endclass.
    class lcl_event_receiver implementation.
      method handle_data_changed.
    at the time being, no checks are made...
      endmethod.
    endclass.
    data: event_receiver type ref to lcl_event_receiver.
    end-of-selection.
      set screen 100.
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
      set pf-status 'BASIC'.
      set titlebar 'BASICTITLE'.
    create ALV Grid Control in the first run
      if g_docking is initial.
        perform create_and_init_controls.
      endif.
    endmodule.                             " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module user_command_0100 input.
      save_ok_code = ok_code.
      clear ok_code.
      case save_ok_code.
        when 'SUBMIT'.
    set the frontend fieldcatalog
    ATTENTION: DDIC-Fields are not updated using this method!
    (see 'RESTART')
          call method g_alv->set_frontend_fieldcatalog
               exporting
                 it_fieldcatalog = gt_fieldcat.
          call method g_alv->refresh_table_display.
          call method cl_gui_cfw=>flush.
        when 'RESTART'.
    Destroy the control currently visible and display it again
    using the changed fieldcatalog.
          perform restart_sflight.
        when '&ALL'.
          perform switch_visibility.
      endcase.
    endmodule.                             " USER_COMMAND_0100  INPUT
    *&      Form  CREATE_AND_INIT_CONTROLS
          text
    -->  p1        text
    <--  p2        text
    form create_and_init_controls.
      create object g_docking
          exporting
               dynnr = '100'
               extension = 150
               side = cl_gui_docking_container=>dock_at_bottom.
      create object g_alv
          exporting
               i_parent = g_docking.
      create object g_custom_container
          exporting
               container_name = 'CC_0100_FIELDCAT'.
      create object g_editable_alv
          exporting
               i_parent = g_custom_container.
    register events
      create object event_receiver.
      set handler event_receiver->handle_data_changed for g_editable_alv.
      call method g_editable_alv->register_edit_event
                    exporting
                       i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      perform build_fieldcatalogs changing gt_fieldcat gt_fcatfcat.
      perform modify_fieldcatalog changing gt_fcatfcat.
      perform select_data.                 "CHANGING gt_sflight
      call method g_alv->set_table_for_first_display
              changing
                   it_outtab       = gt_sflight[]
                   it_fieldcatalog = gt_fieldcat[].
    optimize column width of grid displaying fieldcatalog
      gs_fcatlayo-cwidth_opt = 'X'.
    Get fieldcatalog of table sflight - alv might have
    modified it after passing.
      call method g_alv->get_frontend_fieldcatalog
                importing et_fieldcatalog = gt_fieldcat[].
      call method cl_gui_cfw=>flush.
    Display fieldcatalog of table sflight:
      call method g_editable_alv->set_table_for_first_display
              exporting
                   is_layout       = gs_fcatlayo
              changing
                   it_outtab       = gt_fieldcat[]
                   it_fieldcatalog = gt_fcatfcat[].
    register events
      create object event_receiver.
      set handler event_receiver->handle_data_changed for g_editable_alv.
    endform.                               " CREATE_AND_INIT_CONTROLS
    *&      Form  restart_sflight
          text
    -->  p1        text
    <--  p2        text
    form restart_sflight.
      data: ls_fieldcat type lvc_s_fcat.
    free g_docking and thus g_alv
      call method g_docking->free.
      clear g_docking.
      clear g_alv.
    create new instances
      create object g_docking
          exporting
               dynnr = '100'
               extension = 150
               side = cl_gui_docking_container=>dock_at_bottom.
      create object g_alv
          exporting
               i_parent = g_docking.
    This is an internal method to invalidate all fields in the fieldcat
      loop at gt_fieldcat into ls_fieldcat.
        clear ls_fieldcat-tech_comp.
        modify gt_fieldcat from ls_fieldcat.
      endloop.
    Newly display the list with current fieldcatalog.
      call method g_alv->set_table_for_first_display
              changing
                   it_outtab       = gt_sflight[]
                   it_fieldcatalog = gt_fieldcat.
    Get fieldcatalog - it might be changed by ALV in the last call
      call method g_alv->get_frontend_fieldcatalog
              importing
                   et_fieldcatalog = gt_fieldcat[].
      call method g_editable_alv->refresh_table_display.
      call method cl_gui_cfw=>flush.
    endform.                               " restart_sflight
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    form select_data.
      data: lt_sflight type table of sflight with header line,
            ls_scarr type scarr.
    select data of sflight
      select * from sflight into table lt_sflight up to g_max rows.
    copy data to gt_sflight and update CARRNAME
      loop at lt_sflight.
        move-corresponding lt_sflight to gt_sflight.
        select single * from scarr into ls_scarr
           where carrid = gt_sflight-carrid.
        gt_sflight-carrname = ls_scarr-carrname.
        append gt_sflight.
      endloop.
    endform.                               " select_data
    *&      Form  BUILD_FIELDCATALOGS
          text
         <--P_GT_FIELDCAT  text
         <--P_GT_FCATFCAT  text
    form build_fieldcatalogs changing p_fieldcat type lvc_t_fcat
                                      p_fcatfcat type lvc_t_fcat.
      data: ls_fcat     type lvc_s_fcat.
    Fieldcatalog for table SFLIGHT: p_fieldcat
    generate fieldcatalog automatically
      call function 'LVC_FIELDCATALOG_MERGE'
          exporting
               i_structure_name       = 'SFLIGHT'
            I_CLIENT_NEVER_DISPLAY = 'X'
           changing
                ct_fieldcat            = p_fieldcat[]
       EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    shift all column positions to the right except for MANDT
      loop at p_fieldcat into ls_fcat.
        if ls_fcat-fieldname ne 'MANDT'.
          add 1 to ls_fcat-col_pos.
          if ls_fcat-fieldname = 'CARRID'.
            ls_fcat-txt_field = 'CARRNAME'."link CARRNAME to CARRID
          endif.
          modify p_fieldcat from ls_fcat.
        endif.
      endloop.
    create a new line for CARRNAME in p_fieldcat
      clear ls_fcat.
      ls_fcat-fieldname = 'CARRNAME'.
      ls_fcat-ref_table = 'SCARR'.
      ls_fcat-col_pos = 1.
    insert new line before CARRID (do not forget MANDT!).
      insert ls_fcat into p_fieldcat index 1.
    Fieldcatalog for table LVC_T_FCAT:p_fcatfcat
    Generate fieldcatalog of fieldcatalog structure.
    This fieldcatalog is used to display fieldcatalog 'p_fieldcat'
    on the top of the screen.
      call function 'LVC_FIELDCATALOG_MERGE'
          exporting
               i_structure_name       = 'LVC_S_FCAT'
            I_CLIENT_NEVER_DISPLAY = 'X'
           changing
                ct_fieldcat            = p_fcatfcat[]
       EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    Hide all fields that are not documented (valid for release 4.6A)
      perform hide_fields changing p_fcatfcat.
    endform.                               " BUILD_FIELDCATALOGS
    *&      Module  EXIT_PROGRAM  INPUT
          text
    module exit_program input.
      leave program.
    endmodule.                             " EXIT_PROGRAM  INPUT
    *&      Form  MODIFY_FIELDCATALOG
          text
         <--P_GT_FCATFCAT  text
    form modify_fieldcatalog changing p_fcatfcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
      loop at p_fcatfcat into ls_fcat.
        ls_fcat-coltext = ls_fcat-fieldname.
        ls_fcat-edit = 'X'.
        if ls_fcat-fieldname = 'COL_POS' or ls_fcat-fieldname = 'FIELDNAME'.
          ls_fcat-key = 'X'.
        endif.
        modify p_fcatfcat from ls_fcat.
      endloop.
    endform.                               " MODIFY_FIELDCATALOG
    form hide_fields changing p_fieldcat type lvc_t_fcat.
      data: ls_fcat type lvc_s_fcat.
    Only show documented fields of fieldcatalog.
    For a documentation choose "Help->Application Help" in the menu.
      loop at p_fieldcat into ls_fcat.
        if not (
             ls_fcat-fieldname eq 'CFIELDNAME'
        or   ls_fcat-fieldname eq 'COL_POS'
        or   ls_fcat-fieldname eq 'COLDDICTXT'
        or   ls_fcat-fieldname eq 'COLTEXT'
        or   ls_fcat-fieldname eq 'CURRENCY'
        or   ls_fcat-fieldname eq 'DD_OUTLEN'
        or   ls_fcat-fieldname eq 'DECIMALS_O'
        or   ls_fcat-fieldname eq 'DECMLFIELD'
        or   ls_fcat-fieldname eq 'DO_SUM'
        or   ls_fcat-fieldname eq 'DRAGDROPID'
        or   ls_fcat-fieldname eq 'EDIT_MASK'
        or   ls_fcat-fieldname eq 'EMPHASIZE'
        or   ls_fcat-fieldname eq 'EXPONENT'
        or   ls_fcat-fieldname eq 'FIELDNAME'
        or   ls_fcat-fieldname eq 'HOTSPOT'
        or   ls_fcat-fieldname eq 'ICON'
        or   ls_fcat-fieldname eq 'INTLEN'
        or   ls_fcat-fieldname eq 'INTTYPE'
        or   ls_fcat-fieldname eq 'JUST'
        or   ls_fcat-fieldname eq 'KEY'
        or   ls_fcat-fieldname eq 'LOWERCASE'
        or   ls_fcat-fieldname eq 'LZERO'
        or   ls_fcat-fieldname eq 'NO_OUT'
        or   ls_fcat-fieldname eq 'NO_SIGN'
        or   ls_fcat-fieldname eq 'NO_SUM'
        or   ls_fcat-fieldname eq 'NO_ZERO'
        or   ls_fcat-fieldname eq 'OUTPUTLEN'
        or   ls_fcat-fieldname eq 'QFIELDNAME'
        or   ls_fcat-fieldname eq 'QUANTITY'
        or   ls_fcat-fieldname eq 'REF_FIELD'
        or   ls_fcat-fieldname eq 'REF_TABLE'
        or   ls_fcat-fieldname eq 'REPREP'
        or   ls_fcat-fieldname eq 'REPTEXT'
        or   ls_fcat-fieldname eq 'ROLLNAME'
        or   ls_fcat-fieldname eq 'ROUND'
        or   ls_fcat-fieldname eq 'ROUNDFIELD'
        or   ls_fcat-fieldname eq 'SCRTEXT_L'
        or   ls_fcat-fieldname eq 'SCRTEXT_M'
        or   ls_fcat-fieldname eq 'SCRTEXT_S'
        or   ls_fcat-fieldname eq 'SELDDICTXT'
        or   ls_fcat-fieldname eq 'SELTEXT'
        or   ls_fcat-fieldname eq 'SP_GROUP'
        or   ls_fcat-fieldname eq 'SYMBOL'
        or   ls_fcat-fieldname eq 'TECH'
        or   ls_fcat-fieldname eq 'TIPDDICTXT'
        or   ls_fcat-fieldname eq 'TOOLTIP'
        or   ls_fcat-fieldname eq 'TXT_FIELD' ).
          ls_fcat-tech = 'X'.
        endif.
        modify p_fieldcat from ls_fcat.
      endloop.
    endform.
    form switch_visibility.
    data:  lt_fcatfcat type lvc_t_fcat,
            ls_fcat type lvc_s_fcat.
    call method g_editable_alv->get_frontend_fieldcatalog
                 importing ET_FIELDCATALOG = lt_fcatfcat.
    if not g_all is initial.
         perform hide_fields changing lt_fcatfcat.
         g_all = SPACE.
    else.
        loop at lt_fcatfcat into ls_fcat.
           if ls_fcat-tech eq 'X'.
               ls_fcat-tech = SPACE.
               ls_fcat-no_out = 'X'.
               modify lt_fcatfcat from ls_fcat.
           endif.
        endloop.
        g_all = 'X'.
    endif.
    call method g_editable_alv->set_frontend_fieldcatalog
                exporting it_fieldcatalog = lt_fcatfcat.
    call method g_editable_alv->refresh_table_display.
    endform.
    <b>Reward points</b>
    Regards

Maybe you are looking for

  • Mac Pro and DVI to Video Adapter

    I just received a new Mac Pro with a GeForce 7300 card and was planning to use it in part to display video on a set of TV monitors using the Apple DVI to Video Adapter. Try as I might I have not been able to get the computer to recognize a TV regardl

  • Cannot add form fields in document

    Acrobat Pro version 9.1.2 Windows XP SP 3 I have a document that I cannot add form fields to. When I try I get a message that says "You cannot edit the file as a form due to its security settings. When I go to Advanced->Security->Show Security Proper

  • Query for next record in a multiple records display

    Hi. I have a text item whose data block displays 10 records after post query. I want to put a query on the keyboard up and down button so that when i press the up or down arrow of the keyboard, the cursor moves to the next record and executes the pos

  • SBO 8.8 PL10  DTW Service APInvoice

    Hi, I am having trouble importing AP Invoices (service type) in to SAP Business one 8.8 PL10.  I have not imported service type AP invoices before and there does nto seem to be examples of this in the DTW templates.... Header file: RecordKey     <doc

  • Select statement showing error

    Hi, Please view below select statement and give your feedback: SELECT   vbrk~vkorg          vbrk~vtweg          vbrk~kunrg          vbrk~kunag          vbrk~knumv          " Number of document cindition.          vbrk~fksto          " Cancelled Invoi