How to assign values to a work area which is a Field Symbol?

Hello Experts!
I really need your help! this is the problem:
I need to assign values to fields into a work area which is a field symbol. The values come from a flat file I uploaded and as I can't know the length I had to build the structure dynamically ( That's why I'm using FS). Each field comes from the file separated by ';', I tried using the SPLIT sentence:
"SPLIT text AT ';' INTO TABLE <dyn_table>." but the values are assigned vertically into the same field instead of horizontally into each field of the table(field-symbol table).
I know the name of the field dynamically
(a TEXT + number) and I know I can't do this
<dyn_wa>-TEXT1 or field_name = 'TEXT1' <dyn_wa>-(field_name).... ohhh I'm blocked, I don't seem to find the answer, please help!
Thanks in advance!!
Frinee

Now that you have a table with the values, you can move them to the work area.
data: begin of wa,
      fld1(20) type c,
      fld2(20) type c,
      fld3(20) type c,
*     and so on
      end of wa.
data: istr type table of string with header line.
field-symbols: <fs>.
split text at ';' into table istr.
loop at istr.
assign component sy-tabix of structure wa to <fs>.
if sy-subrc <> 0.
exit.
endif.
<fs> = istr.
endloop.
write:/ wa-fld1, wa-fld2, wa-fld3.
Now, WA has the values in a horizontal fashion.
Regards,
Rich Heilman

