Problem in adding field values?

Hi all,
I am using table COSP in my program. The requirement is i need to add the field values(SMEXXX) of this table structure  until the period entered in seletion-screen.
i.e if the period is 005.
i need to add
SME001 UNTIL SME005 TO a variable.
if the period is 007 then
SME001 UNTIL SME007.
I need the logic to choose the no of  field values dynamically? please help me.
Thanks,
aravind.

Hi,
Create ITAB as follows:
Fetch all the data from all the columns SME001 to SME016 in the respective columns in internal table itab.
Make use of field-symbol to add the value of the corresponding columns as follows:-
<FS1> as line type of ITAB
<fs2> type any.
Assume period selected is 007
LOOP AT ITAB ASSIGNING <FS1>
DO.
IF PERIOD = 000.
exit.
ENDIF.
Concatenate 'SME' period into LV_VARIABLE.
Assign component LV_VARIABLE of structure <FS1>
to <FS2>.
if <FS2> is assigned.
sum = sum + <FS2>
endif.
period = period - 1.
ENDDO.
ENDLOOP.
So now sum will contain the sum of the values of SME001 to SME007.
I hope it is clear.
Regards,
Ankur Parab

Similar Messages

  • Problem in adding fields in ADRC

    We are finding problem in adding and deleing fields n ADRC. We have added few fields to ADRC however when we are adding same through Append structure and adjust its giving problem.
    We are suspecting field created in data dictionary but not added in database (Oracle).
    Please let us know your views and suggest proceeding further.

    We are suspecting field created in data dictionary but not added in database (Oracle).
    So let's make sure:
    Check ABAP dictionary in SE11.
    Check Oracle dictionary in sqlplus:
    sqlplus <schema>/<password>
    describe ADRC

  • Adding field values together using Advanced Field Management

    Hi All
    I have 5 currency fields on the Revenue page, that I need to add together into one field, Total Amount (currency field also). I have made Total Amount field read only, and using adv field mgt set the following default and ticked post default:
    [<Revenue>]=[<cCorporate_Income_ITAG>]+[<cDonation_Income_ITAG>]+[<cFlower_Income_ITAG>]+[<cHost_ITAG>]+[<cMerchandise_Income_ITAG>]
    It does not seem to work, is this possible at all or am I not doing something right.
    Help....

    I'm having a very similar issue. I'm trying to do the calculation as a default field value and receive the following error:
    [1] An error occurred calculating the default value for field 'ZCur_5' in business component 'Revenue'.(SBL-DAT-00412) [2] Could not evaluate expression 'Expr: '=[<cMetal_Rate_ITAG>]*[<nQuoted_Weight_ITAG>]*[<nDross_Factor_ITAG>]'' for field 'ZCur_5' in business component 'Revenue'.(SBL-DAT-00394) [3] Generic SSA NOTOK error message.(SBL-DAT-00472)
    I can make the update work via workflow, but this does not help during the initial creation of the record.
    Any ideas?

  • Problems with Adding Fields/Columns to Crosstab in XI

    Post Author: ph03nix
    CA Forum: General
    I am having problems with formatting a crosstab report in CRXI and am hoping that someone has a solution. 
    The crosstab report is a subreport, and requires the following columns, grouped by Firm (also not working optimally, but at least working):
    Evaluator,   Factor1Rate,&#91;Factor2Rate, .., FactorNRate&#93;, Summary, UpdateDate, UpdatedBy
    Where:
    Evaluator is the person that did the evaluation that resulted in each rating (formula field)
    Factor1Rate, etc, may have one, many, or all of these be applicable - there can be up to 15 of these.  Each FactorRate column is to  display the "rating" given by the Evaluator in the corresponding row/column (this much works).  The table heading is a formula, but the corresponding rate is not.
    Summary should display "Complete"  if and only if there is a Comment field (not displayed) filled out for each FactorNRate that has a value of 0, 1 or 5 - otherwise it is blank
    DateEntered is one of 2 fields ("last_updated" , or "creation_date" if  last_updated is null - a formula field)
    UpdatedBy is the last name of the person who last touched the ratings (formula field)
    I have gotten the FactorRates to display in the headers, and gotten the corresponding rates to display underneath them, but I cannot seem to add any other columns to the report - they are either added as headers with the factor_rating columns repeated as subgroups (with incorrect data), or are added under existing headers with duplicates of the ratings.  I just want to add one column for each field as if it were a normal (non-crosstab) table. 
    TIA!

    the 3 last files
    Attachments:
    Z1&Z2.vi ‏19 KB
    tau_inn (SubVI).vi ‏16 KB
    tau_ut (SubVI).vi ‏10 KB

  • Problem regarding XML field value to XML generation

    Hi Everybody,
    I am facing a typical problem. I am storing xml in an xml datatype field in a table. But when I am generating physical file from the xml field, '&amp;' in the xml field is getting converted into '&' in the physical file. But I want '&amp;' to
    be intact.
    Can anyone faced the issue or have any idea of solving this?
    Thanks & Regards,
    Anujit Karmakar
    Anujit Karmakar Sr. Software Engineer

    Hi Anujit,
    How do you generate physical file from the xml field?
    I make a test on my computer using your XML data with the following scripts, '&amp;' exists in my exported file.
    DECLARE @testXML XML
    SELECT @TestXML='<ENVELOPE>
    <HEADER>
    <TALLYREQUEST>Import Data</TALLYREQUEST>
    </HEADER>
    <BODY>
    <IMPORTDATA>
    <LEDGER NAME="Prafulla Ghosh">
    <ADDRESS.LIST TYPE="String">
    <ADDRESS>BEHIND DILIP MATH &amp; DISARI CLUB</ADDRESS>
    </ADDRESS.LIST>
    <MAILINGNAME.LIST TYPE="String">
    <MAILINGNAME>Prafulla Ghosh</MAILINGNAME>
    </MAILINGNAME.LIST>
    <STATENAME>West Bengal</STATENAME>
    </LEDGER>
    </IMPORTDATA>
    </BODY>
    </ENVELOPE>'
    -- We Store the contents of an XML variable to a table
    CREATE TABLE MyXMLTable
    xCol XML
    INSERT INTO MyXMLTable ( xCol )
    SELECT @testXML
    We Save an XML value to a file.
    DECLARE @Command VARCHAR(255)
    DECLARE @Filename VARCHAR(100)
    SELECT @Filename = 'C:\Files\TestXMLRoutine'
    /* we then insert a row into the table from the XML variable */
    /* so we can then write it out via BCP! */
    SELECT @Command = 'bcp "select xCol from ' + DB_NAME()
    + '..MyXMLTable" queryout '
    + @Filename + ' -w -T -S' + @@servername
    EXECUTE master..xp_cmdshell @command
    --so now the xml is written out to a file
    SELECT CONVERT(nVARCHAR(max),BulkColumn)
    FROM OPENROWSET(BULK 'C:\Files\TestXMLRoutine', SINGLE_BLOB) AS x
    go
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • Problem in Adding Field in the View

    Hi Friends,
            I want to add one field in the view of Interaction Center Webclient.
    I copied the view to the Custom BSP and when i try to Add the attribute in context node the Required Attribute is not available in BOL Entity.Please Help me How to Proceed this.
    Thanks & Regards,
    Ashok.

    Hi,
    Create ITAB as follows:
    Fetch all the data from all the columns SME001 to SME016 in the respective columns in internal table itab.
    Make use of field-symbol to add the value of the corresponding columns as follows:-
    <FS1> as line type of ITAB
    <fs2> type any.
    Assume period selected is 007
    LOOP AT ITAB ASSIGNING <FS1>
    DO.
    IF PERIOD = 000.
    exit.
    ENDIF.
    Concatenate 'SME' period into LV_VARIABLE.
    Assign component LV_VARIABLE of structure <FS1>
    to <FS2>.
    if <FS2> is assigned.
    sum = sum + <FS2>
    endif.
    period = period - 1.
    ENDDO.
    ENDLOOP.
    So now sum will contain the sum of the values of SME001 to SME007.
    I hope it is clear.
    Regards,
    Ankur Parab

  • Problem in Adding field to alv

    Hi,
         I have created my zreports in that i want to add order probability for sales order,inquiry ,quotation . But valus coming in report only 100. But according to customer requirement i want 30% for inquiry and 70% for quoatation . how toa dd these values?
         And 1 more when i wil press f4 it should dispaly values like 00 ,10,20......100.
    Its a std field in vabk n vbap.How to get these requirement?
         Thanx in advance.
    I wil never forget to reward if solution works.

    Hi,
        use this funtion moudule
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
           exporting
                retfield    = 'BUKRS'
                dynprofield = 'BUKRS'
                dynpprog    = sy-cprog
                dynpnr      = sy-dynnr
                value_org   = 'S'
           tables
                value_tab   = it001.
    and handle the f4 in subroutine user-command of AlV report and when u select a value then append  that value in main internal  table for that particular record.

  • Screen exit MEREQ001- Copy 1 PR line item custom fields values in all

    Hi,
    I have implemented the Enhancement MEREQ001 to add a new tab for Purchase Requistion screen at line item level .
    Requirement for me is to show the same data in the newly added tab for all line items and also to save the same data in EBAN table.
    I am facing a problem while saving the data. In EBAN table, the data was saved for all line items. But the custom added field values are saved for only the line item displayed.
    I ll explain with an example for better understanding.
    I have created a PR with 3 line items ITEM1, ITEM2 ,and ITEM2
    When i saved the data when ITEM1 is displayed, EBAN have custom added field values for ITEM1 but not for ITEM2 and item3.
    The same way, if I save data when ITEM2 is displayed, EBAN has custom added field values for ITEM2 but not for ITEM3 and ITEM1.
    Now, my requirement is to get the all  line items ITEM1 & ITEM2 and ITEM3 updated with custom added field values in EBAN.
    The logic i added in  ME_PROCESS_REQ_CUST~CHECK are as below.
           i_items             TYPE mmpur_requisition_ite                       ,
            lv_if_item          TYPE REF TO if_purchase_requisition_item,
            lt_itm_data         TYPE mereq_item   .
    DATA :  LV_dept TYPE EBAN-ZZDEPARTMENT ,
            lx_itm_data type mereq_itemx.
        CALL METHOD im_header->get_items
          RECEIVING
            re_items = i_items.
        LOOP AT i_items INTO wa_item.
          lv_if_item = wa_item-item.
          CALL METHOD lv_if_item->get_data
            RECEIVING
              re_data = lt_itm_data.
          CALL METHOD lv_if_item->get_datax
          RECEIVING
          re_datax = lx_itm_data.
         IF lt_itm_data-zzdepartment IS INITIAL.
             lt_itm_data-zzdepartment =  LV_dept .
             lx_itm_data-zzdepartment = 'X' .
          ELSE.
             Lv_dept = lt_itm_data-zzdepartment.
        ENDIF.
    To set the value for all line item.
            CALL METHOD lv_if_item->SET_DATAX
              EXPORTING
              IM_DATAX = lx_itm_data.
        CALL METHOD lv_if_item->Set_data
            EXPORTING
              IM_data = lt_itm_data.
        ENDLOOP.    " LOOP AT i_items INTO wa_item.
      ENDIF.    " IF ( NOT ls_header1-banfn IS INITIAL
    BUT above logic is not working
    Please give your inputs
    Thanks in advance
    Deepanker Dwivedi

    HI,
    You can use GET CURSOR LINE LINE_NO this will give you the sy-index so that you can read the itab like
    read table itab index line_no. This is one option and second is if you have row selector.
    read table itab with key mark = 'X'.
    If you want the Row contents befor the PAI triggers
    [Check this Thread|Table Control dynamic F4;
    Hope this is clear to you.
    Regards
    Ram

  • Having problems when adding new Curency value field + currency field.

    I need to add a new Currency field (CURR, length 15, 2 decimal places) plus the Currency field itself to a view. 
    I'm really struggerling. I have looked at the existing SAP fields in the Component workbench and I have to admit I can not see how a field is linked/related to the currency itself. Is this link established purlely at the disctionary level?.
    Has anyone added their own Z field value  and Z currency field before. I can create both fields and display them, but what I can not work out is how I related them within the component workbench, or is this done from the dictionary?.
    Any help would be greatly appreciated.
    I should have been able to look at an existing SAP example and work out how it's done, but so far I can not see/determine how this is achieved, even though someone has mentioned that it's controlled via the GET_I_field method. Looking at this method I was expecting to see some mention of both the Currency value field and the Currency field. But as I don't see these confusion reigns.
    Jason

    That's correct, but am I right in thinking that you can't actually create the currency key field itself?.
    I am aware that currency value fields can be created which reference a currency key field, but can see nothing that allows me to create a currency key field to be referenced.
    I hope that makes sense.
    Also, I have amended the structure, changing my value fields from Decimal 15,2 to Currency 15,2  and have created a new currency key field in the structure and referenced this from the Currency value field.
    Witin the Component/view/context node I can see this new currency key field, but it appears as STRUCT.fieldlabel whereas my currency value field appears in the context node as EXT.fieldlabel, because it was created in the AET.
    My problem is that when attempting to add the currency key field onto the screen I don't have it to select from within the list of structures/attributes. All the others attributes in the context node seem to be there, except the new currency key field/attribute.
    The attribute has a SET_fieldlabel, GET_fieldlabel, GET_M_Fieldlabel and a GET_I_Fieldlabel, which I believe is all that should be required.
    Does anyone know what my problem could be?.
    Jason

  • Problem with adding new field to the mass change screen in FBL5N

    Hi,
    We have a problem with adding the field XREF3 to the mass change screen. We followed steps described in the SAP Note 640908, but the result is that when we try to mass change some documents in FBL5N and enter some values in the mass change screen, a message appears: "Please enter at least one new value" and nothing is changed.
    If you have faced with such a problem, we would be grateful if you give us some tips.
    Regards,
    Miłosz Włodarczyk

    The problem has been resolved: we didn't activate a code in SE80.

  • Maintaining operating concern after adding new value field

    Hello,
    I added a new value field to our live operating concern,maintained the data structure throguh KEA0(Maintain operating concern).The changes are transported from Development to Quality,Changes were reflected in Q system.After testing in Q system transports were pushed to production system.The new value field is added to the operating concern. When i check the log for KEA0 in production system it displayed one message like:
    Field VV088 was added to the reference structure
    Message no. KE782.You probably either  changed the operating concern or SAP-EIS aspect, and added the field VV099 to the definition.
    The added a CO-PA value field:
    In this case, the field is added to the definition or the summarization levels. This invalidates all existing levels. Consequently, you need to activate them again and fill them with data.
    In production system maintaining operating concenr or KEAO is only in display mode.Is it needed to regenerate the operating concern once again in production, how to do it. Is the message talking about the KEDV summarization levels.?
    thanks
    rahul

    Hi,
    No no ....KEDV is nothing to do here....that is creation of summarization in CO-PA.
    Since you added new value field you necessarily have to Regenerate the operating concern...
    Use Tcode KEA0...go to Environment tab...there the status of Cross client part  and client specific part both will be in RED....now just click on the Cross client (candle button)...now the system would regenerate the operating concern...once it is over do the same for the client specific...
    Beware when you do regenerate the operating concern no body can enter any transaction in that server since it is cross client table ...hence better do it after business hours.
    Hope this helps!
    Running KEDU with rebuild is relevant only when you already have created summarization and called up the same in the CO-PA report "options" tab. If you did not created the summarization you are nothing to do with KEDU.
    Next: The new value field has to be transported to PRD and hence even in PRD we have to do the regeneration manually.
    Regards,
    Velumani
    Message was edited by: Velumani Arunachalam
    Message was edited by: Velumani Arunachalam

  • Impact of adding new value fields in ongoing operating concern.

    Hi All,
    Want to know the steps of adding new value fields in the existing operating concern in COPA?
    What is the overall impact of addition of New Value fields in the running Operating Concern?
    How do we test the addition of new value fields?
    Is the addition of New Value fields to the running Operating Concern advisable?
    Your support and advice is highly anticipated and appreciated.
    Thanks & Regards
    9819528669

    HI,
    please search in SCN forum before you post:
    Re: Adding a ValueField to an existing Operating Concern?
    Best regards, Christian

  • Change field value in a table, based on another field value in the same row (for each added row)

    Please Help, I want to change field value in a table, based on another field value in the same row (for each added row)
    I am using this code :
    <HTML>
    <HEAD>
    <SCRIPT>
    function addRow(tableID) {
    var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    var colCount = table.rows[0].cells.length;
    for(var i=0; i<colCount; i++ ) {
    var newcell = row.insertCell(i);
    newcell.innerHTML = table.rows[1].cells[i].innerHTML;
    switch(newcell.childNodes[0].type) {
    case "text":
    newcell.childNodes[0].value = "";
    break;
    case "checkbox":
    newcell.childNodes[0].checked = false;
    break;
    case "select-one":
    newcell.childNodes[0].selectedIndex = 0;
    break;}}}
    function deleteRow(tableID) {
    try {var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    for(var i=0; i<rowCount; i++) {
    var row = table.rows[i];
    var chkbox = row.cells[0].childNodes[0];
    if(null != chkbox && true == chkbox.checked) {
    if(rowCount <= 2) {
    alert("Cannot delete all the rows.");
    break;}
    table.deleteRow(i);
    rowCount--;
    i--;}}}catch(e) {alert(e);}}
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
    <INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
    <TABLE id="dataTable" width="350px" border="1">
    <TR>
    <TD width="32"></TD>
    <TD width="119" align="center"><strong>Activity</strong></TD>
    <TD width="177" align="center"><strong>Cost</strong></TD>
    </TR>
    <TR>
    <TD><INPUT type="checkbox" name="chk"/></TD>
    <TD>
    <select name="s1" id="s1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </TD>
    <TD><input type="text" name="txt1" id="txt1"></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

    Hi,
    Let me make sure u r working with table control.
    First u have to create a event(VALIDATE) to do the validation.
    Inside the event,
    1. First get the current index where user has pointed the curson
    2. Once u get the index read the internal table with index value.
    3. Now u can compare the col1 and col2 values and populate the error message.
    1. DATA : lo_elt TYPE REF TO if_wd_context_element,
                   l_index type i.
    lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
         CALL METHOD LO_ELT->GET_INDEX( RECEIVING  MY_INDEX = l_index.
    above code should be written inside the event.
    Thanks,

  • Problem in adding custom table's field in MM46

    Hi,
    I have a complex requirement of adding fields of custom table in MM46 for mass maintance.
    I did most of the part but dont know what is missed.
    Steps that i followed
    1. used tcode MASSOBJ- I Added Ztable name to application table for Object type - BUS1001001.Here i dont know what to provide in other attributes of entry example Number, DB table etc. [SCREENSHOT OF MASSOBJ|https://plus.google.com/photos/114088763388693559922/albums/5704943614516268609]
    2. Used tcode OMSR- I added entry of Ztable'field  here i gave selection group as 211, maint status as KDEVALBQPSZXCFG
    alv group- blank. [screen shot of OMSR |https://plus.google.com/photos/114088763388693559922/albums/5704943614516268609]
    After doing these steps Table name and field of table is visible in mm46. But problem is  Field is not editable that is in display mode only. 
    Pleae see this snapshot - [error image|https://plus.google.com/photos/114088763388693559922/albums/5704938582830478801]
    Please help me by telling what i missed and am i adding right attributes for entries in MASSOBJ AND OMSR?
    Thanks.
    Waiting for expert's comments.
    Reagards
    Rahul
    Please do not use words like 'urgent'
    Edited by: Rob Burbank on Feb 3, 2012 11:31 AM

    Hi Rahul,
    Wellcome to SDN. Perhaps you know it, and although it's for older releases, perhaps it could help you. Please, see SAP Note 381942 - Mass changes for logistics data in the article master.
    I hope this helps you
    Regards
    Eduardo

  • Problem with manually added field.

    Hi,
    I added a field to a table with sql studio.
    There are problems about that field.
    My application does not recognise that field. (wd java app.)
    What must i do make field with no problem?
    Thanks.

    > I added a field to a table with sql studio.
    > There are problems about that field.
    > My application does not recognise that field. (wd java app.)
    > What must i do make field with no problem?
    No offense but to stay with your language: You have to tell "your application" that there is a new field.
    Since we have no idea how you access the system, where you added that field and what you expect to happen nobody can help you.
    Markus

Maybe you are looking for