Google Search - Blog...........

Get All Obsolete Function Modules Or Tables Or Classes

REPORT ztest.

TABLES:rodir.

TYPES: BEGIN OF ty_rodir,
objecttype TYPE rodir-objecttype,
object TYPE rodir-object,
released TYPE rodir-released,
END OF ty_rodir.

DATA: itab TYPE TABLE OF ty_rodir WITH HEADER LINE.

SELECT-OPTIONS: s_objtyp FOR rodir-objecttype,
s_object FOR rodir-object.

INITIALIZATION.

s_objtyp-sign = 'I'.
s_objtyp-option = 'EQ'.
s_objtyp-low = 'FUNC'. " Function module
APPEND s_objtyp.

s_objtyp-low = 'CLAS'. " classes
APPEND s_objtyp.

s_objtyp-low = 'TABL'. " tables
APPEND s_objtyp.

s_objtyp-low = 'VIEW'. " views
APPEND s_objtyp.

s_objtyp-low = 'TTYP'. " table types
APPEND s_objtyp.

s_objtyp-low = 'TYPE'. " types like icons
APPEND s_objtyp.

START-OF-SELECTION.

SELECT objecttype
object
released
FROM rodir
INTO TABLE itab
WHERE objecttype IN s_objtyp
AND object IN s_object
AND obsolete = 'X'.

LOOP AT itab.
AT NEW objecttype.
FORMAT COLOR 7.
CASE itab-objecttype.
WHEN 'FUNC'.
WRITE:/ 'Obsolate function modules are:'.
WHEN 'CLAS'.
WRITE:/ 'Obsolate classes are:'.
WHEN 'TABL'.
WRITE:/ 'Obsolate tables are:'.
WHEN 'VIEW'.
WRITE:/ 'Obsolate views are:'.
WHEN 'TTYP'.
WRITE:/ 'Obsolate table types are:'.
WHEN 'TYPE'.
WRITE:/ 'Obsolate types are:'.
WRITE:/1(60) sy-uline .
ENDCASE.
WRITE:/ .
ENDAT.
FORMAT COLOR OFF.
WRITE: itab-object,
itab-released.
WRITE:/ .

ENDLOOP.


selection-screen is


output is like this :


ABAP - Display All Requests Under A User With Status.

REPORT ztest line-size 160.

tables: e070.

types: begin of ty_final,
TRKORR type e070-TRKORR,
desc type char35,
status type char35,
type type char35,
AS4USER type e070-AS4USER,
AS4DATE type sy-datum,
AS4TIME type sy-uzeit,
end of ty_final.

types: begin of ty_request.
include structure e070.
types: end of ty_request.


data: it_request type standard table of ty_request with header line,
it_final type standard table of ty_final with header line.



select-options: s_req for e070-TRKORR.
parameters:p_user type sy-uname.

start-of-selection.

select * from e070
into table it_request
where TRKORR in s_req
and AS4USER = p_user.

if not it_request[] is initial.

loop at it_request.
it_final-TRKORR = it_request-TRKORR.
case: it_request-TRFUNCTION.
when 'K'.
it_final-desc = 'Workbench Request'.
when 'W'.
it_final-desc = 'Customizing Request'.
when 'C' .
it_final-desc = 'Relocation of Objects Without Package Change'.
when 'O' .
it_final-desc = 'Relocation of Objects with Package Change'.
when 'E' .
it_final-desc = 'Relocation of Complete Package'.
when 'T' .
it_final-desc = 'Transport of Copies'.
when 'S' .
it_final-desc = 'Development/Correction'.
when 'R' .
it_final-desc = 'Repair'.
when 'X' .
it_final-desc = 'Unclassified Task'.
when 'Q' .
it_final-desc = 'Customizing Task'.
when 'G' .
it_final-desc = 'Piece List for CTS Project'.
when 'M' .
it_final-desc = 'Client Transport Request'.
when 'P' .
it_final-desc = 'Piece List for Upgrade'.
when 'D' .
it_final-desc = 'Piece List for Support Package'.
when 'F' .
it_final-desc = 'Piece List'.
endcase.

case it_request-TRSTATUS.
when 'D'.
it_final-status = 'Modifiable'.
when 'L'.
it_final-status = 'Modifiable, Protected'.
when 'O'.
it_final-status = 'Release Started'.
when 'R'.
it_final-status = 'Released'.
when 'N'.
it_final-status = 'Released (with Import Protection for Repaired Objects)'.
endcase.

case: it_request-KORRDEV.
when 'CUST'.
it_final-type = 'Client-specific Customizing'.
when 'SYST'.
it_final-type = 'Repository, cross-client objects'.
endcase.
it_final-AS4USER = it_request-AS4USER.
it_final-AS4DATE = it_request-AS4DATE.
it_final-AS4TIME = it_request-AS4TIME .

if not it_final-TRKORR is initial.
append it_final.
clear it_final.
endif.
endloop.
endif.

sort it_final by desc.

format color 7.
write:/1 'Request/Tas',
20 'Description of Req/Task',
50 'Status',
63 'Type of Request',
100 'User name',
120 'Changed Date',
140 'Changed Time' .
format color off.

loop at it_final.
write:/1 it_final-TRKORR,
20 it_final-desc,
50 it_final-status,
63 it_final-type,
100 it_final-AS4USER,
120 it_final-AS4DATE,
140 it_final-AS4TIME.
endloop.

the selection screen is like this :




and the output is like this :

Get All Exceptions For A Function Module

*------------------------------------------------------*
*description: this is used for displaying all the
*exceptions of a given function module
*------------------------------------------------------*
report zfunction.

*----tables used
tables:FUPARAREF.

*---types declaration
types: begin of ty_FUPARAREF,
FUNCNAME type FUNCNAME,
PARAMETER type PARAMETER,
PPOSITION type SYTABIX,
end of ty_FUPARAREF.

*---internal table declaration
data: itab type table of ty_FUPARAREF with header line.
*---selection screen display
select-options:s_fname for FUPARAREF-FUNCNAME no intervals.
*---start of selection
start-of-selection.

perform get_data.

perform display_data.

*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .

select FUNCNAME
PARAMETER
PPOSITION
from FUPARAREF
into table itab
where FUNCNAME in s_fname
and R3STATE = 'A'
and PARAMTYPE = 'X'.

sort itab by FUNCNAME PPOSITION.

endform. " get_data
*&---------------------------------------------------------------------*
*& Form display_data
*----------------------------------------------------------------------*
form display_data .