Similar Messages

  • BCD_FIELD_OVERFLOW  error while assigning value to dynamic work area

    Hi guys,
                I am trying following code --it uses dynamic table concept.
           LABSTD2 TYPE P DECIMALS  1,
           LABST_2 TYPE P DECIMALS   1,
           LABST_12 TYPE P DECIMALS 1,
           T_ARTMAS-LABST_12 = T_ARTMAS-LABSTD1 + T_ARTMAS-LABSTD2.
           ASSIGN COMPONENT 'LABST_12' OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
           <DYN_FIELD> = T_ARTMAS-LABST_12.
    Value in T_ARTMAS-LABST_12 in debug was 14690.0....still it gave following error-----
    Runtime Error       BCD_FIELD_OVERFLOW
    Except.                CX_SY_CONVERSION_OVERFLOW
    Even i changed decleartion as follows
    LABST_12 TYPE P lenght 10 DECIMALS 1,
    Still it is giving same problem ...
    Kindly help.

    Hi, I think it has nothing to do with an overflow but something with the code. Try this simple (rather stupied) code:
    TYPES: BEGIN OF ty_line,
            fld1      TYPE p DECIMALS 1,
            fld2      TYPE p DECIMALS 1,
            fld3      TYPE p DECIMALS 1,
          END OF ty_line.
    DATA lv_rec       TYPE ty_line.
    DATA lv_count(1)  TYPE n.
    DATA lv_fld1      TYPE p DECIMALS 1.
    DATA lv_fld2      TYPE p DECIMALS 1.
    DATA lv_fld3      TYPE p DECIMALS 1.
    DATA lv_field     TYPE string.
    FIELD-SYMBOLS: <fs_fld> TYPE any.
    BREAK-POINT.
    lv_fld1 = 15211444 / 10.
    lv_fld2 = 54879072 / 10.
    lv_fld3 = lv_fld1 + lv_fld2.
    DO 3 TIMES.
      lv_count = lv_count + 1.
      CLEAR lv_field.
      CONCATENATE 'lv_rec-fld' lv_count INTO lv_field.
      CONDENSE lv_field NO-GAPS.
      ASSIGN (lv_field) TO <fs_fld>.
      <fs_fld> = lv_fld3.
    ENDDO.
    BREAK-POINT.
    Succes.

  • How to assign Values to nested table and pass as parameter to procedure?

    How to assign Values to nested table and pass as parameter to procedure?
    Below is the Object and its type
    create or replace type test_object1 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type1 is table of test_object1;
    create or replace type test_object2 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type2 is table of test_object2;
    GRANT ALL ON test_object1 TO PUBLIC;
    GRANT ALL ON test_type1 TO PUBLIC;
    GRANT ALL ON test_object2 TO PUBLIC;
    GRANT ALL ON test_type2 TO PUBLIC;
    here is the table made of object type:
    create table test_object_tpe
    sl_num NUMBER,
    description VARCHAR2(100),
    main_val1 test_type1,
    main_val2 test_type2
    NESTED TABLE main_val1 STORE AS tot1
    NESTED TABLE main_val2 STORE AS tot2;
    here is the procedure which inserts values into nested table:
    PROCEDURE INSERT_TEST_DATA(sl_num IN NUMBER,
    description IN VARCHAR2,
    p_main_val1 IN test_type1,
    p_main_val2 IN test_type2
    IS
    BEGIN
    FOR rec in p_main_val1.first..p_main_val1.last
    LOOP
    INSERT INTO xxdl.test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    sl_num
    ,description
    ,test_type1 (test_object1(
    p_main_val1(rec).val1,
                                       p_main_val1(rec).val2,
    p_main_val1(rec).val3
    ,test_type2 (test_object2( p_main_val2(rec).val1,
                        p_main_val2(rec).val2,
                        p_main_val2(rec).val3
    END LOOP;
    commit;
    END INSERT_TEST_DATA;
    here is the anonymoys block which assigns values to the object type and pass values into the procedure:
    set serveroutput on;
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1(1).val1 := 'testx1';
    inval1(1).val2 := 'testx2';
    inval1(1).val3 := 'testx3';
    inval2(1).val1 := 'testy1';
    inval2(1).val2 := 'testy2';
    inval2(1).val3 := 'testy3';
    CSI_PKG.INSERT_TEST_DATA(sl_num => p_sl_num,
    description => p_description,
    p_main_val1 => inval1,
    p_main_val2 => inval2
    end;
    Can anybody correct me.
    Thanks,
    Lavan

    Thanks for posting the DDL and sample code but whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    >
    How to assign Values to nested table and pass as parameter to procedure?
    >
    Well you are doing almost everything wrong that could be done wrong.
    Here is code that works to insert data into your table (the procedure isn't even needed).
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1.extend();
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    inval2.extend();
    inval2(1) := test_object2('testy1', 'testy2', 'testy3');
    INSERT INTO test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    (p_sl_num, p_description, inval1, inval2);
    commit;
    end;
    /See Example 5-15 Referencing a Nested Table Element in Chap 5 Using PL/SQL Collections and Records in the PL/SQL doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm#CJABEBEA
    1. You don't even need the procedure since all it does is a simple INSERT into the table which you can do directly (see my code above)
    inval1(1).val1 := 'testx1';There is no element one (1) of 'inval1' since you haven't created any elements yet. You need to EXTEND the collection to add an element
    inval1.extend();And then there is an empty element but 'inval1' is a container for objects of type 'test_object1' not for scalars like 'val1', 'val2', and 'val3'.
    So you can't do
    inval1(1).val1 := 'testx1';You have to create an instance of 'test_object1'
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');And so on for the other collection
    You don't need the procedure (as my sample code shows) but once you populate the variables properly it will work.

  • How to read data from dynamic work area.

    Hi guys,
                I have created dynamic table and work area for report.
    i have populated few values in dynamic work area.
    Now i want to read that data from work area again for calculation.
    i can not use local varialbes to store those values as i dont know how many such variables i need to read.
    that will be known only at run time.
    So as per my knowledge i have only 1 option...to read those all values from work area.
    Kindly help me .... how can i read data which is stored in dynamic work area.

    Hi Kiran,
    Following is not exact code, but exact solution to your problem:
      LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
          l_tabix = sy-tabix.
          ASSIGN COMPONENT 'KOTAB' OF STRUCTURE <dyn_wa> TO <l_kotab>.
          IF <l_kotab> IS ASSIGNED AND <l_kotab> IS INITIAL.
            <l_kotab> = gt_tabs-kotab.
            MODIFY <dyn_table> FROM <dyn_wa> INDEX l_tabix.
          ENDIF.
        ENDLOOP.
    I am hardcoding KOTAB as I was sure about that being in the dynamic structure.
    You can loop on the field catalogue, which you used to create dyamic table,  to use the FIELDNAME to read all the fields of the work area (structure) of your dynamic table.
    thanks,
    Aabhas
    Edited by: Aabhas K Vishnoi on Sep 24, 2009 8:12 PM

  • ALV Report: How to pass the variable in Work area to the FM ? Please help !

    I want to pass the field in the work area which contains the floating point numbers to FM 'FLTP_CHAR_CONVERSION_FROM_SI'. This the correct FM, I have tested.
    If I specify the field with Tab name in FM , It says its not an internal table with header line.
    Please help me, How should can I proceed further and pass the field to FM and get it back in work area.
    And an other issue is I want to sum the particular field in the output.
    Is there a way to do using 'PF-STATUS', if so how ? or what is the alternative for this ?
    Please help me with my issues.
    I'm new to ALV reports.
    Thanks in Advance !

    Hi,
    For your FM issue, i think you are trying to pass the field in the FM as ITAB-field, while you should be taking the data in the work area first and then pass this work area in the FM as WA_ITAB-field.
    I hope this will resolve your prob.
    I mean loop at the table and take the values into work area, update the internal table with changed value. This way by the end of loop you will have all your fields converted.
    Please explain a little more about your second doubt, it is unclear(to me atleast).
    Edited by: DeepakNagar on Jul 28, 2011 6:08 PM

  • Updating a DB table with only non-empty values of a work area

    Hi everybody,
    Is that possible in ABAP to update a table in the database with a work area, but only with non-empty values of this work area?
    Example:
    data: ls_custom type ZCUSTOMERS_0.
    ls_custom-CUSTOMER = '20'.
    ls_custom-LASTNAME = 'MyName'.
    ls_custom-FIRSTNAME = ' '.
    ls_custom-CURRENCY = ' '.
    update ZCUSTOMERS_0 from ls_custom.  *" I want that the update clause don't do the update with FIRSTNAME  and CURRENCY fields because they have empty values*
    If it's possible, how to do it?
    Thanks & regards,
    Abdel

    Total Questions:  81 (66 unresolved)
    Hi,
    To my understanding you mean if the database table has values
    customer         20
    lastname          somename
    firstname         firstname
    currency          INR
    so now after this
    data: ls_custom type ZCUSTOMERS_0.
    ls_custom-CUSTOMER = '20'.
    ls_custom-LASTNAME = 'MyName'.
    ls_custom-FIRSTNAME = ' '.
    ls_custom-CURRENCY = ' '.
    update ZCUSTOMERS_0 from ls_custom.
    you want the result as
    customer         20
    lastname          Myname
    firstname         firstname
    currency          INR
    Is it so? Then Normal update
    data: ls_custom type ZCUSTOMERS_0.
    ls_custom-CUSTOMER = '20'.
    ls_custom-LASTNAME = 'MyName'.
    update ZCUSTOMERS_0 from ls_custom.
    would do that.
    Thanks,
    Sri.

  • How to assigne value in sub record type

    Dear below mention record type database,now i want to assigne value in payr_rec type,in this recrocrd type have one column party_id,but how can assigne value int this field ,
    TYPE group_rec_type IS RECORD(
    group_name VARCHAR2(255),
    group_type VARCHAR2(30),
    created_by_module VARCHAR2(150),
    -- Bug 2467872
    mission_statement VARCHAR2(2000),
    application_id NUMBER,
    party_rec PARTY_REC_TYPE := G_MISS_PARTY_REC
    please guide.

    to get the desired default party_rec attribute value, just assign the "sub-record" attribute defaults as desired; PL/SQL will assign a default (non-null) record as the party_rec value using those attribute defaults:
    create or replace package P_Test_It
    as
         type party_rec_type is record (
              dummy varchar2(1) default 'X'
         type group_rec_type is record (
              group_name VARCHAR2(255),
              group_type VARCHAR2(30),
              created_by_module VARCHAR2(150),
              -- Bug 2467872
              mission_statement VARCHAR2(2000),
              application_id NUMBER,
              party_rec PARTY_REC_TYPE
    end;
    set serveroutput on
    declare
         rec p_test_it.group_rec_type;
    begin
         dbms_output.put_line(rec.party_rec.dummy);
    end;
    X
    PL/SQL procedure successfully completed.Hope it helps.
    Gerard

  • How to assign values for more than one field

    Hi,
    I have written following code
    constants: fieldname(30) value '(SAPMF02D)KNA1-AUFSD'.
    constants: fieldname1(30) value '(SAPMF02D)KNA1-LISFD'.
    constants: fieldname2(30) value '(SAPMF02D)KNA1-FAKSD'.
    field-symbols: <L_FIELD>  TYPE ANY.
    field-symbols: <L_FIELD1> TYPE ANY.
    field-symbols: <L_FIELD2> TYPE ANY.
          Assign (fieldname) to <l_field>.
          <L_FIELD> = 'ZB'. " value according to your requirement
          Assign (fieldname1) to <l_field1>.
          <L_FIELD1> = 'ZB'.
    while debugging <l_field1> is not assinging (fieldname1).
    Im able to assing for (fieldname).
    how to assign value for (fieldname1).
    plz suggest me to assign values for more than one field.
    Regards,
    Brahmaji

    Hello,
    Because there is no field name called LISFD in KNA1. Actually you misspelled the field name.
    It is KNA1-LIFSD

  • How to assign values to server group when you parallelly client-copying

    Hello all,
    I'm now trying to create server group.
    Currently, I use serial process, or default settings, when client-copying.
    But I want to implement this in parallel processes.
    Due to this, I have to create server group and assign a lot of values to something I don't know!
    I want to create a server group, but don't know how to assign values to ones like "Max. requests in queue", "Max. no of logons" and so on.
    Could you please advise me how to allocate values to the resourses shown below;
    Advanced : 1 *I think "1" is the flag for advanced settings
    Max. requests in queue
    Max. no.  of logons
    Max. disp. of own logon
    Max. no. of WPs used: *should be the total of SM50, I guess
    Min. no. of free WPs
    Max. no. of comm. entries
    Max. wait time
    thanks in advance,
    Hozy

    Hi,
      Would you check this [Parallel Processes |http://help.sap.com/saphelp_sm32/helpdata/EN/e8/df959834ac11d586f90000e82013e8/frameset.htm] and [Parallel processes FAQ|http://www.saptechies.com/ccinfo-parallel-processes-faq/] i hope will get some hint.
    Regards
    Mohan Rao

  • How to assign values to Dynamic VO.

    Hi All,
    I have created a Dynamic VO and i have created 2 attributes(name and age) for it.
    Can i create this dynamic VO in Process form request of one of the CO class?
    Please let me know how to assign values to it......and display it and the page.?
    Thanks,
    Sowmya.

    Mukul
    I am trying to achieve something like below:
    Creating a Dynamic VO in my extended controller's ProcessRequest() method and attaching it to a MessageChoiceBean. In ProcessFormRequest() method based on some condition i have to change my Dynaic VO's whereClauseParam and re-execute it so that it will show some different set of values. Below is the code which i used. But after re-executing it my LOV is still showing old set of values. I have posted a query regd. the same but dint get much help. Kindly let me know, if you have any comments. Also Please find the link to my earlier post.
    Link: Re: Re-executed dynamic VO not showing new values
    * CODE *
    ProcessRequest()
    ViewObject vo = (ViewObject)am.createViewObjectFromQueryStmt("dummyVO","SELECT MEANING AS VALUE FROM HR_LOOKUPS WHERE LOOKUP_TYPE = :1");
    vo.setMaxFetchSize(-1);
    vo.setWhereClauseParam(0,"input1");
    vo.executeQuery();
    OAMessageChoiceBean mesBean=(OAMessageChoiceBean)webBean.findIndexedChild(webBean,"DemoChoiceItem");
    mesBean.setPickListCacheEnabled(false);
    mesBean.setPickListViewObjectDefinitionName("dummyVO ");
    mesBean.setPickListViewUsageName("dummyVO ");
    mesBean.setListDisplayAttribute("VALUE");
    mesBean.setListValueAttribute("VALUE");
    ProcessFormRequest()
    If the event is fired
    S.O.P(....);
    ViewObject vo1 = (ViewObject)am.findViewObject("dummyVO");
    vo1.clearCache();
    vo1.reset();
    vo1.setWhereClause(null);
    vo1.setWhereClauseParams(null);
    vo1.setWhereClauseParam(0,"input2");
    vo1.executeQuery();
    S.O.P(....);
    Thanks

  • How to assign a person to work center

    Hi All,
    Can you please let me know how to assign a person to work center?
    Regards,
    Nima

    Dear Nima,
    what is the exact query
    Go to
    Spro > Production > Basic data > Wrok center > determine person responsible
    click new entries & create
    Go to CR01, Basic data tab & in the field person responsible press F4 you can get
    List created in the above Spro
    Regards
    Madhu

  • How to assign values to JTable using mysql database

    how to assign value to JTable using mysql...

    Search the forum. You use the values of the "ResultSet" to create a "DefaultTableModel" which you then add to the "JTable".
    I'll let you pick the search keywords to use, which I've suggested above. You can also throw in my userid if you want to specifically look for my solution.

  • How to assign values to dynamic table

    Hi All,
    I am working with a dynamic table and an internal table. My internal table looks like this.
    Projno       Cust      Opt         Status
    g1234       kkkkk       p1            I001
    g1234       kkkkk       p2            I004
    g1234       kkkkk       p3            I001
    g1234       kkkkk       p5            I002
    g1256       lmnvw       p1            I003
    g1256       lmnvw       p3            I004
    g1256       lmnvw       p5            I005
    g1256       lmnvw       p7            I001
    My Dynamic table struture looks like this
    Projno  Cust     p1  p2  p3 p4  p5  p6  p7
    I need data in my dynamic table from my internal table as follows
    Projno        Cust        p1    p2    p3     p4    p5     p6    p7
    g1234       kkkkk       I001  I004 I001         I002
    g1256       lmnvw       I003         I004         I005           I001.
    The problem is these operations may vary thats why i am using dynamic table. Even i cannot use case statement as the operations may vary.
    Is it possible to do using Assign component or some other way.
    Thanks

    This program creates dynamic internal table
    copy and paste in your program and test it .. debug it to know how it is creating dynamic internal table and values into that table.
    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-inttype   = 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.                    " write_out

  • Sap script: Printing the values got from work area in a row

    Hi ,
    I need to print the values which I m getting from a work area like
    A1     A2
    A3     A4
    and so on
    but I m getting it as
    A1
    A2
    A3
    A4.
    Any solutions to this will be highly appreciated.
    Regards,
    Vivek

    Dear vivek,
    how is your work are structure - is it only with single field ?
    In your script after the each value give an extended line comman "=" which will take first and second values for print and after the second value give "line feed" or "carriage return"  command.
    Hope this solves your problem
    Thanks
    venugopal
    Reward accordingly

  • How to assign values for boolean array in LabVIEW?

    I want assign values for boolean array.Iam not able to do that.For each boolen i want to assign each value.Plz help me......
    Please Mark the solution as accepted if your problem is solved and donate kudoes
    Solved!
    Go to Solution.

    Hi agar,
    values in an array are "assigned" by building an array (using BuildArray) or by replacing values in an existing array (ReplaceArraySubset)!
    Good starting point could be this...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • How can I delete an email account off of my MacBook?

    I have an email account that I no longer use, I would like to delete it off of my MacBook (the entire email account, not just the mailbox). I am so confused as to how to do this! Thanks so much for any help you can give!

  • Total of  actula product cost to  total of target cost

    Hi all Total of  actula product cost to  total of target cost .... How can we get data for this report  plz provide me , is there any standard report available for considering this data Many Thanks MvNr

  • Export multiple response entries to combine PDF.

    Is it possible to export multiple response entries into a singe multi-page (combined PDF?  This can be done externally using Adobe Acrobat Pro, but it would be extremely useful for distributing responses to clients especially since some cannot access

  • Can LOV base on a view?

    Hi, My client created a LOV based on a view. She attached the LOV to a form. When she runs the form, she chooses from the LOV, and insert a record. She tries to query what she just inserted, nothing shows up. She is using version 3.06 on HP unix. I d

  • System monitoring software

      What is the beast/most accurate system monitoring software.  As musch as I love my MOBO the monitoring software it was bundled with is less then par. I have tried nMonitor from nVidia, Speedfan, and PC wizard. nMonitor only monitors 3 temps.  In Sp