2008 May 20 8:45 PM
Hello Gurus,
I am learning object oriented ABAP. The best way to learn it is do it practically. If I want to change the following code in OO code , how can it be done ?
TABLES : gb01.
----
Data Declaration
----
DATA : BEGIN OF i_mid OCCURS 0,
mid(2),
text(10),
END OF i_mid.
DATA :v_tabix LIKE sy-tabix.
----
Selection Screen
----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME
TITLE text-001.
PARAMETER : p_modif(1) DEFAULT 'U',
p_class LIKE gb01-boolclass DEFAULT '009',
p_cltyp LIKE gb01-classtype DEFAULT 'S',
p_table LIKE gb01-bcltab DEFAULT 'BSEG',
p_field LIKE gb01-bclfield DEFAULT 'HKONT',
p_excld LIKE gb01-bexclude DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK b1.
----
Selection Screen F4 Help for Modif ID's
----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_modif.
PERFORM get_modifid.
Start of Selection
START-OF-SELECTION.
CLEAR gb01.
CASE p_modif.
WHEN 'U'. "Update
UPDATE gb01
SET bexclude = p_excld
WHERE bcltab = p_table
AND bclfield = p_field
AND boolclass = p_class
AND classtype = p_cltyp.
IF sy-subrc NE 0.
WRITE : / 'UPDATE - KO'.
ELSE.
WRITE : / 'UPDATE - OK'.
ENDIF.
WHEN 'I'. "Insert
gb01-bcltab = p_table.
gb01-bclfield = p_field.
gb01-boolclass = p_class.
gb01-classtype = p_cltyp.
gb01-bexclude = p_excld.
INSERT INTO gb01 VALUES gb01.
IF sy-subrc NE 0.
WRITE : / 'INSERTION - KO'.
ELSE.
WRITE : / 'INSERTION - OK'.
ENDIF.
WHEN 'D'. "Delete
DELETE FROM gb01
WHERE bcltab = p_table
AND bclfield = p_field
AND boolclass = p_class
AND classtype = p_cltyp.
IF sy-subrc NE 0.
WRITE : / 'DELETE - KO'.
ELSE.
WRITE : / 'DELETE - OK'.
ENDIF.
ENDCASE.
&----
*& Form get_modifid
&----
F4 Help for modif id field
----
FORM get_modifid.
i_mid-mid = 'U'.
i_mid-text = 'Update'.
APPEND i_mid.
i_mid-mid = 'I'.
i_mid-text = 'Insert'.
APPEND i_mid.
i_mid-mid = 'D'.
i_mid-text = 'Delete'.
APPEND i_mid.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = '20'
endpos_row = '12'
startpos_col = '10'
startpos_row = '10'
titletext = 'Modification Ids'
IMPORTING
choise = v_tabix
TABLES
valuetab = i_mid
EXCEPTIONS
break_off = 1
OTHERS = 2.
IF sy-subrc NE 0.
EXIT.
ENDIF.
READ TABLE i_mid INDEX v_tabix.
IF sy-subrc EQ 0.
p_modif = i_mid-mid.
ENDIF.
REFRESH i_mid.
ENDFORM. " get_modifid
Regards,
Rajesh.
The best is to learn is to do it yourself first...and then come here is you got any problem...Don't expect us to the code for you...Sorry...But you'll never learn otherwise -;)
Greetings,
Blag.
2008 May 20 8:50 PM
Hi Rajesh,
To my knowledge if u r using any grid display or list display u can use that part of the code in OO.
remaining part is the same or check for methods to find out any pop up display.
Thanks,
2008 Jun 12 6:28 PM
Hi Rajesh,
Hey here are some of the links, please chek these links u have lot of examples
http://www.saptechnical.com/Tutorials/OOPS/MainPage.htm
and also please check these threads
Best regards,
raam
2008 Jun 12 6:31 PM
The best is to learn is to do it yourself first...and then come here is you got any problem...Don't expect us to the code for you...Sorry...But you'll never learn otherwise -;)
Greetings,
Blag.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |