Example of how to call a BadI from an Abap and use the NEW OO ALV Grid

Very easy to do.
<b>REPORT  Z_BADI_TEST.
test call Badi from standard abap.
*Only from rel 6.40
do the following
1) define the Badi  (SE18).
For Abap call test uncheck multiple use
and filter boxes
2) Implement the badi (SE19).
Add any methods here in the implementation
3) activate
4)  define the standard class exithandler to the
Abap. This class is the "Badi caller
5)  define an exit variable referring to your Badi
Implementation interface
this interface  will normally be
called something like 
ZIF_EX***************
  You will see the actual name in SE18/SE19.
6)  Instantiate your instance of the badi
via  method call get_instance
7)  Now call any method(s) in the Badi.
*****************start of abap code **************
Define the Badi calling class (standard sap class)
  class cl_exithandler definition load.   "Declaration
*Interface reference  
  data exit type ref to zif_ex__jimbotest.    
     data yes type c.
Used in Fmod call in Badi methods
    data: v_knvv type knvv.
    start-of-selection.
    yes = ' '.
  selection-screen  begin of block b1.
  parameters: r1  radiobutton  group rad1,
              r2  radiobutton group rad1,
              r3  radiobutton group rad1.
  selection-screen end of block b1.
    parameters: p_kunnr type knvv-kunnr.
    select  single * into v_knvv
    from knvv
     where kunnr eq p_kunnr.
     export v_knvv to memory id 'CUST6A'.
*Save customer data for the function module call
call method cl_exithandler=>get_instance 
       exporting 
       exit_name    = 'Z_JIMBOTEST' "Your Badi Name
       null_instance_accepted = yes
          changing instance = exit.
   if not exit is initial.
       if r1 = 'X'.
     call method exit->dispord .  "Badi call
      endif.
if r2 = 'X'.
call method exit->dispfakt.     "Badi Call
endif.
if r3 = 'X'.
call method exit->dispmat.      "Badi call
endif.
end of calling abap******** </b>
In the badi   methods code as shown
1)
method ZIF_EX__JIMBOTEST~DISPORD.
CALL FUNCTION 'Z_DISPLAY_CUST'.
endmethod.
2)
method ZIF_EX__JIMBOTEST~DISPFAKT.
CALL FUNCTION 'Z_DISPLAY_FAKT'.
endmethod
3)
method ZIF_EX__JIMBOTEST~DISPMAT.
CALL FUNCTION 'Z_DISPLAY_CUST'.
endmethod.
Copy via SE 41 the status SALV_STANDARD from  standard SAP program SALV_DEMO_METADATA into the main program where you've created the 3 function modules below (SAP______TOP)
Global Data for the three function modules I'm calling
FUNCTION-POOL Z_BADI_KNVV.                  "MESSAGE-ID ..
include <color>.
include <icon>.
include <symbol>.
tables: zknvv.
data: v_zzkvgr6  TYPE KNVV-ZZKVGR6.
data: choice1  type c.
data: choice2 type c.
data: choice3 type c.
data: choice4 Type c.
data: ok-code(5) type c.
data: answer type string.
data: value1 type SPOP-VARVALUE1.
data: answer1  type string.
tables:  vbak, vbap,  vakpa, vbrk, vrkpa.
data: lr_functions type ref to cl_salv_functions_list.
constants: gc_true  type sap_bool value 'X',
           gc_false type sap_bool value space.
add for colour displays
   data: ls_color type lvc_s_colo.
   DATA : LV_SALV_COLUMNS_TABLE TYPE REF TO CL_SALV_COLUMNS_TABLE.
  data: lr_columns type ref to cl_salv_columns_table,
        lr_column  type ref to cl_salv_column_table.
Data:
        gr_table TYPE REF TO cl_salv_table.
data: z_datum type sy-datum.
data: v_knvv type knvv.
data : begin of s_vbak,
          vkorg   type vakpa-vkorg,
          vkgrp   type vakpa-vkgrp,
          vtweg   type vakpa-vtweg,
          spart   type vakpa-spart,
          auart   type vakpa-auart,
          vbeln   type vakpa-vbeln,
          bstnk   type vakpa-bstnk,
          audat   type vakpa-audat,
          netwr   type vbak-netwr,
       end of s_vbak.
