Subroutines in BSP

Hi all,
I know that we need to place the routines in a include program and use it in BSP.
But i am not quite sure where to call the include program.
Below is my piece of code.
****************start of code***********************
LOOP AT gt_result INTO gs_result.
        IF sy-tabix EQ 1.
          CASE gs_result-value.
            WHEN 1.
              gt_output = gt_output1.
            WHEN 2.
              gt_output = gt_output2.
WHEN OTHERS.
do nothing.
          ENDCASE.
       endif.
        ELSE.
          CASE gs_result-value.
            WHEN 1.
              PERFORM compare TABLES gt_output
                                     gt_output1.
            WHEN 2.
              PERFORM compare TABLES gt_output
                                     gt_output2.
        ENDCASE.
        ENDIF.
      ENDLOOP.
      ***********************end of code**********************************
With the above code ,its giving me error " missing 'ENDMETHOD' ".
On searching the forum i learnt that below is the logic to call the include program.
DATA: progname(12) TYPE c VALUE  'ZINCLUDE' .
PERFORM test_include IN PROGRAM (progname) IF FOUND.
So, I created the include program "ZINCLUDE" for that perform "compare"
But I am not quite sure where to implement the above logic.
Please do throw some light on this.
Thanks & Regards,
Bhargav.

Hi Bhargav,
You are right, a sub-routine can be called that way. But please find the similar thread discussed in the forums...
Re: Subroutines in BSP ??????
As it is discussed in the above thread, in order to execute the sub-routine successfully, it was actually written in a ABAP report and not in the include.
The answer to the question where it should be implemented/called depends on your requirement/design/aim of the program.
You can just use this report, in order to execute the sub-routine where ever you want. It can be included any where in BSP like,
     - Layout
     - Event Handlers
For example, please find my code below, which uses a simple subroutine in the layout of BSP.
Page with flow logic:
Layout code:
<%@page language="ABAP" %>
<%
  data: a type int2 value 1,
  b type int2 value 2,
  c type int2.
  DATA: progname(4) TYPE c VALUE 'ZADD' .
  PERFORM add IN PROGRAM (progname) using a b changing c  IF FOUND.
%>
<%= c %>
Report code.
report zadd.
FORM add USING a b
         CHANGING c.
  c = a + b.
ENDFORM.
Hope it helps!
Regards,
Maheswaran

