Go on link..

link us with ...

Thursday, December 30, 2010

MRP INDCTR in MM Modile

*&---------------------------------------------------------------------*
*& Module pool ZVVF_MM050_MRP_INDCTR *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

PROGRAM ZVVF_MM050_MRP_INDCTR .

tables :zvvf_mrp_indctr.

data : begin of IT_Data occurs 0,
w_sel(1) type c.
include structure ZVVF_MRP_INDCTR.
data : end of it_data.


data : wa_data like it_data.


data : w_sel(1) type c.

DATA : W_FLG(1) TYPE C VALUE ' '.

data : w_matnr type zvvf_mrp_indctr-matnr,
w_werks type zvvf_mrp_indctr-matnr,
w_valid_from type zvvf_mrp_indctr-valid_from,
w_valid_to(10) type c,
w_mrp_indctr type zvvf_mrp_indctr-mrp_ind.



*&spwizard: declaration of tablecontrol 'W_TABL_CTRL' itself
controls: W_TABL_CTRL type tableview using screen 0100.

*&spwizard: lines of tablecontrol 'W_TABL_CTRL'
data: g_W_TABL_CTRL_lines like sy-loopc.

data: OK_CODE like sy-ucomm.

*&spwizard: output module for tc 'W_TABL_CTRL'. do not change this line!
*&spwizard: update lines for equivalent scrollbar
module W_TABL_CTRL_change_tc_attr output.
describe table IT_DATA lines W_TABL_CTRL-lines.
endmodule. "W_TABL_CTRL_change_tc_attr OUTPUT

*&spwizard: output module for tc 'W_TABL_CTRL'. do not change this line!
*&spwizard: get lines of tablecontrol
module W_TABL_CTRL_get_lines output.
g_W_TABL_CTRL_lines = sy-loopc.
endmodule. "W_TABL_CTRL_get_lines OUTPUT

*&spwizard: input modul for tc 'W_TABL_CTRL'. do not change this line!
*&spwizard: mark table
module W_TABL_CTRL_mark input.
data: g_W_TABL_CTRL_wa2 like line of IT_DATA.
if W_TABL_CTRL-line_sel_mode = 1
and IT_DATA-W_SEL = 'X'.
loop at IT_DATA into g_W_TABL_CTRL_wa2
where W_SEL = 'X'.
g_W_TABL_CTRL_wa2-W_SEL = ''.
modify IT_DATA
from g_W_TABL_CTRL_wa2
transporting W_SEL.
endloop.
endif.
modify IT_DATA
index W_TABL_CTRL-current_line
transporting W_SEL.
endmodule. "W_TABL_CTRL_mark INPUT

*&spwizard: input module for tc 'W_TABL_CTRL'. do not change this line!
*&spwizard: process user command
module W_TABL_CTRL_user_command input.
OK_CODE = sy-ucomm.
perform user_ok_tc using 'W_TABL_CTRL'
'IT_DATA'
'W_SEL'
changing OK_CODE.
sy-ucomm = OK_CODE.
endmodule. "W_TABL_CTRL_user_command INPUT

*----------------------------------------------------------------------*
* INCLUDE TABLECONTROL_FORMS *
*----------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& Form USER_OK_TC *
*&---------------------------------------------------------------------*
FORM USER_OK_TC USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME
CHANGING P_OK LIKE SY-UCOMM.

*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA: L_OK TYPE SY-UCOMM,
L_OFFSET TYPE I.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*

*&SPWIZARD: Table control specific operations *
*&SPWIZARD: evaluate TC name and operations *
SEARCH P_OK FOR P_TC_NAME.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
L_OFFSET = STRLEN( P_TC_NAME ) + 1.
L_OK = P_OK+L_OFFSET.
*&SPWIZARD: execute general and TC specific operations *
CASE L_OK.
WHEN 'INSR'. "insert row
PERFORM FCODE_INSERT_ROW USING P_TC_NAME
P_TABLE_NAME.
CLEAR P_OK.

WHEN 'DELE'. "delete row
* PERFORM FCODE_DELETE_ROW USING P_TC_NAME
* P_TABLE_NAME
* P_MARK_NAME.
* CLEAR P_OK.

WHEN 'P--' OR "top of list
'P-' OR "previous page
'P+' OR "next page
'P++'. "bottom of list
PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
L_OK.
CLEAR P_OK.
* WHEN 'L--'. "total left
* PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
*
* WHEN 'L-'. "column left
* PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
*
* WHEN 'R+'. "column right
* PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
*
* WHEN 'R++'. "total right
* PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
*
WHEN 'MARK'. "mark all filled lines
PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.

