SAPt Item Upload Programme
SAPt Item Upload Programme
*********************************************************************
*Title : ZALM_MAINT_ITEM_UPLOAD_PROGRAM
*Developer : SHAFIUVLLAH M
*Date : 01.08.2007
*FS : P1143_FS_ESP_ALM_Single Cycle Plan_01
*TS : P1143_TS_ESP_ALM_Single Cycle Plan_01
*Description : BDC for creation of Maintenance item through Tcode : IP04
*
*Change history:
*********************************************************************
************************************************************************
* INCLUDES
************************************************************************
include <icon>.
************************************************************************
* DATA DECLARATIONS
************************************************************************
types: begin of x_itab ,
mptyp type rmipm-mptyp,
wstra type rmipm-wstra,
pstxt type rmipm-pstxt,
tplnr type riwo1-tplnr,
equnr type riwo1-equnr,
bautl type riwo1-bautl,
iwerk type rmipm-iwerk,
wpgrp type rmipm-wpgrp,
auart type rmipm-auart,
ilart type rmipm-ilart,
gewerk type rmipm-gewerk,
wergw type rmipm-wergw,
gsber type rmipm-gsber,
plnty type rmipm-plnty,
plnnr type rmipm-plnnr,
priok type rmipm-priok,
plnal type rmipm-plnal ,
end of x_itab.
types: begin of x_messages,
index type i,
msgtyp(1),
equnr(18),
tplnr(30),
message(120),
end of x_messages.
data : it_itab type standard table of x_itab ,
wa_itab type x_itab .
data x_ctuprms type ctu_params.
data it_bdcdata type standard table of bdcdata.
data : wa_bdcdata type bdcdata.
***********************************************************************
* START OF SELECTION
***********************************************************************
start-of-selection.
perform fill_it_itab.
perform execute_bdc.
*---------------------------------------------------------------------*
* FORM execute_bdc *
*---------------------------------------------------------------------*
* Sub-routine to create maintanince item.
*---------------------------------------------------------------------*
form execute_bdc.
data: w_bill(18).
perform fill_ctuprms.
loop at it_itab into wa_itab.
refresh it_bdcdata.
perform fill_bdcdata using :
'SAPLIWP3' '0200' 'X',
'BDC_OKCODE' c_var ' ',
'RMIPM-MPTYP' wa_itab-mptyp ' ',
'RMIPM-WSTRA' wa_itab-wstra ' ',
'SAPLIWP3' '0201' 'X',
'BDC_OKCODE' c_var ' ',
'RMIPM-PSTXT' wa_itab-pstxt '
'RMIPM-WSTRA' wa_itab-wstra '
'RIWO1-TPLNR' wa_itab-tplnr '
'RIWO1-EQUNR' wa_itab-equnr '
'RIWO1-BAUTL' wa_itab-bautl '
'RMIPM-IWERK' wa_itab-iwerk '
'RMIPM-WPGRP' wa_itab-wpgrp '
'RMIPM-AUART' wa_itab-auart '
'RMIPM-ILART' wa_itab-ilart '
'RMIPM-GEWERK' wa_itab-gewerk
'RMIPM-WERGW' wa_itab-wergw '
'RMIPM-GSBER' wa_itab-gsber '
'RMIPM-PLNTY' wa_itab-plnty '
'RMIPM-PLNNR' wa_itab-plnnr '
'RMIPM-PLNAL' wa_itab-plnal '
',
',
',
',
',
',
',
',
',
' ',
',
',
',
',
',
',
',
',
',
',
',
',
',
' ',
',
' ',
' ',
',
',
',
',
',
',
',
',
',
' ',
',
' ',
' ',
',
',
'.
perform write_messages.
endform.
"execute_bdc
*&---------------------------------------------------------------------*
*& Form FILL_BDCDATA
*&---------------------------------------------------------------------*
* SUB-ROUTINE TO FILL BCDDATA FOR EXECUTION OF BDC
*----------------------------------------------------------------------*
* -->P_0414 text *
* -->P_0415 text *
* -->P_0416 text *
*----------------------------------------------------------------------*
form fill_bdcdata using val1
val2
val3.
clear wa_bdcdata.
if val3 = 'X'.
move val1 to wa_bdcdata-program.
move val2 to wa_bdcdata-dynpro.
move val3 to wa_bdcdata-dynbegin.
else.
move val1 to wa_bdcdata-fnam.
move val2 to wa_bdcdata-fval.
endif.
append wa_bdcdata to it_bdcdata.
endform. " FILL_BDCDATA
*&---------------------------------------------------------------------*
*& Form FILL_it_itab
*&---------------------------------------------------------------------*
*SUB-ROUTINE TO FILL DATA FROM A SPECIFIED FILE TO it_itab INTERNAL TABLE
*----------------------------------------------------------------------*
form fill_it_itab.
refresh it_excel.
at end of row.
condense: wa_itab-mptyp , wa_itab-wstra,
wa_itab-pstxt , wa_itab-tplnr , wa_itab-equnr,
wa_itab-bautl , wa_itab-iwerk, wa_itab-wpgrp,
wa_itab-auart , wa_itab-ilart , wa_itab-gewerk,
wa_itab-wergw , wa_itab-gsber , wa_itab-plnty ,
wa_itab-plnnr , wa_itab-plnal , wa_itab-priok.
append wa_itab to it_itab.
clear wa_itab.
endat .
endloop.
endform. " FILL_it_itab
*&---------------------------------------------------------------------*
*& Form FILL_CTUPRMS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form fill_ctuprms.
clear x_ctuprms.
x_ctuprms-dismode = 'N'.
endform. " FILL_CTUPRMS
*&---------------------------------------------------------------------*
*& Form COLLECit_messages
*&---------------------------------------------------------------------*
* text
*-------------------------------------?--------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form collecit_messages.
data: w_msg(100).
loop at it_msgtab into wa_msgtab.
call function 'FORMAT_MESSAGE'
exporting
id
= wa_msgtab-msgid
lang = wa_msgtab-msgspra
no
= wa_msgtab-msgnr
v1
= wa_msgtab-msgv1
v2
= wa_msgtab-msgv2
importing
msg
= w_msg
exceptions
others = 0.
condense w_msg.
clear wa_messages.
wa_messages-index = w_index.
wa_messages-msgtyp = wa_msgtab-msgtyp.
wa_messages-message = w_msg.
wa_messages-equnr = wa_itab-equnr .
wa_messages-tplnr = wa_itab-tplnr.
append wa_messages to it_messages .
endloop.
w_index = w_index + 1.
refresh it_msgtab.
endform. " COLLECit_messages
*&---------------------------------------------------------------------*
*&
Form write_messages
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form write_messages .
loop at it_messages into wa_messages .
write:/1 sy-vline.
write : 2 wa_messages-index .
if wa_messages-msgtyp = 'S'.
write: 10 icon_green_light.
elseif wa_messages-msgtyp = 'E'.
write: 10 icon_red_light.
elseif wa_messages-msgtyp = 'W'.
write: 10 icon_yellow_light.
endif.
write: 20 sy-vline.
write : 30 wa_messages-equnr .
write: 48 sy-vline.
write : 49 wa_messages-tplnr .
write: 79 sy-vline.
write : 80 wa_messages-message .
write: 180 sy-vline.
write:/1 sy-vline.
uline 1(180).
endloop.
endform.
" write_messages