Similar Messages

  • Calling a subroutine from BSP application

    Hi
    i want to know how to call a subroutine/form in another package in same R/3 system in my BSP application.
    Is there any way to implement this. ?
    What if the subroutine has furhter LOCAL forms called inside it. will they be used as well while calling from my BSP application.
    PLease help.

    you can do that.
    perform p1 IN PROGRAM ('Y_P_TEST') IF FOUND  .
    do you have problem in doing this? what issues are you facing.
    Regards
    Raja

  • Error in using PERFORM in eventhandler in a BSP Application.

    Hi All,
    Can we use Subroutines in BSP applications?
    If yes then please help me with syntax .
    Best Regards,
    Anubhav.
    Edited by: Anubhav Jain on Dec 20, 2007 10:52 PM

    You can call subroutine with below Synatx:
    DATA: progname(20) TYPE C VALUE 'YTESTINCLUDE' .
    PERFORM your_perform_name IN PROGRAM (progname) IF FOUND.
    "where your_perform_name is the form within the include program YTESTINCLUDE[/code]
    Raja T
    Edited by: Raja Thangamani on Dec 20, 2007 4:58 PM

  • ABAP style FORM..ENDFORM in BSP ...?

    Hi, guys!
    I'm rather new to BSP world. Could someone help me with the following question:
    Is it possible to use ABAP style
    =====================
    FORM abc
         USING abc1
         CHANGING abc2.
    ENDFORM.
    =====================
    in BSP and accordingly to call it via PERFORM let's say in Layout of BSP?
    Or maybe there is something instead of this?
    Thanks in advance,
    --- Kaspars
    P.S. In particular case I'm not using MVC format (just htmlb, abap and javascript in layout; and abap in OnInitialization event handler).

    look at the link reg using subroutine in BSP:
    Re: Subroutines in BSP ??????
    <i>Is it "suggested" or is it mandatory to use class/methods</i>
    Its not mandatory to use class/method. But BSP is developed based on class/methods, so you cant avoid using class & methods..
    Raja T

  • 'form' is not useable in bsp page?

    HI.
    here is only simple example in oninitialization bsp page.
    data:      disp_alv  type as4flag value 'X' .
    perform test using  disp_alv.
    form test  using   disp_alv  type as4flag   .
    endform.                 
    but it shows error 'statement endmethod missing'
    why this error occur? did I missing something?
    Regards
    Lee.

    Check the below thread..
    Re: Calling a subroutine from BSP application
    Re: ABAP style FORM..ENDFORM in BSP ...?
    <i>* Reward each useful answers</i>
    Raja T

  • Problem in Subroutnine in BSP

    Hello Experts ,
    I want to use the subroutines.
    Please tell me how can i do this.
    Kuldeep

    Hi,
    Pls check this thread:
    Re: Subroutines in BSP ??????
    Eddy

  • E-recruitment 600 URL/BSP Initial set up - Standalone Test system(ECC 6.0)

    Dearest experts
    At the very cusp of setting e-recruitment up.  I have followed SAP note 890357 min configuration.....
    The BSP for e-recruit upon test via Transaction SICF do not work, apart from the odd one EG. hrrcf_emp_page
    URL's error when created via SE38 RCF_GENERATE_URL. I have set roles, users etc. I know some services require the assignment of a 'service user' eg registration (does anyone know all of them??).
    Technical settings>user interfaces>settings for user interfaces with BSP>Start pages - there is no configuration here is this why the start pages are not firing up??
    Can anyone let me know what config I have missed and is incomplete?? Where to check in the IMG??
    Thanking you in anticipation
    Kindest regards
    R

    Hi Deepak
    thanks  for your response.
    I had already created a service user (which I had specified in the hrrcf* 1. to 8.)
    I hadn't created a candidate and duly did so at your suggestion.
    Error message as follows:
    The error occurred in program CL_HRRCF_ABSTRACT_CONTROLLER==CM001 line 56
    Message no. HRRCF0001010
    Diagnosis
    The system detects a technical inconsistency.
    System Response
    The operation will be terminated.
    Termination takes place in:
    Main program: CL_HRRCF_ABSTRACT_CONTROLLER==CP
    Subroutine: CL_HRRCF_ABSTRACT_CONTROLLER==CM001
    Line in source code: 56
    Procedure for System Administration
    Check the context in which the error occurs.
    Since it is probably a program error and not an input error, you should contact SAP.
    The error occurred in program CL_HRRCF_CAND_REG_A===========CM002 line 17
    Message no. HRRCF0001010
    Diagnosis
    The system detects a technical inconsistency.
    System Response
    The operation will be terminated.
    Termination takes place in:
    Main program: CL_HRRCF_CAND_REG_A===========CP
    Subroutine: CL_HRRCF_CAND_REG_A===========CM002
    Line in source code: 17
    Procedure for System Administration
    Check the context in which the error occurs.
    Since it is probably a program error and not an input error, you should contact SAP.
    I have created one service user and applied to each of these bsp's.....is this correct??
    I also created my own role (copied SAP_RCF_UNREGISTERED_CANDIDATE)
    I am at a loss..............
    As I also have the following error message:
    Customizing table T77RCF_sp_ID contains no corresponding entry for [0000]
    Message no. HRRCF0001014
    Diagnosis
    The system accesses Customizing table T77RCF_sp_ID using parameters [0000]. There are no entries in the table for this.
    Either a program error or an error in Customizing exists.
    System Response
    The operation will be terminated.
    Procedure for System Administration
    Check the entries in table T77RCF_sp_ID for completeness.
    Contact SAP if necessary.
    Kindest Regards

  • Calling a BSP page with flow logic from LAYOUT

    Hello all.  I am developing a BSP transaction to update HR data on SAP.  I initially developed this with one 'page with flow logic' and several 'page fragment's.  It has been suggested that I break this out into several pages with flow logic because the code in  the 'OnInputProcessing' Event Handler was getting quite complicated.  I was using the BSP directive to execute my 'page fragments'.  This was very simple to do.  What do I replace the BSP directive to call a page fragment with in order to call a page with flow logic.  I have included the code below.  I have converted the 'body.htm' 'page fragment' to a 'page with flow logic' and I am not sure of the correct way to call the page.  I do not have access to the navigation->goto_page( 'body.htm' ) at this point.  I am new to BSP and appreciate any help offered.
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <%@extension name="phtmlb" prefix="phtmlb" %>
    <%@extension name="xhtmlb" prefix="xhtmlb" %>
    <htmlb:content id     = "content"
                   design = "design2002+design2003" >
      <htmlb:document disableBackspaceNavigation="TRUE" >
        <htmlb:documentHead title="ESS: Employee Self Service" >
        </htmlb:documentHead>
        <htmlb:documentBody>
          <htmlb:form id="OOEform" >
            <%-- Positioning --%>
            <htmlb:gridLayout columnSize = "2"
                              rowSize    = "2"
                              width      = "100 %" >
              <%-- Row 1 - Header --%>
              <htmlb:gridLayoutCell columnIndex       = "1"
                                    rowIndex          = "1"
                                    colSpan           = "2"
                                    width             = "100 %"
                                    verticalAlignment = "MIDDLE" >
                <DIV style="border-bottom-style:solid;border-color:#A5B1BF;border-width:20px">
                <%@include file="header.htm" %>
                </DIV>
              </htmlb:gridLayoutCell>
              <%-- Row 2; Column 1 (Body Area) --%>
              <htmlb:gridLayoutCell columnIndex       = "1"
                                    rowIndex          = "2"
                                    width             = "80%"
                                    verticalAlignment = "MIDDLE" >
                <%@include file="body.htm" %>
              </htmlb:gridLayoutCell>
              <%-- Row 2; Column 2 (Right Area) --%>
              <htmlb:gridLayoutCell columnIndex         = "2"
                                    rowIndex            = "2"
                                    width               = "20%"
                                    verticalAlignment   = "TOP"
                                    horizontalAlignment = "LEFT" >
                <%@include file="right.htm" %>
              </htmlb:gridLayoutCell>
            </htmlb:gridLayout>
          </htmlb:form>
        </htmlb:documentBody>
      </htmlb:document>
    </htmlb:content>

    Hi,
    uhmmm, as it was previously suggested, you should perhaps think about MVC for your development. Working with classes and methods gives you more room for a better looking code. But at this point I´m not sure where your real problem is. You mentioned first that you created one page with logic and several page fragments and then you are worried because the code in the OnInputProcessing event is getting out of control
    First, you cannot insert a page in a page. You can only insert fragments in a page with <%@include file="header.htm" %>.
    Second, if you don´t have idea of MVC or you don´t want to switch to MVC, then create a modules program (SE38) where you´ll enter your code as subroutines and you call these subroutines from OnInputProcessing as follows:
    perform subrout1 in program XXXXXX tables YYYYY using AAAAA.
    In your programm XXXXX you declare the code as:
    form subrout1 in program XXXXXX tables YYYYY using AAAAA.
    This can be a substitute to classes and methods.

  • BSP data locking

    I have some table data that I want to update and I want to LOCK it. The standard enqueue/ dequeue method doesn't work across different user sessions in a BSP environment.
    Has anyone else solved this issue? Is there a 'standard approach'? or is it a case of build your own locking table?
    regards and thanks in advance,
    Nigel

    Hi,
    you mean, no one else may update it at the same time ?? or are you the only one to update it ?? This is a difficult case and you must think how you create it.
    Is there any representation of the table in BSP ?? If so, then create a subroutine where you save in a variable the user name of the first one to call it and erase that variable when leaving the page. If some one else calls that page, he won´t be able to work with it in case there´s a value in your variable.
    For the second option you can work with authorizations for calling transaction SE16:
    AUTHORITY-CHECK OBJECT object
        ID name1  FIELD f1
        ID name2  FIELD f2
        ID name10 FIELD f10.

  • How can I open a PDF stored in IXOS and then display it in a BSP

    Hello gurus,
    I have created a PDF icon and an onclick action to open a pdf, that displays on every row of an assignment block in the actions column, but I do not know the technical process to determine how to get a PDF from the IXOS system from the line selected. (even if I know it depends on an ID attribute of that assignment block) I want to to call a transaction launcher with the url for the pdf in the IXOS that has an ID that identifies which line in the assignment block the user has clicked the pdf icon for (does that make sense?)
    Therefore, I am assuming the PDF should correspond to the relance ID of the row in the assignment block, but I would like more information as per the business logic involved in able to achieve the desired results for this particular specification. I already confirmed that the XURL or any other attribute in the BOL object does not contain the URL to use for this. I have looked at the class I was told that it may contain the required business logic for determining which PDF in IXOS to fetch for a particular row, and I am currently trying to reverse engineer the logic through looking at other code and using the debugger, but so far I haven'T had much luck.
    Here are some questions I have now for the functional side in the meantime:
    1) Can we fetch the PDF in IXOS for each line of an assignment block?
    2) Which URL should I call with the transaction launcher? a URL link to the PDF on the IXOS system??
    3) Do we have to configure a transaction in the IMG to be launched?
    4) Do we have to create a logical link there that I will make dynamic to call the right PDF for each table line? 
    5) Are there any existing examples of this or a similar functionality/ logic that I could refer to, preferably in CRM 7 WebUI?
    6) Do you have any code to just display a PDF in a new window? Or prompt a download?
    One possible way I thought of would be for me to have a logical link defined in the IMG, that I could call passing it different attributes (eg. some object id, etc) and then return the PDF and display it in the UI in a new browser window by itself. Alternatively, we can just prompt a download. What do you think would be the optimal behaviour here?
    Please do not hesitate to propose any potential solution. Any partial answers/ links to wikis/ other threads, anything would be much appreciated.
    Thank you in advance.
    Best regards,
    Jonathan Laplante

    Hi,
    I partially answered your question in another posting but I feel that you´re in the wrong forum for your problem. This is for BSP development and you talk about CRM.

  • Any ideas on a nice BSP view pretty printer?

    Hi there,
    I am wondering whether somebody already tried to extend the SAP standard pretty printer by an own functionality which fits better for pages with mixed content, containing not only BSP-elements but also HTML-tags.
    The standard pretty printer considers everything as plain text which is not a BSP-element and leaves it unaltered. Only BSP-elements are arranged according to their tree structure.
    This produces ugly results for pages with mixed content.
    1.) Requirement
    A Pretty Printer for HTML-based BSP views should cover the following:
    (a) HTML-Tags and BSP-elements together form the chain. As in following example:
    <z:table table_id="testTab" binding="//test/gt_test" rows="5">
      <z:tableBody position="top">
        <colgroup>
          <col width="4%">
          <col width="96%">
        </colgroup>
      </z:tableBody>
      <z:column name="type" header="<%=zcl_bsp_util=>dtel_text_s('EDI_TTYP')%>"
                listPos="10"/>
      <z:column name="text" listPos="20"></z:column>
    </z:table>
    (b) Certain HTML formatting tags like I, B, etc. should not be added to the stack but be treated inline.
    (c) HTML-attribute names should be converted to lower case, the attribute values should be quoted.
    (d) Like for BSP-elements, there should be a threshold after which the attributes should appear in separate lines. Instead of a certain maximum "number of attributes", this could also be a maximum number of characters per line.
    (e) Scripting Tags (<% ... %>) should start at a new line, if the content contains new-lines.
    (f) Evaluation Scripting (<%= ... %>) should be inline, if they are contained within text nodes (and not within HTML oder BSP element nodes).
    (g) The Pretty Printer should be parametrizable (with parameters like indent-depth,... ).
    2.) Exits?
    Of course, one could always use an external HTML editor and write an add-on for that editor which produces the desired result. Or one could take the view content into the clipboard, paste it into a plain text editor like UltraEdit or TextPad which allows external commands, apply an external, self-written pretty printer to it and then paste the result back into the View. But it would be easier to use the "Pretty Printer" button directly to get the result. Therefore the question arises at which point the standard Pretty Printer Functionality could be modified or extended.
    I didn't find an exit. But the pretty-print itself is doubly-decoupled in the standard which minimizes the number of points where an extension has to be made:
    2.a) First decoupling point: The Fcode handler method pretty_printer_ext( ) in cl_o2_page is calling
    dynamically a method in cl_o2_co2_processor:
    * call pretty printer
      create object pp type ('CL_O2_CO2_PROCESSOR').
      appl_str = me->pagekey-applname.
      page_str = me->pagekey-pagekey.
      try.
          CALL METHOD pp->('PRETTY_PRINT')
            EXPORTING
              indent              = 2
              ATTRIBUTE_NORMALIZE = 'X'
              ATTRIBUTE_THRESHOLD = 2
              BSP_UNFORMATTED     = source
              appl                = appl_str
              page                = page_str
            IMPORTING
              test_ok             = test_ok
              BSP_FORMATTED       = pp_source.
        catch cx_o2_co2_exception into o2ex.
    2.b) Second decoupling point:
    The method pretty_print() of class cl_o2_co2_processor (fancy names, by the way. It seems that many former chemistry students had joined the BSP team ),
    there is a second delegation, to a local class, as follows:
      data pretty type ref to LCL_BSP_PRETTY_PRINT.
      pretty = LCL_BSP_PRETTY_PRINT=>getInstance( processor = me ).
    The real logic for doing the Pretty Print, finally, is performed in this local class.
    3.) Implementation.
    Since, up to my knowledge, there is no HTML parser in the ABAP world,
    the implementation could be based on existing HTML Parsers, like the Perl module Parser::HTML, or the Java package http://htmlparser.sourceforge.net/ . The pretty printer could then be called as external OS command.
    Are there any ideas out there? Or is there somebody who already worked in this direction?
    Regards,
    Rüdiger

    For those who are interested. I found out that the Dave Ragget's classic "HTML Tidy" (see <a href="http://tidy.sourceforge.net/">http://tidy.sourceforge.net/</a> )  is available in ABAP! There is a class CL_HTMLTIDY (at least here in my SAP_BASIS 700 system) which wraps calls of HTML Tidy by kernel modules.
    The class is undocumented, but there are 2 OSS notes of this year for it, so it might well be that it is alive.
    HTML Tidy can surely not directly be used for Pretty Printing BSP views, but for designing test cases or for doing things like HTML parsing, it might be a helpful tool.

  • Problem with index of numbers in BSP Front end

    Hello All,
    I am facing the below problem. Request your help.
    Scenario: When I am trying to add the projects in the Front end , I am facing the problem with the index of numbering of the projects.
    Example: If I am adding 6 projects ( at the max only 4 on each page i-e there are 2 pages ), then the index is wrongly numbered and the arrow (for direction of the pages) are wrongly displayed. The direction of the arrow is pointed to the next page rather pointing to the previous page and the index of numbering of the pages is wrong.
    Request you to please suggest if this is any code fault in the table maintainance activity in the backend (BSP).

    Hi Irina,
    If you mean the number range is skipping 10 numbers in between runs then its because of the buffering in the number range.
    To avoid the buffer influencing the number range, pass
    'X' to the function module parameter: IGNORE_BUFFER.
    This should resolve the problem.
    Cheers,
    Aditya

  • BSP Error while selecting "campaign elements" in spanish --- crm 2007

    Hi experts,
    I´m trying to look for a solution for a problem with an error that occours while selecting in WEB UI --marketing --- campaign elements , in spanish language.
    Error Business Server Page (BSP)
    <thtmlb:textView>: (design) The Attribute Value is not a Value from: STANDARD/HEADER1/HEADER2/LABEL/VALUE/ITALIC/BOLD
    In english it works perfect.

    Which field is? Has translate value content to spanish for this field?.
    In SAP CRM UI, press F2 and tell me which is the field

  • Badi/exit/Workflow called during  execution of the BSP "SRMSUS_SELFREG"

    Hi all,
    We are running on SRM 5.0.(SP06) Strategic sourcing scenario.We are using enterprise Portal as the front end.My query is that at the end of Supplier  registration process,when the Supplier admin creates the USER ID's for the Suppliers(through BSP SRMSUS_SELFREG),is there any way by which we can create the enterprise Portal users for those suppliers at the same time(Automation) ?My BASIS person told me that the automation is possible when the EP system is connected only to 1 backend but in our landscape we are having several systems connected to EP.
    Other alternative would be to send a mail to the EP administrator stating that the Vendors User ID's have been created in SRM and the EP ID's need to be created.
    For this ,i didnt get any BADi/exit which gets triggered during this USER ID creation process wherein i can write my logic for sending the mail to the EP admin.
    There are some Std workflows (e.g. WS10000209)for USER creation but these dont seem to be useful in this scenario.
    So the only method left is to modify the Std BSP which  we dont want.Has anybody worked on this kind of scenario?
    Any suggestions are welcome and will be rewarded as well.
    BR,
    Disha.

    Hi
    I am still searching.. but no BADI/Exit is called in this case..
    <u>Meanwhile, i found few SAP OSS notes, which you can go through -></u>
    Note 1031896 Delimiting of Supplier Reg URL due to Special characters
    Note  1031070 Supplier cannot be registered
    Note  996030 Need to relogin to srmsus_selfreg service when using aliases
    Note 1032573 FormofAddr field mandatory in userselfreg.htm page
    Note 1003820 Supplier cannot be registered
    Note 889451 Not Possible to register in Supplier self-registration
    Note  807511 Error message after self registration of supplier admin user
    Note 784883 Irrelevant warning message stops self registration
    Do let me know.
    Regards
    - Atul

  • Xcelsius Dashboard on SAP R/3 Table using BSP and XML Mapping

    Hi Experts,
    I have developed a simple dashboard on small data set (10 records) that I am fetching from a R/3 Table into BSP and generating XML from there and consuming it in Xcelsius (SAP R/3 + BSP + XML Mapping).
    Now I want to fetch data based on Variables values that should be passed from the dashboard at the runtime and should display the data  accordingly. Any help on how it can be achieved?
    Thanks..!!
    Sharad

    Hi,
    You could try doing this by using XML data connection. You would have to make use of Enable load to get the data from XML and Enable send to send data back to XML from dashboard.
    This would require you to write a script.
    Thanks,
    Amit