loop at itab .
AT NEW FUNCNAME.
write:/.
write:/ itab-FUNCNAME.
write:/ .
endat.
write:/ itab-PPOSITION,
itab-PARAMETER.

endloop.

endform. " display_data



selection screen is like this :




output is like this :

Report To Convert Output In Email (HTML Format).

REPORT zhtml_report.
*----------------------------------------------------------*
*Description: this report will creates an output in email
* in HTML format
*----------------------------------------------------------*

DATA: it_maildata TYPE sodocchgi1 OCCURS 10 WITH HEADER LINE ,
it_mailtext LIKE solisti1 OCCURS 10 WITH HEADER LINE,
it_mailrecep LIKE somlrec90 OCCURS 10 WITH HEADER LINE,
it_listtable TYPE abaplist OCCURS 10 WITH HEADER LINE,
it_htmldata TYPE w3html OCCURS 10 WITH HEADER LINE,
it_ascidatatab TYPE char255 OCCURS 10 WITH HEADER LINE.


START-OF-SELECTION.
*----------------------------------------------------------*
**before submitting the report first create a test program for
**displaying the output in html program .copy and paste the
**below report
*report ztest_submit.
*start-of-selection.
*do 10 times.
*write:/ 'this is the test report for html output in email'.
*enddo.
*----------------------------------------------------------*

SUBMIT ztest_submit
EXPORTING LIST TO MEMORY AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = it_listtable
EXCEPTIONS
not_found = 1
OTHERS = 2.

CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
TABLES
html = it_htmldata
listobject = it_listtable.


CLEAR: it_maildata,
it_mailtext,
it_mailrecep.
REFRESH: it_mailtext,
it_mailrecep.

it_maildata-obj_name = 'TEST'.
it_maildata-obj_descr = 'Test Subject'.

LOOP AT it_htmldata.
it_mailtext = it_htmldata.
APPEND it_mailtext.
ENDLOOP.

it_mailrecep-receiver = 'venkatntw@gmail.com'.
it_mailrecep-rec_type = 'U'.
APPEND it_mailrecep.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = it_maildata
document_type = 'HTM'
put_in_outbox = 'X'
TABLES
object_header = it_mailtext
object_content = it_mailtext
receivers = it_mailrecep
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

COMMIT WORK.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.

Validate Whether Request Moved To Other Server Or Not

*&---------------------------------------------------------------------*
* the result can be verified as below
* go to se09--->click on the request --->click on transport logs
* there you can see the production system details(import, Selection
* for Import,Check Versions)
*&---------------------------------------------------------------------*

REPORT yztest1 .

TABLES: tpalog,dfies.

TYPES: BEGIN OF ty_tpalog.
INCLUDE STRUCTURE tpalog.
TYPES: END OF ty_tpalog.

TYPES: BEGIN OF ty_help,
trkorr TYPE trkorr,
END OF ty_help.

DATA : lt_fields TYPE TABLE OF dfies,
ls_field TYPE dfies.

DATA: it_tpalog TYPE STANDARD TABLE OF ty_tpalog WITH HEADER LINE,
it_help TYPE STANDARD TABLE OF ty_help WITH HEADER LINE.

SELECT-OPTIONS: s_trkorr FOR tpalog-trkorr.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_trkorr-low.

SELECT trkorr
INTO TABLE it_help
FROM tpalog
UP TO 5 ROWS.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'TRKORR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'S_TRKORR-LOW'
value_org = 'S'
TABLES
value_tab = it_help
field_tab = lt_fields.


START-OF-SELECTION.

SELECT * FROM tpalog
INTO TABLE it_tpalog
WHERE trkorr IN s_trkorr
AND trstep = '<'. IF sy-subrc = 0. LOOP AT it_tpalog. WRITE:/ it_tpalog-trkorr, 'This was transported'. ENDLOOP. ELSE. WRITE:/ 'no request is transported'. ENDIF. the output is :

ABAP - Working With List Memory

report ztest .

data: it_ascilines type char255 occurs 0 with header line,
it_list type table of abaplist with header line,
it_msg type table of soli initial size 0 with header line.

*---start of selection
start-of-selection.

*--output of the list.
do 10 times.
write:/ sy-index.
enddo.
*----saving this list to memory
call function 'SAVE_LIST'
tables
listobject = it_list
exceptions
list_index_invalid = 1
others = 2 .

*----retriving list from memory
call function 'LIST_TO_ASCI'
tables
listobject = it_list
listasci = it_ascilines
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.

check sy-subrc = 0.
it_msg[] = it_ascilines[].

*---displaying the list retrived from memory
loop at it_msg.
write:/ it_msg-line.
endloop.

the output is like this:

HR ABAP - Minimum & Maximum Salaries For The Employees.

REPORT yztest .

*----data base tables used
TABLES: pa0008.

*---types declaration
TYPES: BEGIN OF ty_pa0008,
pernr LIKE pa0008-pernr,
begda LIKE pa0008-begda,
endda LIKE pa0008-endda,
trfar LIKE pa0008-trfar,
trfgb LIKE pa0008-trfgb,
trfgr LIKE pa0008-trfgr,
trfst LIKE pa0008-trfst,
END OF ty_pa0008.

TYPES: BEGIN OF ty_t510n,
molga LIKE t510n-molga,
trfar LIKE t510n-trfar,
trfgb LIKE t510n-trfgb,
trfgr LIKE t510n-trfgr,
trfst LIKE t510n-trfst,
grmin LIKE t510n-grmin,
grmax LIKE t510n-grmax,
endda LIKE t510n-endda,
END OF ty_t510n.

*--internal table declaration
DATA: it_pa0008 TYPE TABLE OF ty_pa0008 WITH HEADER LINE,
it_t510n TYPE TABLE OF ty_t510n WITH HEADER LINE.

*---selection screen data
SELECT-OPTIONS:s_pernr FOR pa0008-pernr.
PARAMETERS:p_molga TYPE molga.

*--start of selection
START-OF-SELECTION.

perform get_data.

END-OF-SELECTION.

perform display_data.

*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .


SELECT pernr
begda
endda
trfar
trfgb
trfgr
trfst
FROM pa0008
INTO TABLE it_pa0008
WHERE pernr IN s_pernr.

if not it_pa0008[] is initial.

SELECT molga
trfar
trfgb
trfgr
trfst
grmin
grmax
endda
FROM t510n
INTO TABLE it_t510n
FOR ALL ENTRIES IN it_pa0008
WHERE trfar = it_pa0008-trfar
AND trfar = it_pa0008-trfar
AND trfgb = it_pa0008-trfgb
AND trfgr = it_pa0008-trfgr
AND trfst = it_pa0008-trfst
AND endda = '99991231'.
endif.

