Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


create a Report to print Stock & Valuated Stock for Plant
(ALV Grid)

Selection Screen Ranges:
Material Number (MARA-MATNR)
Material Type (MARA-MTART)
Valuation Class (MBEW-BKLAS)
Storage Location (MARD-LGORT)
Parameter filed plant (MARD-WERKS)

Selection condition:

Total valuated stock – MBEW-LBKUM – should be greater than
zero

Table to be used MAKT,MARD,MBEW,MARA,T001L.. (Use inner
joins)

Display output:
Storage location: (TOO1L-LGORT) Description (T001L-LGOBE)

Material No (MARA-MATNR), Material Description (MAKT-
MAKTX), Total valuated stock (MBEW-LBKUM), Val of tot
valuated stock (MBEW-SALK3),

IF MBEW-VPRSV = 'S'.
Price – MBEW-STPRS
ELSEIF DTAB-VPRSV = 'V'.
Price – MBEW-VERPR.
ENDIF.

Subtotal of Total valuated stock (MBEW-LBKUM), Val of tot
valuated stock (MBEW-SALK3),

Grand Total of Total valuated stock (MBEW-LBKUM), Val of
tot valuated stock (MBEW-SALK3),


In the ALV grid display keep a button in the tool bar which
on clicking navigates through the screen to the next grid
which displays the grand total.

Use SET PF_STATUS which is in the FM
reuse_alv_grid_display to set the button.



create a Report to print Stock & Valuated Stock for Plant (ALV Grid) Selection Screen Range..

Answer / bad boy

REPORT Z_FD_PURCHASE_ORDER_FREIGHT.

*type pools declarations
TYPE-POOLS: SLIS.

*table declarations
TABLES : MAKT,MARD,MBEW,MARA,T001L.

*structure declaration
TYPES:BEGIN OF Z_STOCK ,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
LBKUM LIKE MBEW-LBKUM,
SALK3 LIKE MBEW-SALK3,
LGORT LIKE T001L-LGORT,
LGOBE LIKE T001L-LGOBE,
VPRSV LIKE MBEW-VPRSV ,
STPRS LIKE MBEW-STPRS ,
VERPR LIKE MBEW-VERPR,
END OF Z_STOCK.

*internal table declarations
DATA :Z_LI_ITAB TYPE TABLE OF Z_STOCK,
Z_LWA_ITAB LIKE LINE OF Z_LI_ITAB.

*alv declarations
DATA : Z_LWA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
Z_LI_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
Z_LI_SORT TYPE SLIS_T_SORTINFO_ALV,
Z_LWA_SORT LIKE LINE OF Z_LI_SORT,
Z_LWA_FLDCAT TYPE SLIS_FIELDCAT_ALV,
Z_LI_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.

*select-options
SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE
TEXT-001.
SELECT-OPTIONS :Z_S_MATR FOR MARA-MATNR,"MATERIAL NUMBER
Z_S_MTAT FOR MARA-MTART,"MATERIAL TYPE
Z_S_BKLS FOR MBEW-BKLAS,"VALUATION CLASS
Z_S_LGOT FOR MARD-LGORT,"STORAGE LOCATION
Z_S_WERS FOR MARD-WERKS."PARAMETER FILED
PLANT
SELECTION-SCREEN : END OF BLOCK BLK1.

START-OF-SELECTION.

SELECT A~MATNR T~MAKTX W~LBKUM W~SALK3 L~LGORT L~LGOBE
W~VPRSV W~STPRS W~VERPR INTO Z_LWA_ITAB
FROM MARA AS A JOIN MBEW AS W ON W~MATNR = A~MATNR
JOIN MAKT AS T ON T~MATNR = W~MATNR
JOIN MARD AS D ON D~MATNR = T~MATNR
JOIN T001L AS L ON L~LGORT = D~LGORT
WHERE A~MATNR IN Z_S_MATR AND
A~MTART IN Z_S_MTAT AND
W~BKLAS IN Z_S_BKLS AND
D~LGORT IN Z_S_LGOT AND
D~WERKS IN Z_S_WERS AND
W~LBKUM > 0 GROUP BY A~MATNR T~MAKTX W~LBKUM W~SALK3
L~LGORT L~LGOBE W~VPRSV W~STPRS W~VERPR.

