ABAP : string take 8 charatcers

Hi Experts ,
I need your help. Actually i have started working in ABAP as welll. need to know that below is the coding being done for Screen Painter and need your help  in troubleshooting error. the Error is :
"Program ZSCREENPAINTER1
"TYPE LINE" or "LIKE LINE" expected, not "BEGIN". ."
coding that i have done is :
PROGRAM  ZSCREENPAINTER1.
DATA : OK_CODE TYPE SY-UCOMM,
types: BEGIN OF EKPO,
       EBELP TYPE EBELP,
       BUKRS TYPE BUKRS,
       WERKS TYPE WERKS,
       MATKL TYPE MATKL,
       END OF EKPO.
thanks & regards ,
M.S

Hi
PROGRAM ZSCREENPAINTER1.
DATA : OK_CODE TYPE SY-UCOMM . " Remove comma and keep dot
types: BEGIN OF EKPO,
EBELP TYPE EBELP,
BUKRS TYPE BUKRS,
WERKS TYPE WERKS,
MATKL TYPE MATKL,
END OF EKPO.

Similar Messages

  • Error While converting xml to sap abap string.

    Hi Experts,
    As i am doing an cross Application from SAP to .Net and vice versa.I am receiving an xml from .Net and it should be converted to ABAP string Using the following function module   SMUM_XML_PARSE 
    And the following string i am receiving from .net
    <Root><qApprovalInfo><RequesterId>xxxx</RequesterId><RequesterName>xxx</RequesterName><ApproverId>xxxx</ApproverId><ApproverLevel>1</ApproverLevel><PendingApprovalId>0200169911</PendingApprovalId><CreatedDate>20/07/2011</CreatedDate><CreatedBy>xx</CreatedBy><ModifiedDate>2011-07-20 16:45</ModifiedDate><ModifiedBy>xxxx</ModifiedBy><ApplicationCode>EPAY</ApplicationCode><WorkFlowCode>EPX</WorkFlowCode><ApprovalStatus>APPROVED</ApprovalStatus><ActionComments><![CDATA[APPROVED(through  Desktop)]]></ActionComments><Mode>CREATE</Mode><ActionSource>DESKTOP</ActionSource></qApprovalInfo><qApprovalHidden><Approverl>40002664</Approver><EmployeeId>40016515</EmployeeId></qApprovalHidden></Root>
    In this xml i am getting all the values except the <ActionComments><![CDATA[APPROVED(through Desktop)]]></ActionComments>
    is their any way to convert that CDATA value?..
    have anybody come across the following issue ?...
    can anybody provide the solution for this?.
    Edited by: basavaraj.p on Aug 29, 2011 10:54 AM

    Hi,
    SMUM_XML_PARSE is a simplified, unreleased and undocumented version of the powerful, released and documented iXML
    If you look at the GET_ELEMENT subroutine in that function module, you'll see that the nodes of type CO_NODE_CDATA_SECTION are simply ignored.
    The simpliest thing for you, maybe, is to duplicate the code of SMUM_XML_PARSE (as it is rather easy to handle), and add a section to GET_ELEMENT. You'll have also to use IF_IXML_CDATA_SECTION interface and ixml_iid_cdata_section constant.
    Documentation is here: [SAP Library: Interface if_ixml_cdata_section|http://help.sap.com/saphelp_nw70/helpdata/en/bb/576658dca511d4990b00508b6b8b11/frameset.htm ]
    Best regards,
    Sandra

  • ABAP String processing using normal methods

    I have a string like this:
    A:12345;B:34324;C:443232;
    Question 1)
    How do I extract B:34324 from the above string?
    Note: I can only use methods provided in ABAP programming (BC-ABA) such as split, CO, CA,etc
    Question 2)
    How do I know how many ';' characters the string contains?
    Question 3)
    How do I know the position of "B:" in the string?
    Please help.
    Thanks and best regards,

    Hi,
    Question 3)
    How do I know the position of "B:" in the string?
    Check this
    DATA a TYPE string value  'A:12345;B:34324;C:443232'.
    DATA c TYPE i.
    DATA d TYPE c.
    DATA e TYPE i VALUE 0.
    DATA f TYPE i VALUE 0.
    c = STRLEN( a ).
    DO c TIMES.
      d = a+e(1).
      e = e + 1.
      f = f + 1.
      IF d EQ 'B'.
        EXIT.
      ENDIF.
    ENDDO.
    WRITE f.
    Thanks

  • How does "Unflatten From String" take a type and return a value of that type?

    http://zone.ni.com/reference/en-XX/help/371361E-01/glang/unflatten_from_string/
    How exactly does the "type" argument for "Unflatten From String" work? I need to create a VI that takes a type, passes it as an argument to several calls of the "Unflatten From String" function, and returns an array containing elements of the type originally passed. The "Unflatten From String" function seems to do some magic though, because the type of the "value" that it outputs changes depending on the type it is passed as input. How do I do the same magic in my VI?
    Ultimately, what I need to accomplish is an unflatten-list operation. Given a type T and a byte string of length L (which contains a concatenation of T elements that are flattened to their bytes), create a VI that unflattens all the types in the string and return an array of length (L / sizeof(T)) that contains each type.
    Note: performing the unflatten-list operation is trivial, but I cannot for the life of me figure out how to do it in a VI that takes a type and returns an array of the appropriate type. By the way, my data is being given to me from another source, so please don't bother suggesting that I should be flattening an array using LabVIEW's "Flatten To String" function in the first place. My data is not given in LabVIEW's array format: http://zone.ni.com/reference/en-XX/help/371361B-01/lvconcepts/flattened_data/
    Thanks a ton!
    -Wakka

    Take a look at this example:  You can see that the flattened string contains several bytes.  The first four bytes contain the length of array (number of elements).  Since the data type is U32, the next 32 bits (4 bytes) contains the value of the first element, and so on.  Could you possibly use this scheme to do what you want to do?  Other data types present different outputs.  You would have to experiment with them.
    - tbob
    Inventor of the WORM Global

  • Unflatten from string takes long time to execute in x64

    Hi All,
    I am running into an issue where "Unflatten from String" is taking enormous amout of memory n time in LV 2012 SP1 x64 to execute. I pass in a NOT flattened string to this function and it consumes ~5 Gigs of memory and takes more than 10 minutes to execute it. On x86, it executes almost instantly.
    It only happens if the input is not a flattened string. 
    Is this a known bug?
    I have attached the vi here for you to see the problem. If you run it on x64, it might take more than 10 mins to execute and your system will be in a hung state. 
    Ritesh
    Attachments:
    Flat String to Data bug.vi ‏9 KB

    LVCoder wrote:
    With "x64" I meant LV x64. It executes instantly on LV x86 running on Win 64 bit but on LV x64 it takes like eternity. 
    I know it cannot unflatten it and I want it to return an error. My actual code can receive a flattened or NOT flattened string and I have a case structure which handles different strings differently. 
    Be careful with that terminology, it only applies to the Windows Operating System with respect to 32-bit and 64-bit processors.  There is no such thing as LabVIEW x64, or LabVIEW x86.  The property terminology is LabVIEW 32-bit (the most common one, most people use, even on 64-bit OS's since it is the most fully supported), and LabVIEW 64-bit (not commonly used, doesn't have full support of all add-on modules and toolkits, and is mainly only used by people who need LabVIEW to analyze very large datasets.)

  • ABAP String code for String.IndexOf("str")

    Hi,
    I'm totally new to abap. How can I determine iif one string is in another?
    Thanks,
    Doug

    Hi Doug,
    we have the comparison operator CS (contains string).
    IF 'My brother loves it' CS 'other'.
    evaluates TRUE.
    System variable SY-FDPOS will carry the offset where the string starts, here 5.
    Although we have ABAP objects now for some time, we are far away from languages like JAVA where all data objects are classes with predefined methods.
    But you are welcome to implement something comparable.
    Regards,
    Clemens

  • ABAP STRING OPERATIONS

    What is the ABAP code to find characters of a string after the forward slash(/) ?
    For eg : USER/SAP/ABC.CSV
    How to retrive ABC.CSV which is after /.

    HI Sai,
    Use the Following Code:
    DATA :   G_FILE          TYPE STRING,
                   G_EXTENSION         TYPE STRING,
                  G_FILE_EXT          TYPE CHAR255.
    CALL FUNCTION 'CH_SPLIT_FILENAME'
          EXPORTING
            complete_filename = g_file " Your File Name
          IMPORTING
            extension         = g_extension
            name_with_ext     = g_file_ext
          EXCEPTIONS
            invalid_drive     = 1
            invalid_path      = 2
            OTHERS            = 3.
    Thanks And Regards
    Mohit

  • ABAP string functions

    What is the ABAP code to find the last three characters of a string?

    data: c TYPE string VALUE 'this is string',
          c1(3),
          len TYPE i.
    len = STRLEN( c ).
    len = len - 3.
    c1 = c+len(3).
    WRITE / c1.
    try this
    Edited by: mayank jain on Jul 27, 2009 1:03 PM

  • New line specific characters in a ABAP STRING

    I would like insert in a string a specific cararcter in a string...Like in VB with 'Vbcrlf' or in C with '/n'...
    Does anybody know how to ?

    First entry in:
    <a href="/people/brian.mckellar/blog/2003/10/23/bsp-trouble-shooting-frequently-asked-short-questions">BSP Trouble Shooting: Frequently Asked (Short) Questions</a>

  • Abap string and internal table issue

    Hi All,
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    All points will be awarded
    And please do not offer rewards.
    Regards,
    srinivas
    Edited by: srinu.anisetti on Mar 24, 2010 12:26 PM
    Edited by: srinu.anisetti on Mar 24, 2010 12:33 PM
    Edited by: Rob Burbank on Mar 24, 2010 10:02 AM

    we are waiting for your issue

  • Evaluation of change logs - how to read it in ABAP ?

    Hi,
    i have a logging on a table in SAP.
    You can use report RSVTPROT for reporting the changes.
    BUT: i have to look for changes in my own ABAP. How can i use the table log ? I found some function modules
    like DBLOG_READ, but they seem to be very complex, and
    the output is a 'log data' with unreadable 255-byte-strings ???
    Is there a simply way to read the logging information in a own abap ?

    Take a look at program :
    RSTBCOUNT
    RSTBHIST
    RSTBZAHL
    and Fms
    DBLOG_CVRT_C_TO_D
    DBLOG_CVRT_C_TO_T
    DBLOG_EVAL_CALL_FOR_BC_SET
    DBLOG_EVAL_CALL_FOR_SEL_CHAP
    DBLOG_EVAL_CALL_FOR_SEL_OBJECT
    DBLOG_GET_ARCHIVES_FOR_PERIOD
    DBLOG_READ_WITH_STATISTIC
    <b> call function 'DBLOG_READ_TABLE'</b>
             exporting
                  from_day  = from_day
                  from_time = from_time
                  to_day    = to_day
                  to_time   = to_time
                  obj_list  = obj_list
                  user_list = user_list
                  log_keys  = log_keys
             changing
                  log_list  = log_list[].
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • How to evaluate the dynamic condition string in PL/SQL ?

    Hello, I am solving the issue of checking and validating the event table.
    For Example, the event table namely "Contract_validated" contains some atts about a contract as follow:
    CONTRACT_VALIDATED (SEQ_ID, CO_ID, VALID_T, CHANGE_KEY, ATT1, ATT1_FROM, ATT2, ATT2_FROM, REASON, CHANGE_KEY_ORIG, ATT1_ORIG, ATT2_ORIG)
    In this table, the pairs (ATT1 and ATT1_FROM), (ATT2 and ATT2_FROM) must be compared to check whether the values are changed or not in the update event (change_key = U). If some records have change_key = U but the values does not change, I need to protocol and correct such records.
    The table name and attributes list could be dynamic, and will be provided as parameters. Therefore, I use Dynamic PL/SQL to generate the code to test the conditions between the values between the pairs columns for detecting the invalid event. However, I am stucking in testing the condition phrases because I can not evaluate the condition string in the SELECT statement. I can not use IF because parts of this condition string take the value from a record and collection type. Anyone has the idea how to evaluate the condition in such case, please give me instructions or recommendations (it could be other alternatives to solve the problems)
    Here is the code which generated from my Dynamic PL/SQL string, however, Oracle raise exception error at the EXECUTE IMMEDIATE v_sql command
    SELECT 'x' FROM DUAL WHERE (NVL(v_rec.ATT1, NULL) <> NVL(v_rec.ATT1_FROM , NULL) OR (NVL(v_rec.ATT2, NULL) <> NVL(v_rec.ATT2_FROM , NULL))
    E-0008: Unkown Exception raised in Loop. ORACLE:ORA-00904: "V_REC"."ATT2_FROM": invalid identifier
    vo_traced_list has type Table of VARCHAR2(2000), storing the atts list of table (CONTRACT_VALIDATED), it has value already from other procedure invocation.
    Here is the dynmic PL/SQL code generated dynamically depends on the table name, and attr list:
    DECLARE v_rec CONTRACT_VALIDATED%ROWTYPE;
    TYPE cv_type IS REF CURSOR;
    v_rec_cv CV_TYPE;
    v_cond VARCHAR2(4000);
    cond BOOLEAN := FALSE;
    v_exec VARCHAR2(1000);
    v_default VARCHAR2(10):= 'NULL';
    tk_val CONTRACT_VALIDATED.VALID_T%TYPE;
    pk_val CONTRACT_VALIDATED.CO_ID%TYPE;
    v_cnt NUMBER;
    BEGIN
    OPEN v_rec_cv FOR SELECT /*+ parallel(x,4) */ x.* FROM CONTRACT_VALIDATED x WHERE CHANGE_KEY = 'U' ORDER BY VALID_T;
    FETCH v_rec_cv INTO v_rec;
    IF v_rec_cv%NOTFOUND THEN
    Add_Log('Event_Validating',v_user,v_event_validated,'INFO','I-0001: No-Procession needed');
    ELSE
    BEGIN
    LOOP
    pk_val := v_rec.co_id;
    tk_val := v_rec.valid_t;
    v_cnt := vo_traced_atts_list.COUNT;
    v_cond := '(NVL(v_rec.'|| vo_traced_atts_list(1)||', ' || v_default || ') <> NVL(v_rec.' || vo_traced_atts_list(1)||'_FROM'
    ||' , ' || v_default || '))';
    cond := (BOOLEAN) v_cond;
    FOR v_i IN 2..v_cnt LOOP
    BEGIN
    v_cond := v_cond ||CHR(13)||CHR(10)||'OR (NVL(v_rec.'||vo_traced_atts_list(v_i)||', ' || v_default || ') <> NVL(v_rec.'||vo_traced_atts_list(v_i)||'_FROM'
    ||' , ' || v_default || '))';
    END;
    END LOOP;
    v_exec := 'SELECT ''x'' FROM DUAL WHERE '||v_cond;
    Add_Log('Event_Validating',v_user,v_event_validated,'INFO',v_exec);
    EXECUTE IMMEDIATE v_exec;
    /* Exception raised from here
    E-0008: Unkown Exception raised in Loop. ORACLE:ORA-00904: "V_REC"."ATT2_FROM": invalid identifier
    It seems that Oracle does not understand the dynamic reference v_rec.ATT2_FROM, v_rec.ATT2,... to test the condtion
    IF SQL%ROWCOUNT = 0     THEN -- condition is false ==> traced attributes does not changed
    -- update the REASON = 4 - not interested event
    v_exec := 'UPDATE CONTRACT_VALIDATED SET REASON = 4 WHERE CO_ID = '||pk_val||' AND VALID_T = '||tk_val;
    EXECUTE IMMEDIATE v_exec;
    END IF;
    FETCH v_rec_cv INTO v_rec;
    EXIT WHEN v_rec_cv%NOTFOUND;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    Add_Log('SCD_VALIDATION',v_user,v_event_validated,'ERROR','E-0008: Unkown Exception raised in Loop. ORACLE:'||SQLERRM);
    RAISE ge_raise_error;
    END;
    END IF;
    CLOSE v_rec_cv;
    EXCEPTION
    WHEN OTHERS THEN
    Add_Log('SCD_VALIDATION',v_user,v_event_validated,'ERROR','E-0008: Unkown Exception raised in Loop. ORACLE:'||SQLERRM);
    RAISE ge_raise_error;
    END;

    Dear Andrew,
    Thank you so much for your suggestions, however, I think it will be better to let me explain more about the situation.
    I am working at Data Warehousing and Analysis part. The event tables are provided by other applications such as Customer OTLP system, Sales Management, etc. We therefore just have the results stored in the event tables (which could be wrong or inconsistency) and no way to force them to be valid by constraints. Before further processing the events , their records should be checked and overridden if possible, and that is the point I am trying to solve now.
    The Event table names, their attributes list, data types, primary key, timestamp columns etc are dynamic and are provided via parameters. I would like to write a procedure which can check the invalid events (not only update, but also insert, delete), protocol them, and override them if possible before processing further. Because the table name, attribute lists, data type, etc are not known in advanced, to my best knowledge, the only choice is generating dynamic PL/SQL code although it could suck the performance. The code you have seen in my first question is the output from the follwoing procedure, where the i_att_list provides the atts list has been parsed from other procedure invocation, i_pk is the primary key, i_tk is the time key, i_table_name is the table name (which is Event_Validation in previous example). The stucking point I have met now is that I do not know how to test the condition to detect the different between column pairs (ATT1 and ATT1_FROM, ...). Using Select from dual is just a dummy select for testing the where condition which must be formed as a string by that way.
    Thank you very much for your answer and looking forward to seeing your further recommendations or suggestions.
    Regards,
    Tho.
    CREATE OR REPLACE PROCEDURE Update_Validation
    ( i_att_list enum_string, -- list of attributes
    i_pk IN VARCHAR2, -- primary key column
    i_tk IN VARCHAR2, -- time key column
    i_table_name IN VARCHAR2 -- table_name - the columns format be checked
    ) AUTHID Current_User IS
    TYPE LoopCurType           IS REF CURSOR;
    ln_parallel NUMBER := 4;
    ge_raise_error EXCEPTION;
    v_user VARCHAR2(100);
    v_sql VARCHAR2(4000);
    v_string VARCHAR2(4000);
    v_crlf VARCHAR2(2) := CHR(13)||CHR(10);
    BEGIN
    SELECT sys_context('USERENV','current_schema') INTO v_user FROM DUAL;
    v_sql:= 'SELECT /*+ parallel(x,'||ln_parallel||') */ x.* FROM ' ||i_table_name|| ' x '||
              'WHERE CHANGE_KEY = ''U'''||
    ' order by '||i_tk;
    v_string := 'DECLARE v_rec '||i_table_name||'%ROWTYPE;' ||v_crlf||
              ' TYPE cv_type IS REF CURSOR; ' ||v_crlf||
    ' v_rec_cv CV_TYPE; ' ||v_crlf||
              ' v_cond VARCHAR2(4000); ' ||v_crlf||
         ' v_exec VARCHAR2(100);' ||v_crlf||
              ' v_default VARCHAR2(10):= ''~~''; ' ||v_crlf||
    ' tk_val '||i_table_name||'.'||i_tk||'.%TYPE;'||v_crlf||
    ' pk_val '||i_table_name||'.'||i_pk||'.%TYPE;'||v_crlf||
              ' v_cnt NUMBER;' ||v_crlf||
              'BEGIN ' ||v_crlf||
                        'OPEN v_rec_cv FOR ' ||v_sql ||';' ||v_crlf||
                        'FETCH v_rec_cv INTO v_rec;' ||v_crlf||
                             ' IF v_rec_cv%NOTFOUND THEN ' ||v_crlf||
                                  'Add_Log(''Event_Validating'',v_user,i_table_name,''INFO'',''I-0001: No-Procession needed'');'||v_crlf||
                             ' ELSE ' ||v_crlf||
                                  ' BEGIN '||v_crlf||
                                  ' LOOP '||v_crlf||
                                  'pk_val := v_rec.'||i_pk||';'||v_crlf||
    'tk_val := v_rec.'||i_tk||';'||v_crlf||
    'v_cnt := i_att_list.COUNT;' ||v_crlf||
                                            'v_cond := ''NVL(v_rec.''|| i_att_list(1)||'', '' || v_default || '') <> NVL(v_rec.'' || i_att_list(1)||''_FROM'''||v_crlf||
                             '||'' , '' || v_default || '')'';'||v_crlf||
                                            'FOR v_i IN 2..v_cnt LOOP'||v_crlf||
                                                 'BEGIN'||v_crlf||
                                                 'v_cond := v_cond ||CHR(13)||CHR(10)||''OR NVL(v_rec.''||i_att_list(v_i)||''), <> NVL(v_rec.''||i_att_list(v_i)||''_FROM'''||v_crlf||
                                                 '||'' , '' || v_default || '')'';'||v_crlf||
                                                 'END;'||v_crlf||
                                            'END LOOP;'||v_crlf||
                                            'v_exec := ''SELECT ''x'' FROM DUAL WHERE ''||v_cond;'||v_crlf||
                                            'EXECUTE IMMEDIATE v_exec;'||v_crlf||
                                            'IF SQL%ROWCOUNT = 0     THEN -- condition is false ==> traced attributes does not changed'||v_crlf||
                                            '-- update the REASON = 4 - not interested event'||v_crlf||
                                            'UPDATE '||i_table_name||' SET REASON = 4 WHERE '||i_pk||' = '||v_tk||' AND '||i_tk||' = '||tk_val||';'||v_crlf||
                                            'END IF;'||v_crlf||
                                       'FETCH v_rec_cv INTO v_rec;' ||v_crlf||
                                       'EXIT WHEN v_rec_cv%NOTFOUND;'||v_crlf||
                        ' END LOOP;'||v_crlf||
                                  'EXCEPTION' ||v_crlf||
                             'WHEN OTHERS THEN'||v_crlf||
                        'Add_Log(''SCD_VALIDATION'',v_user,i_table_name,''ERROR'',''E-0008: Unkown Exception raised in Loop. ORACLE:''||SQLERRM);'||v_crlf||
                        'RAISE ge_raise_error;'||v_crlf||
                                  'END;'||v_crlf||
                                  'END IF;'|| v_crlf||
                        'Close v_rec_cv;'||v_crlf||
                        'EXCEPTION' ||v_crlf||
                   'WHEN OTHERS THEN'||v_crlf||
              'Add_Log(''SCD_VALIDATION'',v_user,i_table_name,''ERROR'',''E-0008: Unkown Exception raised in Loop. ORACLE:''||SQLERRM);'||v_crlf||
              'RAISE ge_raise_error;'||v_crlf||
                   'END;';               
         Add_Log('SCD_UPDATE_VALIDATION',v_user,i_table_name,'INFO','I-0006: Update Validation : '||v_string);     
         EXECUTE IMMEDIATE v_string;
    EXCEPTION
    WHEN OTHERS THEN
    Add_Log('SCD_VALIDATION',v_user,i_table_name,'ERROR','E-0008: Unkown Exception raised in Loop. ORACLE:'||SQLERRM);
    END Update_Validation;

  • Running Excel macros from ABAP

    Hello everyone,
    I am trying to execute an Excel macro from an ABAP program.  We are currently on a 46C system.  While doing some research on help.sap.com I came across the method execute_macro in class i_oi_document_proxy.  I’ve never used methods in ABAP before and I’m not really sure what I’m doing.  Has anyone got this to work?  When I try to run the program it dumps with error OBJECTS_OBJREF_NOT_ASSIGNED.
    Thanks,
    Becky
    Here is the program:
    REPORT ztest_program.
    INCLUDE ole2incl.
    DATA gs_excel TYPE ole2_object .
    DATA gs_wbooks TYPE ole2_object .
    DATA gs_wbook TYPE ole2_object .
    DATA gs_application TYPE ole2_object .
    DATA: h_sheet TYPE ole2_object.
    DATA: document TYPE REF TO i_oi_document_proxy.
    *Name of the macro in Excel
    DATA: macro_string(50) TYPE c
                     VALUE 'FB03process.FromTheBeginning',
          no_flush TYPE c,
          param_count TYPE i VALUE 0,
          script_name TYPE c VALUE 'X',
          error TYPE REF TO i_oi_error
                OCCURS 0 WITH HEADER LINE,
          retcode TYPE soi_ret_string,
          error_string(50) TYPE c,
          retvalue(30) TYPE c.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
             text       = text-007
         EXCEPTIONS
              OTHERS     = 1.
    CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF gs_excel 'Visible' = 1 .
    GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
    GET PROPERTY OF gs_wbooks 'Application' = gs_application .
    *--Opening the existing document
    CALL METHOD OF gs_wbooks 'Open' = gs_wbook
         EXPORTING #1 = 'D:\temp\FB03process.xls' .
    tell user what is going on
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
              PERCENTAGE = 0
             text       = text-009
         EXCEPTIONS
              OTHERS     = 1.
    GET PROPERTY OF gs_excel 'ACTIVESHEET' = h_sheet.
    CALL METHOD document->execute_macro
         EXPORTING macro_string  = macro_string
                   param_count   = param_count
                   script_name   = script_name
                   no_flush      = no_flush
         IMPORTING error         = error
                   retcode       = retcode
         CHANGING  error_string  = error_string
                   retvalue      = retvalue.
    disconnect from Excel
    FREE OBJECT gs_excel.
    PERFORM err_hdl.
    FORM err_hdl.
      IF sy-subrc <> 0.
        WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL

    Hi,
    Please correct me if I am wrong but it seems that you have not fetched a handle to the document object before issuing the statement CALL METHOD document->execute_macro. Hence the error OBJECTS_OBJREF_NOT_ASSIGNED is being dislayed. If you want to use SAP Desktop Office Integration using ABAP Objects, take a look at this article at http://www.intelligenterp.com/feature/archive/ or http://www.sapinfo.net/public/en/index.php4/article/comvArticle-193333c63b4bd807d2/en/articleStatistic
    Hope this helps.
    Regards
    Message was edited by: Shehryar Khan

  • FOR loop in ABAP Code ?

    Hi,
    I am working on a ABAP requirement, where I need to use a dynamic variable attached to a compilable code.
    For ex:
    In Jave we use
    for( i=0; i >n; i++){
    int i=0;
    stmti+stmti = result;
    Here  i  is an dynamic variable and it will be keep on changing ATTACHED TO stmti as stmt1.stmt2....etc. whenever there is a
    change in i.
    In ABAP, I have below code to attach:- Here I need to change from 1 to 100 like below. currently I see it as re-work, if i put the code each time changing manually. so I want make it in a loop and so dynamic and hence less code. How to achieve this. Please
    help. Any ABAP string functions to be used?
    if i=1
    DATA ls_nd_tmp1 TYPE wd_this->Element_nd_tmp1.
       DATA it_nd1 TYPE TABLE OF wd_this->Element_nd_tmp1.
       DATA wa_nd1 TYPE wd_this->Element_nd_tmp1.
    if i=2
    DATA ls_nd_tmp2 TYPE wd_this->Element_nd_tmp2.
       DATA it_nd2 TYPE TABLE OF wd_this->Element_nd_tmp2.
       DATA wa_nd2 TYPE wd_this->Element_nd_tmp2.
    Thanks
    Praveen
    Edited by: Praveen kumar Kadi on Sep 23, 2010 9:59 AM

    >
    Praveen kumar Kadi wrote:
    >
    > if i=1
    > DATA ls_nd_tmp1 TYPE wd_this->Element_nd_tmp1.
    >    DATA it_nd1 TYPE TABLE OF wd_this->Element_nd_tmp1.
    >    DATA wa_nd1 TYPE wd_this->Element_nd_tmp1.
    >
    > if i=2
    > DATA ls_nd_tmp2 TYPE wd_this->Element_nd_tmp2.
    >    DATA it_nd2 TYPE TABLE OF wd_this->Element_nd_tmp2.
    >    DATA wa_nd2 TYPE wd_this->Element_nd_tmp2.
    >
    What are you going to do with this data once you've defined it?  I'd define an internal table with three fields -
    TYPES: BEGIN OF my_elements_ty,
            r_element1 TYPE REF TO data,
            r_element2 TYPE REF TO data,
            r_element3 TYPE REF TO data,
          END OF my_elements_ty.
    DATA: lt_elements TYPE STANDARD TABLE OF my_elements_ty,
          ls_element  TYPE my_elements_ty.
    Then, for each iteration, build the name of the element type in strings and use something like:
    CREATE DATA ls_element-r_element1 TYPE (the_type_in_the_string1).   
    CREATE DATA ls_element-r_element1 TYPE (the_type_in_the_string2).   
    CREATE DATA ls_element-r_element1 TYPE (the_type_in_the_string3).
    INSERT ls_element INTO TABLE lt_elements.
    But this really is advanced ABAP, and not suitable for someone who is clearly a beginner. ( Also note that these forums are not supposed to be a substitute for training - or reading an ABAP tutorial ).
    matt

  • ABAP Program using Selection Screen in Process Chain

    Hi,
    I have included an ABAP Program in the Process Chain.
    The ABAP Program takes a selection screen value from user before execution.
    I have created a variant for both the ABAP Process (YPV_ABC) and a variant for the Selection Screen (YPV_XYZ).
    The ABAP Program executes perfectly well in SE 38.
    I get the following message when I execute the Process Chain.
    "Status Change of Process ABAP YPV_ABC.
    Save Status and Trigger Events if Appropriate "
    When I click Yes, the ABAP Process becomes red.
    These are error messages in the log
    516 -  Job started     
    550 -  Step 001 started (program RSPROCESS, variant &0000000012961, user ID ALEREMOTE)
    25 -    Could not ascertain code page     
    546 -  Job cancelled after system exception ERROR_MESSAGE     
    My questions are:
    1) Is it possible to use an  ABAP Program which has a user input screen in Process Chain?
    2) Could you please help  with the above error?

    1) Is it possible to use an ABAP Program which has a user input screen in Process Chain?
    ABAP programs, with variants established for selection screens, are possible. We use them quite extensively for setting triggers to allow Process Chain to continue after an Interrupt Process has been hit.
    2) Could you please help with the above error?
    I'm not quite sure what could be causing this. When you tested this program in SE38, did you test it with the same variant for the selection screen and did you execute it in background?

Maybe you are looking for

  • Imac FaceTime to iPad Mini

    I'm using an iMac and Facetime Doesn't work when trying to call an iPad Mini. Help please!

  • How create ear to setup file or exe

    how i will create setup or exe from ear.

  • Acrobat creates two IDs from Windows account

    I have 200+ users with Acrobat 8 Pro. We use a WebDAV server on our internal domain for reviewing and commenting on PDF files. 5-20 users review each PDF on average. Most users have PC laptops. In the office, they connect directly to our domain. Exte

  • Getting Back To My Mac working in the UK with ADSL

    I live in the UK and would like to use Back To My Mac. My home Mac is connected to the internet via ADSL. I have an apple extreme router connected to my ADSL router. Has anyone managed to make Back To My Mac work in the UK over ADSL? If so, what hard

  • HELP ME IN OKCODE

    HI ALL,          HOW TO FIND OKCODE FOR A PARTICULAR BUTTONS IN THE MENUBAR,APP TOOL BAR AND STANDARD TOOL BAR? WITH WARM REGARDS, KHADAR.