endform. " get_data
*&---------------------------------------------------------------------*
*& Form display_data
*----------------------------------------------------------------------*
form display_data .


LOOP AT it_pa0008.
WRITE:/ it_pa0008-pernr ,
it_pa0008-begda ,
it_pa0008-endda .

READ TABLE it_t510n WITH KEY trfar = it_pa0008-trfar
trfgb = it_pa0008-trfgb
trfgr = it_pa0008-trfgr
trfst = it_pa0008-trfst.
WRITE:/ it_t510n-trfar,
it_t510n-trfgb ,
it_t510n-trfgr,
it_t510n-trfst,
it_t510n-grmin ,
it_t510n-grmax.
ENDLOOP.

endform. " display_data


the selection screen is like this ..



and the output is like this:




ALSO READ:

- Handling User Exits In HR ABAP.

- Termination Workbench Report In HR ABAP.

- Service Calculation Report In HR ABAP.

- Use Of BAPI HR_MAINTAIN_MASTERDATA For Updating HR DATA.

- Upload The Over Time Report In HR ABAP.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


Main Program For An Include

REPORT ztest.

*---internal table declaration
data: begin of itab occurs 0,
mainprogram type char40,
end of itab .
*-----data declaration
data: NUMBER_OF_MAINPROGRAMS type char3.

*---selection screen data
parameters:p_includ type char40.

*---start of selection

start-of-selection.

CALL FUNCTION 'RS_GET_MAINPROGRAMS'
EXPORTING
name = p_includ
IMPORTING
NUMBER_OF_MAINPROGRAMS = NUMBER_OF_MAINPROGRAMS
TABLES
mainprograms = itab
EXCEPTIONS
CANCELLED = 1.

*----display result
write:/ 'number of main programs is:' , NUMBER_OF_MAINPROGRAMS.
loop at itab.
write:/ 'the main program for this include is:' , itab-mainprogram.
endloop.

the selection screen output is like this:



and the output is like this :


Multiple Screens In Dock Container

REPORT yztest .

TYPE-POOLS: slis.

* Tables
TABLES: mara.

TYPES: BEGIN OF ty_name,
name TYPE char10,
age TYPE i,
END OF ty_name.

TYPES: BEGIN OF ty_marks,
sub1 TYPE i,
sub2 TYPE i,
total TYPE i,
END OF ty_marks.

TYPES: BEGIN OF ty_phone,
phnum TYPE char10,
END OF ty_phone.

TYPES: BEGIN OF ty_addr,
address TYPE char20,
END OF ty_addr .

* Output internal table
DATA: itab TYPE TABLE OF ty_name,
wa TYPE ty_name,
itab1 TYPE TABLE OF ty_marks,
wa1 TYPE ty_marks,
itab2 TYPE TABLE OF ty_phone,
wa2 TYPE ty_phone,
itab3 TYPE TABLE OF ty_addr,
wa3 TYPE ty_addr.

* ALV Grid
DATA: r_grid TYPE REF TO cl_gui_alv_grid,
r_grid1 TYPE REF TO cl_gui_alv_grid,
r_grid2 TYPE REF TO cl_gui_alv_grid,
r_grid3 TYPE REF TO cl_gui_alv_grid,
g_dock TYPE REF TO cl_gui_docking_container,
g_dock1 TYPE REF TO cl_gui_docking_container,
g_dock2 TYPE REF TO cl_gui_docking_container,
g_dock3 TYPE REF TO cl_gui_docking_container,
g_dock4 TYPE REF TO cl_gui_docking_container,
it_fieldcat TYPE lvc_t_fcat,
it_fieldcat1 TYPE lvc_t_fcat,
it_fieldcat2 TYPE lvc_t_fcat,
it_fieldcat3 TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.

DATA picture TYPE REF TO cl_gui_picture.

DATA url(255).
CLEAR url.
DATA init.

START-OF-SELECTION.

wa-name = 'test01'.
wa-age = '1'.
APPEND wa TO itab.

wa-name = 'test02'.
wa-age = '2'.
APPEND wa TO itab.

wa-name = 'test03'.
wa-age = '3'.
APPEND wa TO itab.

wa1-sub1 = '11'.
wa1-sub2 = '22'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.

wa1-sub1 = '22'.
wa1-sub2 = '33'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.

wa2-phnum = '99999999999'.
APPEND wa2 TO itab2.

wa2-phnum = '888888888888'.
APPEND wa2 TO itab2.

wa2-phnum = '777777777777'.
APPEND wa2 TO itab2.

wa3-address = 'HItech City'.
APPEND wa3 TO itab3.

wa3-address = 'Secunderabad'.
APPEND wa3 TO itab3.

wa3-address = 'Hyderabad'.
APPEND wa3 TO itab3.

PERFORM display_image.

CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.

SET PF-STATUS 'LISTOUT1'.
SET TITLEBAR 'LIST1'.

wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-seltext = 'NAME OF THE STUDENT'.
wa_fieldcat-coltext = 'NAME OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-seltext = 'AGE OF THE STUDENT'.
wa_fieldcat-coltext = 'AGE OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-fieldname = 'SUB1'.
wa_fieldcat-seltext = 'SUBJECT1'.
wa_fieldcat-coltext = 'SUBJECT1'.
APPEND wa_fieldcat TO it_fieldcat1.

wa_fieldcat-fieldname = 'SUB2'.
wa_fieldcat-seltext = 'SUBJECT2'.
wa_fieldcat-coltext = 'SUBJECT2'.
APPEND wa_fieldcat TO it_fieldcat1.

wa_fieldcat-fieldname = 'TOTAL'.
wa_fieldcat-seltext = 'TOTAL'.
wa_fieldcat-coltext = 'TOTAL'.
APPEND wa_fieldcat TO it_fieldcat1.

wa_fieldcat-fieldname = 'PHNUM'.
wa_fieldcat-seltext = 'PHONE NO'.
wa_fieldcat-coltext = 'PHONE NO'.
APPEND wa_fieldcat TO it_fieldcat2.

wa_fieldcat-fieldname = 'ADDRESS'.
wa_fieldcat-seltext = 'ADDRESS'.
wa_fieldcat-coltext = 'ADDRESS'.
APPEND wa_fieldcat TO it_fieldcat3.