IF Z_LWA_ITAB-VPRSV = 'S'.
APPEND Z_LWA_ITAB TO Z_LI_ITAB.
ENDIF.

ENDSELECT.

SELECT A~MATNR T~MAKTX W~LBKUM W~SALK3 L~LGORT L~LGOBE
W~VPRSV W~STPRS W~VERPR INTO Z_LWA_ITAB
FROM MARA AS A JOIN MBEW AS W ON W~MATNR = A~MATNR
JOIN MAKT AS T ON T~MATNR = W~MATNR
JOIN MARD AS D ON D~MATNR = T~MATNR
JOIN T001L AS L ON L~LGORT = D~LGORT
WHERE A~MATNR IN Z_S_MATR AND
A~MTART IN Z_S_MTAT AND
W~BKLAS IN Z_S_BKLS AND
D~LGORT IN Z_S_LGOT AND
D~WERKS IN Z_S_WERS AND
W~LBKUM > 0 GROUP BY A~MATNR T~MAKTX W~LBKUM W~SALK3
L~LGORT L~LGOBE W~VPRSV W~STPRS W~VERPR.

IF Z_LWA_ITAB-VPRSV = 'V'.
APPEND Z_LWA_ITAB TO Z_LI_ITAB.
ENDIF.

ENDSELECT.

DELETE ADJACENT DUPLICATES FROM Z_LI_ITAB.


Z_LWA_FIELDCAT-FIELDNAME = 'MATNR'.
Z_LWA_FIELDCAT-SELTEXT_M = 'MATERIAL NUMBER'.
Z_LWA_FIELDCAT-COL_POS = 0.
Z_LWA_FIELDCAT-OUTPUTLEN = 20.

APPEND Z_LWA_FIELDCAT TO Z_LI_FIELDCAT.
CLEAR Z_LWA_FIELDCAT.

Z_LWA_FIELDCAT-FIELDNAME = 'MAKTX'.
Z_LWA_FIELDCAT-SELTEXT_M = 'MATERIAL DESCRIPTION'.
Z_LWA_FIELDCAT-COL_POS = 1.
Z_LWA_FIELDCAT-OUTPUTLEN = 28.

APPEND Z_LWA_FIELDCAT TO Z_LI_FIELDCAT.
CLEAR Z_LWA_FIELDCAT.

Z_LWA_FIELDCAT-FIELDNAME = 'LBKUM'.
Z_LWA_FIELDCAT-SELTEXT_M = 'TOTAL VALUATED STOCK'.
Z_LWA_FIELDCAT-COL_POS = 2.
Z_LWA_FIELDCAT-OUTPUTLEN = 19.

APPEND Z_LWA_FIELDCAT TO Z_LI_FIELDCAT.
CLEAR Z_LWA_FIELDCAT.

Z_LWA_FIELDCAT-FIELDNAME = 'SALK3'.
Z_LWA_FIELDCAT-SELTEXT_M = 'VAL OF TOT VALUATED STOCK'.
Z_LWA_FIELDCAT-COL_POS = 3.
Z_LWA_FIELDCAT-OUTPUTLEN = 25.

APPEND Z_LWA_FIELDCAT TO Z_LI_FIELDCAT.
CLEAR Z_LWA_FIELDCAT.

Z_LWA_FIELDCAT-FIELDNAME = 'LGORT'.
Z_LWA_FIELDCAT-SELTEXT_M = 'STORAGE LOCATION'.
Z_LWA_FIELDCAT-COL_POS = 4.
Z_LWA_FIELDCAT-OUTPUTLEN = 15.

APPEND Z_LWA_FIELDCAT TO Z_LI_FIELDCAT.
CLEAR Z_LWA_FIELDCAT.

Z_LWA_FIELDCAT-FIELDNAME = 'LGOBE'.
Z_LWA_FIELDCAT-SELTEXT_M = 'DESCRIPTION'.
Z_LWA_FIELDCAT-COL_POS = 5.
Z_LWA_FIELDCAT-OUTPUTLEN = 16.

