BAPI_PO_GETRELINFO: For Purchase Orders;
BAPI_REQUISITION_GETRELINFO: For Purchase Requisitions;
BAPI_ENTRYSHEET_GETRELINFO: For Service Entry Sheet;
Executing for the PO above:
*&---------------------------------------------------------------------*
*& Report ZPOWF_HISTORY
*& For Linkedin 🙂 by José Sequeira http://bit.ly/2PbRleX
*&---------------------------------------------------------------------*
report zpowf_history.
include <icon>.
*--------------------------------------------------------------------*
"Declaring...
*--------------------------------------------------------------------*
types: begin of ty_out,
relcode type frgco,
descript type frgct,
icon type icon_d,
end of ty_out.
data: gr_table type ref to cl_salv_table.
data: lr_columns type ref to cl_salv_columns_table,
lr_column type ref to cl_salv_column_table.
data: lt_final type table of bapirlcopo,
lt_out type table of ty_out,
ls_out type ty_out,
ls_posted type bapirlcopo,
ls_final type bapirlcopo.
"Selecting PO
*--------------------------------------------------------------------*
parameters: p_ebeln type ebeln.
*--------------------------------------------------------------------*
start-of-selection.
"Getting stuff ready...(You could do the same for PR and Entry Sheet, searching with BAPI_*_GETRELINFO...
call function 'BAPI_PO_GETRELINFO'
exporting
purchaseorder = p_ebeln
* PO_REL_CODE = "You could also just check one Rel Code, not the complete PO
importing
release_already_posted = ls_posted
tables
release_final = lt_final.
if lt_final[] is initial.
message 'PO not found...' type 'S' display like 'E'.
else.
*--------------------------------------------------------------------*
"Preparing data... You could automate the check below in some many
" ways, just doing like that for DEMO purposes...
*--------------------------------------------------------------------*
read table lt_final into ls_final index 1.
if ls_final-rel_code1 is not initial.
ls_out-relcode = ls_final-rel_code1.
ls_out-descript = ls_final-rel_cd_tx1.
if ls_posted-rel_code1 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
if ls_final-rel_code2 is not initial.
ls_out-relcode = ls_final-rel_code2.
ls_out-descript = ls_final-rel_cd_tx2.
if ls_posted-rel_code2 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
if ls_final-rel_code3 is not initial.
ls_out-relcode = ls_final-rel_code3.
ls_out-descript = ls_final-rel_cd_tx3.
if ls_posted-rel_code3 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
if ls_final-rel_code4 is not initial.
ls_out-relcode = ls_final-rel_code4.
ls_out-descript = ls_final-rel_cd_tx4.
if ls_posted-rel_code4 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
if ls_final-rel_code5 is not initial.
ls_out-relcode = ls_final-rel_code5.
ls_out-descript = ls_final-rel_cd_tx5.
if ls_posted-rel_code5 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
if ls_final-rel_code6 is not initial.
ls_out-relcode = ls_final-rel_code6.
ls_out-descript = ls_final-rel_cd_tx6.
if ls_posted-rel_code6 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
if ls_final-rel_code7 is not initial.
ls_out-relcode = ls_final-rel_code7.
ls_out-descript = ls_final-rel_cd_tx7.
if ls_posted-rel_code7 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
if ls_final-rel_code8 is not initial.
ls_out-relcode = ls_final-rel_code8.
ls_out-descript = ls_final-rel_cd_tx8.
if ls_posted-rel_code8 is not initial.
ls_out-icon = icon_okay.
else.
ls_out-icon = icon_warning.
endif.
append ls_out to lt_out.
endif.
*--------------------------------------------------------------------*
"Showing simple ALV...
cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = lt_out ).
lr_columns = gr_table->get_columns( ).
lr_columns->set_optimize( 'X' ).
lr_column ?= lr_columns->get_column( 'ICON' ).
lr_column->set_icon( if_salv_c_bool_sap=>true ).
lr_column->set_long_text( 'ICON' ).
gr_table->display( ).
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
14 | |
10 | |
7 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 |