IF g_dock IS INITIAL.
CREATE OBJECT g_dock
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock->dock_at_left
extension = 300.

CREATE OBJECT r_grid
EXPORTING
i_parent = g_dock.

ENDIF.

IF g_dock1 IS INITIAL.
CREATE OBJECT g_dock1
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock1->dock_at_right
extension = 300.

CREATE OBJECT r_grid1
EXPORTING
i_parent = g_dock1.

ENDIF.

IF g_dock2 IS INITIAL.
CREATE OBJECT g_dock2
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock2->dock_at_top
extension = 100.

CREATE OBJECT r_grid2
EXPORTING
i_parent = g_dock2.

IF g_dock3 IS INITIAL.
CREATE OBJECT g_dock3
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock3->dock_at_top
extension = 100.

CREATE OBJECT r_grid3
EXPORTING
i_parent = g_dock3.

ENDIF.

IF NOT itab[] IS INITIAL.
CALL METHOD r_grid->set_table_for_first_display
CHANGING
it_outtab = itab
it_fieldcatalog = it_fieldcat.
ENDIF.

IF NOT itab1[] IS INITIAL.
CALL METHOD r_grid1->set_table_for_first_display
CHANGING
it_outtab = itab1
it_fieldcatalog = it_fieldcat1.
ENDIF.

IF NOT itab2[] IS INITIAL.
CALL METHOD r_grid2->set_table_for_first_display
CHANGING
it_outtab = itab2
it_fieldcatalog = it_fieldcat2.
ENDIF.

IF NOT itab3[] IS INITIAL.
CALL METHOD r_grid3->set_table_for_first_display
CHANGING
it_outtab = itab3
it_fieldcatalog = it_fieldcat3.
ENDIF.

if g_dock4 is initial.
CREATE OBJECT g_dock4
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock4->dock_at_bottom
extension = 100.

CREATE OBJECT picture
EXPORTING parent = g_dock4.

CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
init = 'X'.
endif.

ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form display_image
*----------------------------------------------------------------------*
FORM display_image .

DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE w3param-ret_code.
DATA content_type LIKE w3param-cont_type.
DATA content_length LIKE w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.

REFRESH query_table.
query_table-name = '_OBJECT_ID'.
query_table-value = 'ENJOYSAP_LOGO'.
APPEND query_table.

CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = query_table
html = html_table
mime = pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
object_not_found = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.

CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1.



ENDFORM. " display_image
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit INPUT.

CALL METHOD g_dock->free.
CALL METHOD g_dock1->free.
CALL METHOD g_dock2->free.
CALL METHOD g_dock3->free.

ENDMODULE. " EXIT INPUT

the output is like this :

HR ABAP - Display Texts For Personnel Subarea, Employee Group, Employee Subgroup, Cost Center & Organizational Unit.

REPORT yztexts no standard page heading
line-size 450. .

*----database tables used
TABLES: pa0001.

*---types for Personnel Subarea Text
TYPES: BEGIN OF ty_text,
btrtl TYPE t001p-btrtl,
btext TYPE t001p-btext,
END OF ty_text,
*---Employee group text
BEGIN OF ty_text1,
persg TYPE t501t-persg,
ptext TYPE t501t-ptext,
END OF ty_text1,
*---Employee subgroup text
BEGIN OF ty_text2,
persk TYPE t503t-persk,
ptext1 TYPE t503t-ptext,
END OF ty_text2,
*---Cost center text
BEGIN OF ty_text3,
kostl TYPE cskt-kostl,
ltext TYPE cskt-ltext,
END OF ty_text3,
*---Organizational unit short text
BEGIN OF ty_text4,
orgeh TYPE t527x-orgeh,
orgtx TYPE t527x-orgtx,
END OF ty_text4,

BEGIN OF ty_pa0001,
pernr LIKE pa0001-pernr,
begda LIKE pa0001-begda,
endda LIKE pa0001-endda,
bukrs LIKE pa0001-bukrs,
werks LIKE pa0001-werks,
persg LIKE pa0001-persg,
persk LIKE pa0001-persk,
btrtl LIKE pa0001-btrtl,
kostl LIKE pa0001-kostl,
kokrs LIKE pa0001-kokrs,
orgeh LIKE pa0001-orgeh,
END OF ty_pa0001.

*---internal tables
DATA: it_pa0001 TYPE TABLE OF ty_pa0001 WITH HEADER LINE,
it_text TYPE TABLE OF ty_text WITH HEADER LINE,
it_text1 TYPE TABLE OF ty_text1 WITH HEADER LINE,
it_text2 TYPE TABLE OF ty_text2 WITH HEADER LINE,
it_text3 TYPE TABLE OF ty_text3 WITH HEADER LINE,
it_text4 TYPE TABLE OF ty_text4 WITH HEADER LINE.

*--selection screen
SELECT-OPTIONS: s_pernr FOR pa0001-pernr.

*---start of selection
START-OF-SELECTION.

perform get_data.

SELECT pernr
begda
endda
bukrs
werks
persg
persk
btrtl
kostl
kokrs
orgeh
FROM pa0001
INTO TABLE it_pa0001
WHERE pernr IN s_pernr.

IF NOT it_pa0001[] IS INITIAL.
* Personnel Subarea Text
SELECT btrtl btext
FROM t001p
INTO TABLE it_text
FOR ALL ENTRIES IN it_pa0001
WHERE werks = it_pa0001-werks
AND btrtl = it_pa0001-btrtl.

* Employee group text
SELECT persg ptext
FROM t501t
INTO TABLE it_text1
FOR ALL ENTRIES IN it_pa0001
WHERE sprsl = sy-langu
AND persg = it_pa0001-persg.

* Employee subgroup text
SELECT persk ptext
FROM t503t
INTO TABLE it_text2
FOR ALL ENTRIES IN it_pa0001
WHERE sprsl = sy-langu
AND persk = it_pa0001-persk.

* Cost center text
SELECT kostl ltext
FROM cskt
INTO TABLE it_text3
FOR ALL ENTRIES IN it_pa0001
WHERE spras = sy-langu
AND kokrs = it_pa0001-kokrs
AND kostl = it_pa0001-kostl.

* Organizational unit short text
SELECT orgeh orgtx
INTO TABLE it_text4
FROM t527x
FOR ALL ENTRIES IN it_pa0001
where orgeh = it_pa0001-orgeh
AND SPRSL = sy-langu .
ENDIF.

format color 7.

