SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

внедрение BADI в программу



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
polkon
Участник
Участник



Joined: 28 Nov 2012
Posts: 14

PostPosted: Fri Dec 28, 2012 12:55 pm    Post subject: внедрение BADI в программу Reply with quote

Нужна помощь с прогой.
Написал такой код:
Code:

DATA : et_ekko TYPE TABLE OF ekko,
           et_ekpo TYPE TABLE OF ekpo  .
 
DATA :

 w_handle TYPE REF TO ZCL_TEST01, " ZCL_TEST01 - BADi-определение

       ob_custom TYPE REF TO cl_gui_custom_container ,
       ob_split1 TYPE REF TO cl_gui_easy_splitter_container ,
       ob_split2 TYPE REF TO cl_gui_easy_splitter_container ,
       ob_grid1  TYPE REF TO cl_gui_alv_grid ,
       ob_grid2  TYPE REF TO cl_gui_alv_grid .

DATA :
 OK_CODE LIKE sy-ucomm,
 SAVE_OK LIKE sy-ucomm.

PARAMETER iv_ebeln type ekko-ebeln.

START-OF-SELECTION.


* GET BADI - for getting objects..................
GET BADI w_handle.
* CALL BADI - for calling interface methods.
CALL BADI w_handle->select_data
   EXPORTING
    iv_ebeln = iv_ebeln
   IMPORTING
     et_ekpo  = et_ekpo
     et_ekko  = et_ekko




CALL SCREEN 100.

*&---------------------------------------------------------------------*
*& Module status_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*AT LINE-SELECTION.

MODULE status_0100 OUTPUT.
   SET TITLEBAR 'DYNPRO' .
   SET PF-STATUS 'DYNPR'.


* This will create a container
   CREATE OBJECT ob_custom
      EXPORTING
        container_name = 'CONTAINER' .

* This spit the container OB_CUSTOM into two
   CREATE OBJECT ob_split1
      EXPORTING
        parent = ob_custom
        orientation = cl_gui_easy_splitter_container=>orientation_vertical .

    CREATE OBJECT ob_split2
       EXPORTING
          parent = ob_split1->bottom_right_container
          orientation = cl_gui_easy_splitter_container=>orientation_vertical.

   CREATE OBJECT ob_grid1
      EXPORTING
        i_parent = ob_split1->top_left_container .

   CREATE OBJECT ob_grid2
      EXPORTING
        i_parent = ob_split2->top_left_container.


   CALL METHOD ob_grid1->set_table_for_first_display
      EXPORTING
        i_structure_name = 'ekko'
      CHANGING
        it_outtab = et_ekko.

   CALL METHOD ob_grid2->set_table_for_first_display
      EXPORTING
         i_structure_name = 'ekpo'
      CHANGING
         it_outtab = et_ekpo.


ENDMODULE. " status_0100 OUTPUT


Программа, основанная на BADI для ввода номера документа и вывода результата в ALV сплит контейнеры.

нужно сделать так, что бы выбор данных должен осуществляться в программе и далее данные должны передаваться в бади для редактирования.
И осуществить внедрение бади с реализацией редактирования в методе.

Code:

method zcl_test_01_interface~select_data.
   select *
    from ekko
    into table et_ekko
    where ebeln = iv_ebeln.

  select *
    from ekpo
    into table et_ekpo
    where ebeln = iv_ebeln.

  endmethod.
Back to top
View user's profile Send private message
Preatos
Участник
Участник



Joined: 25 Nov 2008
Posts: 7

PostPosted: Fri Dec 28, 2012 3:56 pm    Post subject: Reply with quote

Code:
REPORT  Z_TRY.


data lcl type REF TO zcl_test1.

data: t_ekpo type table of ekpo,
      t_ekko type table of ekko.

data w_handle type REF TO ZENH_TEST1.


parameters p_ebeln type ekko-ebeln.

START-OF-SELECTION.

create OBJECT lcl.

  lcl->select_data(
  EXPORTING
    iv_ebeln = p_ebeln
   IMPORTING
     et_ekpo  = t_ekpo
     et_ekko  = t_ekko
       ).




TRY.
   GET BADI w_handle.
      CATCH cx_badi_not_implemented.
ENDTRY.

if w_handle is bound.

CALL BADI w_handle->change_data
  changing
     ct_ekko  = t_ekko
     ct_ekpo  = t_ekpo.

endif.

**** Вот тут ты выводишь результат на экран в split container.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.