TYPES : BEGIN OF MAT,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
END OF MAT.
CLASS CLASS_EVENT DEFINITION.
PUBLIC SECTION.
CLASS-METHODS : HANDLE_TOOL FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE.
CLASS-METHODS : HANDLE_USER_COMMAND FOR EVENT USER_COMMAND
OF CL_GUI_ALV_GRID IMPORTING E_UCOMM.
ENDCLASS.
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
END OF MAT.
CLASS CLASS_EVENT DEFINITION.
PUBLIC SECTION.
CLASS-METHODS : HANDLE_TOOL FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE.
CLASS-METHODS : HANDLE_USER_COMMAND FOR EVENT USER_COMMAND
OF CL_GUI_ALV_GRID IMPORTING E_UCOMM.
ENDCLASS.
DATA : IT_MAT TYPE TABLE OF MAT,
WA_MAT TYPE MAT.
DATA : O_CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_ALV TYPE REF TO CL_GUI_ALV_GRID.
DATA : IT_FCAT TYPE LVC_T_FCAT,
WA_FCAT TYPE LVC_S_FCAT,
WA_LAYOUT TYPE LVC_S_LAYO.
DATA : OR_IT_MAT TYPE TABLE OF MAT,
OR_WA_MAT TYPE MAT,
WA_MARA TYPE MARA,
WA_MAKT TYPE MAKT.
WA_MAT TYPE MAT.
DATA : O_CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_ALV TYPE REF TO CL_GUI_ALV_GRID.
DATA : IT_FCAT TYPE LVC_T_FCAT,
WA_FCAT TYPE LVC_S_FCAT,
WA_LAYOUT TYPE LVC_S_LAYO.
DATA : OR_IT_MAT TYPE TABLE OF MAT,
OR_WA_MAT TYPE MAT,
WA_MARA TYPE MARA,
WA_MAKT TYPE MAKT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_MATNR FOR WA_MAT-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
SELECT-OPTIONS : S_MATNR FOR WA_MAT-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
CLASS CLASS_EVENT IMPLEMENTATION.
METHOD HANDLE_TOOL.
DATA : SAV_BUT TYPE STB_BUTTON.
SAV_BUT-FUNCTION = 'SAVE'.
SAV_BUT-ICON = ICON_SYSTEM_SAVE.
SAV_BUT-QUICKINFO = 'SAVE'.
SAV_BUT-TEXT = 'SAVE'.
SAV_BUT-DISABLED = ' '.
APPEND SAV_BUT TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD.
METHOD HANDLE_TOOL.
DATA : SAV_BUT TYPE STB_BUTTON.
SAV_BUT-FUNCTION = 'SAVE'.
SAV_BUT-ICON = ICON_SYSTEM_SAVE.
SAV_BUT-QUICKINFO = 'SAVE'.
SAV_BUT-TEXT = 'SAVE'.
SAV_BUT-DISABLED = ' '.
APPEND SAV_BUT TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD.
METHOD HANDLE_USER_COMMAND .
CASE E_UCOMM.
WHEN 'SAVE'.
PERFORM UPDATE_DATA_BASE.
ENDCASE.
ENDMETHOD.
ENDCLASS.
CASE E_UCOMM.
WHEN 'SAVE'.
PERFORM UPDATE_DATA_BASE.
ENDCASE.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM CREATE_FIELDCAT.
PERFORM LAYOUT.
END-OF-SELECTION.
CALL SCREEN 100.
PERFORM FETCH_DATA.
PERFORM CREATE_FIELDCAT.
PERFORM LAYOUT.
END-OF-SELECTION.
CALL SCREEN 100.
FORM FETCH_DATA .
SELECT A~MATNR ERSDA ERNAM SPRAS MAKTX INTO TABLE IT_MAT
FROM MARA AS A INNER JOIN MAKT AS B ON B~MATNR = A~MATNR
WHERE A~MATNR IN S_MATNR.
OR_IT_MAT = IT_MAT.
ENDFORM.
SELECT A~MATNR ERSDA ERNAM SPRAS MAKTX INTO TABLE IT_MAT
FROM MARA AS A INNER JOIN MAKT AS B ON B~MATNR = A~MATNR
WHERE A~MATNR IN S_MATNR.
OR_IT_MAT = IT_MAT.
ENDFORM.
FORM CREATE_FIELDCAT .
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'MATNR'.
WA_FCAT-KEY = 'X'.
WA_FCAT-COLTEXT = 'MATERIAL NUMBER'.
WA_FCAT-OUTPUTLEN = 18.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'ERSDA'.
WA_FCAT-COLTEXT = 'DATE'.
WA_FCAT-OUTPUTLEN = 18.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 3.
WA_FCAT-FIELDNAME = 'ERNAM'.
WA_FCAT-COLTEXT = 'CREATED BY'.
WA_FCAT-OUTPUTLEN = 18.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 4.
WA_FCAT-FIELDNAME = 'SPRAS'.
WA_FCAT-COLTEXT = 'LANGAUE'.
WA_FCAT-OUTPUTLEN = 4.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 5.
WA_FCAT-FIELDNAME = 'MAKTX'.
WA_FCAT-COLTEXT = 'MATERIAL DESCRIPTION'.
WA_FCAT-OUTPUTLEN = 40.
WA_FCAT-EDIT = 'X'.
APPEND WA_FCAT TO IT_FCAT.
ENDFORM.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'MATNR'.
WA_FCAT-KEY = 'X'.
WA_FCAT-COLTEXT = 'MATERIAL NUMBER'.
WA_FCAT-OUTPUTLEN = 18.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'ERSDA'.
WA_FCAT-COLTEXT = 'DATE'.
WA_FCAT-OUTPUTLEN = 18.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 3.
WA_FCAT-FIELDNAME = 'ERNAM'.
WA_FCAT-COLTEXT = 'CREATED BY'.
WA_FCAT-OUTPUTLEN = 18.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 4.
WA_FCAT-FIELDNAME = 'SPRAS'.
WA_FCAT-COLTEXT = 'LANGAUE'.
WA_FCAT-OUTPUTLEN = 4.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 5.
WA_FCAT-FIELDNAME = 'MAKTX'.
WA_FCAT-COLTEXT = 'MATERIAL DESCRIPTION'.
WA_FCAT-OUTPUTLEN = 40.
WA_FCAT-EDIT = 'X'.
APPEND WA_FCAT TO IT_FCAT.
ENDFORM.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STAT'.
* SET TITLEBAR 'xxx'.
ENDMODULE.
SET PF-STATUS 'STAT'.
* SET TITLEBAR 'xxx'.
ENDMODULE.
MODULE DISPLAY OUTPUT.
IF O_CUST IS NOT BOUND .
create object O_CUST
exporting
* PARENT =
CONTAINER_NAME = 'CUST'
* STYLE =
* LIFETIME = LIFETIME_DEFAULT
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
exceptions
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
.
if SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
IF O_CUST IS NOT BOUND .
create object O_CUST
exporting
* PARENT =
CONTAINER_NAME = 'CUST'
* STYLE =
* LIFETIME = LIFETIME_DEFAULT
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
exceptions
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
.
if SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
create object O_ALV
exporting
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = O_CUST
* I_APPL_EVENTS = SPACE
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
* I_FCAT_COMPLETE = SPACE
exceptions
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
.
if SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
exporting
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = O_CUST
* I_APPL_EVENTS = SPACE
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
* I_FCAT_COMPLETE = SPACE
exceptions
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
.
if SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
SET HANDLER CLASS_EVENT=>HANDLE_TOOL FOR O_ALV.
SET HANDLER CLASS_EVENT=>HANDLE_USER_COMMAND FOR O_ALV.
call method O_ALV->SET_TABLE_FOR_FIRST_DISPLAY
exporting
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
IS_LAYOUT = WA_LAYOUT
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
changing
IT_OUTTAB = IT_MAT
IT_FIELDCATALOG = IT_FCAT
* IT_SORT =
* IT_FILTER =
exceptions
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
.
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.
SET HANDLER CLASS_EVENT=>HANDLE_USER_COMMAND FOR O_ALV.
call method O_ALV->SET_TABLE_FOR_FIRST_DISPLAY
exporting
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
IS_LAYOUT = WA_LAYOUT
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
changing
IT_OUTTAB = IT_MAT
IT_FIELDCATALOG = IT_FCAT
* IT_SORT =
* IT_FILTER =
exceptions
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
.
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.
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
FORM LAYOUT .
WA_LAYOUT-COL_OPT = 'X'.
ENDFORM.
WA_LAYOUT-COL_OPT = 'X'.
ENDFORM.
FORM UPDATE_DATA_BASE .
LOOP AT IT_MAT INTO WA_MAT.
CLEAR OR_WA_MAT .
READ TABLE OR_IT_MAT INTO OR_WA_MAT INDEX SY-TABIX.
IF SY-SUBRC = 0.
IF OR_WA_MAT NE WA_MAT .
WA_MARA-MATNR = WA_MAT-MATNR.
WA_MARA-ERSDA = WA_MAT-ERSDA.
WA_MARA-ERNAM = WA_MAT-ERNAM.
MODIFY MARA FROM WA_MARA .
WA_MAKT-MATNR = WA_MAT-MATNR.
WA_MAKT-SPRAS = WA_MAT-SPRAS.
WA_MAKT-MAKTX = WA_MAT-MAKTX.
MODIFY MAKT FROM WA_MAKT .
IF SY-SUBRC = 0.
MESSAGE 'RECORD UPDATED SUCESSFULLY' TYPE 'I'.
ENDIF.
ENDIF.
ENDIF.
CLEAR WA_MAT.
ENDLOOP.
ENDFORM.
LOOP AT IT_MAT INTO WA_MAT.
CLEAR OR_WA_MAT .
READ TABLE OR_IT_MAT INTO OR_WA_MAT INDEX SY-TABIX.
IF SY-SUBRC = 0.
IF OR_WA_MAT NE WA_MAT .
WA_MARA-MATNR = WA_MAT-MATNR.
WA_MARA-ERSDA = WA_MAT-ERSDA.
WA_MARA-ERNAM = WA_MAT-ERNAM.
MODIFY MARA FROM WA_MARA .
WA_MAKT-MATNR = WA_MAT-MATNR.
WA_MAKT-SPRAS = WA_MAT-SPRAS.
WA_MAKT-MAKTX = WA_MAT-MAKTX.
MODIFY MAKT FROM WA_MAKT .
IF SY-SUBRC = 0.
MESSAGE 'RECORD UPDATED SUCESSFULLY' TYPE 'I'.
ENDIF.
ENDIF.
ENDIF.
CLEAR WA_MAT.
ENDLOOP.
ENDFORM.
Certs4you is the best and authentic website to clear the SAP C_HANAIMP_16 exam on the first attempt. They have the best study material related to SAP Certification. They have a professional team to deal with the clients very well. Certs4you offers $$15 discount today to get this offer please visit Certs4you.com.
ReplyDeleteC_HANAIMP_16 Cheat Sheet