write:/1 'personnel number',
30 'begin date',
60 'end date',
90 'company code',
120 'Employee Group',
150 'Employee Group text',
180 'Employee Subgroup',
210 'Employee Subgroup text',
240 'Personnel Subarea',
270 'Personnel Subarea text',
300 'cost center',
330 'cost center text',
360 'orgnization unit',
390 'organization unit text'.

format color off.

LOOP AT it_pa0001.

WRITE:/1 it_pa0001-pernr,
30 it_pa0001-begda,
60 it_pa0001-endda,
90 it_pa0001-bukrs,
120 it_pa0001-werks,
150 it_pa0001-persg.
READ TABLE it_text1 WITH KEY persg = it_pa0001-persg.
WRITE: 180 it_text1-ptext,
210 it_pa0001-persk.
READ TABLE it_text2 WITH KEY persk = it_pa0001-persk.
WRITE: 240 it_text2-ptext1.

READ TABLE it_text WITH KEY btrtl = it_pa0001-btrtl.
WRITE: 270 it_text-bte t,
300 it_pa0001-kostl.
READ TABLE it_text3 WITH KEY kostl = it_pa0001-kostl.
WRITE: 330 it_text3-ltext,
360 it_pa0001-orgeh.
READ TABLE it_text4 WITH KEY orgeh = it_pa0001-orgeh.
WRITE: 390 it_text4-orgtx.
ENDLOOP.

the selection screen is like this:...



and the output is like this :




ALSO READ:

- Minimum & Maximum Salaries For The Employees.

- Handling User Exits In HR ABAP.

- Termination Workbench Report In HR ABAP.

- Service Calculation Report In HR ABAP.

- Use Of BAPI HR_MAINTAIN_MASTERDATA For Updating HR DATA.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


Report Program To Display Inactive Programs Under The User

REPORT ztest.

*---database tables used
TABLES: dwinactiv .

*---types used
TYPES: BEGIN OF ty_tab.
INCLUDE STRUCTURE dwinactiv.
TYPES: END OF ty_tab.
*--internal tables used
DATA: itab TYPE TABLE OF ty_tab WITH HEADER LINE.

*---selection screen
SELECT-OPTIONS: s_uname FOR dwinactiv-uname.

*---start of selection
START-OF-SELECTION.

perform get_data.

END-OF-SELECTION.

perform display_data.

*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .

SELECT object
obj_name
uname
delet_flag
FROM dwinactiv
INTO TABLE itab
WHERE uname IN s_uname.

sort itab by uname.

endform. " get_data
*&---------------------------------------------------------------------*
*& Form display_data
*----------------------------------------------------------------------*
form display_data .

LOOP AT itab .
on change of itab-uname.
format color 7.
WRITE:/ itab-uname .
write:/ 'in active objects under user is :'.
format color off.
ENDon.
write:/1 itab-object,
35 itab-obj_name,
120 itab-delet_flag.
ENDLOOP.

endform. " display_data

the selection screen output is like this :



the output is like this:

Line Feed & Updates For Open Dataset

REPORT ztest.

*---data declarations
DATA: file_content TYPE string.

*---selection screen
PARAMETERS:p_file TYPE char100 DEFAULT 'F:\usr\sap\put\venkat.txt',
p_input TYPE char20,
p_char TYPE char30,
p_pos TYPE i.
*---get f4 help for the file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

PERFORM f4_file.

*---start of selection
START-OF-SELECTION.

PERFORM write_file.

PERFORM update_file.

PERFORM display_file.

*&---------------------------------------------------------------------*
*& Form write_file
*----------------------------------------------------------------------*
FORM write_file .

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT
with smart linefeed.

TRANSFER p_input TO p_file.
CLOSE DATASET p_file .

ENDFORM. " write_file
*&---------------------------------------------------------------------*
*& Form update_file
*----------------------------------------------------------------------*
FORM update_file .

OPEN DATASET p_file FOR UPDATE IN TEXT MODE
ENCODING DEFAULT
with smart linefeed
AT POSITION p_pos.
TRANSFER p_char TO p_file.
CLOSE DATASET p_file.

ENDFORM. " update_file
*&---------------------------------------------------------------------*
*& Form display_file
*----------------------------------------------------------------------*
FORM display_file .

OPEN DATASET p_file FOR INPUT IN TEXT MODE
ENCODING DEFAULT
with smart linefeed.
WHILE sy-subrc = 0.
READ DATASET p_file INTO file_content.
WRITE / file_content.
ENDWHILE.
CLOSE DATASET p_file.

ENDFORM. " display_file
*&---------------------------------------------------------------------*
*& Form f4_file
*----------------------------------------------------------------------*
FORM f4_file .

*-- if the file location is application server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = '/'
filemask = '*'
IMPORTING
serverfile = p_file
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

ENDFORM. " f4_file

the selection screen is like this:



and the output is like this:

HR ABAP - Obtain All The Sub Org Units Under An Organization Unit

report.

TABLES: hrp1000.

TYPES: BEGIN OF ty_orgunit,
objid TYPE objid,
begda TYPE begda,
endda TYPE endda,
END OF ty_orgunit.

DATA:it_orgunit TYPE STANDARD TABLE OF ty_orgunit WITH HEADER LINE.
DATA:root_org TYPE STANDARD TABLE OF hrwpc_s_hrobject WITH HEADER LINE.
DATA:t_objec TYPE STANDARD TABLE OF hrwpc_s_objec WITH HEADER LINE.
DATA:t_struc TYPE STANDARD TABLE OF hrwpc_s_struc WITH HEADER LINE.

SELECT-OPTIONS:s_objid FOR hrp1000-objid,
s_date FOR sy-datum .

START-OF-SELECTION.
*--For all the org.units entered in the selection.

LOOP AT s_objid.
CLEAR it_orgunit.
REFRESH it_orgunit.
root_org-objid = s_objid-low.
root_org-plvar = '01'.
root_org-otype = 'O'.

*--Get the sub org.unts for the given selection.
CALL FUNCTION 'HRWPC_RFC_STRUCTURE_GET'
EXPORTING
root = root_org
evpath = 'O-O_DOWN'
begda = s_date-low
endda = s_date-high
TABLES
t_objec = t_objec
t_struc = t_struc
EXCEPTIONS
nothing_found = 1
internal_error = 2
OTHERS = 3.

*--Prepare final sub org.units tabl.
LOOP AT t_objec WHERE objid NE s_objid-low.
WRITE:/ t_objec-objid .
ENDLOOP.
ENDLOOP.


ALSO READ:

- Display Texts For Personnel Subarea, Employee Group, Employee Subgroup, Cost Center & Organizational Unit.