APPEND Z_LWA_FIELDCAT TO Z_LI_FIELDCAT.
CLEAR Z_LWA_FIELDCAT.

Z_LWA_FIELDCAT-FIELDNAME = 'VPRSV'.
Z_LWA_FIELDCAT-SELTEXT_M = 'PRICE CTRL'.
Z_LWA_FIELDCAT-COL_POS = 6.
Z_LWA_FIELDCAT-OUTPUTLEN = 20.

APPEND Z_LWA_FIELDCAT TO Z_LI_FIELDCAT.
CLEAR Z_LWA_FIELDCAT.

*call function 'reuse_alv_grid_display'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'DISPLAY'
I_CALLBACK_USER_COMMAND = 'UCOMM'
IT_FIELDCAT = Z_LI_FIELDCAT[]
I_GRID_TITLE = 'ALV LIST'
TABLES
T_OUTTAB = Z_LI_ITAB
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.

*form display
FORM DISPLAY USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'DISPLAY' EXCLUDING RT_EXTAB.
ENDFORM."endform.

*form ucomm
FORM UCOMM USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
SLIS_SELFIELD.

CASE R_UCOMM.
WHEN 'NO'.

Z_LWA_FLDCAT-FIELDNAME = 'MATNR'.
Z_LWA_FLDCAT-SELTEXT_M = 'MATERIAL NUMBER'.
Z_LWA_FLDCAT-COL_POS = 0.
Z_LWA_FLDCAT-OUTPUTLEN = 20.
APPEND Z_LWA_FLDCAT TO Z_LI_FLDCAT.
CLEAR Z_LWA_FLDCAT.

Z_LWA_FLDCAT-FIELDNAME = 'MAKTX'.
Z_LWA_FLDCAT-SELTEXT_M = 'MATERIAL DESCRIPTION'.
Z_LWA_FLDCAT-COL_POS = 1.
Z_LWA_FLDCAT-OUTPUTLEN = 28.
APPEND Z_LWA_FLDCAT TO Z_LI_FLDCAT.
CLEAR Z_LWA_FLDCAT.

Z_LWA_FLDCAT-FIELDNAME = 'LBKUM'.
Z_LWA_FLDCAT-SELTEXT_M = 'TOTAL VALUATED STOCK'.
Z_LWA_FLDCAT-COL_POS = 2.
Z_LWA_FLDCAT-OUTPUTLEN = 19.
Z_LWA_FLDCAT-DO_SUM = 'X'.
APPEND Z_LWA_FLDCAT TO Z_LI_FLDCAT.
CLEAR Z_LWA_FLDCAT.

Z_LWA_FLDCAT-FIELDNAME = 'SALK3'.
Z_LWA_FLDCAT-SELTEXT_M = 'VAL OF TOT VALUATED STOCK'.
Z_LWA_FLDCAT-COL_POS = 3.
Z_LWA_FLDCAT-OUTPUTLEN = 25.
Z_LWA_FLDCAT-DO_SUM = 'X'.
APPEND Z_LWA_FLDCAT TO Z_LI_FLDCAT.
CLEAR Z_LWA_FLDCAT.

Z_LWA_FLDCAT-FIELDNAME = 'LGORT'.
Z_LWA_FLDCAT-SELTEXT_M = 'STORAGE LOCATION'.
Z_LWA_FLDCAT-COL_POS = 4.
Z_LWA_FLDCAT-OUTPUTLEN = 15.

APPEND Z_LWA_FLDCAT TO Z_LI_FLDCAT.
CLEAR Z_LWA_FLDCAT.

Z_LWA_FLDCAT-FIELDNAME = 'LGOBE'.
Z_LWA_FLDCAT-SELTEXT_M = 'DESCRIPTION'.
Z_LWA_FLDCAT-COL_POS = 5.
Z_LWA_FLDCAT-OUTPUTLEN = 16.
APPEND Z_LWA_FLDCAT TO Z_LI_FLDCAT.
CLEAR Z_LWA_FLDCAT.

