Академический Документы
Профессиональный Документы
Культура Документы
Tiny Link
Wiki Markup
Close
Move Page My
OK
Cancel
Search
Recently View ed
Know n Location
Failed to retrieve
ABAP Developme
ABAP Developme
Page Ordering
Back
Reorder
Move
Unknow n user or
Page Restrictions
Editing restricted
Cancel
Close
Save
Link
There w ere no re
1710
Code in SE38:
*&---------------------------------------------------------------------*
*& Report YKC_SCRIPT_DRIVER_PRO
*&
*&---------------------------------------------------------------------*
*&Krishna Chauhan (Sparta Consulting)
*&Date: 09 Jan 2009
*&---------------------------------------------------------------------*
REPORT YKC_SCRIPT_DRIVER_PRO.
tables: mara, makt, marc,mard.
data: begin of it_final occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
ersda like mara-ersda,
ernam like mara-ernam,
werks like mard-werks,
lgort like mard-lgort,
beskz like marc-beskz,
dismm like marc-dismm,
end of it_final.
*---internal table to get data from mara
data: begin of it_mara occurs 0,
matnr like mara-matnr,
ersda like mara-ersda,
ernam like mara-ernam,
end of it_mara.
*---internal table to store mat description
data: begin of it_makt occurs 0,
matnr like makt-matnr,
spras like makt-spras,
maktx like makt-maktx,
end of it_makt.
*--internal table to keep data from marc
data: begin of it_marc occurs 0,
matnr like mara-matnr,
werks like marc-werks,
beskz like marc-beskz,
dismm like marc-dismm,
end of it_marc.
*--internal table to keep data from mard
data: begin of it_mard occurs 0,
matnr like mara-matnr,
werks like mard-werks,
lgort like mard-lgort,
end of it_mard.
Select-options s_matnr for mara-matnr.
Start-of-selection.
perform get_data.
PERFORM open_form.
LOOP AT it_final.
PERFORM start_form.
PERFORM write_form.
PERFORM end_form.
ENDLOOP.
PERFORM close-form.
*&---------------------------------------------------------------------*
*&
Form GET_DATA
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
form GET_DATA .
select matnr ersda ernam
from mara into table it_mara
where matnr in s_matnr.
sort it_mara by matnr.
if not it_mara[] is initial.
*---getting common data from mara & marc on the basis of matnr.
select matnr werks beskz dismm
from marc into table it_marc
for all entries in it_mara
where matnr = it_mara-matnr.
select matnr spras maktx
from makt into table it_makt
for all entries in it_mara
" GET_DATA
*&---------------------------------------------------------------------*
*&
Form OPEN-FORM
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
Form OPEN_FORM .
CALL FUNCTION 'OPEN_FORM'
EXPORTING
Form = 'YKC_FIRST_SCRIPT'.
Endform.
"OPEN-FORM
*&---------------------------------------------------------------------*
*&
Form START_FORM
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
Form START_FORM .
CALL FUNCTION 'START_FORM'
EXPORTING
Form = 'YKC_FIRST_SCRIPT'.
Endform.
"START_FORM
*&---------------------------------------------------------------------*
*&
Form WRITE_FORM
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
Form WRITE_FORM .
*--CALL FUNCTION 'WRITE_FORM'
EXPORTING
Window = 'GRAPH1'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
Element
= 'E1'
* FUNCTION
= 'SET'
* TYPE
= 'BODY'
Window
= 'WINDOW1'
.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element
= 'E2'
* FUNCTION
= 'SET'
* TYPE
= 'BODY'
Window
= 'MAIN'
.
endform.
" WRITE_FORM
*&---------------------------------------------------------------------*
*&
Form END_FORM
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
form END_FORM .
CALL FUNCTION 'END_FORM'
* IMPORTING
* RESULT
* EXCEPTIONS
* UNOPENED
=1
* BAD_PAGEFORMAT_FOR_PRINT
* SPOOL_ERROR
=3
=2
* OTHERS
=4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
endform.
" END_FORM
*&---------------------------------------------------------------------*
*&
Form CLOSE-FORM
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
form CLOSE-FORM .
CALL FUNCTION 'CLOSE_FORM'
* IMPORTING
* RESULT
* RDI_RESULT
* TABLES
* OTFDATA
* EXCEPTIONS
* UNOPENED
=1
* BAD_PAGEFORMAT_FOR_PRINT
* SEND_ERROR
=3
* SPOOL_ERROR
* OTHERS
=4
=5
.
endform.
The output will be:
"CLOSE-FORM
=2