Go on link..

link us with ...

Showing posts with label SD REPORT. Show all posts
Showing posts with label SD REPORT. Show all posts

Friday, April 29, 2011

SD Configuration

Enterprise Structure:

1 Edit, Copy, Delete, Check Company Code(T001)
Company is created by FI Consultant.
The company code is an organizational unit used in accounting. It is used to structure the business organization from a financial accounting perspective.
IMG -> Enterprise Structure -> Definition -> Financial Accounting -> Define, copy, delete, check Company Code

2 Define Credit Control Area(T014)
Company is created by FI Consultant.
The credit control area is an organizational unit that specifies and checks a credit limit for customers.A credit control area can include one or more company codes. It is not possible to assign a company code to more than one control area. Within a credit control area, the credit limits must be specified in the same currency.
IMG -> Enterprise Structure -> Definition -> Financial Accounting-> Define Credit Control Area

3. Maintaining Sales Organization(TVKO)
Sales Organization is an organizational unit responsible for the sale of certain products or services.
IMG -> Enterprise Structure -> Definition -> Sales and Distribution -> Define, copy, delete, check Sales organization

4. Assigning Sales Organization to Company Code(TVKO~BUKRS)
This assignment ensures all the sales made through this Sales Organization are accounted for in the assigned Company Code (Company Code is created by FI Consultant).
IMG -> Enterprise Structure -> Assignment -> Sales and Distribution -> Assign Sales Organziation to Company Code

5. Maintaining Distribution Channel(TVTW)
Distribution Channel is the way, in which Products or Services reach Customers.
IMG -> Enterprise Structure -> Definition -> Sales and Distribution -> Define, copy, delete, check distribution channel

6. Assigning Distribution Channel to Sales Organization(TVKOV)
This assignment ensures, a Sales Organization can supply Materials to Customers through this Distribution Channel.
IMG -> Enterprise Structure -> Assignment -> Sales and Distribution > Assign distribution channel to sales organization

7. Maintaining Division(TSPA)
Division is a way of grouping materials, products, or services.
IMG -> Enterprise Structure -> Definition -> Logistics – General -> Define, copy, delete, check division

8. Assigning Division to Sales Organization(TVKOS)
IMG -> Enterprise Structure -> Assignment -> Sales and Distribution -> Assign division to sales organization

9. Setting up Sales Area(TVTA)
All the sales are made from a particular sales Area. For creating a Sales Order Sales Area is compulsory.
IMG ->Enterprise Structure -> Assignment -> Sales and Distribution -> Set up sales area

10 Maintain sales office(TVBUR)
you define the sales offices in your company. The definition of sales offices is optional.
For each sales office, you can determine the printer for output based on the sales documents in different ways
IMG -> Enterprise Structure -> Definition -> Sales and Distribution -> Maintain Sales Office

11 Assign sales office to sales area(TVKBZ)
IMG -> Enterprise Structure -> Assignment -> Sales and Distribution -> Assign sales Office to Sales Area

12 Maintain sales Group(TVKGR)
company. The definition of sales groups is optional. You can use the SD system without creating sales groups.

13 Assign sales group to sales office(TVBVK)
you can assign as many sales groups as desired to the sales offices. Any one sales group can belong to several sales offices.
IMG -> Enterprise Structure -> Assignment -> Sales and Distribution -> Assign sales group to sales office

14. Define Shipping Points(TVST)
Shipping Point is the Organizational element, which is responsible for shipping the Materials to the Customers.
IMG -> Enterprise Structure -> Definition -> Logistics Execution -> Define, copy, delete, check shipping point

15 Define, copy, delete, check plant(T001W)
Plant is created by MM Consultant.
IMG -> Enterprise Structure -> Definition -> Logistics – General -> Define, copy, delete, check plant

16 Assigning Shipping Point to Plant(TVSWZ)
This assignment ensures that goods from different Plant can be dispatched from different Shipping Points.
IMG -> Enterprise Structure -> Assignment -> Logistics Execution -> Assign shipping point to plant

17. Assigning Sales Organization- Distribution Channel- Plant(TVKWZ)
Plant is created ny MM Consultant.
IMG -> Enterprise Structure -> Assignment -> Sales and Distribution -> Assign sales organization – distribution channel – plant

Note: Ensure to do the undermentioned configuration also though it is not in Customizing node of Enterprise Structure.

18. Defining Common Distribution Channels for Master Data(TVKOV-VKWKO TVKOV~VTWKU)
Use
The purpose of this activity is to define distribution channels which have common master data..

Procedure
Access the activity using one of the following navigation options:
IMG Menu -> Sales and Distribution -> Master Data -> Define Common Distribution Channels
Transaction Code: VOR1

19. Defining Common Divisions for Master Data(TVKOS-SPAKO TVKOS~SPAKU)
Use
The purpose of this activity is to define distribution channels which have common master data..

Procedure
Access the activity using one of the following navigation options:
IMG Menu -> Sales and Distribution -> Master Data -> Define Common Division
Transaction Code: VOR2

Pricing Procedure
In SD, Pricing Procedure is determined based on Sales Area (Sales Organization + Distribution Centre + Division) + Customer Pricing Procedure + Document Pricing Procedure. Sales Area is determined in Sales Order Header Level. Customer Pricing Procedure is determined from Customer Master. Document Pricing Procedure is determined from Sales Document Type / Billing Type (if configured). Once the pricing procedure is determined, Condition records are fetched. If appropriate condition records are found, the price is determined. If Mandatory pricing condition is missing, system will through an error message.

