Skip to Content
author's profile photo Former Member
Former Member

Display schedule qty - Month wise in ALV Grid

Hi Experts,

I have a requirement to display the schedule line quantities month wise in ALV Grid. The columns sholud be dynamic columns based on the input date range. I got some idea about how to create dynamic ALV but it is not clear to implement in my requirement.

Please Guide me in achiving the same.

Example:

Jan 2011 Feb 2011 March 2011

100 2000 300

Thanks&Regards,

Karthik

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jun 14, 2011 at 02:10 PM

    Hi.,

    Create field catalog dynamically as like this.,

    select-options s_date for sy-datum.
    
    data: n type i,
          count type i,
          cnt type string,
          field type string,
          descr type string.
    
    DATA: m TYPE t247-mnr,
          month_name type char10,
          m1 type i.
    
    n = s_date-high+4(2) - s_date-low+4(2) .   " getting number of months
    
    m1 = s_date-low+4(2).
    
    m = m1.
    
    n = n + 1.
    
    DO n TIMES.   " building field catalog dynamically
    
      m = m + 1.
      count = count + 1.
      cnt = count.
    
      concatenate 'FIELD' cnt into field.
    
      CALL FUNCTION 'ISP_GET_MONTH_NAME'    " FM to get month name
          EXPORTING
            LANGUAGE           =  sy-langu
            MONTH_NUMBER       =   m
         IMPORTING
    *    LANGU_BACK         =
           LONGTEXT           =  month_name .
    
      concatenate month_name s_date-low+0(4) into descr separated by ''.
    
    
      wa_fieldcat-col_pos = count.
      wa_fieldcat-row_pos = '1'.
      wa_fieldcat-fieldname = field.
      wa_fieldcat-seltext_m = descr.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
    
    
    ENDDO.

    After this create dynamic table using,

    CALL METHOD cl_alv_table_create=>create_dynamic_table

    EXPORTING

    it_fieldcatalog = t_fldcat

    IMPORTING

    ep_table = t_newtable.

    then loop the internal table and assign the component to final internal table,.

    like .,

    CONCATENATE 'FIELD' index INTO fieldvalue. " do same like fieldcatalog

    ASSIGN COMPONENT fieldvalue OF STRUCTURE <fs_dyntable> TO <fs_fldval>.

    <fs_fldval> = wa-fieldvalue.

    hope this helps u.,

    Thanks & Regards,

    Kiran

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi, Kiran ,

      In this report Month is display in column wise but in my report display in row wise plz help me. but month start from April may...etc...Validation by means of selection screen creation date. I will send Example..

      Creation Date :

      creation date: 20.05.2012 to 18.07.2012.

      From (may 20 to 31 created order Qty will be display in may )

      From(June 1 to 30 created order Qty will be display in june)

      From(July 1 to 18 created order Qty will be display in july)

      Plz Guide me

      Month Qty1 qty2 Total

      April

      may 10 30 40

      jun 80 20 100

      july 10 10 20

      aug

      sep

      Nov

      Dec

      Jan

      Feb

      March

      Total 110 60 160

      plz guide me

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.