TYPES : BEGIN OF BILL,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
NETWR TYPE VBRP-NETWR,
END OF BILL.
DATA : IT_BILL TYPE TABLE OF BILL,
WA_BILL TYPE BILL.
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.
DATA : IT_SORT TYPE LVC_T_SORT,
WA_SORT TYPE LVC_S_SORT.
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
NETWR TYPE VBRP-NETWR,
END OF BILL.
DATA : IT_BILL TYPE TABLE OF BILL,
WA_BILL TYPE BILL.
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.
DATA : IT_SORT TYPE LVC_T_SORT,
WA_SORT TYPE LVC_S_SORT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_VBELN FOR WA_BILL-VBELN.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM FIELDCAT.
PERFORM SORT.
CALL SCREEN 100.
SELECT-OPTIONS : S_VBELN FOR WA_BILL-VBELN.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM FIELDCAT.
PERFORM SORT.
CALL SCREEN 100.
FORM FETCH_DATA .
SELECT VBELN POSNR NETWR FROM VBRP INTO TABLE IT_BILL WHERE
VBELN IN S_VBELN.
ENDFORM.
SELECT VBELN POSNR NETWR FROM VBRP INTO TABLE IT_BILL WHERE
VBELN IN S_VBELN.
ENDFORM.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STAT'.
* SET TITLEBAR 'xxx'.
ENDMODULE.
SET PF-STATUS 'STAT'.
* SET TITLEBAR 'xxx'.
ENDMODULE.
MODULE DISPLAY OUTPUT.
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_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
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
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
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDMODULE.
FORM FIELDCAT .
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-KEY = 'X'.
WA_FCAT-OUTPUTLEN = 10 .
WA_FCAT-COLTEXT = 'Billing Document '.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'POSNR'.
WA_FCAT-OUTPUTLEN = 6 .
WA_FCAT-COLTEXT = 'Billing item '.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 3.
WA_FCAT-FIELDNAME = 'NETWR'.
WA_FCAT-OUTPUTLEN = 15 .
WA_FCAT-COLTEXT = 'Net value '.
WA_FCAT-DO_SUM = 'X'.
APPEND WA_FCAT TO IT_FCAT.
ENDFORM.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-KEY = 'X'.
WA_FCAT-OUTPUTLEN = 10 .
WA_FCAT-COLTEXT = 'Billing Document '.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'POSNR'.
WA_FCAT-OUTPUTLEN = 6 .
WA_FCAT-COLTEXT = 'Billing item '.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 3.
WA_FCAT-FIELDNAME = 'NETWR'.
WA_FCAT-OUTPUTLEN = 15 .
WA_FCAT-COLTEXT = 'Net value '.
WA_FCAT-DO_SUM = 'X'.
APPEND WA_FCAT TO IT_FCAT.
ENDFORM.
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 SORT .
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
ENDFORM. " SORT
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
ENDFORM. " SORT
Great blog...
ReplyDeleteSAP Training in Chennai