Enhancement of IT0001
*----------------------------------------------------------------------*
* INCLUDE ZP000120 *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module MOD_PBO OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE module_pbo_0001 OUTPUT.
TABLES:zhrdesignation.
DATA:
lwa_desig TYPE zhrdesignation,
lwa_disp TYPE zhr_discipline,
lt_desig TYPE TABLE OF zhrdesignation.
DATA:
gv_txt TYPE zhrdetxt,
gv_discp TYPE zhr_distxt.
IF p0001-zzdesig IS NOT INITIAL.
SELECT SINGLE * FROM zhrdesignation INTO lwa_desig
WHERE spras EQ sy-langu
AND desig = p0001-zzdesig.
IF gv_txt IS INITIAL.
gv_txt = lwa_desig-detxt.
ENDIF.
IF sy-subrc NE 0.
MESSAGE i000(zhr) WITH p0001-zzdesig.
CLEAR : p0001-zzdesig, zhrdesignation-detxt.
ENDIF.
ENDIF.
IF p0001-zz_disp IS NOT INITIAL.
SELECT SINGLE * FROM zhr_discipline INTO lwa_disp WHERE code EQ p0001-zz_disp.
IF gv_discp IS INITIAL.
gv_discp = lwa_disp-dis_txt.
ENDIF.
IF sy-subrc NE 0.
MESSAGE i028(zhr) WITH p0001-zz_disp.
ENDIF.
ENDIF.
* SELECT SINGLE detxt FROM zhrdesignation INTO gv_txt WHERE spras EQ sy-langu AND
* desig EQ p0001-zzdesig.
ENDMODULE. " MOD_PBO OUTPUT
*----------------------------------------------------------------------*
* MODULE f_getdesignations
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE f_getdesignations.
** DATA lt_desig TYPE TABLE OF zhrdesignation.
DATA:
lt_retval TYPE TABLE OF ddshretval,
lwa_retval TYPE ddshretval.
* FIELD-SYMBOLS <fs_retval> TYPE ddshretval.
* FIELD-SYMBOLS <fs_field> TYPE any.
* DATA loc_field1 TYPE string.
* DATA loc_field2 TYPE string.
DATA: lt_fields TYPE TABLE OF dynpread,
ls_fields LIKE LINE OF lt_fields.
**
CLEAR: lt_desig, lt_retval.
**
*--To get the Designation details.
SELECT * FROM zhrdesignation INTO TABLE lt_desig.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'DESIG'
value_org = 'S'
* DYNPPROG = SY-REPID
* DYNPNR = SY-DYNNR
dynprofield = 'P0001-ZZDESIG'
TABLES
value_tab = lt_desig
* field_tab = field_tab
return_tab = lt_retval
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
* IF sy-subrc = 0.
* READ TABLE lt_retval ASSIGNING <fs_retval> INDEX 1.
* IF sy-subrc = 0.
* SPLIT <fs_retval>-retfield AT '-' INTO loc_field1 loc_field2.
* ASSIGN COMPONENT loc_field2 OF STRUCTURE p0001 TO <fs_field>.
* <fs_field> = <fs_retval>-fieldval.
* CLEAR: loc_field1, loc_field2.
* UNASSIGN <fs_field>.
* ENDIF.
* ENDIF.
IF sy-subrc EQ 0.
READ TABLE lt_retval INTO lwa_retval INDEX 1.
p0001-zzdesig = lwa_retval-fieldval.
ENDIF.
READ TABLE lt_desig INTO zhrdesignation WITH KEY desig = p0001-zzdesig ."<fs_retval>-fieldval.
IF sy-subrc = 0.
***--Setting the Dynpro value back.
CLEAR: ls_fields, lt_fields.
**
ls_fields-fieldname = 'P0001-ZZ_CATCODE'.
ls_fields-fieldvalue = zhrdesignation-cat_code.
APPEND ls_fields TO lt_fields.
CLEAR: ls_fields.
ls_fields-fieldname = 'P0001-ZZ_SCALE'.
ls_fields-fieldvalue = zhrdesignation-scale.
APPEND ls_fields TO lt_fields.
CLEAR: ls_fields.
ls_fields-fieldname = 'P0001-ZZ_GRADE'.
ls_fields-fieldvalue = zhrdesignation-grade.
APPEND ls_fields TO lt_fields.
CLEAR: ls_fields.
**
ls_fields-fieldname = 'GV_TXT'."ZHRDESIGNATION-DETXT'.
ls_fields-fieldvalue = zhrdesignation-detxt.
APPEND ls_fields TO lt_fields.
CLEAR: ls_fields.
**
**** ls_fields-fieldname = 'ZHRDESIGNATION-SHTXT'.
**** ls_fields-fieldvalue = zhrdesignation-shtxt.
**** APPEND ls_fields TO lt_fields.
**** CLEAR: ls_fields.
**
IF lt_fields IS NOT INITIAL.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = lt_fields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDIF.
** ENDIF.
** ENDIF.
ENDMODULE. "f_getdesignations
No comments:
Post a Comment