Z_LWA_FLDCAT-FIELDNAME = 'VPRSV'.
Z_LWA_FLDCAT-SELTEXT_M = 'PRICE CTRL'.
Z_LWA_FLDCAT-COL_POS = 6.
Z_LWA_FLDCAT-OUTPUTLEN = 20.
APPEND Z_LWA_FLDCAT TO Z_LI_FLDCAT.
CLEAR Z_LWA_FLDCAT.

Z_LWA_SORT-FIELDNAME = 'MATNR'.
Z_LWA_SORT-TABNAME = 'Z_LI_ITAB'.
Z_LWA_SORT-UP = 'X'.
Z_LWA_SORT-SUBTOT = 'X'.
APPEND Z_LWA_SORT TO Z_LI_SORT .
CLEAR Z_LWA_SORT.

*call function 'reuse_alv_grid_display'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = Z_LI_FLDCAT[]
IT_SORT = Z_LI_SORT[]
TABLES
T_OUTTAB = Z_LI_ITAB
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.

ENDCASE.
ENDFORM."endform

Is This Answer Correct ?    5 Yes 5 No

Post New Answer

More SAP ABAP Interview Questions

What is SAPscript and layout set?

1 Answers  


What is a data element?

0 Answers  


how to retrieve the field label of data element in reports.(not in alv)

2 Answers  


What are different types of parameters?

0 Answers  


In the process of creating a delivery tere is a firld date which needs to be saved, there is an userexit available but that exit does not have that date field in it, how would you overcome this. You have the delivery no that got created instead

2 Answers   Cap Gemini,


What is the diffrence between RFC & normal Function module?

8 Answers   SAP Labs,


What is meant by authorization? : sap abap hr

0 Answers  


why to create a custom BAPI if the BAPI already exists? y to find BAPI again? frankly even i dint undstnd tne question properly. if any one come across this q please do anser me.

0 Answers   IBM,


What is the BAPI to retrieve data for list of customers and thier sales areas i.e., Customer No, Sales Organization, Distribution Channel, and Division. For all the customers.

1 Answers   TCS,


A field containing quantity amounts (data type quan) must be assigned to a referencetable and a reference field. Explain?

0 Answers  


What is the difference between abap and hr abap? : abap hr

0 Answers  


Explain about workbench request and customization requests?

0 Answers  