- Minimum & Maximum Salaries For The Employees.

- Handling User Exits In HR ABAP.

- Termination Workbench Report In HR ABAP.

- Service Calculation Report In HR ABAP.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


HR ABAP - Get All The Existing Organization Units.

REPORT Ztest .

tables: hrp1000.

select-options:s_objid for hrp1000-objid,
s_date for sy-datum .

data: roots type HRROOTOB occurs 0 with header line.

types: begin of ty_orgunit,
objid type objid,
begda type begda,
endda type endda,
end of ty_orgunit.

data:it_orgunit type standard table of ty_orgunit with header line.
*--Check for Org.unit entered or not.

IF s_objid[] IS INITIAL.
*--If no org unit entered, get root orgs
CALL FUNCTION 'RH_STRUC_HELP_ROOTS_GET'
EXPORTING
SEARCH_PLVAR = '01'
SEARCH_OTYPE = 'O'
SEARCH_BEGDA = s_date-low
SEARCH_ENDDA = s_date-high
TABLES
ROOTS = roots.

IF SY-SUBRC = 0.
loop at roots.
s_objid-sign = 'I'.
s_objid-option = 'EQ'.
s_objid-low = roots-objid.
append s_objid.
endloop.
ENDIF.
endif.

start-of-selection.

SELECT objid
begda
endda
INTO table it_orgunit
FROM hrp1000
WHERE otype = 'O'
AND objid IN s_objid
AND plvar = '01'.

end-of-selection.

loop at it_orgunit.
write:/ it_orgunit-objid.
endloop.



ALSO READ:

- Obtain All The Sub Org Units Under An Organization Unit.

- Display Texts For Personnel Subarea, Employee Group, Employee Subgroup, Cost Center & Organizational Unit.

- Minimum & Maximum Salaries For The Employees.

- Handling User Exits In HR ABAP.

- Termination Workbench Report In HR ABAP.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


HR ABAP - First & Last Working Date Of An Employee.

REPORT ztest.

TABLES: pa0000.

PARAMETERS:p_pernr LIKE pa0000-pernr.

DATA: entrydate TYPE p0000-begda,
leavingdate TYPE p0000-begda.

DATA: BEGIN OF it_entry_dates OCCURS 0.
INCLUDE STRUCTURE hida.
DATA: END OF it_entry_dates.

START-OF-SELECTION.

CALL FUNCTION 'HR_ENTRY_DATE'
EXPORTING
persnr = p_pernr
begda = '18000101'
endda = '99991231'
IMPORTING
entrydate = entrydate
TABLES
entry_dates = it_entry_dates
EXCEPTIONS
entry_date_not_found = 1
pernr_not_assigned = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'HR_LEAVING_DATE'
EXPORTING
persnr = p_pernr
begda = '18000101'
endda = '99991231'
IMPORTING
leavingdate = leavingdate
exceptions
leaving_date_not_found = 1
pernr_not_assigned = 2
others = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

END-OF-SELECTION.

WRITE:/ 'entry date:', entrydate COLOR 6,
'leaving date:', leavingdate COLOR 5.


ALSO READ:

- Get All The Existing Organization Units.

- Obtain All The Sub Org Units Under An Organization Unit.

- Display Texts For Personnel Subarea, Employee Group, Employee Subgroup, Cost Center & Organizational Unit.

- Minimum & Maximum Salaries For The Employees.

- Handling User Exits In HR ABAP.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


HR ABAP - Display Details about Organization unit, Position or Job In HR ABAP.

REPORT YZTEST .

*---database tables used
tables: hrp1000.

*----types declaration
types: begin of ty_table,
PLVAR type hrp1000-plvar,
OTYPE type hrp1000-OTYPE,
OBJID type hrp1000-OBJID,
ISTAT type hrp1000-ISTAT,
LANGU type hrp1000-LANGU,
SEQNR type hrp1000-SEQNR,
STEXT type hrp1000-STEXT,
end of ty_table.
*---internal table declaration
data: it_table type table of ty_table with header line.

*---selection screen
select-options: s_objid for hrp1000-objid.

parameters:p_otype type hrp1000-otype.

* enter o for org unit
* s for position
* c for job

*--start of selection
start-of-selection.
*--get the data
perform get_data.
*---end of selection
end-of-selection.
*---display data
perform display_data.

*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .

SELECT PLVAR
OTYPE
OBJID
ISTAT
LANGU
SEQNR
STEXT
FROM HRP1000
INTO table it_table
WHERE PLVAR = '01'
AND OTYPE = p_otype
AND OBJID in s_objid
AND ISTAT = '1'
AND LANGU = sy-langu
AND SEQNR = '000'.

sort it_table by objid.
delete adjacent duplicates from it_table comparing objid.

endform. " get_data
*&---------------------------------------------------------------------*
*& Form display_data
*----------------------------------------------------------------------*
form display_data .

loop at it_table.
write:/ it_table-PLVAR,
it_table-OTYPE,
it_table-OBJID,
it_table-ISTAT,
it_table-LANGU,
it_table-SEQNR,
it_table-STEXT.
endloop.

endform. " display_data




HR ABAP - Ordering (Descending ) Org. Unit For An Organization.

REPORT YZTEST.

*--internal table declarations
DATA:result_struc TYPE TABLE OF struc WITH HEADER LINE.
*---selection screen declarations
PARAMETERS:p_objid TYPE objid.
*---start of selection
START-OF-SELECTION.

perform get_data.

perform header .

perform display_data.

*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .

CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'O'
act_objid = p_objid
act_wegid = 'O-O'
act_plvar = '01'
act_begda = sy-datum
act_endda = sy-datum
TABLES
result_struc = result_struc.


SORT result_struc BY level DESCENDING.

endform. " get_data
*&---------------------------------------------------------------------*
*& Form header
*----------------------------------------------------------------------*
form header .

FORMAT COLOR 7.
WRITE:/1 'Level',
20 'Object Type',
35 ' Object ID',
50 'Start Date',
65 'End Date'.
FORMAT COLOR OFF.

endform. " header
*&---------------------------------------------------------------------*
*& Form display_data
*----------------------------------------------------------------------*
form display_data .

LOOP AT result_struc .
IF sy-tabix = 1.
WRITE:/1 result_struc-level,
20 result_struc-otype,
35 result_struc-objid,
50 result_struc-sbegd,
65 result_struc-sendd.
ELSE.
EXIT.
ENDIF.
ENDLOOP.

endform. " display_data


