Local interface with example using parameters.
1. Goto SE38.
2. Give program name and click on create.
3. Give description and select type executable program.
4. Write code.
REPORT zab_if_sale_delivery.
DATA: lv_erzet TYPE erzet,
lv_erdat TYPE erdat,
lv_vbtyp TYPE vbtyp,
lv_ernam TYPE ernam.
PARAMETERS: p_vbeln TYPE vbeln.
PARAMETERS: p_r1 TYPE c RADIOBUTTON GROUP g1,
p_r2 TYPE c RADIOBUTTON GROUP g1.
INTERFACE if_sale_del.
METHODS display
IMPORTING pvbeln TYPE vbeln
EXPORTING perzet TYPE erzet
perdat TYPE erdat
pvbtyp TYPE vbtyp
pernam TYPE ernam.
ENDINTERFACE.
CLASS sale DEFINITION.
PUBLIC SECTION.
INTERFACES if_sale_del.
ENDCLASS.
CLASS sale IMPLEMENTATION.
METHOD if_sale_del~display.
SELECT SINGLE erzet
erdat
vbtyp
ernam
FROM vbak
INTO ( perzet,perdat, pvbtyp, pernam )
WHERE vbeln EQ p_vbeln.
ENDMETHOD.
ENDCLASS.
CLASS delivery DEFINITION.
PUBLIC SECTION.
INTERFACES if_sale_del.
ENDCLASS.
CLASS delivery IMPLEMENTATION.
METHOD if_sale_del~display.
SELECT SINGLE erzet
erdat
vbtyp
ernam
FROM likp
INTO ( perzet,perdat, pvbtyp, pernam )
WHERE vbeln EQ p_vbeln.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: obj_sale TYPE REF TO sale,
obj_del TYPE REF TO delivery.
IF p_r1 = 'X'.
CREATE OBJECT obj_sale.
obj_sale->if_sale_del~display(
EXPORTING
pvbeln = p_vbeln
IMPORTING
perzet = lv_erzet
perdat = lv_erdat
pvbtyp = lv_vbtyp
pernam = lv_ernam
).
WRITE: 'Sale order details', / p_vbeln ,
/ lv_erzet,
/ lv_erdat,
/ lv_vbtyp,
/ lv_ernam.
ELSEIF p_r2 = 'X'.
CREATE OBJECT obj_del.
obj_del->if_sale_del~display(
EXPORTING
pvbeln = p_vbeln
IMPORTING
perzet = lv_erzet
perdat = lv_erdat
pvbtyp = lv_vbtyp
pernam = lv_ernam
).
WRITE: 'Delivery order details', / p_vbeln ,
/ lv_erzet,
/ lv_erdat,
/ lv_vbtyp,
/ lv_ernam.
ENDIF.
Case1-Sale
* Input
* Output
Case2-Delivery
* Input
* Output
****************************Thank you ****************************
Comments
Post a Comment