WHEN 'DMRK'. "demark all filled lines
PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.

* WHEN 'SASCEND' OR
* 'SDESCEND'. "sort column
* PERFORM FCODE_SORT_TC USING P_TC_NAME
* l_ok.

ENDCASE.

ENDFORM. " USER_OK_TC

*&---------------------------------------------------------------------*
*& Form FCODE_INSERT_ROW *
*&---------------------------------------------------------------------*
FORM fcode_insert_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME .

*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA L_LINES_NAME LIKE FELD-NAME.
DATA L_SELLINE LIKE SY-STEPL.
DATA L_LASTLINE TYPE I.
DATA L_LINE TYPE I.
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS TYPE CXTAB_CONTROL.
FIELD-SYMBOLS TYPE STANDARD TABLE.
FIELD-SYMBOLS TYPE I.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*

ASSIGN (P_TC_NAME) TO .

*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO
. "not headerline

*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
ASSIGN (L_LINES_NAME) TO .

*&SPWIZARD: get current line *
GET CURSOR LINE L_SELLINE.
if sy-subrc <> 0. " append line to table
l_selline = -lines + 1.
*&SPWIZARD: set top line *
if l_selline > .
-top_line = l_selline - + 1 .
else.
-top_line = 1.
endif.
else. " insert line into table
l_selline = -top_line + l_selline - 1.
l_lastline = -top_line + - 1.
endif.
*&SPWIZARD: set new cursor line *
l_line = l_selline - -top_line + 1.

*&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO
INDEX L_SELLINE.
-LINES = -LINES + 1.
*&SPWIZARD: set cursor *
SET CURSOR LINE L_LINE.

ENDFORM. " FCODE_INSERT_ROW

*&---------------------------------------------------------------------*
*& Form FCODE_DELETE_ROW *
*&---------------------------------------------------------------------*
FORM fcode_delete_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME .

*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA L_TABLE_NAME LIKE FELD-NAME.

FIELD-SYMBOLS TYPE cxtab_control.
FIELD-SYMBOLS
TYPE STANDARD TABLE.
FIELD-SYMBOLS .
FIELD-SYMBOLS .
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*

ASSIGN (P_TC_NAME) TO .

*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO
. "not headerline

*&SPWIZARD: delete marked lines *
DESCRIBE TABLE
LINES -LINES.

LOOP AT
ASSIGNING .

*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE TO .

IF = 'X'.
DELETE
INDEX SYST-TABIX.
IF SY-SUBRC = 0.
-LINES = -LINES - 1.
ENDIF.
ENDIF.
ENDLOOP.

ENDFORM. " FCODE_DELETE_ROW

*&---------------------------------------------------------------------*
*& Form COMPUTE_SCROLLING_IN_TC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
* -->P_OK ok code
*----------------------------------------------------------------------*
FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
P_OK.
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA L_TC_NEW_TOP_LINE TYPE I.
DATA L_TC_NAME LIKE FELD-NAME.
DATA L_TC_LINES_NAME LIKE FELD-NAME.
DATA L_TC_FIELD_NAME LIKE FELD-NAME.

FIELD-SYMBOLS TYPE cxtab_control.
FIELD-SYMBOLS TYPE I.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*

ASSIGN (P_TC_NAME) TO .
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
ASSIGN (L_TC_LINES_NAME) TO .


*&SPWIZARD: is no line filled? *
IF -LINES = 0.
*&SPWIZARD: yes, ... *
L_TC_NEW_TOP_LINE = 1.
ELSE.
*&SPWIZARD: no, ... *
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
ENTRY_ACT = -TOP_LINE
ENTRY_FROM = 1
ENTRY_TO = -LINES
LAST_PAGE_FULL = 'X'
LOOPS =
OK_CODE = P_OK
OVERLAPPING = 'X'
IMPORTING
ENTRY_NEW = L_TC_NEW_TOP_LINE
EXCEPTIONS
* NO_ENTRY_OR_PAGE_ACT = 01
* NO_ENTRY_TO = 02
* NO_OK_CODE_OR_PAGE_GO = 03
OTHERS = 0.
ENDIF.

*&SPWIZARD: get actual tc and column *
GET CURSOR FIELD L_TC_FIELD_NAME
AREA L_TC_NAME.

IF SYST-SUBRC = 0.
IF L_TC_NAME = P_TC_NAME.
*&SPWIZARD: et actual column *
SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
ENDIF.
ENDIF.

*&SPWIZARD: set the new top line *
-TOP_LINE = L_TC_NEW_TOP_LINE.


ENDFORM. " COMPUTE_SCROLLING_IN_TC

*&---------------------------------------------------------------------*
*& Form FCODE_TC_MARK_LINES
*&---------------------------------------------------------------------*
* marks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
FORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME.
*&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------*
DATA L_TABLE_NAME LIKE FELD-NAME.

FIELD-SYMBOLS TYPE cxtab_control.
FIELD-SYMBOLS
TYPE STANDARD TABLE.
FIELD-SYMBOLS .
FIELD-SYMBOLS .
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*

ASSIGN (P_TC_NAME) TO .

*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO
. "not headerline

*&SPWIZARD: mark all filled lines *
LOOP AT
ASSIGNING .

*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE TO .

= 'X'.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines

*&---------------------------------------------------------------------*
*& Form FCODE_TC_DEMARK_LINES
*&---------------------------------------------------------------------*
* demarks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA L_TABLE_NAME LIKE FELD-NAME.

FIELD-SYMBOLS TYPE cxtab_control.
FIELD-SYMBOLS
TYPE STANDARD TABLE.
FIELD-SYMBOLS .
FIELD-SYMBOLS .
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*

ASSIGN (P_TC_NAME) TO .

*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO
. "not headerline

*&SPWIZARD: demark all filled lines *
LOOP AT
ASSIGNING .

*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE TO .

= SPACE.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines
*&---------------------------------------------------------------------*
*& Module display_data INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE display_data INPUT.

if ( zvvf_mrp_indctr-matnr is initial )
or
( zvvf_mrp_indctr-werks is initial ).
message e333(s1) with 'Enter Material and Plant Value.'.
else.
if w_flg eq ' ' and ok_code is initial.
refresh it_data.
if zvvf_mrp_indctr-werks is initial.
select * from zvvf_MRP_indctr
into corresponding fields of table it_data
where matnr = zvvf_mrp_indctr-matnr
ORDER BY VALID_FROM DESCENDING.
if sy-subrc ne 0.
message e333(s1) with 'NO Data to Display for Selection Criteria'.
endif.
elseif zvvf_mrp_indctr-matnr is initial.
select * from zvvf_MRP_indctr
into corresponding fields of table it_data
where werks = zvvf_mrp_indctr-werks
ORDER BY VALID_FROM DESCENDING.
if sy-subrc ne 0.
message e333(s1) with 'NO Data to Display for Selection Criteria'.
endif.

elseif not ( zvvf_mrp_indctr-matnr is initial
and zvvf_mrp_indctr-werks is initial ).

select * from zvvf_MRP_indctr
into corresponding fields of table it_data
where matnr = zvvf_mrp_indctr-matnr
and werks = zvvf_mrp_indctr-werks
ORDER BY VALID_FROM DESCENDING.
if sy-subrc ne 0.
message e333(s1) with 'NO Data to Display for Selection Criteria'.
endif.
endif.
endif.
endif.
ENDMODULE. " display_data INPUT
*&---------------------------------------------------------------------*
*& Module SELECT_DATA INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE SELECT_DATA INPUT.
data : w_answer(1) type c,
wa_mrp_indctr type zvvf_mrp_indctr,
it_mrp_indctr type standard table of zvvf_mrp_indctr,
l_line_cnt type i.

IF IT_DATA-W_SEL = 'X'.
IF OK_CODE = 'DELE'.

CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Are you Sure to Delete??'
TEXT_BUTTON_1 = 'YES'(001)
* ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'NO'(002)
* ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '2'
DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
ANSWER = w_answer
* TABLES
* PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC eq 0.
if w_answer eq '1'.

if it_data-valid_to eq '99991231'.

select * from zvvf_mrp_indctr
into corresponding fields of table it_mrp_indctr
where matnr = it_data-matnr
and werks = it_data-werks.

if sy-subrc eq 0.

describe table it_mrp_indctr lines l_line_cnt.

if l_line_cnt eq 1.

delete from ZVVF_MRP_INDCTR
where matnr = it_data-matnr
and werks = it_data-werks
and valid_from = it_data-valid_from
and valid_to = it_data-valid_to
and mrp_ind = it_data-mrp_ind.

if sy-subrc eq 0.
commit work.
endif.

