0% found this document useful (0 votes)
11 views2 pages

Apr 10 12 - 15 PM

The document outlines an ABAP report program that retrieves sales order data based on user-defined date selections and optional order IDs. It constructs an ALV grid display for the sales orders, allowing users to select and approve or reject orders. The program includes logic for handling user commands and updating order statuses in a custom database table.

Uploaded by

pudheena33
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Apr 10 12 - 15 PM

The document outlines an ABAP report program that retrieves sales order data based on user-defined date selections and optional order IDs. It constructs an ALV grid display for the sales orders, allowing users to select and approve or reject orders. The program includes logic for handling user commands and updating order statuses in a custom database table.

Uploaded by

pudheena33
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

*&---------------------------------------------------------------------**& Report

ZTASK1*&---------------------------------------------------------------------
**&*&---------------------------------------------------------------------*REPORT
ZTASK1.DATA: P_DATE TYPE ZODATE.SELECT-OPTIONS P_DATEE FOR P_DATE
OBLIGATORY.PARAMETERS: P_OID TYPE ZOID.TYPES: BEGIN OF SALES_ORD, OID TYPE ZOID,
DATE TYPE ZODATE, MID TYPE ZIID, QUANTITY TYPE ZQUAN, PRICE TYPE ZOA, selected
TYPE c, END OF SALES_ORD.DATA: IT_ORD TYPE TABLE OF SALES_ORD, WA_ORD TYPE
SALES_ORD.IF P_OID = 0. SELECT T1~OID T1~ODATE T2~ITEM_ID
T2~QUANTITY T2~PRICE INTO table IT_ORD FROM ZORD_H AS T1 INNER
JOIN ZORD_I AS T2 ON T1~OID = T2~ORDER_ID WHERE T1~ODATE IN P_DATEE.ELSE.
SELECT T1~OID T1~ODATE T2~ITEM_ID T2~QUANTITY
T2~PRICE INTO table IT_ORD FROM ZORD_H AS T1 INNER JOIN ZORD_I AS T2
ON T1~OID = T2~ORDER_ID WHERE T1~ODATE IN P_DATEE AND T1~OID = P_OID.ENDIF.
DATA: i_sfcat TYPE slis_t_fieldcat_alv, wa_sfcat TYPE slis_fieldcat_alv.*
ls_layout TYPE slis_layout_alv. DATA: gr_alv_grid TYPE REF TO cl_gui_alv_grid.
DATA: V_POS TYPE N. v_pos = 1. wa_sfcat-col_pos = v_pos. wa_sfcat-fieldname =
'SELECTED'. wa_sfcat-checkbox = 'X'. wa_sfcat-seltext_l = 'Select'. wa_sfcat-
edit = 'X'. APPEND wa_sfcat TO i_sfcat. clear wa_sfcat. v_pos = v_pos + 1.
wa_sfcat-col_pos = v_pos. wa_sfcat-fieldname = 'OID'. wa_sfcat-tabname =
'IT_ORD'. wa_sfcat-outputlen = 10. wa_sfcat-seltext_l = 'ORDER ID'. append
wa_sfcat to i_sfcat. clear wa_sfcat. v_pos = v_pos + 1. wa_sfcat-col_pos =
v_pos. wa_sfcat-fieldname = 'DATE'. wa_sfcat-tabname = 'IT_ORD'. wa_sfcat-
outputlen = 10. wa_sfcat-seltext_l = 'DATE'. append wa_sfcat to i_sfcat. clear
wa_sfcat. v_pos = v_pos + 1. wa_sfcat-col_pos = v_pos. wa_sfcat-fieldname =
'MID'. wa_sfcat-tabname = 'IT_ORD'. wa_sfcat-outputlen = 10. wa_sfcat-seltext_l
= 'MATERIAL ID'. append wa_sfcat to i_sfcat. clear wa_sfcat. v_pos = v_pos + 1.
wa_sfcat-col_pos = v_pos. wa_sfcat-fieldname = 'QUANTITY'. wa_sfcat-tabname =
'IT_ORD'. wa_sfcat-outputlen = 10. wa_sfcat-seltext_l = 'QUANTITY'.* wa_sfcat-
edit = 'X'. append wa_sfcat to i_sfcat. clear wa_sfcat. v_pos = v_pos + 1.
wa_sfcat-col_pos = v_pos. wa_sfcat-fieldname = 'PRICE'. wa_sfcat-tabname =
'IT_ORD'. wa_sfcat-outputlen = 10. wa_sfcat-seltext_l = 'PRICE'. append wa_sfcat
to i_sfcat. clear wa_sfcat.* ls_layout-box_fieldname = 'SELECTED'. CALL FUNCTION
'REUSE_ALV_GRID_DISPLAY' EXPORTING* I_INTERFACE_CHECK = ' '*
I_BYPASSING_BUFFER = ' '* I_BUFFER_ACTIVE = '
' I_CALLBACK_PROGRAM = SY-REPID I_CALLBACK_PF_STATUS_SET
= 'PF_STATUS' I_CALLBACK_USER_COMMAND = 'USR_COMMAND'*
I_CALLBACK_TOP_OF_PAGE = ' '* I_CALLBACK_HTML_TOP_OF_PAGE = '
'* I_CALLBACK_HTML_END_OF_LIST = ' '* I_STRUCTURE_NAME
=* I_BACKGROUND_ID = ' '* I_GRID_TITLE
=* I_GRID_SETTINGS =* IS_LAYOUT =
LS_LAYOUT IT_FIELDCAT = i_sfcat* IT_EXCLUDING
=* IT_SPECIAL_GROUPS =* IT_SORT
=* IT_FILTER =* IS_SEL_HIDE
=* I_DEFAULT = 'X'* I_SAVE
= ' '* IS_VARIANT =* IT_EVENTS
=* IT_EVENT_EXIT =* IS_PRINT
=* IS_REPREP_ID =* I_SCREEN_START_COLUMN =
0* I_SCREEN_START_LINE = 0* I_SCREEN_END_COLUMN
= 0* I_SCREEN_END_LINE = 0* I_HTML_HEIGHT_TOP
= 0* I_HTML_HEIGHT_END = 0* IT_ALV_GRAPHICS
=* IT_ADD_FIELDCAT =* IT_EXCEPT_QINFO
=* IR_SALV_FULLSCREEN_ADAPTER =* IMPORTING*
E_EXIT_CAUSED_BY_CALLER =* ES_EXIT_CAUSED_BY_USER =
TABLES T_OUTTAB = IT_ORD* EXCEPTIONS*
PROGRAM_ERROR = 1* OTHERS = 2
. IF SY-SUBRC <> 0.* Implement suitable error handling here ENDIF. FORM
PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB. SET PF-STATUS 'ACTION_BUTTON'.
ENDFORM. FORM USR_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
SLIS_SELFIELD. DATA: REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new *then insert the
"FOLLOWING CODE IN YOUR USER_COMMAND ROUTINE... IF REF_GRID IS INITIAL. CALL
FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING E_GRID = REF_GRID.
ENDIF. IF NOT REF_GRID IS INITIAL. CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
ENDIF.RS_SELFIELD-refresh = 'X'. DATA: IT_STATUS TYPE TABLE OF ZSALES_CUSTOM,
WA_STATUS TYPE ZSALES_CUSTOM. IF R_UCOMM EQ 'APPROVE'. LOOP AT IT_ORD INTO
WA_ORD WHERE SELECTED = 'X'. SELECT ORDER_STATUS FROM ZSALES_CUSTOM INTO TABLE
IT_STATUS WHERE MID = WA_ORD-MID AND ORDER_STATUS = 'APPROVED'. IF SY-SUBRC eq
0. MESSAGE: I001(ZMSG) WITH WA_ORD-OID. ELSE. WA_STATUS-OID =
WA_ORD-OID. WA_STATUS-ODATE = WA_ORD-DATE. WA_STATUS-MID = WA_ORD-
MID. WA_STATUS-QUANTITY = WA_ORD-QUANTITY. WA_STATUS-PRICE = WA_ORD-
PRICE. WA_STATUS-ORDER_STATUS = 'APPROVED'. INSERT ZSALES_CUSTOM FROM
WA_STATUS. MESSAGE: I000(ZMSG) WITH WA_ORD-OID. ENDIF. ENDLOOP.
ENDIF. IF R_UCOMM = 'REJECT'. " Add your reject logic here ENDIF. ENDFORM.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy