Assigning amount to months in Dynamic

Hi all,
I have a Dynamic ITAB, which is having month names as Dynamic columns. Now i want to assign some amount to each month.
so, in the assignment part, i write :
LOOP AT itab   INTO  wa_itab.
    ASSIGN COMPONENT  'MNT_AMT'  OF STRUCTURE <gwa_line> TO <gwa_field>.
    <gwa_field> = wa_itab-mnt_amt.  " this is my Amount value
    DO l_terms TIMES.  " l_terms is dynamic..
          ASSIGN COMPONENT  wa_flname OF STRUCTURE <gwa_line> TO <gwa_field>.
      <gwa_field> = wa_itab-mnt_amt.
    ENDDO.
endloop.
but the amount is assigning to the last month only.
for ex: say i have months, starting from JANUARY to DECEMBER, in my case the amount is assigned to DECEMBer.
i want to assign amount to each month.
how to do that ?
Thanks
Kamala

Hi,
Do as below.
Assume the month names are stored in an internal table with header line it_months with a single field month. Which means the content of the table it_months will be the colomns of the final interanal table of structure <gwa_line>.
I assume there is a field which stores the month names in the internal table itab.
The modified code is below.
LOOP AT itab INTO wa_itab.
ASSIGN COMPONENT 'MNT_AMT' OF STRUCTURE <gwa_line> TO <gwa_field>.
<gwa_field> = wa_itab-mnt_amt. " this is my Amount value
LOOP AT it_months WHERE month = wa_itab-month.
    ASSIGN COMPONENT it_months-month OF STRUCTURE <gwa_line> TO <gwa_field>.
    <gwa_field> =  wa_itab-mnt_amt.
  ENDLOOP.
append <gwa_line> to <gt_line>.
endloop.
Hope this helps you,
Murthy.