else.
sort it_mrp_indctr by valid_from.
l_line_cnt = l_line_cnt - 1.
read table it_mrp_indctr into wa_mrp_indctr
index l_line_cnt.
update ZVVF_MRP_INDCTR
set valid_to = '99991231'
where matnr = wa_mrp_indctr-matnr
and werks = wa_mrp_indctr-werks
and valid_from = wa_mrp_indctr-valid_from
and mrp_ind = wa_mrp_indctr-mrp_ind.

delete from ZVVF_MRP_INDCTR
where matnr = it_data-matnr
and werks = it_data-werks
and valid_from = it_data-valid_from
and valid_to = it_data-valid_to
and mrp_ind = it_data-mrp_ind.

if sy-subrc eq 0.
commit work.
endif.
endif.
endif.
else.
delete from ZVVF_MRP_INDCTR
where matnr = it_data-matnr
and werks = it_data-werks
and valid_from = it_data-valid_from
and valid_to = it_data-valid_to
and mrp_ind = it_data-mrp_ind.

if sy-subrc eq 0.
commit work.
delete it_data
where matnr = it_data-matnr
and werks = it_data-werks
and valid_from = it_data-valid_from
and valid_to = it_data-valid_to
and mrp_ind = it_data-mrp_ind
and w_sel = 'X'.

message s333(s1) with 'Record Deleted Successfully'.

refresh control 'w_tabl_ctrl' from screen '0100'.
endif.
endif.
else.

endif.

ENDIF.
clear ok_code.
endif.

ENDIF.
ENDMODULE. " SELECT_DATA INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
data : l_delimit_dat type sy-datum.

if ok_code eq 'CREA'.
loop at screen.
if screen-name = 'W_FRM'.
screen-invisible = '0'.
screen-active = '1'.
screen-INPUT = '1'.
screen-OUTPUT = '1'.
endif.
if screen-name = 'W_VALID_FROM'.
screen-invisible = '0'.
screen-active = '1'.
endif.

if screen-name = 'W_VALID_TO'.
screen-invisible = '0'.
screen-active = '0'.
screen-input = '0'.
screen-output = '1'.
w_valid_to = '31.12.9999'.
endif.

if screen-name = 'W_MRP_INDCTR'.
screen-invisible = '0'.
screen-active = '1'.
endif.

if screen-name = 'VALID_FROM_LABL'.
screen-invisible = '0'.
screen-active = '1'.
endif.

if screen-name = 'VALID_TO_LABL'.
screen-invisible = '0'.
screen-active = '1'.
endif.

if screen-name = 'MRP_INDCTR_LABL'.
screen-invisible = '0'.
screen-active = '1'.
endif.

if screen-name = 'W_SAVE'.
screen-invisible = '0'.
screen-active = '1'.
endif.

if screen-name = 'W_CANCEL'.
screen-invisible = '0'.
screen-active = '1'.
endif.

if screen-name = 'W_MATNR'.
screen-invisible = '1'.
screen-active = '0'.
endif.
if screen-name = 'W_WERKS'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'MATERIAL_LABL'.
screen-invisible = '1'.
screen-active = '0'.
endif.
if screen-name = 'PLANT_LABL'.
screen-invisible = '1'.
screen-active = '0'.
endif.

modify screen.
endloop.
W_FLG = 'X'.
ELSEIF OK_CODE EQ 'SAVE'.


clear: wa_mrp_indctr.
refresh it_mrp_indctr.

select * from zvvf_mrp_indctr
into corresponding fields of table it_mrp_indctr
where matnr = zvvf_mrp_indctr-matnr
and werks = zvvf_mrp_indctr-werks.
if sy-subrc eq 0.
sort it_mrp_indctr by valid_from.

loop at it_mrp_indctr into wa_mrp_indctr.
if ( wa_mrp_indctr-valid_from le w_valid_from )
and ( wa_mrp_indctr-valid_to ge w_valid_from ).
if wa_mrp_indctr-valid_to ne '99991231'.
clear ok_code.
message e333(s1)
with 'Valid From Date is overlapping with existing date interval
values.'.
exit.
elseif ( wa_mrp_indctr-valid_from eq w_valid_from ).
clear ok_code.
message e333(s1)
with 'Valid From Date is overlapping with existing date value.'.
exit.
else.
l_delimit_dat = w_valid_from - 1.
update zvvf_mrp_indctr
set valid_to = l_delimit_dat
where matnr = wa_mrp_indctr-matnr
and werks = wa_mrp_indctr-werks
and valid_from = wa_mrp_indctr-valid_from
and mrp_ind = wa_mrp_indctr-mrp_ind.