Categories
  • SAP Basis Interview Questions SAP Basis (1262)
  • SAP ABAP Interview Questions SAP ABAP (3939)
  • SAPScript Interview Questions SAPScript (236)
  • SAP SD (Sales & Distribution) Interview Questions SAP SD (Sales & Distribution) (2717)
  • SAP MM (Material Management) Interview Questions SAP MM (Material Management) (912)
  • SAP QM (Quality Management) Interview Questions SAP QM (Quality Management) (99)
  • SAP PP (Production Planning) Interview Questions SAP PP (Production Planning) (523)
  • SAP PM (Plant Maintenance) Interview Questions SAP PM (Plant Maintenance) (252)
  • SAP PS (Project Systems) Interview Questions SAP PS (Project Systems) (138)
  • SAP FI-CO (Financial Accounting & Controlling) Interview Questions SAP FI-CO (Financial Accounting & Controlling) (2766)
  • SAP HR (Human Resource Management) Interview Questions SAP HR (Human Resource Management) (1180)
  • SAP CRM (Customer Relationship Management) Interview Questions SAP CRM (Customer Relationship Management) (432)
  • SAP SRM (Supplier Relationship Management) Interview Questions SAP SRM (Supplier Relationship Management) (132)
  • SAP APO (Advanced Planner Optimizer) Interview Questions SAP APO (Advanced Planner Optimizer) (92)
  • SAP BW (Business Warehouse) Interview Questions SAP BW (Business Warehouse) (896)
  • SAP Business Workflow Interview Questions SAP Business Workflow (72)
  • SAP Security Interview Questions SAP Security (597)
  • SAP Interfaces Interview Questions SAP Interfaces (74)
  • SAP Netweaver Interview Questions SAP Netweaver (282)
  • SAP ALE IDocs Interview Questions SAP ALE IDocs (163)
  • SAP Business One Interview Questions SAP Business One (110)
  • SAP BO BOBJ (Business Objects) Interview Questions SAP BO BOBJ (Business Objects) (388)
  • SAP CPS (Central Process Scheduling) Interview Questions SAP CPS (Central Process Scheduling) (14)
  • SAP GTS (Global Trade Services) Interview Questions SAP GTS (Global Trade Services) (21)
  • SAP Hybris Interview Questions SAP Hybris (132)
  • SAP HANA Interview Questions SAP HANA (700)
  • SAP PI (Process Integration) Interview Questions SAP PI (Process Integration) (113)
  • SAP PO (Process Orchestration) Interview Questions SAP PO (Process Orchestration) (25)
  • SAP BI (Business Intelligence) Interview Questions SAP BI (Business Intelligence) (174)
  • SAP BPC (Business Planning and Consolidation) Interview Questions SAP BPC (Business Planning and Consolidation) (38)
  • SAP BODS (Business Objects Data Services) Interview Questions SAP BODS (Business Objects Data Services) (49)
  • SAP BODI (Business Objects Data Integrator) Interview Questions SAP BODI (Business Objects Data Integrator) (26)
  • SAP Ariba Interview Questions SAP Ariba (9)
  • SAP Fiori Interview Questions SAP Fiori (45)
  • SAP EWM (Extended Warehouse Management) Interview Questions SAP EWM (Extended Warehouse Management) (58)
  • Sap R/3 Interview Questions Sap R/3 (150)
  • SAP FSCM Financial Supply Chain Management Interview Questions SAP FSCM Financial Supply Chain Management (101)
  • SAP WM (Warehouse Management) Interview Questions SAP WM (Warehouse Management) (31)
  • SAP GRC (Governance Risk and Compliance) Interview Questions SAP GRC (Governance Risk and Compliance) (64)
  • SAP MDM (Master Data Management) Interview Questions SAP MDM (Master Data Management) (0)
  • SAP MRS (Multi Resource Scheduling) Interview Questions SAP MRS (Multi Resource Scheduling) (0)
  • SAP ESS MSS (Employee Manager Self Service) Interview Questions SAP ESS MSS (Employee Manager Self Service) (13)
  • SAP CS (Customer Service) Interview Questions SAP CS (Customer Service) (0)
  • SAP TRM (Treasury and Risk Management) Interview Questions SAP TRM (Treasury and Risk Management) (0)
  • SAP Web Dynpro ABAP Interview Questions SAP Web Dynpro ABAP (198)
  • SAP IBP (Integrated Business Planning) Interview Questions SAP IBP (Integrated Business Planning) (0)
  • SAP OO-ABAP (Object Oriented ABAP) Interview Questions SAP OO-ABAP (Object Oriented ABAP) (70)
  • SAP S/4 HANA Finance (Simple Finance) Interview Questions SAP S/4 HANA Finance (Simple Finance) (143)
  • SAP FS-CD (Collections and Disbursements) Interview Questions SAP FS-CD (Collections and Disbursements) (0)
  • SAP PLM (Product Lifecycle Management) Interview Questions SAP PLM (Product Lifecycle Management) (0)
  • SAP SuccessFactors Interview Questions SAP SuccessFactors (33)
  • SAP Vistex Interview Questions SAP Vistex (0)
  • SAP ISR (IS Retail) Interview Questions SAP ISR (IS Retail) (28)
  • SAP IdM (Identity Management) Interview Questions SAP IdM (Identity Management) (0)
  • SAP IM (Investment Management) Interview Questions SAP IM (Investment Management) (0)
  • SAP UI5 Interview Questions SAP UI5 (59)
  • SAP SCM (Supply Chain Management) Interview Questions SAP SCM (Supply Chain Management) (51)
  • SAP XI (Exchange Infrastructure) Interview Questions SAP XI (Exchange Infrastructure) (49)
  • SAP Cloud Platform Interview Questions SAP Cloud Platform (34)
  • SAP Testing Interview Questions SAP Testing (89)
  • SAP SolMan (Solution Manager) Interview Questions SAP SolMan (Solution Manager) (63)
  • SAP MaxDB Interview Questions SAP MaxDB (116)
  • SAP GUI Interview Questions SAP GUI (15)
  • SAP AllOther Interview Questions SAP AllOther (329)