Constructing ABAP statement dynamically...

Hello Gurus,
I have a custom report (ZREPTA) which calls another generic custom program (ZGENERIC) inside. This program is
used by many other custom reports. Now this generic custom program has as a perform routine. The form-endform for this perform is written in the custom report which is calling the generic custom program. Now its not necessary that  all custom reports needs the peform routine of generic custom program (ZGENERIC).
My question is how do I build the following ABAP lines of dynamically so that even if other program
say ZREPTC calls ZGENERIC, it won't be a problem even if it does not have form routine defined
since the perform statement in ZGENERIC is build dynamically.
perform post_process tables doc_connect.
Regards,
Jainam.
Edited by: Jainam Shah on Oct 2, 2009 9:08 PM
Edited by: Jainam Shah on Oct 2, 2009 9:08 PM

Avoiding the temptation to use generic subroutines is the best option in my opinion.
> Because I am working on module development in whcih there can be 100's of reports from which some will and some won't use that.
Why dont you create a function mode then which only uses this form if requested to do so). But it also might involve exposing the parameter to it's interface so you need to be carefull if it is remote enabled.
That is what FM's are for  -> modularization.
Cheers,
Julius
Edited by: Julius Bussche on Oct 2, 2009 10:01 PM

Similar Messages

  • Problem constructing SQL statement dynamically

    One of our system requirements is to generate a report dynamically based on certain search crieria. I implemented the report by creating a dynamic page. The dynamic page receive the search criteria as page parameters.
    Inside the dynamic page, I have an oracle (PL/SQL) section where I built the SQL statement dynamically based on the criteria.
    The opening of the cursor, selecting and displaying of the data works fine - no problem there. The only problem I have is with the construction of the where-clause. It almost seems as if the "if-statements" are completely ignored!!
    Take for example the following extract that makes use of the page parameter "pSDate" that contains the start date:
         whereClause := 'where claimant.kUserName = Claims.fClaimantUserName';
         if rTrim(ltrim(to_char(:pSDate))) = '' then
         whereClause := whereClause||' and Claims.CaptureDate >= to_date('''||:pSDate||''')';
         end if;
    After execution of the above the value of "whereClause" is always "where claimant.kUserName = Claims.fClaimantUserName" ... regardless of whether pSDate is populated or not. In other words, I can't get the "then" part of this statement to execute!
    By printing out the value of pSDate I verified that it indeed contains/not contains a value. I experimented with various functions (ltrim, to_char...) without any success. I even changed the operator in the condition to <> and it still does not work. I find this really weird.
    This is probably something really stupid but being new to PL/SQL I am missing it. Is there anybody out there that knows how I can solve this?

    Tried it and unfortunatly it does not work.
    By specifying the ":" you inform the compiler that it's a parameter to the "dynamic page". As a result it's added as a bind variable of the page. That is visible on the "Customization Form Display Options"-tab.
    The dynamic page is "called" from a stored procedure which "pass" values to these parameters. The passing seems to work fine since, when I "print" the parameter value in the page e.g.
    htp.p('pSDate: '||:pSDate)
    the correct value is displayed.
    The question remains, why does it not work when I use this parameter/bind variable in a condition that forms part of a if-statement?
    I have tried to assign the parameter to a tmp variable of type varchar2(100) just before the if-statement. Using the tmp variable in the if-statement makes no difference.
    Pleeeease can someone help me

  • Obsolete ABAP statements/FM/BAPI in sap 4.7

    dear experts
    pls gv me the details of obsolete ABAP statements/FM/BAPI in sap 4.7 and their replacement in ECC 6.0,the statements should be related to MODULE POOL ,reports

    Hello
    ERP 6.0 implies Unicode as well. Therefore have a look at [ABAP and Unicode|http://help.sap.com/saphelp_nw04/helpdata/en/62/3f2cadb35311d5993800508b6b8b11/content.htm]
    You will find useful documentation in the ABAP keyword documenation (ERP 6.0) as well:
    Obsolete Statements
    The statements described in this subnode are obsolete and are only still available for reasons of compatibility with releases prior to 4.6 or 6.10. You may still come across these statements in old programs but you should not use them in new programs.
    Most of the obsolete statements listed here are syntactically forbidden in ABAP Objects or in Unicode programs. As a result, they can now only be used outside of classes or non-Unicode programs. There are replacement constructions for all obsolete statements which improve the efficiency and readability of programs.
    Apart from the obsolete statements listed in this node, there are also obsolete variants and additions for non-obsolete statements. These cannot be used in ABAP Objects and Unicode programs either. They are detailed in the description of the corresponding statements.
    Regards
      Uwe

  • Same ABAP statements for SY-SUBRC 0 or 4

    Hi,
    I have a READ TABLE statement and if the SY-SUBRC is equal to 0 or 4, the same ABAP statements should be giving to both. What would be the most efficient way of writing this? Should I just not check for for the SY-SUBRC?
    Thanks,
    RT

    You can simply check for 0 and 4, or if there is no chance of sy-subrc being anything other 0 or 4, simply don't check it..
    clear itab.
    read table itab with key....
    check sy-subrc = 0
        or sy-subrc = 4.
    Regards,
    Rich Heilman

  • Error "Error in ABAP statement when processing an internal table. table."

    Hello,
    I am facing the error when tried for GR from SRM portal for my shopping cart and for others created shopping cart. The error is
    "Error in ABAP statement when processing an internal table. table."
    I have the central receipient role. Couold any body assist me?
    Thanks,
    Pijush

    Hi Harish,
    Execute the query in RSRT and check whether you have any short dump is in ST22. This would give a clear idea at what might have gone wrong.
    Another thing is to check whether the code for the variable is fine in the user exit.
    Hope this helps.
    Bye
    Dinesh

  • Obsolete ABAP statements in OOPs context

    Obsolete ABAP statements in OOPs context

    hi,
    Check t-code UCCheck.
    Put the program name in the t-code and you will get the obsolete statements.
    Also check table radir.
    <b>Reward points if useful.</b>

  • In which cases can the ABAP statement CALL TRANSFORMATION be used?

    Hi friends,
    here is my questions with options below.
    In which cases can the ABAP statement CALL TRANSFORMATION be used? (T/F)
    -To transform as iXML document object into and ABAP data structure using
    XSLT.
    - To transform an XML document contained in a string into another XML
    document
    using and XSLT program.
    - To get canonic XML display of an ABAP data structure.
    - To transform an XML document contained in an xstring into another XLM
    document using an ST program (Simple Transformation).
    - To transform and ABAP data structure into an SML document using ST.
    Kindly give me the expalnation to each statement with either True or False.

    CALL TRANSFORMATION is a new language element in ABAP that we can use to <b>call up the transformation</b>.
    The type of transformation:
    XML to XML
    XML to ABAP
    ABAP to XML or
    ABAP to ABAP is already determined by the two additions SOURCE and RESULT in CALL TRANSFORMATION.
    Check this link for more details.
    http://help.sap.com/saphelp_nw04/helpdata/en/a8/824c3c66177414e10000000a114084/content.htm
    Regards,
    Maha

  • LIKE and Type in abap statements

    Hello  All ,
    I have a question regarding the 'Like' and' Type' 
    I have created a badi XXX , The method has a changing parameter 'A'  which is referenced to a structure .
    The typing method I have mentioned in the method ( in the parameter list ) is TYPE .( I feel it should  have been Like ). Can this cause an issue while writing abap statements in the method ?
    Thanks in advance .
    Best Regards,
    swetha

    Hi Swetha,
    Check out the below link for your question.
    what is the difference between type and like
    Re: what is the difference between type and like
    Re: what is the difference between type and like
    Thanks,
    Chidanand

  • Want to construct insert statement from all_tab_columns

    I am using Oracle 10GR2 and a new user for plsql
    I want to write a plsql block or SQL in order to insert some dummy data.
    I want to use the column list from all_tab_columns and want to construct insert statement
    EX: I am trying to construct SQL as below
    for i in (select column_name from all_tab_columns where table_name='EMP')
    loop
    v_sql := insert into emptest valuesi.column_name
    could you please let me know any pointer for the same ..?
    can I use any other technique for the same .. like collection, nested table etc

    Am not clear for this requirement, if possible could you please elaborate.
    Also specify the requirement, inputs and expected outputs with your query in code format...
    This will help..

  • Urgent: About Obsolete ABAP statements in Netweaver 4.0?

    Can any body please help us about the obsolete ABAP statements in Netweaver 4.0 corresponding to SAP 4.6?

    Hi,
    Pls read first the rules of engagement.
    Anyway, open an editor and choose Utilities->Help on->New features in ABAP.
    Or check notes like
    367676 and 689951
    Eddy

  • Performance in ABAP  statement

    hi experts
    in one of my program the performance is getting affected in the abap statement not in the database access
    the program logic goes in this way from the main program 3 performs were called for in the last performa onlythe entire processing starts
    in that last perform it s callin for a report through submit and return statement , the called report s again refering to one include program.
    in se30 the highest % it showssthe last perform that s said and the program that s called through submit statement the include program is not affecting the performance please tell mehow to change the report insucha wayi can improve the performance
    please reply
    will assign marks for sure
    thanks in advance

    From your as I understand your original message, your report is calling another report and it is taking a very long time in that step.
    Obviously, the second program is taking time and that is the one to be analyzed. So, you put a break-point on the SUBMIT statement and see what are the parameters that being sent to the second program. Then, run the second program all by itself using the parameters you have noted down and analyze what the problem is.
    If my response is totally off of your question, please clarify the question.

  • ABAP statement for JDBC connection to SQL server

    Hi Gurus,
    i need to connect a WebDynpro abap to a SQL server.
    My OS is Unix so i cannot use a ODBC connection.
    Can anyone help me to know if it's possible to write an abap statement to connect the SQL server by JDBC connection?
    thanks a lot
    Regards
    Claudio.

    Hi,
          ELSEIF SCREEN-GROUP2 = 'PRO'.
          clear: list.
          if screen-name = 'ZAVBAK-ZZPROMO_ID'.
            exec sql.
       commit
              set connection :'CBREPOSITORYPRD'
            endexec.
            exec sql.
              CONNECT TO :'CBREPOSITORYPRD'
            endexec.
            exec sql.
              COMMIT
            endexec
          EXEC SQL.
              OPEN C1 FOR
              SELECT CutterRewardsUserListid,
                     SAPAccountNumber,
                     PromoID,
                     FirstName,
                     LastName
                     FROM CutterRewardsUserList
                     WHERE SAPAccountNumber = :XVBPA-KUNNR ORDER BY PromoID
            ENDEXEC.
            DO.
              EXEC SQL.
                FETCH NEXT C1 INTO :WA5
              ENDEXEC.
              IF SY-SUBRC = 0.
                PERFORM UPDATE_LIST.
              ELSE.
                EXIT.
              ENDIF.
            ENDDO.
            EXEC SQL.
              CLOSE C1
            ENDEXEC.

  • Provide ABAP statement used in HR Extractor

    Hello All,
    I am extracting data by enhancing 0EMPLOYEE_ATTR extractor, using database tables PA0002, PA9001 (Custom infotype) and PA0006. But the logic does not take care of time intervals that are overlapping. so the data coming looks inconsistent.
    For e.g.:
    0EMPLOYEE (change of cost center)
    01.01.2007 - 31.03.2007 000001 524000
    01.04.2007 - 31.03.2008 000001 524001
    PA9001 (change of job title)
    01.01.2007 - 31.06.2007 000001 Manager
    01.07.2007 - 31.12.2007 000001 Director
    Wrong result (without time consolidation)
    01.01.2007 - 31.03.2007 000001 524000 Manager
    01.04.2007 - 31.03.2008 000001 524001 Manager
    Correct result (with time consolidation)
    01.01.2007 - 31.03.2007 000001 524000 Manager
    01.04.2007 - 31.06.2007 000001 524001 Manager
    01.07.2007 - 31.03.2008 000001 524001 Director
    How do I get this resolved?
    Kindly inform. Thanks.
    Regards,
    KP
    Edited by: KK PP on Jan 8, 2008 6:35 AM
    I referred a std FM 'HR_BIW_EXTRACT_IO_OCCUPANCY', which uses a ABAP statement PROVIDE for retrieval of consistent data based on the time intervals, but I am not sure how it works. Kindly help.
    Regards,
    KP

    Please help.

  • CONDANCE abap Statement

    Hi Experts,
    I have a small probelem with Condance abap statement.
    issue..
    I have a char field lenth 30, this field is the input field from the SAP master data.
    when evert the user enter the field between , before or after space i want to delete the space it could not to allow.
    i have used the condance field nane with NO-GAPS. this is working fine as of now.
    when the user copy from the EXCEL sheet and past into sap that field is comming as blank field it is not appearing in debug mode also. bit storing in database table as a field plus space.
    this field i copied and  i have seen in MS-WORD here is was showing sapace as the # charactor.
    this issue how can i handle in my progam. is thare any statement to delete non sap char.
    please help me on this.
    regards,
    pala.

    hi amit & koen.
    Thanks for replay...
    ya that was right but am not able to seec # with debug mode,
    how can i hotcode with '#'.
    this value is comming with space . i can't see any vaue in debug bode.
    when oen the value with MS-DOS promt it can appears with value with #.
    this is the problem am facing..
    Can u chech once and revert back...
    regards,
    pala

  • BREAK  ABAP statement

    What is the use of BREAK ABAP statement in ABAP.

    When we set the break point using the 'Set Breakpoint' button in the ABAP editor, sometimes the code will not stop at that point for debugging. For example, when a program runs in asynchronous mode, the Set Breakpoint option will not work. Only when we put the code like break <username>, the code will stop at that point for debugging. 
    Even in case of smartforms, we need to put the break abap statement to stop the smartform for debugging.
    Hope it answers your question.
    Regards
    Swetha.

Maybe you are looking for