Rich heilman :currency

hi rich,
plz suggest me the possible solution.
thanks in advance

Not really familiar with currencies as the company I work for is in US and is not international so I haven't had to deal with it. 
So, from your code it appears that you are working with a PERFORM in sapscript, right?  You want to write to the amount field with a specific currency?  I think that you may be able to use the CURRENCY keyword in your WRITE statement.
WRITE IN_TAB-IN to AMOUNT CURRENCY 'USD'.
You will need to find the currency key for your currency.  I think this may just handle the decimal places though, not sure.
Regards,
Rich Heilman

Similar Messages

  • WD -Select options - DUMP -Practicing Rich heilman's app

    Hi,
    I am practising the tutorial created by Rich heilman /people/rich.heilman2/blog/2005/12/20/using-select-options-in-a-web-dynproabap-application
    I am getting following dump while running i browser.
    Error when processing your request
    What has happened?
    The URL http://ssss.com/sap/bc/webdynpro/sap/ytest/ was not called due to an error.
    Note
    The following error text was processed in the system DV1 : Exception condition "TYPE_NOT_FOUND" raised.
    The error occurred on the application server sape-dev_DV1_00 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: DESCRIBE_BY_NAME of program CL_ABAP_TYPEDESCR=============CP
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system DV1 in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server sape-dev_DV1_00 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server sape-dev_DV1_00 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 180 -u: XXXXX -l: E -s: DV1 -i: sape-dev_DV1_00 -w: 0 -d: 20090112 -t: 162129 -v: RABAX_STATE -e: RAISE_EXCEPTION
    All I did is i used a different table and follwed all steps.
    Rich,
    Thank you for the wonderful blog.
    Any idea?
    rgds
    Vara
    Edited by: Vara K on Jan 12, 2009 11:26 PM
    Edited by: Vara K on Jan 12, 2009 11:34 PM

    Rich,
    Here is what I did.
    I changed SFLIGHT TABLE to PROJ and tried to put only one select-options for field PSPNR.
    Node name = PROJ.
    I kept a break-point in these methods but  it got dumped before that only.
    method WDDOINIT .
    data:
    lt_range_table type ref to data,
    rt_range_table type ref to data,
    read_only type abap_bool,
    typename type string.
    data:
    lr_componentcontroller type ref to ig_componentcontroller,
    l_ref_cmp_usage type ref to if_wd_component_usage.
    * create the used component
    l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
    if l_ref_cmp_usage->has_active_component( ) is initial.
    l_ref_cmp_usage->create_component( ).
    endif.
    * get a pointer to the interface controller of the select options
    *component
    wd_this->m_wd_select_options =
    wd_this->wd_cpifc_select_options( ).
    * init the select screen
    wd_this->m_handler =
    wd_this->m_wd_select_options->init_selection_screen( ).
    * create a range table that consists of this new data element
    lt_range_table =
    wd_this->m_handler->create_range_table(
    i_typename = 'S_PSPNR_ID' ).
    *add a new field to the selection
    wd_this->m_handler->add_selection_field(
    i_id = 'S_PSPNR_ID'
    it_result = lt_range_table
    i_read_only = read_only ).
    endmethod.
    method ONACTIONCONTINUE .
    data: node_proj type ref to if_wd_context_node.
    data: rt_pspnr type ref to data.
    data: iproj type table of proj.
    data: wproj type proj.
    field-symbols: <fs_pspnr> type table.
    * Retrieve the data from the select option
    rt_pspnr = wd_this->m_handler->get_range_table_of_sel_field(
    i_id = 'S_PSPNR_ID' ).
    * Assign it to a field symbol
    assign rt_pspnr->* to <fs_pspnr>.
    * Retrieve that data from the database. Normally it is suggested to
    * encapsulate the data retrieval in a separate class.
    * For simplicity, the SELECT statement has been implemented here.
    clear iproj. refresh iproj.
    select * into corresponding fields of table iproj from proj
    where pspnr in <fs_pspnr>.
    * Bind the data to the context
    node_proj = wd_context->get_child_node( name = `PROJ` ).
    node_proj->bind_elements( iproj ).
    endmethod.
    rgds
    vara
    Edited by: Vara K on Jan 13, 2009 12:10 AM

  • How to fix a bug in Rich Heilman's weblog code?

    Dear all,
    I'm trying to create a report on a code given in the weblog by Rich Heilman:
    /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
    Unfortunately, there is a bug in the code and a short dump occurs:
    A RAISE statement in the program "CL_ABAP_TYPEDESCR=============CP" raised the
    exception condition "TYPE_NOT_FOUND".
    I copied here the whole code:
    REPORT  Z_DYNAMIC.
    type-pools : abap.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
    start-of-selection.
      perform get_structure.
      perform create_dynamic_itab.
      perform get_data.
      perform write_out.
    form get_structure.
    data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
    data : ref_table_des type ref to cl_abap_structdescr.
    * Get the structure of the table.
      ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
      loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
    endform.
    form create_dynamic_itab.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = ifc
                   importing
                      ep_table        = dy_table.
      assign dy_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
    endform.
    form get_data.
    * Select Data from table.
      select * into table <dyn_table>
                 from (p_table).
    endform.
    form write_out.
    * Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index
             of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
      endloop.
    endform.
    Could someone fix a bug, please?
    Best regards,
    Eugene

    Hi Eugene,
    I made a small change to the code and it works even for MARA. See the code below..
    REPORT zsritest58 .
    TYPE-POOLS : abap.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa>,
                   <dyn_field>.
    DATA: dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          xfc TYPE lvc_s_fcat,
          ifc TYPE lvc_t_fcat.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_table(30) TYPE c DEFAULT 'T001'.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      PERFORM get_structure.
      PERFORM create_dynamic_itab.
      PERFORM get_data.
      PERFORM write_out.
    *       FORM get_structure                                            *
    FORM get_structure.
    <b>*data : idetails type abap_compdescr_tab,
    *       xdetails type abap_compdescr.
    *data : ref_table_des type ref to cl_abap_structdescr.
    ** Get the structure of the table.
    *  ref_table_des ?=
    *      cl_abap_typedescr=>describe_by_name( p_table ).
    *  idetails[] = ref_table_des->components[].
    *  loop at idetails into xdetails.
    *    clear xfc.
    *    xfc-fieldname = xdetails-name .
    *    xfc-datatype = xdetails-type_kind.
    *    xfc-intlen = xdetails-length.
    *    xfc-decimals = xdetails-decimals.
    *    append xfc to ifc.
    *  endloop.
      SELECT SINGLE tabname INTO p_table FROM dd02l
      WHERE tabname EQ p_table
        AND as4local EQ 'A'
        AND as4vers EQ '0000'.
      IF sy-subrc NE 0.
        STOP.
      ENDIF.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
    *   I_BUFFER_ACTIVE              =
         i_structure_name             = p_table
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
    *   I_BYPASSING_BUFFER           =
        CHANGING
          ct_fieldcat                  = ifc[]
       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.</b>
    ENDFORM.
    *       FORM create_dynamic_itab                                      *
    FORM create_dynamic_itab.
    * Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
                   EXPORTING
                      it_fieldcatalog = ifc
                   IMPORTING
                      ep_table        = dy_table.
      ASSIGN dy_table->* TO <dyn_table>.
    * Create dynamic work area and assign to FS
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    ENDFORM.
    *       FORM get_data                                                 *
    FORM get_data.
    * Select Data from table.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE <dyn_table>
                 FROM (p_table).
    ENDFORM.
    *       FORM write_out                                                *
    FORM write_out.
    * Write out data from table.
      LOOP AT <dyn_table> INTO <dyn_wa>.
        DO.
          ASSIGN COMPONENT  sy-index
             OF STRUCTURE <dyn_wa> TO <dyn_field>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          IF sy-index = 1.
            WRITE:/ <dyn_field>.
          ELSE.
            WRITE: <dyn_field>.
          ENDIF.
        ENDDO.
      ENDLOOP.
    ENDFORM.
    Hope this helps..
    Sri

  • Conversion of Quantity from German to the US format

    Is there any Function Module to convert Quantity from German format to the US format?
    Ex: US Format 3,000.00 = German Format 3.000,00
    Thanks and Regards,
    Vijay

    You can use the CURRENCY extension of the WRITE statement.
    write us_value to de_value CURRENCY 'DEM'.
    Check table TCURX for the german currency.
    Regards,
    Rich Heilman
    Found the currency key....
    Message was edited by: Rich Heilman

  • Enhance method with new parameter

    How can I enhance an existing method with a new Parameter?
    In some tutorial is written that this should be possible. But there is no exact description.

    Thx Rich Heilman 
    but in the Doku "Enhancements to Global Classes and Interfaces"
    http://help.sap.com/saphelp_nw70/helpdata/en/58/4fb541d3d52d31e10000000a155106/content.htm
    you find:
    You can enhance the components of a global class or global interface by:
    &#9679;     Inserting new, optional formal parameters for existing methods (but no new exceptions)

  • "The Mystery of the Deck", or, "Is SAP a Nondeterministic Automaton?"

    Please note:
    1) There is a serious question embedded within this post;
    2) The post is not meant as a criticism of the subscription stack - I know what I fool I am for trying to run it under VM on a 4-year old Dell 8200 with 1G overall RAM.
    That being said ...
    Some of you low-lifes out there (Chris S?) have probably played a hand or two of Hollywood Gin (Rummy) for money stakes such as "straight half", "quarter-nickel-quarter", "world, solarsystem, universe", etc.  So you know that each hand starts with both players being dealt 10 cards, while the remaining 32 are placed between the two players in a face-down "stack" or "deck" (except for one that is placed face up next to the "deck".)
    And therefore, it is safe to conclude that at least some of you low-lifes have probably asked the same question that generations of "gin" players have asked:
    Does the order of the cards in the "deck" change after it is has been placed face-down on the table?
    Since no one knows the answer to this "for sure", and in fact, cannot know the answer to this for sure, this mystery is known as "the mystery of the deck".
    Why am I bothering to tell you this?
    Well, I've spent the last seaveral days trying to get the NW7 subscription stack to run in 750M of a VM on my old Dell 8200 with just 1 gig of RAM overall.
    And as you would expect, the WDA application DEMO_TABLE kept on timing out.
    So I set timeout and proctimeout to -1 in the startup profile and changed max_wprun_time dynamically in RZ11 and chose a simpler demo application (DEMO_SIMPLE_MAIN).
    Well, after a few minutes, the window for this app finally popped.
    But here's the funny thing.
    Since I knew everything was actually working as it should, I figured I'd try "DEMO_TABLE" one more time.
    It popped in about 30 seconds.
    So unless one of you "least-recently-used-page-gurus" knows why this happened, I will have to conclude that:
    a) SAP, or at least the NW7 subscription stack, is really a non-deterministic automaton (intentionally or unintentionally);
    b) yes, the order of the cards does change in the deck after the hand of gin has been dealt.
    djh
    Edited by: Rich Heilman on May 1, 2008 2:38 PM
    Edited by: Rich Heilman on May 2, 2008 9:44 AM

    Hey Rich -
    Yeah - that sounds reasonable - thanks very much for taking the time to mention it.
    But one puzzle - the Basis guy who was helping me out for the install says that for the regular ABAP stuff (not the WDA) stuff, the compiles "persist" across a server down/up.  Meaning that when something compiles for the first time, it doesn't have to be recompiled after a server down/up.
    Is this true for the regular stuff (non-WDA)?
    And if so, why not for the WDA as well? Why would stuff have to recompile each time the server is brought up?
    Also, the Basis guy thought it might also have something to do with SAP being smart enough not to keep swapping stuff in/out that's never used - so eventually, the amount of "thrashing" decreases and the machine gets to do some actual work.
    Glad you're not too busy with your new responsibilities to post here occasionally.
    Have your wife and kids told you yet that you gotta find a job that gets you out of the house?
    Best
    djh

  • Getting a program Dump Error in Herarchial ALV

    Hello All,
    I am getting a dump error when I am executing the below program. Kindly help as I am not getting the output. However all the subroutines are getting properly populated with data. Getting a dump error while calling the function : REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Pasted below are both the question and solution. Copy the solution in SE38 and execute it to check out the dump error.
    Kindly help.
    Thanks,
    Vinod.
    QUESTION :-
    Objective
         Hierarchical ALV for displaying Sales documents per customer
    Design
         Create a program that will allow the user to display all customers that have placed Sales Orders in the given date range. The user will have an ability to drill-down to see the sales order items per customer.
         Selection screen fields–
              Sales order creation date (range)
              Customer number (range)
         Output –
              Header –
                   Customer Number
                   Customer Name
                   Total Order value (sum of order values from items below)
              Details –
    Sales order number
    Material number
    Order quantity
    Order value
    Reference
         Tables:  KNA1, VBAK, VBAP
         Transaction – VA03 (Sales order)
    SOLUTION :-
    *& Report  Z_HALV_32722                                                *
    REPORT  Z_HALV_32722                            .
    TYPE-POOLS: slis.
    TABLES : kna1,
             vbak.
    SELECT-OPTIONS: s_cst_no FOR kna1-kunnr.
    SELECT-OPTIONS: s_cr_dt FOR vbak-erdat.
    DATA : BEGIN of ty_hdr,
            kunnr TYPE vbak-kunnr,
            name1 TYPE kna1-name1,
            netwr TYPE vbak-netwr,
            END of ty_hdr,
            gt_hdr LIKE TABLE OF ty_hdr,
            gs_hdr LIKE LINE OF gt_hdr.
    DATA : BEGIN of ty_ln,
            kunnr TYPE vbak-kunnr,
            vbeln TYPE vbap-vbeln,
            matnr TYPE vbap-matnr,
            kwmeng TYPE vbap-kwmeng,
            netwr TYPE vbap-netwr,
            END of ty_ln,
            gt_ln LIKE TABLE OF ty_ln,
            gs_ln LIKE LINE OF gt_ln.
    DATA : BEGIN of ty_hdr1,
            kunnr TYPE vbak-kunnr,
            END of ty_hdr1,
            gt_hdr1 LIKE TABLE OF ty_hdr1,
            gs_hdr1 LIKE LINE OF gt_hdr1.
    DATA : gt_fc TYPE slis_t_fieldcat_alv,
           gs_fc LIKE LINE OF gt_fc,
           gs_k_fld TYPE  slis_keyinfo_alv,
           gt_layout TYPE slis_layout_alv,
           gv_repid  TYPE sy-repid.
    START-OF-SELECTION.
    gv_repid = sy-repid.
    perform fetch_data.
    perform prepare_fc.
    perform prepare_layout.
    perform show_output.
    *&      Form  fetch_data
          text
    -->  p1        text
    <--  p2        text
    form fetch_data .
    SELECT kunnr
    INTO CORRESPONDING FIELDS OF TABLE gt_hdr1
    FROM vbak
    WHERE vbak~kunnr IN s_cst_no
    AND vbak~erdat IN s_cr_dt.
    DELETE ADJACENT DUPLICATES FROM gt_hdr1 COMPARING kunnr.
    LOOP AT gt_hdr1 INTO gs_hdr1.
      SELECT SINGLE vbakkunnr kna1name1 SUM( vbak~netwr )
      INTO (gs_hdr-kunnr, gs_hdr-name1, gs_hdr-netwr)
      FROM vbak INNER JOIN kna1
      ON vbakkunnr = kna1kunnr
      WHERE vbak~kunnr = gs_hdr1-kunnr
      GROUP BY vbakkunnr kna1name1.
      APPEND gs_hdr TO gt_hdr.
      SELECT vbakkunnr vbapvbeln vbapmatnr vbapkwmeng vbap~netwr
      INTO CORRESPONDING FIELDS OF TABLE gt_ln
      FROM vbap INNER JOIN vbak
      ON vbapvbeln = vbakvbeln
      WHERE vbak~kunnr = gs_hdr1-kunnr.
    ENDLOOP.
    endform.                    " fetch_data
    *&      Form  prepare_fc
          text
    -->  p1        text
    <--  p2        text
    form prepare_fc .
      CLEAR gs_k_fld.
      gs_k_fld-header01 = 'KUNNR'.
      gs_k_fld-item01   = 'KUNNR'.
      CLEAR gs_fc.
      gs_fc-fieldname = 'KUNNR'.
      gs_fc-tabname   = 'GT_HDR'.
      gs_fc-seltext_l = text-001.
      APPEND gs_fc TO gt_fc.
      CLEAR gs_fc.
      gs_fc-fieldname = 'NAME1'.
      gs_fc-tabname   = 'GT_HDR'.
      gs_fc-seltext_l = text-002.
      APPEND gs_fc TO gt_fc.
      CLEAR gs_fc.
      gs_fc-fieldname = 'NETWR'.
      gs_fc-tabname   = 'GT_HDR'.
      gs_fc-seltext_l = text-003.
      APPEND gs_fc TO gt_fc.
      CLEAR gs_fc.
      gs_fc-fieldname = 'VBELN'.
      gs_fc-tabname   = 'GT_LN'.
      gs_fc-seltext_l = text-004.
      APPEND gs_fc TO gt_fc.
      CLEAR gs_fc.
      gs_fc-fieldname = 'MATNR'.
      gs_fc-tabname   = 'GT_LN'.
      gs_fc-seltext_l = text-005.
      APPEND gs_fc TO gt_fc.
      CLEAR gs_fc.
      gs_fc-fieldname = 'KWMENG'.
      gs_fc-tabname   = 'GT_LN'.
      gs_fc-seltext_l = text-006.
      APPEND gs_fc TO gt_fc.
      CLEAR gs_fc.
      gs_fc-fieldname = 'NETWR'.
      gs_fc-tabname   = 'GT_LN'.
      gs_fc-seltext_l = text-007.
      APPEND gs_fc TO gt_fc.
    endform.                    " prepare_fc
    *&      Form  prepare_layout
          text
    -->  p1        text
    <--  p2        text
    form prepare_layout .
    gt_layout-colwidth_optimize = 'X'.
    gt_layout-expand_fieldname = 'TST'.
    endform.                    " prepare_layout
    *&      Form  show_output
          text
    -->  p1        text
    <--  p2        text
    form show_output .
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
      EXPORTING
      I_INTERFACE_CHECK              = ' '
        I_CALLBACK_PROGRAM             = gv_repid
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
        IS_LAYOUT                      = gt_layout
        IT_FIELDCAT                    = gt_fc
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
        i_tabname_header               = 'GT_HDR'
        i_tabname_item                 = 'GT_LN'
      I_STRUCTURE_NAME_HEADER        =
      I_STRUCTURE_NAME_ITEM          =
        is_keyinfo                     = gs_k_fld
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      tables
        t_outtab_header                = GT_HDR[]
        t_outtab_item                  = GT_LN[]
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.                    " show_output

    Everything looks fine with the gt_layout, it is not an internal table, so no need to append to it, it is simply a structure, but you do tell it that TST is the expand field, but there is no field of this name in your internal for the header, so add it like this.
    DATA : BEGIN of ty_hdr,
    kunnr TYPE vbak-kunnr,
    name1 TYPE kna1-name1,
    netwr TYPE vbak-netwr,
    <b>TST  type c,</b>
    END of ty_hdr,
    Doing so should make you program work correctly.
    Regards,
    Rich Heilman
    Message was edited by:
            Rich Heilman

  • Calling a report from a remote system

    Hello All,
    Any idea on this issue will be of great help.
    The scenario is like this.
    a. There are two SAP systems. SYS1 and SYS2.
    b. SYS2 has ALV reports which need to be executed from SYS1.
    c. I applied the following logic which successfully calls the report in SYS1 but does not show up in the ALV format.
    d. The following is the logic used.
    There is an RFC enabled function module in SYS2 that has the statement SUBMIT EXPORTING.... Within the same FM, the LIST_MEMORY imports the report contents. This FM since it is being called from SYS1, sends back the imported contents from SYS2 to SYS1.
    e. In SYS1, the WRITE_LIST is being used that prints the report.  BUT THIS SHOWS THE OUTPUT in the form of a normal report.
    My question is, how do I show the contents in the ALV format.
    Please note,, the reuse_alv..list..display FM cannot be used as the internal table that is imported in SYS1 has the data in the RAW format.
    Any help??/
    Thanks for your time

    Yes, you can do that using the RFC, but you won't be able to send any parameters thru the selection screen.
    report zrich_0003 no standard page heading.
    data: source type table of  PROGTAB with header line,
          output like listzeile occurs 10 with header line.
    call function 'RFC_ABAP_INSTALL_AND_RUN'
               destination <system_name>
             exporting
               mode                = space
               programname         = <the_program_name>
             tables
                program            = source
                writes             = output.
    loop at output.
      write:/ output.
    endloop.
    Regards,
    Rich Heilman
    Message was edited by: Rich Heilman

  • Scheduling periodic background jobs with changing parameters

    Greetings,
    I am wondering if anyone knows a way to do the following:
    Say I have a report that I want to schedule in the background to run at the end of every month.  Is there a way to set up the jobs to use different parameters (dates, etc.) each month without creating a variant for each month and scheduling the jobs separately?  I hope that I am being clear in this question. 
    Another example would be if I wanted to run the report each day for the previous day.  As you can see, it would be quite tedious to create a variant and manually scheduled job for each day.
    Thanks in advance for any help or tips.
    Geoff

    Yes, when setting up your variant, you can pull in "dynamic" variants. 
    At your selection screen, click go to,  variants, save as variant. Name it and give description. 
    Now for you particular field, check the "selection variable" check box for that field.  Now at the top of the screen, click the selection variable button.  This will take you to a new screen.  Here you can choose to get the variable from the TVARV table, use a dynamic date calculation, or user defined.
    In the case where you want to run for yesterday.  Double click the icon under the "D", now click the down error.  Double click current date -/+ ???,  enter the -1.    Now click save.  This variant will now always take sy-datum - 1 and put it into that field. 
    Now for your monthly report.   What we do here is we have variables set up in the TVARV table, which include current fiscal month, current calendar month, previous fiscal month, and so on.  We run a program which re-calculates these variables everyday so that they are always accurate.  You can set up the selection variable to use the table variable from TVARV.  You would do this the same way as the dynamic date calc except click on the icon under the "T".
    Regards,
    Rich Heilman
    Rich Heilman

  • How do I create a context menu in the new CL_SALV

    I like a function xx in context menu. How do I create a context menu in the  CL_SALV ?
    thank you!
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        TYPES: t_proc TYPE zmp_c00_pr_d,
               tt_proc TYPE STANDARD TABLE OF t_proc,
               tt_proces_subpr TYPE TABLE OF ltyp_proces_subpr.
        CLASS-DATA: lr_context TYPE REF TO cl_gui_alv_grid,
        r_selections TYPE REF TO cl_salv_selections,
        lr_menu type ref to cl_ctmenu.
        CLASS-METHODS: main CHANGING ct_zmp_c00_pr_d TYPE tt_proc
                                     ct_proces_subpr TYPE tt_proces_subpr
                                     cv_screen TYPE i.
      PRIVATE SECTION.
        CLASS-DATA lt_zmp_c00_pr_d TYPE TABLE OF zmp_c00_pr_d.
        CLASS-DATA ls_process TYPE zmp_c00_pr_d.
        CLASS-METHODS: handle_double_click
                   FOR EVENT double_click  OF cl_salv_events_table
                   IMPORTING row column,
                   detail
                   IMPORTING l_objkey TYPE zmp_c00_pr_d-objkey.
    ENDCLASS.                    "lcl_events DEFINITION
    * CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD main.
        DATA: lr_alv TYPE REF TO cl_salv_table,
              lr_events TYPE REF TO cl_salv_events_table,
              lr_columns TYPE REF TO cl_salv_columns,
              lt_col_tab TYPE salv_t_column_ref.
        FIELD-SYMBOLS <column> LIKE LINE OF lt_col_tab.
        IF r_container IS INITIAL.
          CREATE OBJECT r_container
            EXPORTING
              container_name              = 'CONTAINER'
            EXCEPTIONS
              cntl_error                  = 1
              cntl_system_error           = 2
              create_error                = 3
              lifetime_error              = 4
              lifetime_dynpro_dynpro_link = 5
              OTHERS                      = 6.
          IF sy-subrc <> 0.
            MESSAGE i004(z_pm_tool).
          ENDIF.
    *Für Dynpro 1400
          IF cv_screen = '1400'.
            TRY.
                CALL METHOD cl_salv_table=>factory
                  EXPORTING
    *    list_display   = IF_SALV_C_BOOL_SAP=>FALSE
                    r_container    = r_container
                  IMPORTING
                    r_salv_table   = r_alv
                  CHANGING
                    t_table        = ct_proces_subpr.
              CATCH cx_salv_msg .
            ENDTRY.
            TRY.
    * zeige die Daten
                r_alv->display( ).
                IF sy-subrc NE 0.
                  MESSAGE i001(z_pm_tool).
                ENDIF.
              CATCH cx_salv_msg.
            ENDTRY.
          ENDIF.
    * Für Dynpro 1100
          TRY.
              CALL METHOD cl_salv_table=>factory
                EXPORTING
    *    list_display   = IF_SALV_C_BOOL_SAP=>FALSE
                  r_container    = r_container
                IMPORTING
                  r_salv_table   = r_alv
                CHANGING
                  t_table        = ct_zmp_c00_pr_d  .
            CATCH cx_salv_msg .
          ENDTRY.
          TRY.
    * zeige die Daten
              r_alv->display( ).
              IF sy-subrc NE 0.
                MESSAGE i001(z_pm_tool).
              ENDIF.
            CATCH cx_salv_msg.
          ENDTRY.
    *Ereignisobjekt holen
          lr_events = r_alv->get_event( ).
    ** get the SELECTIONS object
    *r_selections = r_alv->get_selections( ).
    * Interne-Tabelle füllen und an die Methode handle_double_click übergeben
          LOOP AT ct_zmp_c00_pr_d INTO ls_process.
            APPEND ls_process TO lt_zmp_c00_pr_d.
          ENDLOOP.
    * Zeiger auf Container für Kontexmenu
          CREATE OBJECT lr_context
            EXPORTING
              i_parent = r_container.
          DATA: lt_events TYPE cntl_simple_events.
          CALL METHOD lr_context->set_registered_events
            EXPORTING
              events                    = lt_events
            EXCEPTIONS
              cntl_error                = 1
              cntl_system_error         = 2
              illegal_event_combination = 3
              OTHERS                    = 4.
          IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    * Interne-Tabelle füllen und an die Methode handle_double_click übergeben
          LOOP AT ct_zmp_c00_pr_d INTO ls_process.
            APPEND ls_process TO lt_zmp_c00_pr_d.
          ENDLOOP.
    * Event: Add Function
          SET HANDLER: on_added_function FOR lr_events.
    * Event: Kontexmenu
    *      SET HANDLER: on_context_menu_request FOR lr_context.
    * Event: Doppelklick
          SET HANDLER handle_double_click FOR lr_events.
    * get the SELECTIONS object
          r_selections = r_alv->get_selections( ).
    * Einzelne Spalte holen
          lr_columns = r_alv->get_columns( ).
    * Doppelklick funktioniert nur auf das Feld OBJKEY
          LOOP AT lt_col_tab ASSIGNING <column>.
            <column>-r_column->set_output_length( 20 ).
            IF <column>-columnname = 'OBJKEY'.
              <column>-r_column->set_visible( 'X' ).
            ELSE.
              <column>-r_column->set_visible( ' ' ).
            ENDIF.
          ENDLOOP.
          IF lt_col_tab IS NOT INITIAL AND sy-subrc <> 0.
            MESSAGE i002(z_pm_tool).
          ENDIF.
        ENDIF.
      ENDMETHOD.                    "main
      METHOD handle_double_click.
        FIELD-SYMBOLS <fs_zmp_c00_pr_d> TYPE zmp_c00_pr_d.
        READ TABLE lt_zmp_c00_pr_d INDEX row ASSIGNING <fs_zmp_c00_pr_d>. " vor dem Changing Parameter der Klasse
    *    READ TABLE ct_zmp_c00_pr_d INDEX row ASSIGNING <fs_zmp_c00_pr_d>.
        IF sy-subrc <> 0.
          RETURN.
        ENDIF.
        IF column = 'OBJKEY'.
          lcl_event_handler=>detail( <fs_zmp_c00_pr_d>-zz_slotid_a ).
        ENDIF.
      ENDMETHOD.                    "handle_double_click
      METHOD detail.
        DATA: lr_alv TYPE REF TO cl_salv_table,
              lt_alv_tab TYPE TABLE OF zmp_p00_sp_d.
    * Subprozess holen
        SELECT * FROM zmp_p00_sp_d INTO TABLE lt_alv_tab
          WHERE objkey = l_objkey.
        IF sy-subrc <> 0.
          MESSAGE i003(z_pm_tool).
        ENDIF.
        TRY.
    * Neu erzeugte Instanz für ALV-Tabellenobjekt holen
            cl_salv_table=>factory( IMPORTING r_salv_table = lr_alv
                                     CHANGING t_table = lt_alv_tab ).
    * Ausgabe Fenster für SubScreens
            lr_alv->set_screen_popup( start_column = 1
                                   end_column = 130
                                   start_line = 1
                                   end_line = 10 ).
    * Anzeige der Daten
            lr_alv->display( ).
            IF sy-subrc <> 0.
              MESSAGE i001(z_pm_tool).
            ENDIF.
          CATCH cx_salv_msg.
        ENDTRY.
      ENDMETHOD.                    "detail
    ENDCLASS."lcl_event_handler IMPLEMENTATION
    Edited by: polaris1 on Dec 15, 2010 12:18 PM

    Can't read that jumble, but suggest you look at the excellent SALV tutorials by Rich Heilman by searching for SALV tutorial on SCN.  You'll find working code and how-to for adding your own functions to SALV.

  • Issue with length of text field - READ_TEXT & SAVE_TEXT

    Hi,
        I need to allow user to enter max 400 char in one field and that needs to be updated in the VA02 for the corresponding sales order.
        I can able to save the text max 132 chars since TLINE-TDLINE will allow max 132 chars in both READ_TEXT & SAVE_TEXT.
        So here i am looking for the solutions for the below...
    1) How to design one input field to take 400 chars at one shot .... do i need to use table control ?
    2) Once i get the 400 char may be i will split in to 3-4 lines and i can append 130130130... like that through those FM... if not possible can you tell me the alternative.
    regards
    jaya

    You need to use class CL_TEXT_EDIT....
    Kindly stolen from Rich Heilman -:)
    report zrich_0001 .
    data:
          dockingleft  type ref to cl_gui_docking_container,
          text_editor    type ref to cl_gui_textedit,
          repid type syrepid.
    data: itext type table of tline-tdline,
          xtext type tline-tdline.
    parameters: p_check.
    at selection-screen output.
      repid = sy-repid.
      create object dockingleft
                  exporting repid     = repid
                            dynnr     = sy-dynnr
                            side      = dockingleft->dock_at_left
                            extension = 1070.
      create object text_editor
                  exporting
                       parent     = dockingleft.
      xtext = 'http:\www.sap.com'.
      append xtext to itext.
      call method text_editor->set_text_as_r3table
         exporting
               table              = itext
         exceptions
               others             = 1.
    start-of-selection.
      call method text_editor->get_text_as_r3table
         importing
               table              = itext
         exceptions
               others             = 1.
      loop at itext into xtext.
        write:/ xtext.
      endloop.
    You can use <b>RKD_WORD_WRAP</b> to wrap the text into an internal table -;)
    Greetings,
    Blag.

  • Problem while splitting a string based on ' comma '

    Hi,
    I'm trying to upload a file in .csv format into an internal table. For this i'm declaring an internal table it_iflat and a work area wa_xflat as shown below.
    DATA:  it_iflat type table of string,
           wa_xflat type string.
    Now, once i have data in it_iflat..i loop at each record and split it at the occurance of a comma. as shown below.
    DATA:  it_irec type table of string with header line.
    loop at it_iflat into wa_xflat.
         clear it_irec.
        refresh it_irec.
        split wa_xflat at ',' into table it_irec.
    This is working fine when the <b>last column</b> of the excel sheet is populated. But when this field is left blank in the excel sheet..the total number of values that i get in it_irec is one less than the actual.
    Is this happening because the last column doesn't have a value and since its after the last comma..its getting neglected?
    Could anyone please let me know how to resolve this.
    Thanks in advance
    Harsha.

    If there is a value in the last column, then the value should appear in the last column of your itab.
    Maybe try it this way instead.
    report zrich_0001.
    data: it_iflat type table of string,
          wa_xflat type string.
    data: begin of it_irec occurs 0,
          fld1(10) type c,
          fld2(10) type c,
          fld3(10) type c,
          end of it_irec.
    clear it_irec.   refresh it_irec.
    loop at it_iflat into wa_xflat.
      clear it_irec.
      split wa_xflat at ',' into it_irec-fld1
                                 it_irec-fld2
                                 it_irec-fld3.
      append it_itrec.
    endloop.
    Regards,
    Rich Heilman
    Message was edited by: Rich Heilman

  • Error while opening XML file

    hi all,
    i was downloading data from the internal table into an XML file. i wrote the coding in the following way. Mr. Rich Heilman helped to solve this requirement to the maximum extent but iam stuck at the last moment. the coding is
    tables:mara.
    type-pools: truxs.
    parameters: p_matnr like mara-matnr.
    data: ixml type truxs_xml_table.
    data: xxml like line of ixml.
    data: size type i.
    data: file_str type string.
    file_str = 'C:\simp.xml'.
    data: begin of itab_mara occurs 0,
              matnr like mara-matnr,
              ernam like mara-ernam,
              aenam like mara-aenam,
              vpsta like mara-vpsta,
          end of itab_mara.
    select matnr ernam aenam vpsta from mara into table itab_mara up to 5
    rows where matnr = p_matnr.
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
    EXPORTING
      I_FIELD_SEPERATOR          =
      I_LINE_HEADER              =
      I_FILENAME                 =
      I_APPL_KEEP                = ' '
      I_XML_DOC_NAME             =
    IMPORTING
       PE_BIN_FILESIZE            = size
      TABLES
        I_TAB_SAP_DATA             = itab_mara
    CHANGING
       I_TAB_CONVERTED_DATA       = ixml
    EXCEPTIONS
      CONVERSION_FAILED          = 1
      OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       BIN_FILESIZE                  = size
        FILENAME                      = file_str
       FILETYPE                      = 'BIN'
      APPEND                        = ' '
      WRITE_FIELD_SEPARATOR         = ' '
      HEADER                        = '00'
      TRUNC_TRAILING_BLANKS         = ' '
      WRITE_LF                      = 'X'
      COL_SELECT                    = ' '
      COL_SELECT_MASK               = ' '
      DAT_MODE                      = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = ixml
    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.
    but when i tried to open the XML file it is showing the following error.
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    A name was started with an invalid character. Error processing resource 'file:///C:/simp.xml'. Line 1, Position 23
    <?xml version="1.0"?><%_TYPE0000000019><%_TYPE0000000019><MATNR Datatype="C" Length="18">00000000008...
    do anyone know how to rectify this error.
    thanks,
    anil.

    check this thread for complete code sample
    https://forums.sdn.sap.com/click.jspa?searchID=2218535&messageID=975797
    Raja

  • How to find out tcode for the zprogram.

    Hi All,
    How to find out the Tcode of a Zprogram.
    I will appritiate your help.
    Thanks,
    Veni.

    Couple of ways to do this,  one is to go to SE93 and do F4 on the transaction code field, click information system,  click the all selections icon, then put the name of the z program in the field, and hit enter,  this will give you the tcode.
    Regards,
    RIch Heilman
    Message was edited by:
            Rich Heilman

  • At end of field,  for dynamic internal table entries ?

    Dear All,
    I've data in my dynamic internal table.
    But, to understand in a better way I created a test program with static entries.
    Case 1 -->
    DATA: BEGIN OF itab OCCURS 0,
            year TYPE char4,
            name TYPE char10,
          END OF itab.
    DATA: BEGIN OF itab2 OCCURS 0 ,
            year TYPE char4,
            name TYPE char10,
            count TYPE i,
          END OF itab2.
    DATA: gv_count TYPE i,
          gv_flag TYPE char1.
    itab-name = 'AAAA'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'AAAB'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'AAAC'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'AAAD'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBB'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBA'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBC'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBD'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCC'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCA'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCB'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCD'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCE'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCf'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDD'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDA'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDB'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDC'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDE'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    SORT itab BY year.
    LOOP AT itab.
    * Counter
      gv_count = gv_count + 1.
      AT END OF year.
        itab2-count = gv_count.
        MOVE-CORRESPONDING itab TO itab2.
        APPEND itab2.
        CLEAR gv_count.
        WRITE:/ itab2-name,
        itab2-year,
        itab2-count.
        CLEAR itab2.
        CLEAR gv_flag.
      ENDAT.
    ENDLOOP.
    Now for the above program the Output is :
    Name     Year          Count
    ********** 2005          5
    ********** 2006          6
    ********** 2007          4
    ********** 2008          4
    " Forget about the asterisk values as it's an example !
    The above output is correct, But in my real case the table structure is not like the above .
    The order of the field are in reverse.
    i.e. The internal table is like this :
    Case 2 -->
    DATA: BEGIN OF itab OCCURS 0,
            name TYPE char10,
            year TYPE char4,
          END OF itab.
    DATA: BEGIN OF itab2 OCCURS 0 ,
            name TYPE char10,
            year TYPE char4,
            count TYPE i,
          END OF itab2.
    In this case if I'm using at end of year the output is coming wrong.
    Even on change of is also not working.
    Request you guys to help me out so that I can achieve the same output as of case 1 with the table declaration as of CASE 2.
    Regards,
    Deepu.k

    Hello Rich Heilman,
    Again you came for my rescue ............
    My code for this scenario is like this :
    DATA: BEGIN OF itab OCCURS 0,
            name TYPE char10,
            year TYPE char4,
          END OF itab.
    DATA: BEGIN OF itab2 OCCURS 0 ,
            name TYPE char10,
            year TYPE char4,
            count TYPE i,
          END OF itab2.
    DATA: gv_count TYPE i,
          gv_flag TYPE char1.
    itab-name = 'AAAA'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'AAAB'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'AAAC'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'AAAD'.
    itab-year = '2008'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBB'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBA'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBC'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'BBBD'.
    itab-year = '2007'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCC'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCA'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCB'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCD'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCE'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'CCCf'.
    itab-year = '2006'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDD'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDA'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDB'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDC'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    itab-name = 'DDDE'.
    itab-year = '2005'.
    APPEND itab.
    CLEAR itab.
    SORT itab BY year.
    LOOP AT itab.
    * Counter
      gv_count = gv_count + 1.
      IF sy-tabix GT 1.
        ON CHANGE OF itab-year.
          itab2-count = gv_count.
          MOVE-CORRESPONDING itab TO itab2.
          APPEND itab2.
          CLEAR gv_count.
          WRITE:/ itab2-name,
          itab2-year,
          itab2-count.
          CLEAR itab2.
          CLEAR gv_flag.
        ENDON.
      ENDIF.
    ENDLOOP.
    The Output is :
    DDDC       2005          2
    CCCf       2006          4
    BBBD       2007          6
    AAAD       2008          4
    The above output is wrong.
    Can u correct me where I'm doing wrong ?
    Regards,
    Deepu.K

Maybe you are looking for