data : begin of s_vbrk,
          vbeln   type vrkpa-vbeln,
          vkorg   type vrkpa-vkorg,
          fkart   type vrkpa-fkart,
          fkdat   type vrkpa-fkdat,
          netwr   type vbrk-netwr,
       end of s_vbrk.
  data: begin of s_vbap,
         matnr   type vbap-matnr,
         arktx   type vbap-arktx,
         netwr   type vbap-netwr,
         kwmeng  type vbap-kwmeng,
      end of s_vbap.
data: t_vbap like table of s_vbap.
data:   t_vbak
        like table of s_vbak.
  data:   t_vbrk
        like table of s_vbrk.
data:   s_name  type tabname.
data: gr_selections type ref to cl_salv_selections.
data: gr_events type ref to cl_salv_events_table.
Source code of the function modules.
Function modules themselves
FUNCTION Z_DISPLAY_CUST.
s_name = 'S_VBAK'.
orders in last 6 months
z_datum = sy-datum - 180.
import v_knvv from memory id 'CUST6A'.
get data
   select avkorg aaudat avkgrp avtweg aspart aauart abstnk avbeln b~netwr
      into corresponding fields of  table t_vbak
      up to 100 rows
         from (  vakpa as a
          inner join vbak as b
           on avbeln eq bvbeln )
        where a~kunde eq v_knvv-kunnr
        and a~parvw eq 'AG'
       and a~vkorg eq 'EN01'
        and a~trvog eq '0'
        and a~audat gt z_datum.
sort t_vbak by audat descending.
*data: gt_hyperlink type standard table of g_type_s_hyperlink.
Instead of if_salv_c_bool_sap=>false, you can pass the
value if_salv_c_bool_sap=>true to this method to
see your ALV as a list.
display data in Grid / List
  TRY.
      CALL METHOD cl_salv_table=>factory
        EXPORTING
          list_display   = if_salv_c_bool_sap=>false
        IMPORTING
          r_salv_table   = gr_table
        CHANGING
          t_table    = t_vbak.
    CATCH cx_salv_msg.
  ENDTRY.
try.
LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).
      ls_color-col = col_negative.
      ls_color-int = 0.
      ls_color-inv = 0.
      lr_column->set_color( ls_color ).
  catch cx_salv_not_found.
endtry.
try.
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'VBELN' ).
ls_color-col = col_negative.
      ls_color-int = 1.
      ls_color-inv = 1.
      lr_column->set_color( ls_color ).
catch cx_salv_not_found.
endtry.
try.
*LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).
lr_column->set_short_text( 'Short' ).
lr_column->set_medium_text( 'Medium' ).
lr_column->set_long_text( 'Net Value' ).
*lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'URL' ).
catch cx_salv_not_found.
endtry.
gr_table->set_screen_status( pfstatus = 'SALV_STANDARD'
report = sy-repid
set_functions = gr_table->c_functions_all ).
this statement actually does the display.
  gr_table->display( ).
ENDFUNCTION.
FUNCTION Z_DISPLAY_FAKT.
s_name = 'S_VBRK'.
invoices in last 6 months
z_datum = sy-datum - 180.
import v_knvv from memory id 'CUST6A'.
get data
   select avbeln afkart avkorg afkdat
     b~netwr
      into corresponding fields of  table t_vbrk
      up to 100 rows
         from (  vrkpa as a
          inner join vbrk as b
           on avbeln eq bvbeln )
        where a~kunde eq v_knvv-kunnr
        and a~parvw eq 'RG'
       and a~vkorg eq 'EN01'
        and a~vbtyp eq 'M'
        and a~fkdat gt z_datum.
sort t_vbrk by fkdat descending.
*data: gt_hyperlink type standard table of g_type_s_hyperlink.
Instead of if_salv_c_bool_sap=>false, you can pass the
value if_salv_c_bool_sap=>true to this method to
see your ALV as a list.
display data in Grid / List
  TRY.
      CALL METHOD cl_salv_table=>factory
        EXPORTING
          list_display   = if_salv_c_bool_sap=>false
        IMPORTING
          r_salv_table   = gr_table
        CHANGING
          t_table    = t_vbrk.
    CATCH cx_salv_msg.
  ENDTRY.
try.
LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).
      ls_color-col = col_negative.
      ls_color-int = 0.
      ls_color-inv = 0.
      lr_column->set_color( ls_color ).
      catch cx_salv_not_found.