Similar Messages

  • How to create events for a limited amount of months

    Hi guys,
    It happened to me more than once wanting to create an event that would repeat every month for  5 months ( example ) and having to create an individual event for every single month since there is now way to limited the amount of months a event can occur.
    Is there a way to limit the amount of months of an event?
    Thanks in advance for your help.

    Hello Pasapula
    When you are in the View Cluster maintenance dialog (SE54) click on dialog "Events".
    Below the field for the view cluster you have an additional field <b>FORM routines main program</b>. There you have to add the main program containing the FORM routines called by the VC events.
    For example: I had defined a normal report containing an include with all the FORM routines. The report contains only the following lines of coding:
    report zus_0120_u1.
    * Common Data und access routines for user exits in VC maintenance
    include LSVCMCOD.
    include  zus_0120_f1. "FORM routines for VC events
    Now in the "Events" dialog of the view cluster maintenance you assign your FORM routines to the events.
    Regards
      Uwe

  • Can i assign an 'order by' clause dynamically in forms ??

    I know it's possible to assign an 'order by' clause in reports with lexical parameter.
    for example..
    select A
    from TABLE
    where A is not null
    &V_ORDERBY
    In this, v_orderby might be 'order by name' like that,,,
    can i assign an 'order by' clause dynamically IN FORMS ??
    If you understan my question, please answer to me,,,ㅜㅜ

    Have you tried this build-in function?
    SET_BLOCK_PROPERTY('[BLOCK_NAME]', ORDER_BY, 'SORTCOL1, SORTCOL2...');
    Where 'SORTCOL1, SORTCOL2...' are the table columns name.

  • No Assigned Amount.

    Hi!
    I have created a project and then created POs using a wbs under this project.
    However, no assigned amount is being shown - either in CJ33 or S_ALR_87013542.
    Can anybody help?
    Regards,
    RC.

    Hi Riju,
    Check Commitment Management is active or not in CO Area ?
    Check the Availability control status in CJ32 in Extras --> Availability Control --> info, analysis....
    If activated, check the Budget Profile for Activation Type and Availability control at what level ? i.e annual ? Overall ? Overall release ? Annual release ??
    Still facing problem..revert back !!!
    Regards,
    Hari

  • ECM- how to assign amount to the budget structure ?

    Hi,
    I'm new to Enterprise Compensation Management (ECM Module).
    I need to know how we create a budget structure for org units? How we assign amount to the budget structure.
    I found one program 'RHECM_BUDGET_GENERATE' which generates the budget structure, but it doesn't assign the amount. So how to assign the budget amount. Which transaction we use for the same ? or Is there any FM which assigns the amount to the budget structure? I am trying to enhance the program 'RHECM_BUDGET_GENERATE'  so that it assigns the budget amount also.
    Thanks in advance,
    Shrinivas

    I'm fuming! Same problem as I like to manually assign location data, esp as I just imported lots of old photos which I recently found on an old drive. They are now on new Photos app, but iPhoto, otherwise I would use the latter to assign geo data as before. It seems very complicated but maybe I could delete from iPhoto, somehow import in to iPhotos, then import from iPhoto to Photos. Would that work?
    Lots of my photos have ALSO lost their geo data and their face data due to the fact that somehow my new "Photos" library suddenly decided to put 4000 odd duplicates in the new library imported from iPhoto. I then ran a duplicate-finding application in the new photos library, managed to remove most of the duplicates, however most of the photos that then remained had lost their face data which took ages to put on in the first place!!! (Perhaps the ones I deleted had the location nd face data I wanted and the software kept the duplicate version. I don't know...)
    Plus I am having a nightmare with the new automatic uploading photos to icloud application that runs in the background if enabled.. It says its still uploading  but doesn't appear to have got past a thousand in last few days and just 'stuck' on this amount, despite saying it is uploading automatically. My iOS devices only show a fragment of what is on my mac.
    O well!

  • Assigning value to a range dynamically

    Hello All,
    I want to assign the values to a range dynamically.
    For example in the following piece of code, I cannot directly assign wa-kunnr to
    r_kunnr-low.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign    = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low     = wa-kunnr.
    APPEND r_kunnr.
    ENDLOOP.
    Can this be done dynamically? If I use following code I am getting a short dump.
    lv_fnam = 'wa-kunnr'.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign    = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low     = ( lv_fnam ).
    APPEND r_kunnr.
    ENDLOOP.
    Could anyone please suggest how to do this?
    Regards
    Indrajit

    Hi,
    Try giving it capital letters
    lv_fnam = <b>'WA-KUNNR'</b>.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low = ( lv_fnam ).
    APPEND r_kunnr.
    ENDLOOP.
    Thanks
    Naren

  • Assigning Action to multiple users dynamically

    Hello,
    I have a GP Application wherein the user fills out a form which goes for approval to the Approver....the approver is determined using the 'Assign users to Process Role' Callable Object dynamically which works fine....now i want one more approver to get the same workitem in the worklist as the other....i tried to map this user to the same user identifier as done for the first user.....but it does not work.....how can i achieve this..?
    Any help would be highly appreciated..
    Regards,
    Anil

    Anil,
    Has i am not wrong are you trying to assigning a task to multiple users dynamilally?
    if so..
    Please Use parallel dynamic block and pass list of users to role.
    Reply me if you want more info.
    Regards,
    Rajesh

  • Assigning Multiple tasks in process dynamically

    Hello,
    Please help me out in solving following problem
    Scenario:
    Step 1: Query the DB get all the Products (Multiple rows).
    Step 2: For each Product merge the product information to a template, rendering it as PDF and Assigning it to a user(Assign Task Activity)
    With out waiting for the user action i would like to repeat step 2 so that i can assign all product information as different task dynamically
    Can any one please help meto achieve this?(PFA Process Design diagram)
    Thanks in advance
    Regards
    Rao

    This is more tricky than it sounds.
    You could use a gateway with one branch that goes to the User step and another branch that goes straight to the end of the gateway and set the gateway to No Wait.
    Then, from the end of the gateway object loop back to the start of the gateway so that it assigns it to the next person.
    In the next version of LiveCycle, you should be able to use the Mutli User Task operation to assign a task to multiple users in parallel.
    Jasmin

  • Assigning values to a range dynamically

    Hello All,
    I want to assign the values to a range dynamically.
    For example in the following piece of code, I cannot directly assign wa-kunnr to
    r_kunnr-low.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low = wa-kunnr.
    APPEND r_kunnr.
    ENDLOOP.
    Can this be done dynamically? If I use following code I am getting a short dump.
    lv_fnam = 'wa-kunnr'.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low = ( lv_fnam ).
    APPEND r_kunnr.
    ENDLOOP.
    Could anyone please suggest how to do this?
    Regards
    Indrajit

    Hi Indrajit,
    this is working perfectly for me ...i did not get any error
    REPORT  ychatest.
    TABLES : kna1.
    DATA : wa TYPE kna1,
           lv_fnam(10).
    FIELD-SYMBOLS : <fs> TYPE ANY.
    SELECT-OPTIONS : s_kunnr FOR kna1-kunnr.
    INITIALIZATION.
      wa-kunnr = '100'.
      lv_fnam = 'WA-KUNNR'.
      ASSIGN (lv_fnam) TO <fs>.
      s_kunnr-sign = 'I'.
      s_kunnr-option = 'BT'.
      s_kunnr-low = <fs>.
      APPEND s_kunnr.

  • ASSIGN VALUE TO XML ATTRIBUTE DYNAMICALLY

    how can we create and asign value to an XML attribute dynamically?

    Hi Harshit,
    In this case you should use append xml instead of assign in the assignment action block.
    Assigfn values to local variables from sql query say "Local.Shift", "Local.Quantity" and "Local.Total" then append it to your output as:
    <root  Shift="#Local.Shift#" Qty="#Local.Quantity#" Total="#Local.Total#" />
    Append it to parent of <root /> element.
    Regards,
    Swaroop

  • Create View to allocate amount per month - financial year

    Hi All,
    I like to create an SQL view to divide amount 300,000 between 12 month starting from Month July 2014:
    Amount    Month             Year
    25,000       July              2014
    25,000       August          2014
    25,000       September    2014
    25,000       October        2014
    25,000       November    2014
    25,000       December     2014
    25,000       January        2015
    25,000       February      2015
    25,000       June            2015
    Thanks

    you almost got it, just add the logic...i hard coded the value 12 
    With CURRENT_FISCAL_YEAR as
    Select Cast(case when datepart(month, current_timestamp) >= 7 then datename(year, current_timestamp) + '-07-01'else cast(datepart(year, current_timestamp) -1 as VarChar(4)) + '-07-01' End As Date) As Current_Year_FY
    , NUMBERS as (Select NUMBER from Master..SPT_Values where Type = 'P' and number between 0 and 11)
    , CURRENT_FISCAL_MONTHLY as
    Select 300000/12 as Split,DateAdd(Month, Number, Current_Year_FY) as Current_FY_Month,year(DateAdd(Month, Number, Current_Year_FY)) as Current_FY_Year
    from CURRENT_FISCAL_YEAR
    Cross Join NUMBERS
    Select *
    from Current_FIscal_monthly
    Hope it Helps!!

  • Rolling 13 months data dynamically

    Hi All ,
    I got the 'Cal year/Month' filed  and it is showing as 04.2010.
    How to make the block to get rolling 13 months data and how to make the block dynamic.
    Could any one please help me on this and how to convert the data 04.2010 to April 2010.
    Many Thanks in advance

    In the first column of the block get the current month data and then add second column for last month data by creating an report level object with the following formula.
    =If(MonthNumberOfYear(CurrentDate()) =1;ToDate("12/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy" ); ToDate(FormatNumber(MonthNumberOfYear(CurrentDate())-1;"##")"/01/"FormatNumber(Year(CurrentDate());"####");"MM/dd/yyyy") )
    Similarly, add another column for 'last month - 1' data by creating an report level object with following formula.
    = If(MonthNumberOfYear(CurrentDate()) =2;ToDate("12/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy"); If(MonthNumberOfYear(CurrentDate()) =1;ToDate("11/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy" ); ToDate(FormatNumber(MonthNumberOfYear(CurrentDate())-2;"##")"/01/"FormatNumber(Year(CurrentDate());"####");"MM/dd/yyyy") ) )
    Similarly, add another column for 'last month - 2' data by creating an report level object with following formula.
    = If(MonthNumberOfYear(CurrentDate()) =3;ToDate("12/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy"); If(MonthNumberOfYear(CurrentDate()) =2;ToDate("11/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy"); If(MonthNumberOfYear(CurrentDate()) =1;ToDate("10/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy" ); ToDate(FormatNumber(MonthNumberOfYear(CurrentDate())-3;"##")"/01/"FormatNumber(Year(CurrentDate());"####");"MM/dd/yyyy") ) ) )
    In a similar fashion continue this logic for last month -10. This will give you the block of rolling 13 months data.
    In the case of date function. If your date is a DATE data type then use FormatDate() or if its a STRING data type then use SubStr.
    Thanks,
    Praneeth

  • Headcount for all months and dynamic formula in HR Module

    Hi all,
    I am new to HR module, I had requrement like user will i/p from date and to date for calmonth based upon that i need to create a report i, and in the report i need to  calculate the %attrition(leavers rate)
    I am uploading  from a flat file and the fields in the flat file contains empno,emplocation,empdepartment,Dateofjoining,dateofreleiving
    suppose if the user enters from 05.2008 till 06.2008 means my formula will look like
    the formula to calulate %attrition = totalemployquit/(opening headcount of 1st of 05.2008Closing headcount of end of 05.208)/2opening headcount of 1st of 06.2008+Closing headcount of end of 06.2008)/2)/No of months 365/No of days elapsed100
    if user enters 03.2008 till 05.2008 means my formula will chage accordingly:
    totalemployquit/(opening headcount of 1st of 03.2008Closing headcount of end of 03.208)/2(opening headcount of 1st of 04.2008Closing headcount of end of 04.208)/2opening headcount of 1st of 05.2008+Closing headcount of end of 05.2008)/2)/No of months 365/No of days elapsed100
    Please help me out that sap has the facility for dynamic formula and also how can i find the  opening and closing headcount .
    I already gone through  Personal administartion link and all so please dont provide me the link in help .sap.com  and all,but it would be help full if telling me the way to implement the keyfigures 0HDCNT_VC and 0HDCNT_NC in this case .

    Mr Vinay
        Here u can do one thing by creating custom exit variable and write code for the same in CMOD.
        With this variable u can populate what ever u want.
         Recently i got this req & i solved .
    Warm Regards,
       Hari

  • Assigning part of a string dynamically to a component of a structure

    Hello,
    I want to take part of a string
    example: value = string+10(7)
    and assign this value to a structure. But I only have the fieldnames of the structure. I need something like the following
    Assign value TO COMPONENT (fieldname) of structure
    Thanks.
    Regards, Lars.

    do you have a set structure name you're dealing with or is that dynamic?
    If it's the first scenario and, say, you were dealing with mara and field matnr you could do this:
    data l_string.
    field-symbols <field> type any.
    l_string = in_string+10(18).
    assign l_string to <field> casting type matnr.
    (or assign l_string to <field> casting like mara-matnr).
    now <field> is a 'matnr' type field.
    If it's more complex please give some more info as I'm sure what you want can be done.

  • Assign values to bapi structure dynamically

    Hi,
    I have to use the BAPI, BAPI_MATERIAL_SAVEDATA to extend the material to different plant specific views. I have to use the structure BAPI_MARC and other structures in order to do this. But the values to be passed to the structure BAPI_MARC are not fixed. These values will be maintained in a custom table against the structure name and field name for a particular plant.
    In the program I have to extract the structure name and field name for a corresponding plant from custom table and fill the corresponding value in BAPI structure BAPI_MARC.
    Now, internal table in the program is having these details.
    How can I fill the bapi structure BAPI_MARC based on this information.
    For example, if in custom table, value 0001 is maintained against the field PUR_GROUP, I have to fill the field PUR_GROUP in strcutre BAPI_MARC with 0001.
    Hope I am clear in explaining the problem. Please let me know how to aciheve this?
    Best Regards,
    Kumar.

    Hi,
    I have tried to implement that in a sample program first. Please have a look at the code below.
    DATA: BEGIN OF line,
            col1 TYPE i,
            col2 TYPE i,
            col3 TYPE i,
          END OF line.
    DATA comp(4) TYPE c VALUE 'COL3'.
    FIELD-SYMBOLS: <f1> TYPE ANY, <f3> TYPE ANY.
    ASSIGN line TO <f1>.
    ASSIGN COMPONENT comp OF STRUCTURE <f1> TO <f3>.
    IF <f3> IS ASSIGNED.
    ENDIF.
    I checked in the debugging mode and the value of <f3> in debugging mode is 0, but not line-col3.
    Best Regards,
    Kumar

Maybe you are looking for