In SD, the steps to configure Pricing procedure are as under:
Step 1:
Condition table: If existing condition table meets the requirement, we need not create a new condition table. Considering the requirement for new condition table, the configuration will be done in spro as follows: IMG -
> Basic Function -> Condition Table (select the required fields combination, which will store condition record).
Step 2:
Access Sequence: If existing access sequence meets the requirement, we need not create a new access sequence. Considering the requirement for new sequence, the configuration will be done in spro as follows: IMG -> Basic Function -> Access Sequence (Access sequence is made up of Accesses (Tables) & the order of priority in which it is to be accessed. Here we assign the condition table to access sequence.
Step 3:
Condition Type: If existing condition type meets the requirement, we need not create a new condition type. Considering the requirement for new condition type, the configuration will be done in spro as follows: IMG -> Basic Function -> Condition Type. It is always recommended to copy an existing similar condition type & make the neccessary changes. Here we assign Access sequence to Condition type.
Step 4:
a. Pricing Procedure: It is recommended to copy a similar pricing procedure & make the neccesary changes in new pricing procedure. Pricing Procedure is a set of condition type & arranged in the sequence in which it has to perform the calculation. Considering the requirement for new Pricing Procedure, the configuration will be done in spro as follows: IMG -> Basic Function -> Pricing Procedure –> Maintain Pricing Procedure.
b. Pricing Procedure: After maintaining the pricing procedure the next step will be determination of pricing procedure. Configuration for determining pricing procedure in SPRO is as follows: IMG -> Basic Function -> Pricing Procedure –> Determine Pricing Procedure.
5. Condition record: Condition record is a master data, which is required to be maintained by Core team / person responsible from the client. During new implementation, the condition records can be uploaded using tools like SCAT, LSMW, etc.

Normal Sales Order Cycle:-

Step 1: Sales Document Type
IMG > Sales and Distribution > Sales > Sales Documents >
Sales Document Header:
1. Sales Document Type:The sales document types represent the different business transactions, such as Inquiry, Quotation, Sales Order, etc. To create new sales order type, always copy as with reference to similar sales order. If possible use standard sales order.
2. Define Number Ranges For Sales Documents: Maintain number range with discussion with core team.
3. Assign Sales Area To Sales Document Types:
A. Combine sales organizations / Combine distribution channels / Combine divisions: Ensure to maintain these, else Sales Order creation will give error.
B. Assign sales order types permitted for sales areas: Assign only required Sales Order Types to required Sales Area. This will minimize selection of Sales Order Type as per sales area.

Sales Document Item:
1. Define Item Categories: If possible use Standard Item Category. Incase if required to create new, copy as from standard & maintain New.
2. Assign Item Categories: If possible, use standard. Formula for deriving item category: Sales Document Type + Item Category Group + Usage + Higher Level Item Category = Item Category

Schedule Line:
1. Define Schedule Line Categories: If possible use Standard Schedule Lines. Incase if required to create new, copy as from standard & maintain New.
2. Assign Schedule Line Categories: If possible, use standard. Formula for deriving Schedule Line: Item Category + MRP Type / No MRP Type.

Step 2:
IMG > Logistic Execution > Shipping > Deliveries >
1. Define Delivery Types: If possible use Standard Delivery Type. Incase if required to create new, copy as from standard & maintain New.
2. Define Item Categories for Deliveries: If possible use Standard Item Categories for Delivery Type. Incase if required to create new, copy as from standard & maintain New.
3. Define Number Ranges for Deliveries: Ensure to maintain number range.

Step 3:
IMG > Sales and Distribution > Billing >
1. Define Billing Types: If possible use Standard Billing Type. Incase if required to create new, copy as from standard & maintain New.
2. Define Number Range For Billing Documents: Ensure to maintain number range.
3. Maintain Copying Control For Billing Documents: Maintain relevant copy controls such as Sales Order to Billing, Deliver to Billing, etc.

The configuration differs from scenario to scenario & requirement of the client.

Friday, December 31, 2010

UnBlock PO For Posting Movement

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

REPORT ZVVF_MR025_WEIGHBRIDGE_UNBLOCK no standard page heading line-size
110 MESSAGE-ID ZMM .

*----------------------------------------------------------------------
** Module Sales *
*----------------------------------------------------------------------
** Objective: UnBlock PO For Posting Movement
** Program : Updates tables ( ) Download data ( )
** Output Lists (X) ALV
**

**---------------------------------------------------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS : slis.
*---------------------------------------------------------------------*
**TABLES :
*---------------------------------------------------------------------*
TABLES : ZVVF_MT25_BRIDGE, " Weigh Bridge PO Details
ekpo, " Purchasing Document Item
MKPF. " Header: Material Document

*---------------------------------------------------------------------*
**CONSTANTS :
*---------------------------------------------------------------------*
*--- For ALV ----*
CONSTANTS: c_top_of_page_db TYPE slis_formname VALUE 'TOP_OF_PAGE_DB'.

*---------------------------------------------------------------------*
**DATA :
*---------------------------------------------------------------------*
DATA : W_REPID LIKE SY-REPID,
W_ANS type n,
w_ok like sy-ucomm,
W_MODE LIKE CTU_PARAMS-DISMODE.

*---------------------------------------------------------------------*
**INTERNAL TABLES :
*---------------------------------------------------------------------*
*--- For ALV ----*
DATA: it_list_top_of_page TYPE slis_t_listheader,
it_events TYPE slis_t_event,
it_fieldcat TYPE slis_t_fieldcat_alv.
*---------------*
DATA: IT_PODAT TYPE TABLE OF ZVVF_MT25_BRIDGE WITH HEADER LINE.
*---------------------------------------------------------------------*
**WORK AREAS
*---------------------------------------------------------------------*
DATA: WA_PODAT LIKE LINE OF IT_PODAT,
WA_layout TYPE slis_layout_alv. " For ALV

*---------------------------------------------------------------------*
**SELECTION SCREEN
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
select-options : so_date for mkpf-budat obligatory.
SELECTION-SCREEN END OF BLOCK MAIN .

*---------------------------------------------------------------------*
**INITIALIZATION :
*---------------------------------------------------------------------*
INITIALIZATION.

w_repid = SY-REPID.
*---------------------------------------------------------------------*
**AT SELECTION SCREEN :
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM Check_DATA.

*---------------------------------------------------------------------*
**START OF SELECTION :
*---------------------------------------------------------------------*
START-OF-SELECTION.

LOOP AT IT_podat INTO WA_podat.
PERFORM MATNR_FORMAT.
MODIFY IT_podat FROM WA_podat TRANSPORTING MATNR.
endloop.

*---------------------------------------------------------------------*
**END OF SELECTION :
*---------------------------------------------------------------------*
END-OF-SELECTION.

PERFORM fieldcat_init USING it_fieldcat[].
PERFORM eventtab_build USING it_events[].
PERFORM comment_build USING it_list_top_of_page[].
PERFORM layout_build USING WA_layout.
PERFORM write_alv_grid.

*&---------------------------------------------------------------------*
*& Form Check_DATA
*&---------------------------------------------------------------------*
FORM Check_DATA.

**Select all PO which are blocked and not yet posted

select * from ZVVF_MT25_BRIDGE into corresponding fields of table
it_podat where
budat in so_date AND
Zpost NE 'X' and
zblck = 'X'.
IF SY-SUBRC NE 0.
MESSAGE E005.
ENDIF.
endform. "Check_DATA

*&--------------------------------------------------------------------*
*& Form fieldcat_init
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->IT_FIELDCATtext
*---------------------------------------------------------------------*
FORM fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
DATA :w_pos TYPE i VALUE 0.



w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZBLCK'.
wa_fieldcat-seltext_m = 'Block Memo'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '1'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-EDIT = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'BWART'.
wa_fieldcat-seltext_m = 'Movement Type'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_m = 'PO No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-seltext_m = 'PO Item'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = 'Material'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LIFNR'.
wa_fieldcat-seltext_m = 'Vendor Acc.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-seltext_m = 'Plant'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.



w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LGORT'.
wa_fieldcat-seltext_m = 'Storage Location'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'FRBNR'.
wa_fieldcat-seltext_m = 'Truck No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'XBLNR'.
wa_fieldcat-seltext_m = 'Delivery/LR No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'BKTXT'.
wa_fieldcat-seltext_m = 'Bill of Lading'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LSMNG'.
wa_fieldcat-seltext_m = 'Delivered Qty.'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'GMEINS'.
wa_fieldcat-seltext_m = 'Gross Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'TMEINS'.
wa_fieldcat-seltext_m = 'Tare Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MENGE'.
wa_fieldcat-seltext_m = 'Net Wt.'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'GRUND'.
wa_fieldcat-seltext_m = 'Reason for Movement'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-seltext_m = 'UOM'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '5'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_m = 'Transporter'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZTEXT'.
wa_fieldcat-seltext_m = 'Block Reason'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO lt_fieldcat.


ENDFORM. " fieldcat_init

*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_EVENTS[] text
*----------------------------------------------------------------------*
FORM eventtab_build USING lt_events TYPE slis_t_event.
DATA: wa_event TYPE slis_alv_event.
DATA: c_top_of_page TYPE slis_formname.

c_top_of_page = c_top_of_page_db.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO wa_event.
IF sy-subrc <> 0.
MOVE c_top_of_page TO wa_event-form.
APPEND wa_event TO lt_events.
ELSE.
MOVE c_top_of_page TO wa_event-form.
MODIFY lt_events FROM wa_event INDEX sy-tabix .
ENDIF.

ENDFORM. " eventtab_build

*&---------------------------------------------------------------------*
*& Form comment_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_LIST_TOP_OF_PAGE[] text
*----------------------------------------------------------------------*
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'VVF LTD. Mumbai'.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = SY-ULINE.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = 'UnBlock PO For Posting Movement'.
APPEND wa_line TO lt_top_of_page.

ENDFORM. " comment_build

*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_layout text
*----------------------------------------------------------------------*
FORM layout_build USING wa_layout TYPE slis_layout_alv.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
* wa_layout-edit = 'X'.
ENDFORM. " layout_build

*&---------------------------------------------------------------------*
*& Form write_alv_grid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM write_alv_grid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = w_repid i_callback_user_command = 'USER_COMMAND' i_callback_PF_STATUS_SET = 'PF_STATUS' i_background_id = 'ALV_BACKGROUND' I_CALLBACK_TOP_OF_PAGE = c_top_of_page_db is_layout = WA_layout it_fieldcat = it_fieldcat[] it_events = it_events[] i_save = 'A' * I_DEFAULT = 'X' TABLES t_outtab = IT_PODAT EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.





ENDFORM. " write_alv_grid

*&---------------------------------------------------------------------*
*& Form PF_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PF_STATUS using extab type slis_t_extab.

SET PF-STATUS 'ZSTANDARD1'
.

ENDFORM. "PF_STATUS
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM USER_COMMAND using OK_CODE type SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.

IF OK_CODE = '&DATA_SAVE'.
***blocking memo
LOOP AT IT_PODAT INTO WA_PODAT .

UPDATE ZVVF_MT25_BRIDGE SET
ZBLCK = WA_PODAT-ZBLCK
WHERE EBELN = WA_PODAT-EBELN AND
EBELP = WA_PODAT-EBELP .

ENDLOOP.

IF SY-SUBRC = 0.
MESSAGE S132.
set screen 0.
leave screen.
ENDIF.

***when back leave screen
ELSEIF OK_CODE = 'OUT'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = text-003
TEXT_QUESTION = text-004
DEFAULT_BUTTON = '2'
DISPLAY_CANCEL_BUTTON = ' '
IMPORTING
ANSWER = w_ans
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF w_ans = '1'.
set screen 0.
leave screen.
ELSE.
leave screen.
ENDIF.
endif.
ENDFORM. "USER_COMMAND
*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE_DB *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE_DB.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_top_of_page
i_logo = ' '.
ENDFORM. "top_of_page_db

*&--------------------------------------------------------------------*
*& Form MATNR_FORMAT
*&--------------------------------------------------------------------*
* MATNR FORMAT
*---------------------------------------------------------------------*
FORM MATNR_FORMAT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = WA_podat-MATNR
IMPORTING
OUTPUT = WA_podat-MATNR.
ENDFORM.

Report of STOs having Delivery Note Qty less than Received Qty

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

REPORT ZVVF_MR025_WEIGHBRIDGE_STOLIST no standard page heading line-size
110 MESSAGE-ID ZMM .

*----------------------------------------------------------------------
** Module Sales *
*----------------------------------------------------------------------
** Objective: Report of STOs having Delivery Note Qty
**less than Received Qty
** Program : Updates tables ( ) Download data ( )
** Output Lists (X) ALV
**
---------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS : slis.
*---------------------------------------------------------------------*
**TABLES :
*---------------------------------------------------------------------*
TABLES : ZVVF_MT25_BRIDG1, " Weigh Bridge Posted POs Details
ekpo, " Purchasing Document Item
MKPF. " Header: Material Document

*---------------------------------------------------------------------*
**CONSTANTS :
*---------------------------------------------------------------------*
*--- For ALV ----*
CONSTANTS: c_top_of_page_db TYPE slis_formname VALUE 'TOP_OF_PAGE_DB'.

*---------------------------------------------------------------------*
**DATA :
*---------------------------------------------------------------------*
DATA : W_REPID LIKE SY-REPID,
W_ANS type n,
w_ok like sy-ucomm,
W_MODE LIKE CTU_PARAMS-DISMODE.

*---------------------------------------------------------------------*
**INTERNAL TABLES :
*---------------------------------------------------------------------*
*--- For ALV ----*
DATA: it_list_top_of_page TYPE slis_t_listheader,
it_events TYPE slis_t_event,
it_fieldcat TYPE slis_t_fieldcat_alv.
*---------------*
DATA: IT_PODAT TYPE TABLE OF ZVVF_MT25_BRIDG1 WITH HEADER LINE.
*---------------------------------------------------------------------*
**WORK AREAS
*---------------------------------------------------------------------*
DATA: WA_PODAT LIKE LINE OF IT_PODAT,
WA_layout TYPE slis_layout_alv. " For ALV

*---------------------------------------------------------------------*
**SELECTION SCREEN
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
select-options : so_DATE for MKPF-BUDAT obligatory.
SELECTION-SCREEN END OF BLOCK MAIN .

*---------------------------------------------------------------------*
**INITIALIZATION :
*---------------------------------------------------------------------*
INITIALIZATION.

w_repid = SY-REPID.
*---------------------------------------------------------------------*
**AT SELECTION SCREEN :
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM Check_DATA.

*---------------------------------------------------------------------*
**START OF SELECTION :
*---------------------------------------------------------------------*
START-OF-SELECTION.

LOOP AT IT_podat INTO WA_podat.
PERFORM MATNR_FORMAT.
MODIFY IT_podat FROM WA_podat TRANSPORTING MATNR.
endloop.

*---------------------------------------------------------------------*
**END OF SELECTION :
*---------------------------------------------------------------------*
END-OF-SELECTION.

PERFORM fieldcat_init USING it_fieldcat[].
PERFORM eventtab_build USING it_events[].
PERFORM comment_build USING it_list_top_of_page[].
PERFORM layout_build USING WA_layout.
PERFORM write_alv_grid.

*&---------------------------------------------------------------------*
*& Form Check_DATA
*&---------------------------------------------------------------------*
FORM Check_DATA.

**SELECT POS having Delivery Note Qty
**less than Received Qty


select * from ZVVF_MT25_BRIDG1 into corresponding fields of table
it_podat where BUDAT in so_DATE .

loop at it_podat into wa_podat.
if not wa_podat-lsmng lt wa_podat-menge.
delete it_podat index sy-tabix.
endif.
endloop.


IF it_podat[] is initial.
MESSAGE E005.
ENDIF.
endform. "Check_DATA

*&--------------------------------------------------------------------*
*& Form fieldcat_init
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->IT_FIELDCATtext
*---------------------------------------------------------------------*
FORM fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
DATA :w_pos TYPE i VALUE 0.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-seltext_m = 'Plant'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_m = 'PO No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-seltext_m = 'PO Item'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = 'Material'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LSMNG'.
wa_fieldcat-seltext_m = 'Delivered Qty.'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MENGE'.
wa_fieldcat-seltext_m = 'Received Qty.'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-seltext_m = 'UOM'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '5'.
APPEND wa_fieldcat TO lt_fieldcat.


* w_pos = w_pos + 1.
* CLEAR wa_fieldcat.
* wa_fieldcat-col_pos = w_pos.
* wa_fieldcat-tabname = 'IT_PODAT'.
* wa_fieldcat-fieldname = 'ZBLCK'.
* wa_fieldcat-seltext_m = 'Block Memo'.
* wa_fieldcat-emphasize = 'C410'.
* wa_fieldcat-outputlen = '1'.
* wa_fieldcat-checkbox = 'X'.
* APPEND wa_fieldcat TO lt_fieldcat.
*
* w_pos = w_pos + 1.
* CLEAR wa_fieldcat.
* wa_fieldcat-col_pos = w_pos.
* wa_fieldcat-tabname = 'IT_PODAT'.
* wa_fieldcat-fieldname = 'ZPOST'.
* wa_fieldcat-seltext_m = 'Post Memo'.
* wa_fieldcat-emphasize = 'C410'.
* wa_fieldcat-outputlen = '1'.
* wa_fieldcat-checkbox = 'X'.
* APPEND wa_fieldcat TO lt_fieldcat.

ENDFORM. " fieldcat_init

*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_EVENTS[] text
*----------------------------------------------------------------------*
FORM eventtab_build USING lt_events TYPE slis_t_event.
DATA: wa_event TYPE slis_alv_event.
DATA: c_top_of_page TYPE slis_formname.

c_top_of_page = c_top_of_page_db.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO wa_event.
IF sy-subrc <> 0.
MOVE c_top_of_page TO wa_event-form.
APPEND wa_event TO lt_events.
ELSE.
MOVE c_top_of_page TO wa_event-form.
MODIFY lt_events FROM wa_event INDEX sy-tabix .
ENDIF.

ENDFORM. " eventtab_build

*&---------------------------------------------------------------------*
*& Form comment_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_LIST_TOP_OF_PAGE[] text
*----------------------------------------------------------------------*
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'VVF LTD. Mumbai'.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = SY-ULINE.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info =
'List of POs having Delivered Qty Less than Received Qty'.
APPEND wa_line TO lt_top_of_page.

ENDFORM. " comment_build

*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_layout text
*----------------------------------------------------------------------*
FORM layout_build USING wa_layout TYPE slis_layout_alv.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
* wa_layout-edit = 'X'.
ENDFORM. " layout_build

*&---------------------------------------------------------------------*
*& Form write_alv_grid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM write_alv_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_PF_STATUS_SET = 'PF_STATUS'
i_background_id = 'ALV_BACKGROUND'
I_CALLBACK_TOP_OF_PAGE = c_top_of_page_db
is_layout = WA_layout
it_fieldcat = it_fieldcat[]
it_events = it_events[]
i_save = 'A'
* I_DEFAULT = 'X'
TABLES
t_outtab = IT_PODAT
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.





ENDFORM. " write_alv_grid

*&---------------------------------------------------------------------*
*& Form PF_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PF_STATUS using extab type slis_t_extab.

SET PF-STATUS 'ZSTANDARD1'
.

ENDFORM. "PF_STATUS
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM USER_COMMAND using OK_CODE type SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.

IF OK_CODE = '&DATA_SAVE'.
***blocking memo
LOOP AT IT_PODAT INTO WA_PODAT .

UPDATE ZVVF_MT25_BRIDGE SET
ZBLCK = WA_PODAT-ZBLCK
WHERE EBELN = WA_PODAT-EBELN AND
EBELP = WA_PODAT-EBELP .

ENDLOOP.

IF SY-SUBRC = 0.
MESSAGE S131.
set screen 0.
leave screen.
ENDIF.

***when back leave screen
ELSEIF OK_CODE = 'OUT'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = text-003
TEXT_QUESTION = text-004
DEFAULT_BUTTON = '2'
DISPLAY_CANCEL_BUTTON = ' '
IMPORTING
ANSWER = w_ans
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF w_ans = '1'.
set screen 0.
leave screen.
ELSE.
leave screen.
ENDIF.
endif.
ENDFORM. "USER_COMMAND
*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE_DB *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE_DB.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_top_of_page
i_logo = ' '.
ENDFORM. "top_of_page_db

*&--------------------------------------------------------------------*
*& Form MATNR_FORMAT
*&--------------------------------------------------------------------*
* MATNR FORMAT
*---------------------------------------------------------------------*
FORM MATNR_FORMAT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = WA_podat-MATNR
IMPORTING
OUTPUT = WA_podat-MATNR.
ENDFORM.

UnBlock OBD for Updating Batch

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

REPORT ZVVF_MR025_WEIGHBRIDGE_SDBLOCK no standard page heading line-size
110 MESSAGE-ID ZMM .

*----------------------------------------------------------------------
** Module Sales *
*----------------------------------------------------------------------
** Objective: UnBlock OBD for Updating Batch
** Program : Updates tables ( ) Download data ( )
** Output Lists (X) ALV
**

**---------------------------------------------------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS : slis.
*---------------------------------------------------------------------*
**TABLES :
*---------------------------------------------------------------------*
TABLES : ZVVF_MT25_OUTMOV, "Weigh Bridge Down Loaded Details
ekpo, " Purchasing Document Item
MKPF. " Header: Material Document
*---------------------------------------------------------------------*
**CONSTANTS :
*---------------------------------------------------------------------*
*--- For ALV ----*
CONSTANTS: c_top_of_page_db TYPE slis_formname VALUE 'TOP_OF_PAGE_DB'.

*---------------------------------------------------------------------*
**DATA :
*---------------------------------------------------------------------*
DATA : W_REPID LIKE SY-REPID,
W_ANS type n,
w_ok like sy-ucomm,
W_MODE LIKE CTU_PARAMS-DISMODE.

*---------------------------------------------------------------------*
**INTERNAL TABLES :
*---------------------------------------------------------------------*
*--- For ALV ----*
DATA: it_list_top_of_page TYPE slis_t_listheader,
it_events TYPE slis_t_event,
it_fieldcat TYPE slis_t_fieldcat_alv.
*---------------*
DATA: IT_PODAT TYPE TABLE OF ZVVF_MT25_OUTMOV WITH HEADER LINE.
*---------------------------------------------------------------------*
**WORK AREAS
*---------------------------------------------------------------------*
DATA: WA_PODAT LIKE LINE OF IT_PODAT,
WA_layout TYPE slis_layout_alv. " For ALV

*---------------------------------------------------------------------*
**SELECTION SCREEN
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
select-options : so_DATE for ZVVF_MT25_OUTMOV-zdate obligatory.
SELECTION-SCREEN END OF BLOCK MAIN .

*---------------------------------------------------------------------*
**INITIALIZATION :
*---------------------------------------------------------------------*
INITIALIZATION.

w_repid = SY-REPID.
*---------------------------------------------------------------------*
**AT SELECTION SCREEN :
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM Check_DATA.

*---------------------------------------------------------------------*
**START OF SELECTION :
*---------------------------------------------------------------------*
START-OF-SELECTION.

*LOOP AT IT_podat INTO WA_podat.
*PERFORM MATNR_FORMAT.
*MODIFY IT_podat FROM WA_podat TRANSPORTING MATNR.
*endloop.

*---------------------------------------------------------------------*
**END OF SELECTION :
*---------------------------------------------------------------------*
END-OF-SELECTION.

PERFORM fieldcat_init USING it_fieldcat[].
PERFORM eventtab_build USING it_events[].
PERFORM comment_build USING it_list_top_of_page[].
PERFORM layout_build USING WA_layout.
PERFORM write_alv_grid.

*&---------------------------------------------------------------------*
*& Form Check_DATA
*&---------------------------------------------------------------------*
FORM Check_DATA.

**Select all credit memo which are not yet posted

select * from ZVVF_MT25_OUTMOV into corresponding fields of table
it_podat where
zdate in so_DATE AND
Zupdt NE 'X' and
zblck = 'X' and
vbeln ne ' ' AND
GMENGE NE ' ' AND
TMENGE NE ' ' .
IF SY-SUBRC NE 0.
MESSAGE E005.
ENDIF.
endform. "Check_DATA

*&--------------------------------------------------------------------*
*& Form fieldcat_init
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->IT_FIELDCATtext
*---------------------------------------------------------------------*
FORM fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
DATA :w_pos TYPE i VALUE 0.



w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZBLCK'.
wa_fieldcat-seltext_m = 'UnBlock OBD'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '1'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-EDIT = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_m = 'Delivery No'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-seltext_m = 'Plant'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'GMENGE'.
wa_fieldcat-seltext_m = 'Gross Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'TMENGE'.
wa_fieldcat-seltext_m = 'Tare Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZLFIMG'.
wa_fieldcat-seltext_m = 'Net Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LFIMG'.
wa_fieldcat-seltext_m = 'Outbond Delivery Qty'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


ENDFORM. " fieldcat_init

*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_EVENTS[] text
*----------------------------------------------------------------------*
FORM eventtab_build USING lt_events TYPE slis_t_event.
DATA: wa_event TYPE slis_alv_event.
DATA: c_top_of_page TYPE slis_formname.

c_top_of_page = c_top_of_page_db.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO wa_event.
IF sy-subrc <> 0.
MOVE c_top_of_page TO wa_event-form.
APPEND wa_event TO lt_events.
ELSE.
MOVE c_top_of_page TO wa_event-form.
MODIFY lt_events FROM wa_event INDEX sy-tabix .
ENDIF.

ENDFORM. " eventtab_build

*&---------------------------------------------------------------------*
*& Form comment_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_LIST_TOP_OF_PAGE[] text
*----------------------------------------------------------------------*
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'VVF LTD. Mumbai'.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = SY-ULINE.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = 'UnBlock PO for Updating Batch'.
APPEND wa_line TO lt_top_of_page.

ENDFORM. " comment_build

*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_layout text
*----------------------------------------------------------------------*
FORM layout_build USING wa_layout TYPE slis_layout_alv.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
* wa_layout-edit = 'X'.
ENDFORM. " layout_build

*&---------------------------------------------------------------------*
*& Form write_alv_grid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM write_alv_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_PF_STATUS_SET = 'PF_STATUS'
i_background_id = 'ALV_BACKGROUND'
I_CALLBACK_TOP_OF_PAGE = c_top_of_page_db
is_layout = WA_layout
it_fieldcat = it_fieldcat[]
it_events = it_events[]
i_save = 'A'
* I_DEFAULT = 'X'
TABLES
t_outtab = IT_PODAT
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.





ENDFORM. " write_alv_grid

*&---------------------------------------------------------------------*
*& Form PF_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PF_STATUS using extab type slis_t_extab.

SET PF-STATUS 'ZSTANDARD1'
.

ENDFORM. "PF_STATUS
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM USER_COMMAND using OK_CODE type SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.

IF OK_CODE = '&DATA_SAVE'.
***blocking memo
LOOP AT IT_PODAT INTO WA_PODAT .

UPDATE ZVVF_MT25_OUTMOV SET
ZBLCK = WA_PODAT-ZBLCK
WHERE VBELN = WA_PODAT-VBELN AND
WERKS = WA_PODAT-WERKS .

ENDLOOP.

IF SY-SUBRC = 0.
MESSAGE S131.
set screen 0.
leave screen.
ENDIF.

***when back leave screen
ELSEIF OK_CODE = 'OUT'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = text-003
TEXT_QUESTION = text-004
DEFAULT_BUTTON = '2'
DISPLAY_CANCEL_BUTTON = ' '
IMPORTING
ANSWER = w_ans
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF w_ans = '1'.
set screen 0.
leave screen.
ELSE.
leave screen.
ENDIF.
endif.
ENDFORM. "USER_COMMAND
*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE_DB *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE_DB.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_top_of_page
i_logo = ' '.
ENDFORM. "top_of_page_db

*&--------------------------------------------------------------------*
*& Form MATNR_FORMAT
*&--------------------------------------------------------------------*
* MATNR FORMAT
*---------------------------------------------------------------------*
FORM MATNR_FORMAT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = WA_podat-MATNR
IMPORTING
OUTPUT = WA_podat-MATNR.
ENDFORM.

OBD Status Report

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

REPORT ZVVF_MR025_WEIGHBRIDGE_SDDSPLY no standard page heading line-size
110 MESSAGE-ID ZMM .

*----------------------------------------------------------------------
** Module Sales *
*----------------------------------------------------------------------
** Objective: OBD Status Report
** Program : Updates tables ( ) Download data ( )
** Output Lists (X) ALV
**

**---------------------------------------------------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS : slis.
*---------------------------------------------------------------------*
**TABLES :
*---------------------------------------------------------------------*
TABLES : ZVVF_MT25_OUTMOV, "Weigh Bridge Down Loaded Details
ekpo, " Purchasing Document Item
MKPF. " Header: Material Document
*---------------------------------------------------------------------*
**CONSTANTS :
*---------------------------------------------------------------------*
*--- For ALV ----*
CONSTANTS: c_top_of_page_db TYPE slis_formname VALUE 'TOP_OF_PAGE_DB'.

*---------------------------------------------------------------------*
**DATA :
*---------------------------------------------------------------------*
DATA : W_REPID LIKE SY-REPID,
W_ANS type n,
w_ok like sy-ucomm,
W_MODE LIKE CTU_PARAMS-DISMODE.

*---------------------------------------------------------------------*
**INTERNAL TABLES :
*---------------------------------------------------------------------*
*--- For ALV ----*
DATA: it_list_top_of_page TYPE slis_t_listheader,
it_events TYPE slis_t_event,
it_fieldcat TYPE slis_t_fieldcat_alv.
*---------------*
DATA: IT_PODAT TYPE TABLE OF ZVVF_MT25_OUTMOV WITH HEADER LINE.
*---------------------------------------------------------------------*
**WORK AREAS
*---------------------------------------------------------------------*
DATA: WA_PODAT LIKE LINE OF IT_PODAT,
WA_layout TYPE slis_layout_alv. " For ALV

*---------------------------------------------------------------------*
**SELECTION SCREEN
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
select-options : so_DATE for MKPF-BUDAT obligatory.
SELECTION-SCREEN END OF BLOCK MAIN .

*---------------------------------------------------------------------*
**INITIALIZATION :
*---------------------------------------------------------------------*
INITIALIZATION.

w_repid = SY-REPID.
*---------------------------------------------------------------------*
**AT SELECTION SCREEN :
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM Check_DATA.

*---------------------------------------------------------------------*
**START OF SELECTION :
*---------------------------------------------------------------------*
START-OF-SELECTION.
LOOP AT IT_podat INTO WA_podat.
PERFORM MATNR_FORMAT.
MODIFY IT_podat FROM WA_podat TRANSPORTING MATNR.
endloop.

*---------------------------------------------------------------------*
**END OF SELECTION :
*---------------------------------------------------------------------*
END-OF-SELECTION.

PERFORM fieldcat_init USING it_fieldcat[].
PERFORM eventtab_build USING it_events[].
PERFORM comment_build USING it_list_top_of_page[].
PERFORM layout_build USING WA_layout.
PERFORM write_alv_grid.

*&---------------------------------------------------------------------*
*& Form Check_DATA
*&---------------------------------------------------------------------*
FORM Check_DATA.

**Select all credit memo which are not yet posted

select * from ZVVF_MT25_OUTMOV into corresponding fields of table
it_podat where
ZDATE in so_DATE.
IF SY-SUBRC NE 0.
MESSAGE E005.
ENDIF.
endform. "Check_DATA

*&--------------------------------------------------------------------*
*& Form fieldcat_init
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->IT_FIELDCATtext
*---------------------------------------------------------------------*
FORM fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
DATA :w_pos TYPE i VALUE 0.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZPOST'.
wa_fieldcat-seltext_m = 'OBD Posted to WeighBridge' .
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '20'.
wa_fieldcat-checkbox = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZDOWN'.
wa_fieldcat-seltext_m = 'Downloaded OBD' .
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '1'.
wa_fieldcat-checkbox = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZUPDT'.
wa_fieldcat-seltext_m = 'Batch Updated OBD' .
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '1'.
wa_fieldcat-checkbox = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZBLCK'.
wa_fieldcat-seltext_m = 'Blocked OBD' .
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '1'.
wa_fieldcat-checkbox = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_m = 'Delivery No'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-seltext_m = 'Plant'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'GMENGE'.
wa_fieldcat-seltext_m = 'Gross Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'TMENGE'.
wa_fieldcat-seltext_m = 'Tare Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZLFIMG'.
wa_fieldcat-seltext_m = 'Net Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LFIMG'.
wa_fieldcat-seltext_m = 'Outbond Delivery Qty'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZSLIPNO'.
wa_fieldcat-seltext_m = 'Weighslip No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


ENDFORM. " fieldcat_init

*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_EVENTS[] text
*----------------------------------------------------------------------*
FORM eventtab_build USING lt_events TYPE slis_t_event.
DATA: wa_event TYPE slis_alv_event.
DATA: c_top_of_page TYPE slis_formname.

c_top_of_page = c_top_of_page_db.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO wa_event.
IF sy-subrc <> 0.
MOVE c_top_of_page TO wa_event-form.
APPEND wa_event TO lt_events.
ELSE.
MOVE c_top_of_page TO wa_event-form.
MODIFY lt_events FROM wa_event INDEX sy-tabix .
ENDIF.

ENDFORM. " eventtab_build

*&---------------------------------------------------------------------*
*& Form comment_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_LIST_TOP_OF_PAGE[] text
*----------------------------------------------------------------------*
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'VVF LTD. Mumbai'.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = SY-ULINE.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = 'OBD Status Report'.
APPEND wa_line TO lt_top_of_page.

ENDFORM. " comment_build

*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_layout text
*----------------------------------------------------------------------*
FORM layout_build USING wa_layout TYPE slis_layout_alv.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
* wa_layout-edit = 'X'.
ENDFORM. " layout_build

*&---------------------------------------------------------------------*
*& Form write_alv_grid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM write_alv_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
* i_callback_user_command = 'USER_COMMAND'
* i_callback_PF_STATUS_SET = 'PF_STATUS'
i_background_id = 'ALV_BACKGROUND'
I_CALLBACK_TOP_OF_PAGE = c_top_of_page_db
is_layout = WA_layout
it_fieldcat = it_fieldcat[]
it_events = it_events[]
* i_save = 'A'
* I_DEFAULT = 'X'
TABLES
t_outtab = IT_PODAT
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


ENDFORM. " write_alv_grid

*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE_DB *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE_DB.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_top_of_page
i_logo = ' '.
ENDFORM. "top_of_page_db

*&--------------------------------------------------------------------*
*& Form MATNR_FORMAT
*&--------------------------------------------------------------------*
* MATNR FORMAT
*---------------------------------------------------------------------*
FORM MATNR_FORMAT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = WA_podat-MATNR
IMPORTING
OUTPUT = WA_podat-MATNR.
ENDFORM.

Block OBD from Updating Batch

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

REPORT ZVVF_MR025_WEIGHBRIDGE_SDBLOCK no standard page heading line-size
110 MESSAGE-ID ZMM .

*----------------------------------------------------------------------
** Module Sales *
*----------------------------------------------------------------------
** Objective: Block OBD from Updating Batch
** Program : Updates tables ( ) Download data ( )
** Output Lists (X) ALV
**

**---------------------------------------------------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS : slis.
*---------------------------------------------------------------------*
**TABLES :
*---------------------------------------------------------------------*
TABLES : ZVVF_MT25_OUTMOV, "Weigh Bridge Down Loaded Details
ekpo, " Purchasing Document Item
MKPF. " Header: Material Document
*---------------------------------------------------------------------*
**CONSTANTS :
*---------------------------------------------------------------------*
*--- For ALV ----*
CONSTANTS: c_top_of_page_db TYPE slis_formname VALUE 'TOP_OF_PAGE_DB'.

*---------------------------------------------------------------------*
**DATA :
*---------------------------------------------------------------------*
DATA : W_REPID LIKE SY-REPID,
W_ANS type n,
w_ok like sy-ucomm,
W_MODE LIKE CTU_PARAMS-DISMODE.

*---------------------------------------------------------------------*
**INTERNAL TABLES :
*---------------------------------------------------------------------*
*--- For ALV ----*
DATA: it_list_top_of_page TYPE slis_t_listheader,
it_events TYPE slis_t_event,
it_fieldcat TYPE slis_t_fieldcat_alv.
*---------------*
DATA: IT_PODAT TYPE TABLE OF ZVVF_MT25_OUTMOV WITH HEADER LINE.
*---------------------------------------------------------------------*
**WORK AREAS
*---------------------------------------------------------------------*
DATA: WA_PODAT LIKE LINE OF IT_PODAT,
WA_layout TYPE slis_layout_alv. " For ALV

*---------------------------------------------------------------------*
**SELECTION SCREEN
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
select-options : so_DATE for ZVVF_MT25_OUTMOV-zdate obligatory.
SELECTION-SCREEN END OF BLOCK MAIN .

*---------------------------------------------------------------------*
**INITIALIZATION :
*---------------------------------------------------------------------*
INITIALIZATION.

w_repid = SY-REPID.
*---------------------------------------------------------------------*
**AT SELECTION SCREEN :
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM Check_DATA.

*---------------------------------------------------------------------*
**START OF SELECTION :
*---------------------------------------------------------------------*
START-OF-SELECTION.

*LOOP AT IT_podat INTO WA_podat.
*PERFORM MATNR_FORMAT.
*MODIFY IT_podat FROM WA_podat TRANSPORTING MATNR.
*endloop.

*---------------------------------------------------------------------*
**END OF SELECTION :
*---------------------------------------------------------------------*
END-OF-SELECTION.

PERFORM fieldcat_init USING it_fieldcat[].
PERFORM eventtab_build USING it_events[].
PERFORM comment_build USING it_list_top_of_page[].
PERFORM layout_build USING WA_layout.
PERFORM write_alv_grid.

*&---------------------------------------------------------------------*
*& Form Check_DATA
*&---------------------------------------------------------------------*
FORM Check_DATA.

**Select all OBD which are not yet posted

select * from ZVVF_MT25_OUTMOV into corresponding fields of table
it_podat where
zdate in so_DATE AND
Zupdt NE 'X' and
zblck = ' ' and
vbeln ne ' ' AND
GMENGE NE ' ' AND
TMENGE NE ' ' .


IF SY-SUBRC NE 0.
MESSAGE E005.
ENDIF.
endform. "Check_DATA

*&--------------------------------------------------------------------*
*& Form fieldcat_init
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->IT_FIELDCATtext
*---------------------------------------------------------------------*
FORM fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
DATA :w_pos TYPE i VALUE 0.



w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZBLCK'.
wa_fieldcat-seltext_m = 'Block OBD'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '1'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-EDIT = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_m = 'Delivery No'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-seltext_m = 'Plant'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'GMENGE'.
wa_fieldcat-seltext_m = 'Gross Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'TMENGE'.
wa_fieldcat-seltext_m = 'Tare Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'ZLFIMG'.
wa_fieldcat-seltext_m = 'Net Wt.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LFIMG'.
wa_fieldcat-seltext_m = 'Outbond Delivery Qty'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


ENDFORM. " fieldcat_init

*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_EVENTS[] text
*----------------------------------------------------------------------*
FORM eventtab_build USING lt_events TYPE slis_t_event.
DATA: wa_event TYPE slis_alv_event.
DATA: c_top_of_page TYPE slis_formname.

c_top_of_page = c_top_of_page_db.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO wa_event.
IF sy-subrc <> 0.
MOVE c_top_of_page TO wa_event-form.
APPEND wa_event TO lt_events.
ELSE.
MOVE c_top_of_page TO wa_event-form.
MODIFY lt_events FROM wa_event INDEX sy-tabix .
ENDIF.

ENDFORM. " eventtab_build

*&---------------------------------------------------------------------*
*& Form comment_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_it_LIST_TOP_OF_PAGE[] text
*----------------------------------------------------------------------*
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'VVF LTD. Mumbai'.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = SY-ULINE.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = 'Block PO from Updating Batch'.
APPEND wa_line TO lt_top_of_page.

ENDFORM. " comment_build

*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_layout text
*----------------------------------------------------------------------*
FORM layout_build USING wa_layout TYPE slis_layout_alv.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
* wa_layout-edit = 'X'.
ENDFORM. " layout_build

*&---------------------------------------------------------------------*
*& Form write_alv_grid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM write_alv_grid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = w_repid i_callback_user_command = 'USER_COMMAND' i_callback_PF_STATUS_SET = 'PF_STATUS' i_background_id = 'ALV_BACKGROUND' I_CALLBACK_TOP_OF_PAGE = c_top_of_page_db is_layout = WA_layout it_fieldcat = it_fieldcat[] it_events = it_events[] i_save = 'A' * I_DEFAULT = 'X' TABLES t_outtab = IT_PODAT EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.





ENDFORM. " write_alv_grid

*&---------------------------------------------------------------------*
*& Form PF_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PF_STATUS using extab type slis_t_extab.

SET PF-STATUS 'ZSTANDARD1'
.

ENDFORM. "PF_STATUS
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM USER_COMMAND using OK_CODE type SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.

IF OK_CODE = '&DATA_SAVE'.
***blocking memo
LOOP AT IT_PODAT INTO WA_PODAT .

UPDATE ZVVF_MT25_OUTMOV SET
ZBLCK = WA_PODAT-ZBLCK
WHERE vbeln = WA_PODAT-VBELN AND
werks = WA_PODAT-werks .

ENDLOOP.

IF SY-SUBRC = 0.
MESSAGE S131.
set screen 0.
leave screen.
ENDIF.

***when back leave screen
ELSEIF OK_CODE = 'OUT'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = text-003
TEXT_QUESTION = text-004
DEFAULT_BUTTON = '2'
DISPLAY_CANCEL_BUTTON = ' '
IMPORTING
ANSWER = w_ans
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF w_ans = '1'.
set screen 0.
leave screen.
ELSE.
leave screen.
ENDIF.
endif.
ENDFORM. "USER_COMMAND
*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE_DB *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE_DB.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_top_of_page
i_logo = ' '.
ENDFORM. "top_of_page_db

*&--------------------------------------------------------------------*
*& Form MATNR_FORMAT
*&--------------------------------------------------------------------*
* MATNR FORMAT
*---------------------------------------------------------------------*
FORM MATNR_FORMAT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = WA_podat-MATNR
IMPORTING
OUTPUT = WA_podat-MATNR.
ENDFORM.

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)