ALSO READ:

- Display Details about Organization unit, Position or Job In HR ABAP.

- First & Last Working Date Of An Employee.

- Get All The Existing Organization Units.

- Obtain All The Sub Org Units Under An Organization Unit.

- Display Texts For Personnel Subarea, Employee Group, Employee Subgroup, Cost Center & Organizational Unit.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


HR ABAP - Finding Job Code For Position.

REPORT YZTEST.

*---data base tables used
tables: hrp1000.

*---types declaration
types: begin of ty_job,
plvar type hrp1000-plvar,
otype type hrp1000-otype,
objid type hrp1000-objid,
istat type hrp1000-istat,
langu type hrp1000-langu,
seqnr type hrp1000-seqnr,
short type hrp1000-short,
end of ty_job .

*---internal table declaration
data: it_job type standard table of ty_job with header line.

*---selection screen details
select-options:s_stell for hrp1000-objid.

*--start of selection
start-of-selection.

perform get_data.

*--- end of selection
end-of-selection.

perform display_result.
*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .

SELECT plvar otype objid istat
langu seqnr short
FROM hrp1000
INTO table it_job
WHERE plvar = '01'
AND otype = 'C'
AND objid in s_stell
AND istat = '1'
and BEGDA <= sy-datum and ENDDA >= sy-datum
AND langu = sy-langu
AND seqnr = '000' .

endform. " get_data
*&---------------------------------------------------------------------*
*& Form display_result
*----------------------------------------------------------------------*
form display_result .

loop at it_job.
write:/1 it_job-plvar,
20 it_job-otype ,
35 it_job-objid ,
40 it_job-istat ,
55 it_job-langu ,
70 it_job-seqnr ,
105 it_job-short .
endloop.

endform. " display_result


ALSO READ:

- Finding Job Code For Position.

- Ordering (Descending ) Org. Unit For An Organization.

- Display Details about Organization unit, Position or Job In HR ABAP.

- First & Last Working Date Of An Employee.

- Get All The Existing Organization Units.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


Program To Find Out Type Of A Program.

REPORT ztest.

TABLES: TRDIR.

TYPES: BEGIN OF ty_prog,
prog TYPE d010sinf-prog,
r3state TYPE d010sinf-r3state,
subc TYPE d010sinf-subc,
END OF ty_prog.

DATA: v_desc TYPE char40.

DATA: it_prog TYPE STANDARD TABLE OF ty_prog WITH HEADER LINE.

SELECT-OPTIONS: s_prog FOR TRDIR-NAME .

START-OF-SELECTION.
SELECT prog
r3state
subc
FROM d010sinf
INTO TABLE it_prog
WHERE prog in s_prog
AND r3state EQ 'A'.

IF sy-subrc EQ 0.
LOOP AT it_prog.
CASE: it_prog-subc .
WHEN '1'.
v_desc = 'Executable program'.
WHEN 'I'.
v_desc = 'INCLUDE program'.
WHEN 'M'.
v_desc = 'Module pool'.
WHEN 'F'.
v_desc = 'Function group'.
WHEN 'S'.
v_desc = 'Subroutine pool'.
WHEN 'J'.
v_desc = 'Interface pool'.
WHEN 'K'.
v_desc = 'Class pool'.
ENDCASE.

write:/ it_prog-prog,
v_desc.
clear: v_desc.
ENDLOOP.
ENDIF.

Creating A Dynamic Table & Dynamic Fields

report ztest.

data: begin of itab occurs 2,
field1 type dd03l-fieldname,
field2 type dd03l-fieldname,
field3 type dd03l-fieldname,
end of itab.

field-symbols: type table,
LIKE LINE OF ITAB,
TYPE ANY.

parameters: p_tab type dd02l-tabname,
field1 type dd03l-fieldname,
field2 type dd03l-fieldname,
field3 type dd03l-fieldname.


data: value(20),
field type char100.

value = 'ITAB[]'.
assign (value) to .

concatenate field1 field2 field3 into field separated by space.

select (field)
from (p_tab)
into table
up to 10 rows.

if is assigned .

loop at assigning .
write:/ .
endloop.
endif.

Finding Performs In A Program

REPORT ztest.

data: form_routines type STOKEN occurs 0 with header line.

parameters:p_prog type sy-repid.

start-of-selection.

CALL FUNCTION 'SWF_FORMS_OF_PROGRAM_GET'
EXPORTING
program = p_prog
TABLES
form_routines = form_routines
EXCEPTIONS
PROGRAM_NOT_FOUND = 1
CONTAINS_NO_FORM_ROUTINES = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at form_routines.
write:/ 'perform name is:' , form_routines-str.
endloop.

ABAP - F4 (Value On Request) For Organization Unit In HR Report Program.

tables: hrp1000.

select-options: s_objid for hrp1000-objid.

data: it_objec like objec occurs 0 with header line.

at selection-screen on value-request for s_objid-low.

call function 'RH_OBJID_REQUEST'
exporting
plvar = '01'
* otype can be 'O' 'S' 'T' 'C' and so on
otype = 'S'
dynpro_repid = sy-repid
dynpro_dynnr = sy-dynnr
tables
sel_objects = it_objec
exceptions
cancelled = 1
wrong_condition = 2
nothing_found = 3
internal_error = 4
illegal_mode = 5
others = 6 .

if sy-subrc = 0.
read table it_objec index 1.
if sy-subrc = 0.
s_objid-low = it_objec-objid.
endif.
endif.


ALSO READ:

- Employee Pay Scale Report Program.

- Finding Job Code For Position.

- Ordering (Descending ) Org. Unit For An Organization.

- Display Details about Organization unit, Position or Job In HR ABAP.

- First & Last Working Date Of An Employee.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


HR ABAP - Employee Pay Scale Report Program.

REPORT ztest .

TABLES: hrp1000.

SELECT-OPTIONS:s_objid FOR hrp1000-objid,
s_date FOR sy-datum .

DATA: roots TYPE hrrootob OCCURS 0 WITH HEADER LINE.

TYPES: BEGIN OF ty_orgunit,
objid TYPE objid,
begda TYPE begda,
endda TYPE endda,
sobid TYPE sobid,
END OF ty_orgunit.

