What are Views, how they were useful. Types of Views
Answers were Sorted based on User's Feedback
Answer / uma mb
Views are basically a join of two or more underlying
database tables. Certain tables are logically related and
make sense and more meaning when viewed linked together.
Instead os making these joins at runtime and increasing
overheads, views when existing can provide information
readily such as in Search Helps in data entry screens.
Another example is when there is a table with many fields
and it does not make a lot of sense to see all of them
together everytime, it is better we project only certain
columns that we want to see.
There are four types of views:
a) Database View (Generally used a a read only view)
b) Maintenance View (Used as a means to maintain the
underlying tables participating in the view)
c) Projection View (Single table view)
d) Help View (used in 'search helps' got by pressing F4)
Is This Answer Correct ? | 12 Yes | 2 No |
Answer / pavan
*&----------------------------------------------------------
-----------*
*& Report ZPPINRP_BOM_CREATE
*&
*&----------------------------------------------------------
-----------*
*&
*&
*&----------------------------------------------------------
-----------*
REPORT ZPPINRP_BOM_CREATE.
*&----------------------------------------------------------
-----------*
*& Report ZPPINRP_BOM_CREATE
*&
*&----------------------------------------------------------
-----------*
********* Basic documentation of
ABAP***********************************
* Date: 14-06-
2010 *
* Programmer:
Pavan *
* Program Specification document n°: DDD
document *
* Change
request :
*
* Project : SAP Implementation at Ashok
Leyland *
*
*
* Transport
No.: *
*
*
* Description Creating BOM by uploading data from
File *
*
*
* Called
from:
*
* Call
to:
*
*
*
* Inputs if special
use *
*
Tables:
*
* External files: From Local
System *
*
*
* Outputs if special
use *
*
Reports:
*
*
Tables:
*
*
Databases:
*
*
Screens:
*
* External
files: *
* Other
objects:
*
*
*
* Subroutines if special
use: *
* Includes if special
use: *
* Functions if special
use: *
* Logical
database:
*
*
*
************************************************************
************
*REPORT zppinrp_bom_create NO STANDARD PAGE HEADING LINE-
SIZE 350
* LINE-COUNT 65
* MESSAGE-ID zpp.
*-----------------------------------------------------------
-----------*
*
Tables *
*-----------------------------------------------------------
-----------*
TABLES: mara, " General Material Data
stpo, "BOM item
stas, "BOMs - Item Selection
stko, " BOM Header
mast, " Material to BOM Link
rc29p, " EATAB BOM Items
t001w. " Plants/Branches
*-----------------------------------------------------------
-----------*
*
Declarations *
*-----------------------------------------------------------
-----------*
TYPES: BEGIN OF ty_file,
matnr TYPE mara-matnr, "Material
werks TYPE t001w-werks, " Plant
stlan TYPE rc29n-stlan, " Bom Usage
datuv TYPE rc29n-datuv, " Valid from Date
posnr TYPE rc29p-posnr, " BOm item number
postp TYPE rc29p-postp, " Item Category
idnrk TYPE rc29p-idnrk, " BOM component
menge TYPE rc29p-menge, " Componenet QTy
meins TYPE rc29p-meins, " Component UOM
field_index LIKE sy-tabix,
END OF ty_file.
TYPES: BEGIN OF ty_error,
matnr TYPE mara-matnr,
message TYPE bapiret2-message,
END OF ty_error.
*-----------------------------------------------------------
-----------*
*
Constants *
*-----------------------------------------------------------
-----------*
*-----------------------------------------------------------
-----------*
* Workarea
Declarations *
*-----------------------------------------------------------
-----------*
DATA: is_mmst TYPE bapibommst,
is_stz TYPE bapibomstz,
is_stk TYPE bapibomstk,
is_stpo TYPE bapibomstp,
is_stas TYPE bapibomsta,
is_error TYPE ty_error,
w_cnt(4) TYPE c,
w_ecnt(4) TYPE c.
DATA: l_matnr TYPE mara-matnr,
l_werks TYPE t001w-werks,
l_stlan TYPE mast-stlan.
*-----------------------------------------------------------
-----------*
* Internal
Tables *
*-----------------------------------------------------------
-----------*
DATA : it_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER
LINE,
it_file TYPE ty_file OCCURS 0 WITH HEADER LINE,
it_error TYPE ty_error OCCURS 0 WITH HEADER LINE,
l_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
l_return1 LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
it_stpo TYPE bapibomstp OCCURS 0 WITH HEADER LINE,
it_sta TYPE bapibomsta OCCURS 0 WITH HEADER LINE,
it_stk TYPE bapibomstk OCCURS 0 WITH HEADER LINE.
*-----------------------------------------------------------
-----------*
* Global
varaibles *
*-----------------------------------------------------------
-----------*
DATA: gw_nlines TYPE i.
*-----------------------------------------------------------
-----------*
* Selection
Sceen *
*-----------------------------------------------------------
-----------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-
001.
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
*-----------------------------------------------------------
-----------*
*
Initialization *
*-----------------------------------------------------------
-----------*
INITIALIZATION.
p_file = text-t04.
*-----------------------------------------------------------
-----------*
* At Selection
Screen *
*-----------------------------------------------------------
-----------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM lookup_local_file USING p_file.
AT SELECTION-SCREEN.
* Read data from file
PERFORM pick_up_excelfile.
*-----------------------------------------------------------
-----------*
* Start-Of-
Selection *
*-----------------------------------------------------------
-----------*
START-OF-SELECTION.
* Transpose the internal table
PERFORM transpose_rows_and_columns.
*Fill the bapi structures
PERFORM fill_structures.
*display the result
PERFORM display_result.
*&----------------------------------------------------------
-----------*
*& Form LOOKUP_LOCAL_FILE
*&----------------------------------------------------------
-----------*
* text
*-----------------------------------------------------------
-----------*
* -->P_P_FILE text
*-----------------------------------------------------------
-----------*
FORM lookup_local_file USING pc_file LIKE rlgrap-
filename.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
file_name = pc_file.
ENDFORM. " LOOKUP_LOCAL_FILE
*&----------------------------------------------------------
-----------*
*& Form PICK_UP_EXCELFILE
*&----------------------------------------------------------
-----------*
* text
*-----------------------------------------------------------
-----------*
* --> p1 text
* <-- p2 text
*-----------------------------------------------------------
-----------*
FORM pick_up_excelfile .
* Pick up the excel file
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '10'
i_end_row = '50000'
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF it_excel[] IS INITIAL.
MESSAGE e000(zmm) WITH p_file 'File uploaded is empty.'.
ENDIF.
ENDFORM. " PICK_UP_EXCELFILE
*&----------------------------------------------------------
-----------*
*& Form TRANSPOSE_ROWS_AND_COLUMNS
*&----------------------------------------------------------
-----------*
* text
*-----------------------------------------------------------
-----------*
* --> p1 text
* <-- p2 text
*-----------------------------------------------------------
-----------*
FORM transpose_rows_and_columns .
FIELD-SYMBOLS <fs>.
DATA : lw_value(50) TYPE c.
DELETE it_excel WHERE col GT '0010'.
* Convert the upload data into the row format.
LOOP AT it_excel.
lw_value = it_excel-value.
AT NEW col.
ASSIGN COMPONENT it_excel-col OF STRUCTURE it_file TO
<fs>.
<fs> = lw_value.
ENDAT.
AT END OF row.
it_file-field_index = it_excel-row.
APPEND it_file.
CLEAR it_file.
ENDAT.
ENDLOOP.
DESCRIBE TABLE it_file LINES gw_nlines.
ENDFORM. " TRANSPOSE_ROWS_AND_COLUMNS
*&----------------------------------------------------------
-----------*
*& Form FILL_STRUCTURES
*&----------------------------------------------------------
-----------*
* text
*-----------------------------------------------------------
-----------*
* --> p1 text
* <-- p2 text
*-----------------------------------------------------------
-----------*
FORM fill_structures .
CLEAR: l_matnr,
l_werks,
l_stlan,
is_mmst,
is_stz,
is_stpo.
REFRESH : it_stpo,
it_stk,
it_sta,
l_return.
*fill the header details for all the records
LOOP AT it_file.
IF NOT it_file-matnr IS INITIAL.
l_matnr = it_file-matnr.
l_werks = it_file-werks.
l_stlan = it_file-stlan.
ELSE.
it_file-matnr = l_matnr.
it_file-werks = l_werks.
it_file-stlan = l_stlan.
MODIFY it_file.
ENDIF.
ENDLOOP.
CLEAR : l_werks, l_stlan.
LOOP AT it_file.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = it_file-matnr
IMPORTING
output = it_file-matnr.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = it_file-idnrk
IMPORTING
output = it_file-idnrk.
translate it_file-matnr to upper case.
translate it_file-idnrk to upper case.
is_stpo-component = it_file-idnrk.
is_stpo-bom_itm_no = it_file-posnr.
is_stpo-item_cat = it_file-postp.
is_stpo-uncomp = it_file-meins.
is_stpo-compon_qty = it_file-menge.
is_stpo-valid_from = it_file-datuv.
APPEND is_stpo TO it_stpo.
l_werks = it_file-werks.
l_stlan = it_file-stlan.
AT END OF matnr.
is_mmst-material = it_file-matnr.
is_mmst-plant = l_werks."it_file-werks.
is_mmst-bom_usage = l_stlan."it_file-stlan.
is_mmst-lot_sz_min = '0.00'.
is_mmst-lot_sz_max = '99999999'.
is_stz-bom_usage = l_stlan.
is_stk-dsn_office = 'PLM'.
append is_stk to it_stk.
* call bapi
PERFORM bapi_bom_create.
CLEAR: is_mmst, is_stz, is_stpo, is_stk.
REFRESH : it_stpo, it_stk, it_sta.
ENDAT.
ENDLOOP.
ENDFORM. " FILL_STRUCTURES
*&----------------------------------------------------------
-----------*
*& Form BAPI_BOM_CREATE
*&----------------------------------------------------------
-----------*
* text
*-----------------------------------------------------------
-----------*
* --> p1 text
* <-- p2 text
*-----------------------------------------------------------
-----------*
FORM bapi_bom_create .
CALL FUNCTION 'BAPI_BOM_UPLOAD_SAVE'
EXPORTING
is_mast = is_mmst
is_stzu = is_stz
IMPORTING
es_return = l_return
TABLES
it_stko = it_stk
it_stpo = it_stpo
it_stas = it_sta
.
IF l_return-type EQ 'E'.
if l_return-message is initial.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = l_return-id
msgnr = l_return-number
msgv1 = l_return-MESSAGE_V1
msgv2 = l_return-MESSAGE_V2
msgv3 = l_return-MESSAGE_V3
msgv4 = l_return-MESSAGE_V4
IMPORTING
message_text_output = l_return-message.
endif.
MOVE is_mmst-material TO is_error-matnr.
MOVE l_return-message TO is_error-message.
APPEND is_error TO it_error.
CLEAR is_error.
w_ecnt = w_ecnt + 1.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = l_return1.
FORMAT COLOR 5 INTENSIFIED ON INVERSE OFF.
WRITE:/ is_mmst-material.
w_cnt = w_cnt + 1.
CONDENSE w_cnt.
IF w_cnt EQ '1'.
WRITE:/ 'Successful Records'(t01).
SKIP 1.
ENDIF.
ENDIF.
ENDFORM. " BAPI_BOM_CREATE
*&----------------------------------------------------------
-----------*
*& Form DISPLAY_RESULT
*&----------------------------------------------------------
-----------*
* text
*-----------------------------------------------------------
-----------*
* --> p1 text
* <-- p2 text
*-----------------------------------------------------------
-----------*
FORM display_result .
IF NOT w_cnt IS INITIAL.
WRITE:/ 'Total Successful Records:'(t02), w_cnt.
ENDIF.
SKIP 2.
IF NOT it_error[] IS INITIAL.
WRITE:/ 'Error Records'(t03).
SKIP 1.
FORMAT COLOR 4 INTENSIFIED ON INVERSE OFF.
LOOP AT it_error.
WRITE:/ it_error-matnr, it_error-message.
ENDLOOP.
SKIP 1.
WRITE:/ 'Total No of Error Records'(t05), w_ecnt.
ENDIF.
ENDFORM. " DISPLAY_RESULT
Is This Answer Correct ? | 0 Yes | 3 No |
i want to block some spaces after end of page in classical report?how to do that?
how to debug a screen without using /h,break-point,debuging,stop.
please send differences between events
what does it mean occurs 0 while creating an internal table?
what is table maintainence?
how to navigate to report from report? note: no transaction code created to report.
What are the different types joins?
how to debug dialog box?
when we are using at new?should we use this inside the loop or outside?what will be the effect?
What is lock objects? : sap abap data dictionary
I wrote one script program,Now i want to transfer this program from development to production system so that output is displayed correct in production.please give me the steps.In development showing correct output but whereas in production somewhat difference.So what is the problem?
How is conversion of data types done between abap/4 & db layer? : abap data dictionary