Maybe you are looking for

  • CR6.4 RC1 - XMP export bug, anybody else has it?

    I think I found a bug, and although I also found a workaround, here it is. My environment: Windows 7, Photoshop CS5, Camera Raw 6.4 RC1, all of them 64-bits. Steps to reproduce the bug: 1. Open several raw files at once in Camera Raw (in my case, Oly

  • Pdf from safari won't open

    When I save as a pdf from Safari, I get a file that "Acrobat could not open because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

  • GET PARAMETER:   user parameter not consistant.

    I've got a data element ( /SAPSLL/LGREG ) for which I have assigned a user parameter in my user's profile.  The parameter value assigned under "maintain user profile" is Parameter ID: /SAPSLL/LGREG,  Parameter value:  ZLOC. The program I am running e

  • How to change timestamp for MacMail (Lion) - 3hours ahead

    Hello How do you change the timestamp in MacMail (Lion)? It is three hours ahead. My computer time is correct (Pacific time). For example, I send something at 9AM it says 12PM. Please let me know if there is something in the preferences I can change.

  • Urgent - XI Mapping Out Of Memory Exception

    I am processing a 8 MB flat file which after content conversion blows up to a 33 MB file in XI. I have a Mapping program developed using the Graphical Mapping tool of XI. During the message processing i keep seeing the java.lang.OutOfMemoryError when