clear wa_mrp_indctr.

wa_mrp_indctr-matnr = zvvf_mrp_indctr-matnr.
wa_mrp_indctr-werks = zvvf_mrp_indctr-werks.
wa_mrp_indctr-valid_from = w_valid_from.
wa_mrp_indctr-valid_to = '99991231'.
wa_mrp_indctr-mrp_ind = W_MRP_INDCTR.

insert into ZVVF_MRP_INDCTR values wa_mrp_indctr.

if sy-subrc eq 0.
commit work.
message s333(s1) with 'Record inserted Successfully.'.
W_FLG = ' '.
refresh control 'w_tabl_ctrl' from screen '0100'.
else.
rollback work.
endif.


exit.

endif.
endif.
endloop.

else.
wa_mrp_indctr-matnr = zvvf_mrp_indctr-matnr.
wa_mrp_indctr-werks = zvvf_mrp_indctr-werks.
wa_mrp_indctr-valid_from = w_valid_from.
wa_mrp_indctr-valid_to = '99991231'.
wa_mrp_indctr-mrp_ind = W_MRP_INDCTR.

insert into ZVVF_MRP_INDCTR values wa_mrp_indctr.

if sy-subrc eq 0.
commit work.
message s333(s1) with 'Record inserted Successfully.'.
W_FLG = ' '.
refresh control 'w_tabl_ctrl' from screen '0100'.
else.
rollback work.
endif.


endif.



elseif ok_code eq 'CANC'.
W_FLG = ' '.
clear : w_valid_From,w_mrp_indctr.
ELSEIF OK_CODE EQ 'EXIT'.
LEAVE PROGRAM.
endif.

clear ok_code.

ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module hide_Fields OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE hide_Fields OUTPUT.
IF W_FLG IS INITIAL .
loop at screen.
if screen-name = 'W_FRM'.
screen-invisible = '1'.
screen-active = '0'.
endif.
if screen-name = 'W_VALID_FROM'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'W_VALID_TO'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'W_MRP_INDCTR'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'VALID_FROM_LABL'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'VALID_TO_LABL'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'MRP_INDCTR_LABL'.
screen-invisible = '1'.
screen-active = '0'.
endif.
if screen-name = 'W_SAVE'.
screen-invisible = '1'.
screen-active = '0'.
endif.
if screen-name = 'W_CANCEL'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'W_MATNR'.
screen-invisible = '1'.
screen-active = '0'.
endif.
if screen-name = 'W_WERKS'.
screen-invisible = '1'.
screen-active = '0'.
endif.

if screen-name = 'MATERIAL_LABL'.
screen-invisible = '1'.
screen-active = '0'.
endif.
if screen-name = 'PLANT_LABL'.
screen-invisible = '1'.
screen-active = '0'.
endif.
modify screen.
endloop.
ENDIF.
ENDMODULE. " hide_Fields OUTPUT
*&---------------------------------------------------------------------*
*& Module clear_fields OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE clear_fields OUTPUT.
clear : w_matnr,w_werks,it_data.
refresh it_data.
ENDMODULE. " clear_fields OUTPUT
*&---------------------------------------------------------------------*
*& MODULE validate_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE validate_data .



if w_flg eq 'X' and ok_code = 'SAVE'.
* if w_MATNR is initial.
* message e333(s1) with 'Enter Material value.'.
* endif.
*
* if w_werks is initial.
* message e333(s1) with 'Enter Plant value.'.
* endif.

if w_valid_From is initial.
message e333(s1) with 'Enter Valid_From value.'.
endif.
if W_MRP_INDCTR is initial.
message e333(s1) with 'Enter MRP Indicator value.'.
endif.

*
* select single MATNR from mara
* into corresponding fields of wa_Mara
* where matnr = ZVVF_MRP_INDCTR-matnr.
*
* if sy-subrc ne 0.
* message e333(s1) with 'Invalid Material Value.'.
* clear : w_matnr.
* endif.



endif.
ENDMODULE. " validate_data
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZVVF_MG050_STATUS'.
* SET TITLEBAR 'xxx'.
*Delete from zvvf_mrp_indctr
* where matnr = '000000000000600102'
* and werks ='P013'.
*
*commit work.
eNDMODULE. " STATUS_0100 OUTPUT

No comments:

link us...

For Visitors

if you want to publish or Add something on ERP, SAP , SAP FUNCTIONAL, SAP ABAP then mail us along with your email-id. contain must be yours

email-id :- avinashkr_raj@yahoo.com(any email)

email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)