Saturday, 4 May 2019
Saturday, 14 April 2012
Hiding fields in an Infotype
It is sometimes required to customize the screen fields in the HR Infotypes. This can be done using
the view V_T588M.
1. If we see in PA30, the standard screen for 0023 (Other/Previous Employers) is:
2. Let us hide the field “Work Contract” & “Job” from the standard Infotype screen.
Go to SM30 & enter view name as “V_T588M”. Click on “Maintain”.
3. Enter the module pool program & click Ok. In our case it is MP002300.
4. Now click on ‘New Entries’ button.
5. Now enter the “Module Pool” (mandatory) “Standard screen” (mandatory).Press “Enter”.
6. After we press “Enter”, all the screen fields of the Infotype are shown along with their attributes.
7. Now, we can change the attributes according to our requirements by selecting the desired radio button. After that press Save.
8. Then Go to PA30 and check the changes done to the standard Infotype (here Infotype 0023). The fields we chose to hide gets hidden.
the view V_T588M.
1. If we see in PA30, the standard screen for 0023 (Other/Previous Employers) is:
7. Now, we can change the attributes according to our requirements by selecting the desired radio button. After that press Save.
Thursday, 12 April 2012
Get Employees List
HR ABAP - Get Employees List Working Under An Organization Unit.
report ztests.
parameters:p_objid type orgeh .
data: pernr_table type HRPERNR occurs 0 with header line .
CALL FUNCTION 'HRCM_ORGSTRC_EMPLOYEE_LIST_GET'
EXPORTING
plvar = '01'
root_otype = 'O'
root_objid = p_objid
begda = '18000101'
endda = '99991231'
TABLES
pernr_table = pernr_table
EXCEPTIONS
NO_ORGSTRUC_FOUND = 1
NO_EMPLOYEES_FOUND = 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 pernr_table.
write:/ pernr_table-PERNR.
endloop.
Tuesday, 10 April 2012
OOPS-5
REPORT ZO_CLASS5.
*----------------------------------------------------------------------*
* CLASS CLASS1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CLASS1 DEFINITION.
PUBLIC SECTION.
DATA: INSTDATA(25) TYPE C VALUE 'Instance Variable'.
METHODS: INSTMET.
CLASS-DATA: STATDATA(25) TYPE C VALUE 'Static Variable'.
CLASS-METHODS: STATMET.
ENDCLASS. "CLASS1 DEFINITION
*----------------------------------------------------------------------*
* CLASS CLASS1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CLASS1 IMPLEMENTATION.
METHOD INSTMET.
WRITE:/ STATDATA, INSTDATA.
ENDMETHOD. "INSTMET
METHOD STATMET.
WRITE:/ STATDATA.
ENDMETHOD. "STATMET
ENDCLASS. "CLASS1 IMPLEMENTATION
START-OF-SELECTION.
DATA: OREF TYPE REF TO CLASS1.
CREATE OBJECT OREF.
CALL METHOD CLASS1=>STATMET.
CALL METHOD OREF->INSTMET.
*----------------------------------------------------------------------*
* CLASS CLASS1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CLASS1 DEFINITION.
PUBLIC SECTION.
DATA: INSTDATA(25) TYPE C VALUE 'Instance Variable'.
METHODS: INSTMET.
CLASS-DATA: STATDATA(25) TYPE C VALUE 'Static Variable'.
CLASS-METHODS: STATMET.
ENDCLASS. "CLASS1 DEFINITION
*----------------------------------------------------------------------*
* CLASS CLASS1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CLASS1 IMPLEMENTATION.
METHOD INSTMET.
WRITE:/ STATDATA, INSTDATA.
ENDMETHOD. "INSTMET
METHOD STATMET.
WRITE:/ STATDATA.
ENDMETHOD. "STATMET
ENDCLASS. "CLASS1 IMPLEMENTATION
START-OF-SELECTION.
DATA: OREF TYPE REF TO CLASS1.
CREATE OBJECT OREF.
CALL METHOD CLASS1=>STATMET.
CALL METHOD OREF->INSTMET.
Labels:
OOPS
OOPS-4
METHOD GET_MATERIAL.
DATA: G_MATNR TYPE MARA-MATNR.
SELECT SINGLE MATNR FROM MARA
INTO G_MATNR
WHERE MATNR = P_MATNR.
IF SY-SUBRC = 0.
SELECT MATNR
ERNAM
MATKL FROM MARA
INTO TABLE IT_MARA
WHERE MATNR = P_MATNR.
ELSE.
RAISE MATERIAL_NOTFOUND.
ENDIF.
ENDMETHOD.
REPORT ZO_CLASS4.
PARAMETERS: P_MATNR TYPE MARA-MATNR.
TYPES: BEGIN OF T_MARA,
MATNR LIKE MARA-MATNR,
ERNAM LIKE MARA-ERNAM,
MATKL LIKE MARA-MATKL,
END OF T_MARA.
DATA: IT_MARA TYPE STANDARD TABLE OF T_MARA,
WA_MARA LIKE LINE OF IT_MARA.
START-OF-SELECTION.
DATA: OREF TYPE REF TO ZO_CLASS5.
CREATE OBJECT OREF.
CALL METHOD OREF->GET_MATERIAL
EXPORTING
P_MATNR = P_MATNR
IMPORTING
IT_MARA = IT_MARA
EXCEPTIONS
MATERIAL_NOTFOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID 'ZACLASS' TYPE 'I' NUMBER '000'
WITH P_MATNR.
ELSE.
LOOP AT IT_MARA INTO WA_MARA.
WRITE:/ WA_MARA-MATNR, WA_MARA-ERNAM, WA_MARA-MATKL.
ENDLOOP.
ENDIF.
PARAMETERS: P_MATNR TYPE MARA-MATNR.
TYPES: BEGIN OF T_MARA,
MATNR LIKE MARA-MATNR,
ERNAM LIKE MARA-ERNAM,
MATKL LIKE MARA-MATKL,
END OF T_MARA.
DATA: IT_MARA TYPE STANDARD TABLE OF T_MARA,
WA_MARA LIKE LINE OF IT_MARA.
START-OF-SELECTION.
DATA: OREF TYPE REF TO ZO_CLASS5.
CREATE OBJECT OREF.
CALL METHOD OREF->GET_MATERIAL
EXPORTING
P_MATNR = P_MATNR
IMPORTING
IT_MARA = IT_MARA
EXCEPTIONS
MATERIAL_NOTFOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID 'ZACLASS' TYPE 'I' NUMBER '000'
WITH P_MATNR.
ELSE.
LOOP AT IT_MARA INTO WA_MARA.
WRITE:/ WA_MARA-MATNR, WA_MARA-ERNAM, WA_MARA-MATKL.
ENDLOOP.
ENDIF.
Labels:
OOPS
Subscribe to:
Posts (Atom)