endtry.
try.
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'VBELN' ).
ls_color-col = col_negative.
      ls_color-int = 1.
      ls_color-inv = 1.
      lr_column->set_color( ls_color ).
catch cx_salv_not_found.
endtry.
try.
*LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).
lr_column->set_short_text( 'Short' ).
lr_column->set_medium_text( 'Medium' ).
lr_column->set_long_text( 'Net Value' ).
*lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'URL' ).
catch cx_salv_not_found.
endtry.
gr_table->set_screen_status( pfstatus = 'SALV_STANDARD'
report = sy-repid
set_functions = gr_table->c_functions_all ).
this statement actually does the display.
  gr_table->display( ).
ENDFUNCTION.
FUNCTION Z_DISPLAY_MATERIAL.
s_name = 'S_VBAP'.
invoicesrs in last 6 months
z_datum = sy-datum - 180.
import v_knvv from memory id 'CUST6A'.
get data
select avbeln bmatnr barktx bnetwr b~kwmeng
into corresponding fields of  table t_vbap
      up to 100 rows
from (  vakpa as a
          inner join vbap as b
           on avbeln eq bvbeln )
        where a~kunde eq v_knvv-kunnr
        and a~parvw eq 'AG'
       and a~vkorg eq 'EN01'
        and a~trvog eq '0'
        and a~audat gt z_datum.
TRY.
      CALL METHOD cl_salv_table=>factory
        EXPORTING
          list_display   = if_salv_c_bool_sap=>false
        IMPORTING
          r_salv_table   = gr_table
        CHANGING
          t_table    = t_vbap.
    CATCH cx_salv_msg.
  ENDTRY.
try.
LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).
      ls_color-col = col_negative.
      ls_color-int = 0.
      ls_color-inv = 0.
      lr_column->set_color( ls_color ).
  catch cx_salv_not_found.
endtry.
try.
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'ARKTX' ).
ls_color-col = col_negative.
      ls_color-int = 1.
      ls_color-inv = 1.
      lr_column->set_color( ls_color ).
catch cx_salv_not_found.
endtry.
try.
*LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).
lr_column->set_short_text( 'Short' ).
lr_column->set_medium_text( 'Medium' ).
lr_column->set_long_text( 'Net Value' ).
*lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'URL' ).
catch cx_salv_not_found.
endtry.
gr_table->set_screen_status( pfstatus = 'SALV_STANDARD'
report = sy-repid
set_functions = gr_table->c_functions_all ).
this statement actually does the display.
  gr_table->display( ).
ENDFUNCTION.
You can extend this as far as you like -- it's really easy and MUCH MUCH easier than the old way with fieldcatalogs etc etc.

If the pagecontainer_mc holds another movieclip that contains the button you are trying to target, then you need to include that loaded movieclip in the targeting.  And if contacts is that movieclip, then you should be able to target it directly using...
var contacts:contatti = new contatti;
contacts.contacts_btn.addEventListener(MouseEvent.CLICK,showContacts);