TYPES: BEGIN OF ty_0001,
pernr LIKE pa0001-pernr,
endda LIKE pa0001-endda,
begda LIKE pa0001-begda,
orgeh LIKE pa0001-orgeh,
ename LIKE pa0001-ename,
END OF ty_0001.
TYPES: BEGIN OF ty_pa0008,
pernr LIKE pa0008-pernr,
begda LIKE pa0008-begda,
endda LIKE pa0008-endda,
trfar LIKE pa0008-trfar,
trfgb LIKE pa0008-trfgb,
trfgr LIKE pa0008-trfgr,
END OF ty_pa0008.
TYPES: BEGIN OF ty_t510a,
trfar LIKE t510a-trfar,
tartx LIKE t510a-tartx,
END OF ty_t510a.

DATA:it_orgunit TYPE STANDARD TABLE OF ty_orgunit WITH HEADER LINE,
it_0001 TYPE STANDARD TABLE OF ty_0001 WITH HEADER LINE,
it_pa0001 TYPE STANDARD TABLE OF ty_0001 WITH HEADER LINE,
it_pa0008 TYPE STANDARD TABLE OF ty_pa0008 WITH HEADER LINE,
it_t510a TYPE STANDARD TABLE OF ty_t510a WITH HEADER LINE.


START-OF-SELECTION.

SELECT objid
begda
endda
sobid
INTO TABLE it_orgunit
FROM hrp1001
WHERE otype = 'O'
AND objid IN s_objid
AND plvar = '01'.

IF NOT it_orgunit[] IS INITIAL.

LOOP AT it_orgunit .
DATA: v_orgeh TYPE objid.

v_orgeh = it_orgunit-sobid.

SELECT SINGLE pernr
endda
begda
orgeh
ename
FROM pa0001
INTO it_0001
WHERE orgeh = v_orgeh
AND endda >= s_date-low
AND begda <= s_date-high. MOVE it_0001 TO it_pa0001. APPEND it_pa0001. CLEAR it_pa0001.
ENDLOOP.
ENDIF.

DELETE ADJACENT DUPLICATES FROM it_pa0001 COMPARING pernr.

IF NOT it_pa0001[] IS INITIAL.
SELECT pernr
endda
begda
trfar
trfgb
trfgr
FROM pa0008
INTO TABLE it_pa0008
FOR ALL ENTRIES IN it_pa0001
WHERE pernr = it_pa0001-pernr
AND endda GE s_date-low
AND begda LE s_date-high.
*---this is for the text of pay scale area
* IF NOT it_pa0008[] IS INITIAL.
* select TRFAR
* TARTX
* from T510A
* into table it_T510A
* for all entries in it_pa0008
* where trfar = it_pa0008-trfar.
*
* ENDIF.
ENDIF.

WRITE:/1 'Personnel NO',
18 'Start Date',
30 'End Date',
44 'Org Unit',
56 'Emp Name',
80 'Pay scale type',
95 'Pay Scale Area',
115 'Pay Scale Group'.

LOOP AT it_pa0001.
WRITE:/1 it_pa0001-pernr,
18 it_pa0001-begda,
30 it_pa0001-endda,
44 it_pa0001-orgeh,
56 it_pa0001-ename.
READ TABLE it_pa0008 WITH KEY pernr = it_pa0001-pernr.
WRITE: 85 it_pa0008-trfar,
100 it_pa0008-trfgb,
120 it_pa0008-trfgr.
ENDLOOP.



ALSO READ:

- Employee Pay Scale Report Program.

- Finding Job Code For Position.

- Ordering (Descending ) Org. Unit For An Organization.

- Display Details about Organization unit, Position or Job In HR ABAP.

- First & Last Working Date Of An Employee.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


Finding Out Duplicate Invoice - ABAP.

REPORT ztest .

TYPES: BEGIN OF ty_bsip,
bukrs LIKE bsip-bukrs,
belnr LIKE bsip-belnr,
gjahr LIKE bsip-gjahr,
END OF ty_bsip.

PARAMETERS: p_bukrs LIKE bsip-bukrs,
p_lifnr LIKE bsip-lifnr,
p_waers LIKE bsip-waers,
p_xblnr LIKE bsip-xblnr,
p_wrbtr LIKE bsip-wrbtr,
p_bldat LIKE bsip-bldat.

DATA: it_bsip TYPE STANDARD TABLE OF ty_bsip WITH HEADER LINE.

TRANSLATE p_xblnr TO UPPER CASE.

IF p_wrbtr LT 0 OR
p_wrbtr GE 0.

SELECT bukrs belnr gjahr FROM bsip
INTO TABLE it_bsip
UP TO 1 ROWS
WHERE bukrs = p_bukrs
AND lifnr = p_lifnr
AND waers = p_waers
AND xblnr = p_xblnr
AND wrbtr = p_wrbtr
AND bldat = p_bldat.

IF sy-subrc EQ 0.
WRITE:/ 'duplicateinvoicefound'.
ENDIF.
ENDIF.

Displaying Time On A Popup Window.

REPORT ztest .

data: help_info type help_info,
SELECT_VALUE type HELP_INFO-FLDVALUE,
DYNPSELECT type DSELC occurs 0 with header line,
DYNPVALUETAB type DVAL occurs 0 with header line.

initialization.

HELP_INFO-CALL = 'V'.
HELP_INFO-OBJECT = 'F'.
HELP_INFO-PROGRAM = sy-repid.
HELP_INFO-DYNPRO = sy-dynnr.
HELP_INFO-TABNAME = 'BTCH3071'.
HELP_INFO-FIELDNAME = 'FROM_TIME'.
HELP_INFO-FIELDTYPE = 'TIME'.
HELP_INFO-FIELDLNG = '08'.
HELP_INFO-SPRAS = 'E'.
HELP_INFO-MENUFUNCT = 'HC'.

start-of-selection .

CALL FUNCTION 'DD_SHLP_CALL_FROM_DYNP'
EXPORTING
help_infos = help_info
IMPORTING
SELECT_VALUE = SELECT_VALUE
TABLES
dynpselect = dynpselect
dynpvaluetab = dynpvaluetab
.

write:/ 'the selected value is:' , SELECT_VALUE.

Export And Import Data From Memory.

REPORT ztest.


start-of-selection.

perform export_data .

perform import_data.

*&---------------------------------------------------------------------*
*& Form export_data
*----------------------------------------------------------------------*
form export_data .

data: l_char type char10,
l_num type i.

l_num = 110.
l_char = 'test'.

export l_char l_num to memory id 'TEST'.

endform. " export_data
*&---------------------------------------------------------------------*
*& Form import_data
*----------------------------------------------------------------------*
form import_data .

data: l_char type char10,
l_num type i.

import l_char l_num from memory id 'TEST'.

write:/ l_char, l_num.

endform. " import_data