Infotypes Enhacements-1
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.
MODULE get_discipline INPUT.
TYPES:
BEGIN OF ty_grade,
grade TYPE zhrgrade,
grade_txt TYPE zhrgrd_txt,
END OF ty_grade.
DATA:
lt_discp TYPE TABLE OF zhr_discipline,
lwa_discp TYPE zhr_discipline,
lwa_grade TYPE ty_grade ,
lt_grade TYPE TABLE OF ty_grade,
lwa_retvl TYPE ddshretval,
lt_retvl TYPE TABLE OF ddshretval.
DATA:
lv_field TYPE string.
**Get F4 help for Discipline
CLEAR: lt_discp,lt_retvl,lt_fields,lt_grade.
GET CURSOR FIELD lv_field.
CASE lv_field.
WHEN 'P0001-ZZ_DISP'.
SELECT * FROM zhr_discipline INTO TABLE lt_discp WHERE spras EQ sy-langu.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CODE'
value_org = 'S'
dynprofield = 'P0001-ZZ_DISP'
TABLES
value_tab = lt_discp
return_tab = lt_retvl
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
READ TABLE lt_retvl INTO lwa_retvl INDEX 1.
p0001-zz_disp = lwa_retvl-fieldval.
READ TABLE lt_discp INTO lwa_discp WITH KEY code = lwa_retval-fieldval.
ls_fields-fieldname = 'GV_DISCP'."ZHRDESIGNATION-DETXT'.
ls_fields-fieldvalue = lwa_discp-dis_txt.
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.
WHEN 'P0001-ZZ_GRADE'.
lwa_grade-grade = text-003.
lwa_grade-grade_txt = text-007.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
lwa_grade-grade = text-004.
lwa_grade-grade_txt = text-008.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
lwa_grade-grade = text-005.
lwa_grade-grade_txt = text-009.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
lwa_grade-grade = text-006.
lwa_grade-grade_txt = text-010.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'GRADE'
value_org = 'S'
dynprofield = 'P0001-ZZGRADE'
TABLES
value_tab = lt_grade
return_tab = lt_retvl
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
READ TABLE lt_retvl INTO lwa_retvl INDEX 1.
p0001-zz_grade = lwa_retvl-fieldval.
ls_fields-fieldname = 'P0001-ZZ_GRADE'.
ls_fields-fieldvalue = p0001-zz_grade.
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.
ENDCASE.
ENDMODULE. " GET_DISCIPLINE INPUT
MODULE get_discipline INPUT.
TYPES:
BEGIN OF ty_grade,
grade TYPE zhrgrade,
grade_txt TYPE zhrgrd_txt,
END OF ty_grade.
DATA:
lt_discp TYPE TABLE OF zhr_discipline,
lwa_discp TYPE zhr_discipline,
lwa_grade TYPE ty_grade ,
lt_grade TYPE TABLE OF ty_grade,
lwa_retvl TYPE ddshretval,
lt_retvl TYPE TABLE OF ddshretval.
DATA:
lv_field TYPE string.
**Get F4 help for Discipline
CLEAR: lt_discp,lt_retvl,lt_fields,lt_grade.
GET CURSOR FIELD lv_field.
CASE lv_field.
WHEN 'P0001-ZZ_DISP'.
SELECT * FROM zhr_discipline INTO TABLE lt_discp WHERE spras EQ sy-langu.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CODE'
value_org = 'S'
dynprofield = 'P0001-ZZ_DISP'
TABLES
value_tab = lt_discp
return_tab = lt_retvl
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
READ TABLE lt_retvl INTO lwa_retvl INDEX 1.
p0001-zz_disp = lwa_retvl-fieldval.
READ TABLE lt_discp INTO lwa_discp WITH KEY code = lwa_retval-fieldval.
ls_fields-fieldname = 'GV_DISCP'."ZHRDESIGNATION-DETXT'.
ls_fields-fieldvalue = lwa_discp-dis_txt.
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.
WHEN 'P0001-ZZ_GRADE'.
lwa_grade-grade = text-003.
lwa_grade-grade_txt = text-007.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
lwa_grade-grade = text-004.
lwa_grade-grade_txt = text-008.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
lwa_grade-grade = text-005.
lwa_grade-grade_txt = text-009.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
lwa_grade-grade = text-006.
lwa_grade-grade_txt = text-010.
APPEND lwa_grade TO lt_grade.
CLEAR lwa_grade.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'GRADE'
value_org = 'S'
dynprofield = 'P0001-ZZGRADE'
TABLES
value_tab = lt_grade
return_tab = lt_retvl
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
READ TABLE lt_retvl INTO lwa_retvl INDEX 1.
p0001-zz_grade = lwa_retvl-fieldval.
ls_fields-fieldname = 'P0001-ZZ_GRADE'.
ls_fields-fieldvalue = p0001-zz_grade.
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.
ENDCASE.
ENDMODULE.
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
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
No comments:
Post a Comment