Similar Messages

  • HT1848 How do you transfer purchases from an iOS device using the new iTunes (11?)?

    I've just updated iTunes to ver. 11 on my mothers new PC and I'm connecting her iPad up for the first time.  I can't see anything like the transfer purchases option that exsisted in the previous versions.  I've tried to eject and start again, but it's still not giving me the option like it used to when you connected a device for the first time.
    Any help would be greatly appreciated!

    okay, should have serched a little more..  all I had to do was CTRL + b in my library to view the file menu, and under File -> Devices -> transfer purchases
    Please ignore this question!

  • How to call a Applet from a servlet and vice versa...?

    Hi all
    Can anyone help me how to call a applet from a servlet and vice versa. When the applet is called it should contact the database (oracle8i) and get the data. When i submit the applet form the data in the applet should be saved in the database.
    Thanks in advance
    Kamalakannan

    Sweep is correct about requestDispatcher being another approach for inter-servlet delegation; the only issue that i recall with this approach is that it defaults the method of the destination servlet to the one it was called from...for example, calling servlet2 from within servlet1.post() resulted in the dispatcher attempting to utilize servlet2.post() - i believe that i searched for a parameterize solution to no avail :( (ended up handling the request by placing a "fake" doPost() in servlet2 that simply called servlet2.doGet())
    however, if your application is functioning correctly on your pc/webserver then the problem may be external to servlet communication (e.g. client webserver's ports not configured or blocked, missing runtime classes, etc.)
    my suggestion would be to set aside the programmatic concerns for the moment - what is the response if you open a browser on a client's machine and access the URL in question (i.e. http://clientserver:port/stefanoServlet)? If it will not respond to access in this manner then it certainly won't when your application calls for it.
    It's possible that there is a coding error but, given the info supplied, i'd start examining the environment, first. Let us know if you have any luck with the test i recommended or not (please provide abundant detail). Or, if you've found the solution then you may want to post back with a quick blub so the next person knows how to escape the trap.
    D

  • How do you transfer music from your ipod touch to the new Itunes?

    How do you transfer music from your Ipod touch to the new Itunes?

    The music sync is one way - computer to ipod.  the only exception is ituens purchases.
    You need to copy everything from your old computer, or your backup copy of your old computer, to your new one.

  • How do I extract email from a form and send the PDF to that user?

    How do I extract email from a form and send the PDF to that user?

    here you can add email to send to, CC, Subject, and body message
    var oDoc = event.target;
                        oDoc.mailDoc({
                                                                bUI: false,
                                                                cTo: "Agency Contact Email",
                                                                cCC: "",
                                                                cSubject: "Write your title here,
                                                                cMsg: "Dear" + AgencyContact + "(" + AgencyContactEmail + ")\nThe student, " + FirstName + " " + LastName + " has applied to work at your agency. Please confirm they can work here blah blah blah.......\n\nThanks.\n\nrespectuflly,\n\nme"

  • I have forgotten icloud account password linked to my ipad. I am unable to reset the password as well as delete this account from my ipad, and use a new one.

    I have forgotten icloud account password linked to my ipad. I am unable to reset the password as well as delete this account from my ipad, and use a new one.                                  

    None of us here, nor Apple, can help you.

  • Where can I learn how to setup and use the new features in Mountain Lion?

    Where can I learn how to setup and use the new features in Mountain Lion?

    MacWorld has a Superguide, TidBITS has Take Control books, and probably a flock of other publishers have physical books.

  • HT1918 how do i delete an old email address and use a new one as my primary?

    how do i delete a primary email address and use a new one?

    Stop using the old one and start using the new one. Notify all your friends, family, etc. of the change in email address.
    iTunes Store: Changing Account Information

  • How to call a webService from WebDynPro ABAP ?

    We are trying to call a webService from WebDynPro-ABAP application. It is not working, While if we are calling the WebService from a Report, it is working.
    How exactly do we call a WebService from a WebDynPro-ABAP application?
    What are the main steps involved ?

    Hi Phani,
    You will need to create a service call as follows.
    Right click on your WD component name and select Create->Service Call
    The wizard will guide you through a series of steps to make a Web Service Call. On the 3rd screen, it will give you options such as Function Module, Web Service, etc
    Before making a service call, you will need to create a proxy for the Web service in the ABAP Workbench using a WSDL document as a basis. To create or consume Web services, you will need the authorizations associated with the role SAP_BC_WEBSERVICE_ADMIN.

  • How to Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER in VC++ ?

    Hi,
    I have :  -  IMAQ1394 2.0.1
                  -  NI Vision 7.1
    In VB, I can Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER :
        Dim Image0 As New CWIMAQImage
        imaq1394SnapCW(sid0,Image0)
        CWIMAQViewer1.Attach Image0
    Now,How can I do this in VC++6.0?
        I tried:
                  C_CWIMAQImage m_imgViewer1;
                  m_imgViewer1 = m_CWIMAQVision1.CreateCWIMAQImage();
                  m_CWIMAQViewer1.Attach(m_imgViewer1);
                  imaq1394SnapCW(Sid,m_imgViewer1);  <--there is no "imaq1394SnapCW "function in VC++,why?
        Please help me!
        Thank you!

    For people looking back at these old posts regarding
    CWIMAQViewer - it was not made to be used in the C environments and is made
    for VB.
    Refer to the following locations for displaying images in C
    environments:
    Start»All Programs»National Instruments»Vision»Documentation
    Start»All
    Programs»National Instruments»Vision»Text Based Examples
    Make
    sure that you look at the examples and documentation that is in
    reference to the C environments not the VB environments
    Vince M
    Applications Engineer

  • How do you uninstall Photoshop from one computer and retain the serial number?

    I purchased Photoshop CS4 a few years ago which allowed me to use the serial number on two computers, however the initial laptop I installed it on suffered fatal injuries and couldn't be recovered. The problem is that Photoshop is still technically installed on it, therefore the serial number can only be used once more.
    I've since bought a new laptop, and PS is installed, but I'm wanting to install it (and use the serial number) on my work computer which the program will not let me do. Is it possible to cancel out the serial number used on that first broken laptop so that I can install it on my newest one?
    Thanks

    Hi Frank,
    Usually that kind of thing is possible, but since you no longer have access to the crashed system, it's not something you can do yourself...  Only Adobe customer service can help since they control what's activated for your license in their database...
    So your best bet is to contact them and see what they can do - for example resetting all activations of your serial number, so you then start over from scratch (and can reactivate as you desire).

  • How do you transfer photos from an old iPhone to the new one??

    How do you transfer photos from an old iPhone to your new one??

    Photos in your camera roll are included in the iPhone backup, & restoring your new phone from the backup of your old phone, as described here, will restore these photos to your new phone:
    http://support.apple.com/kb/HT2109
    Photos synced to your phone are not included in any iPhone backup. If you're talking about photos that were synced to your old phone, just sync them to your new phone.

  • Computer died, how do I move songs from my iPod touch to the new pc?, Computer died, how do I move songs from my iPod touch to the new pc?

    My hard drive took a nose dive not too long ago, and I've gotten a new one, but having problems transferring all my music from my iPod touch to the new PC. When I searched for help the only thing I found said it didn't apply to the iPod touch. Can anyone point me in a better direction?
    Thanks!
    Dallas.

    See if these articles help you....dont forget to click on the blue links in the article, they contain more information
    http://support.apple.com/kb/HT1848
    http://support.apple.com/kb/HT4527

  • How can I copy bookmarks from another PC without using the resotre not to loose the ones on the curtrent PC

    I want to copy bookmarks from another PC not using the restore function inorder not to delete bookmarks on current PC

    Export them to an HTML file, then import the HTML file to the other computer, that will add the bookmarks to those that already exist.
    * https://support.mozilla.com/kb/Exporting+bookmarks+to+an+HTML+file
    * https://support.mozilla.com/kb/Importing+Bookmarks+from+an+HTML+File

  • HT1657 My movie -- safe House -- froze/stopped with 57 minutes left to play. How can I get the rest of the movie to play or how can I delete it from my iPad and download the rental again?

    My rental movie -- Safe House -- stopped/froze with 57 minutes leftnto play. How can I watch the rest of the movie, or delete it to download it again?

    Welcome to the Apple community.
    Have you tried stopping the movie and trying to start it again.
    Unfortunately you cannot re-download rentals. If the problem continues, select the content which is causing a problem and use the 'Report a problem' button in Your Purchase History.

Maybe you are looking for

  • Sharing Apps and Songs with family members

    I've just set my 2 kids up with their own apple ID's so that they can buy music that they like, instead of only having access to my wife an my music and apps. My wife thinks this was a bad idea, since now if we like songs that they download, we will

  • Ship to Party in Invoice

    Hi Friends, When we create an invoice with respect to delivery using standard copy control the partner function thats appear in the header is bill to party and payer. I want the ship to party also to appear in the partner function at header level. Th

  • Photoshop CS4, CS5 and CS6

    I've just upgraded to Photoshop CS6. I still have applications for CS4 and CS5. This includes Bridge, Device Central, Extendscript Toolkit, and Extention Manager. Each version has one. Can I get rid of all relating to CS4 and CS5 now that I'm using C

  • Change "Date Created" on File Folders

    What is the easiest way to change or alter the "Date Created" on file folders - To a date that is 6 months older? (OS 9.1) I need to store my photos in a single large chronologically ordered file. Some of them are sourced from scanned photos and some

  • WM: Suggest Bin (Like in LT09)

    Hi Experts, I have a requirement to Suggest a Bin (in a custom program) similar to LT09 (which automatically assigns a Bin). I've read several threads and it says to use the FM L_TO_PREPARE_ITEM_INT. Unfortunately, I cannot make this FM work. There a