Write statement after alv display
Hi Experts,
My requirement is that i am displaying an output of ALV List display, in the List display i have a button which undergoes updation of records in Ztable.After pressing the button now i have to display Total no of records in write statement in which i should not have ALV display(i need 2 screens ).
Regards,
Vikram Sukumar
<li>I don't know how you are doing but I am able to display. try this sample program for double click event.
REPORT ztest_notepad.
DATA: BEGIN OF it_t001 OCCURS 0,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
adrnr TYPE t001-adrnr,
END OF it_t001.
TYPE-POOLS:slis.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
DEFINE fieldcat.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = &2.
wa_fieldcat-seltext_m = &3.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
START-OF-SELECTION.
SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_t001 UP TO 10 ROWS.
fieldcat: 'BUKRS' 'IT_T001' 'BUKRS',
'BUTXT' 'IT_T001' 'BUTXT',
'ADRNR' 'IT_T001' 'ADRNR'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_t001.
*& Form USER_COMMAND
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
IF r_ucomm = '&IC1'.
WRITE 'Venkat'.
ENDIF.
ENDFORM. "USER_COMMAND
Thanks
Venkat.O
Similar Messages
-
Hello,
I have a requirement where I am displaying the ALV using grid.
Have a button on top.
After ALV display, I select the row and press the button.
The processing takes place like (Delivery creation).
After this delivery creation, I have to display the log output.
But the log has to be using the normal Write Statement.
Like : Write: 'Delivery created : 1001;.
I am trying this but my write is not working.
The code isgetting executed when seen in debug but nothing displayed on screen.
Any idea??
PranuHi,
add the below command in the ALV exporting..
... user_command = 'USER_COMMAND'..
and paste the code at the last ..
FORM user_command USING r_ucomm TYPE sy-ucomm
ls_selfield TYPE slis_selfield.
IF sy-ucomm = 'YOur button'.
LEAVE TO SCREEN 0.
endif.
ENDFORM. "USER_COMMAND
Regards,
Prabhudas -
List Display After ALV Display.
Hi,
i want to use write statement after display of the GRID ALV report. I User-command is getting dynamically called up when i presses the button.
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&GENERAL'.
READ TABLE i_general INTO wa_general INDEX p_selfield-tabindex.
IF sy-subrc = 0.
LEAVE TO LIST-PROCESSING.
WRITE : sy-uline(90).
write: / 'Serial: ', wa_general-serial.
ENDIF.
ENDFORM.
the problem is i m not able to use back button in the dynamic list display. Use pf-status as well but not working. Pressing BACK button does nothing.
Want to activate print and back button in the dynamic list display. (used pf-status which has back and print fucntion code but not working.)
Reward points sure for right answers.
KartavyaHi..
Try this.....
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&GENERAL'.
READ TABLE i_general INTO wa_general INDEX p_selfield-tabindex.
IF sy-subrc = 0.
<b>SET PF-STATUS SPACE.</b> "this will call the Standard GUI
LEAVE TO LIST-PROCESSING.
WRITE : sy-uline(90).
write: / 'Serial: ', wa_general-serial.
ENDIF.
ENDFORM.
<b>Reward if Helpful.</b> -
Write stat below alv report .if i use field catalog.
hi experts,
i want to use write statment after alv report.
note: i am useing fieldcatalog.
i got it if i use standard table with : end_of_list event event.
thank you.Hi snk,
1. It won't work in GRID display.
2. The reason is when grid comes,
it comes on a screen which has container and the grid control.
3. Write statement is displayed on a special screen,
which is generally used for list output.
Normal screens (where we can put textboxes/checkboxes etc),
do not support write statements.
regards,
amit m. -
Hi,
i have the following problem. In a report we are using the set_table_for_first_display method for ALV display. In the ALV, once pressed the 'BACK' button we want to show per screen some WRITE commands. The lines are being short printed, but the program is not stoping at that point, and therefore going back to the selection screen. So, we are not able to see the content we are printing with the WRITE statements.
Anyone knows how to solve this???
Thanks to everyone...Hello,
did you try the 'LEAVE TO LIST-PROCESSING'-Command before your write-statements ?
Regards Wolfgang -
Convert Normal Report of Write statements to alv list display by usg at new
Hi Experts,
I have one Report in which Data is fetched and displayed using WRITE Stmts now
i want to modify this Report to alv_list_display but prob is with at new command..Suppose when ever new customer is triggered it have to display the data of that particular customer in new page.....
And also format of output in old resport is little bit tricky i want to knw can we format the same output using alv_list_display.
At Header Level data is dispalyed in 4 parts column wise and under those 4colums
Items have been displayed. but i have 20 fields which are to b displayed same as old one. under those 4 colums when i use alv_list_display.
Naveen Kumarhi,
try this code
this program is first of all header level data will be printed
when you click on any header level it show all the items under that head
Data Extract from Tables ZFII_COST, BSIS.
Program Name :ZFII_COSTING_REPORT_DISPLAY
Object ID :E7
Functional Analyst :VENKAT
Programmer :venkatesh
Start date :07/05/2007
Initial CTS :HFDK901345
Description :
Includes :n/a
Function Modules :REUSE_ALV_GRID_DISPLAY , *
CONVERSION_EXIT_ALPHA_INPUT
FTI_FISCAL_YEAR_MONTH_GET
Logical database :n/a
Transaction Code :n/a
External references :n/a
Modification Log
Date | Modified by | CTS number | Comments
07/05/2007 | venkaetsh | HFDK901345 | Initial version
REPORT ZFII_COSTING_REPORT_DISPLAY NO STANDARD PAGE HEADING
MESSAGE-ID ZFI.
TYPE-POOLS: FTIS.
FOR THE ALV DISPLAY.
TYPE-POOLS: SLIS.
DATA:
G_REPID LIKE SY-REPID,
GWA_SORT TYPE SLIS_SORTINFO_ALV,
GIT_SORT TYPE SLIS_T_SORTINFO_ALV,
GIT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GIT_EVENTS TYPE SLIS_T_EVENT,
GFL_LAYOUT TYPE SLIS_LAYOUT_ALV,
GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,
GWA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
GIT_XS_EVENT TYPE SLIS_ALV_EVENT,
G_POS TYPE I VALUE 1.
DATA:
G_REPID LIKE SY-REPID,
GWA_SORT TYPE SLIS_SORTINFO_ALV,
GIT_SORT TYPE SLIS_T_SORTINFO_ALV,
GIT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GIT_EVENTS TYPE SLIS_T_EVENT,
GFL_ITEMSLAYOUT TYPE SLIS_LAYOUT_ALV,
GIT_ITEMSFIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,
GWA_ITEMSFIELDCAT TYPE SLIS_FIELDCAT_ALV,
GIT_XS_EVENT TYPE SLIS_ALV_EVENT,
G_ITEMSPOS TYPE I VALUE 1.
DECLARING THE VARIABLES.
DATA:
G_BUKRS TYPE T001-BUKRS.
TABLE FOR THE INITIAL FETCHING
TYPES: BEGIN OF T_COST.
INCLUDE STRUCTURE ZFII_COST.
TYPES: CNSTDGLACC TYPE ZFII_COSTING-CNSTDGLACC.
TYPES: END OF T_COST.
TYPES: T_IT_COST TYPE STANDARD TABLE OF T_COST.
DATA: GIT_COST TYPE T_IT_COST.
DATA: GWA_COST TYPE T_COST.
TYPES: BEGIN OF T_CONSOL.
INCLUDE STRUCTURE ZFII_COSTING.
TYPES: END OF T_CONSOL.
TYPES: T_IT_CONSOL TYPE STANDARD TABLE OF T_CONSOL.
DATA: GWA_CONSOL TYPE T_CONSOL.
DATA: GIT_CONSOL TYPE T_IT_CONSOL.
*TYPES: BEGIN OF T_SENDDATA.
INCLUDE STRUCTURE ZFII_COSTINGDETAILS.
*TYPES: END OF T_SENDDATA.
*TYPES: T_IT_SENDDATA TYPE STANDARD TABLE OF T_SENDDATA.
*DATA: GIT_SENDDATA TYPE T_IT_SENDDATA.
*DATA: GWA_SENDDATA TYPE T_SENDDATA.
TYPES: BEGIN OF T_BSIS,
HKONT TYPE BSIS-HKONT,
SHKZG TYPE BSIS-SHKZG,
DMBTR TYPE BSIS-DMBTR,
KOSTL TYPE BSIS-KOSTL,
END OF T_BSIS.
TYPES: T_IT_BSIS TYPE STANDARD TABLE OF T_BSIS.
DATA: GIT_BSIS TYPE T_IT_BSIS.
DATA: GWA_BSIS TYPE T_BSIS.
DATA: GIT_TOTALBSIS TYPE T_IT_BSIS.
DATA: GWA_TOTALBSIS TYPE T_BSIS.
DATA: G_FTIS_DATUM TYPE FTIS_DATUM.
DATA: G_FTIS_GJAHR TYPE FTIS_GJAHR.
DATA: G_FTIS_MONAT TYPE FTIS_MONAT.
ranges
RANGES: R_HKONT FOR BSIS-HKONT.
data: g_KOSTL type BSIS-KOSTL.
DESIGNING OF THE SELECTION SCREEN STARTS.
DATA: G_YEARMONTH TYPE ZFII_COST-YEARMONTH.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME. " TITLE TEXT-001.
PARAMETERS: P_COCODE TYPE T001-BUKRS DEFAULT 'H901'.
SELECT-OPTIONS: S_MONYR FOR G_YEARMONTH OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
DESIGN OF THE SELECTION SCREEN ENDS.
INITIALIZATION.
clearing and refreshing all the variables
and the tables used in the programme.
INITIALIZATION.
PERFORM CLEAR_REFRESH.
AT SELECTION-SCREEN.
event to validate the values entered
and fetching the data
if no data found error message will be shown
AT SELECTION-SCREEN.
PERFORM VALIDATE_VALUES.
*start of selection.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM CHANGE_DATA.
PERFORM DISPLAY_ALV.
*& Form CLEAR_REFRESH
text
--> p1 text
<-- p2 text
FORM CLEAR_REFRESH .
CLEAR: G_REPID.
G_REPID = SY-REPID.
CLEAR:
GWA_COST, G_POS,
G_BUKRS, GWA_TOTALBSIS,
R_HKONT, G_FTIS_DATUM.
REFRESH:
GIT_BSIS, GIT_COST.
ENDFORM. " CLEAR_REFRESH
*& Form VALIDATE_VALUES
text
--> p1 text
<-- p2 text
FORM VALIDATE_VALUES .
SELECT SINGLE
BUKRS FROM
T001 INTO G_BUKRS
WHERE BUKRS = P_COCODE.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-000.
ENDIF.
ENDFORM. " VALIDATE_VALUES
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA .
SELECT
MANDT
COMPCODE
YEARMONTH
DEPARTMENT
CNSTDGLACC
GLCODEFROM
GLCODETO
AMOUNT
FLAG
TYPE
FROM ZFII_COST
INTO TABLE GIT_COST
WHERE COMPCODE = P_COCODE
and YEARMONTH in S_MONYR.
IF SY-SUBRC NE 0.
MESSAGE I000 WITH TEXT-001.
STOP.
ELSE.
SELECT
MANDT
CNSTDGLACC
GLCODEFROM
GLCODETO
FLAG
FROM ZFII_COSTING
INTO TABLE GIT_CONSOL.
IF SY-SUBRC NE 0.
MESSAGE I000 WITH TEXT-003.
STOP.
ENDIF.
ENDIF.
ENDFORM. " GET_DATA
*& Form Change_data
text
--> p1 text
<-- p2 text
FORM CHANGE_DATA .
IF GIT_CONSOL IS NOT INITIAL.
IF GIT_COST IS NOT INITIAL.
sort GIT_CONSOL.
LOOP AT GIT_COST INTO GWA_COST.
READ TABLE GIT_CONSOL INTO GWA_CONSOL
WITH KEY GLCODEFROM = GWA_COST-GLCODEFROM
GLCODETO = GWA_COST-GLCODETO
BINARY SEARCH.
IF SY-SUBRC EQ 0.
GWA_COST-CNSTDGLACC = GWA_CONSOL-CNSTDGLACC.
MODIFY GIT_COST FROM GWA_COST.
ENDIF.
CLEAR: GWA_CONSOL, GWA_COST.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " Change_data
*& Form DISPLAY_ALV
text
--> p1 text
<-- p2 text
FORM DISPLAY_ALV .
GFL_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GFL_LAYOUT-ZEBRA = 'X'.
PERFORM FILL_FIELDCAT.
PERFORM SORT_FIELDS.
PERFORM CALL_GRID.
ENDFORM. " DISPLAY_ALV
*& Form FILL_FIELDCAT
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT .
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'COMPCODE' " InTab Field Name
'GIT_COST' " InTab Name
'5' " Output Length
'Company code' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'YEARMONTH' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'Year & Month' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'CNSTDGLACC' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'G/L Account code' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'CNSTDGLACC' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'Cnsl GL' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'DEPARTMENT' " InTab Field Name
'GIT_COST' " InTab Name
'4' " Output Length
'Department' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'GLCODEFROM' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'From GL' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'GLCODETO' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'To GL' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'FLAG' " InTab Field Name
'GIT_COST' " InTab Name
'2' " Output Length
'Flag' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'TYPE' " InTab Field Name
'GIT_COST' " InTab Name
'2' " Output Length
'Type' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'AMOUNT' " InTab Field Name
'GIT_COST' " InTab Name
'18' " Output Length
'Amount' " Column Name Text
'CURR' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
'X' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
ENDFORM. " FILL_FIELDCAT
*& Form init_field_catalog
text
-->P_GIT_FIELDCAT text
-->PV_POS text
-->PV_FIELDNAME text
-->PV_TABNAME text
-->PV_OUTPUT text
-->PV_SELTEXT text
-->PV_DATATYPE text
-->PV_KEY text
-->PV_ROW text
-->PV_HOTSPOT text
-->PV_EMPHASIZE text
-->PV_SUM text
-->PV_CHECKBOX text
-->PV_INPUT text
FORM INIT_FIELD_CATALOG USING P_GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV
PV_POS LIKE GWA_FIELDCAT-COL_POS
PV_FIELDNAME LIKE GWA_FIELDCAT-FIELDNAME
PV_TABNAME LIKE GWA_FIELDCAT-TABNAME
PV_OUTPUT LIKE GWA_FIELDCAT-OUTPUTLEN
PV_SELTEXT LIKE GWA_FIELDCAT-SELTEXT_M
PV_DATATYPE LIKE GWA_FIELDCAT-DATATYPE
PV_KEY LIKE GWA_FIELDCAT-KEY
PV_ROW LIKE GWA_FIELDCAT-ROW_POS
PV_HOTSPOT LIKE GWA_FIELDCAT-HOTSPOT
PV_EMPHASIZE LIKE GWA_FIELDCAT-EMPHASIZE
PV_SUM LIKE GWA_FIELDCAT-DO_SUM
PV_CHECKBOX LIKE GWA_FIELDCAT-CHECKBOX
PV_EDIT LIKE GWA_FIELDCAT-EDIT
PV_INPUT LIKE GWA_FIELDCAT-INPUT.
DATA: LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
LT_FIELDCAT-OUTPUTLEN = PV_OUTPUT.
LT_FIELDCAT-COL_POS = PV_POS.
LT_FIELDCAT-FIELDNAME = PV_FIELDNAME.
LT_FIELDCAT-TABNAME = PV_TABNAME.
LT_FIELDCAT-SELTEXT_L = PV_SELTEXT.
LT_FIELDCAT-KEY = PV_KEY.
LT_FIELDCAT-ROW_POS = PV_ROW.
LT_FIELDCAT-HOTSPOT = PV_HOTSPOT.
LT_FIELDCAT-EMPHASIZE = PV_EMPHASIZE.
LT_FIELDCAT-DO_SUM = PV_SUM.
LT_FIELDCAT-CHECKBOX = PV_CHECKBOX.
LT_FIELDCAT-INPUT = PV_INPUT.
LT_FIELDCAT-EDIT = PV_EDIT.
LT_FIELDCAT-DATATYPE = PV_DATATYPE.
APPEND LT_FIELDCAT TO P_GIT_FIELDCAT.
CLEAR LT_FIELDCAT.
ENDFORM. " init_field_catalog
*& Form SORT_FIELDS
text
--> p1 text
<-- p2 text
FORM SORT_FIELDS .
GWA_SORT-SPOS = 1. " Sort order
GWA_SORT-FIELDNAME = 'COMPCODE'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
GWA_SORT-SPOS = 2. " Sort order
GWA_SORT-FIELDNAME = 'YEARMONTH'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
GWA_SORT-SPOS = 3. " Sort order
GWA_SORT-FIELDNAME = 'CNSTDGLACC'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
GWA_SORT-SPOS = 4. " Sort order
GWA_SORT-FIELDNAME = 'DEPARTMENT'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
ENDFORM. " SORT_FIELDS
*& Form CALL_GRID
text
--> p1 text
<-- p2 text
FORM CALL_GRID .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = GFL_LAYOUT
IT_FIELDCAT = GIT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GIT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = GIT_COST
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. " CALL_GRID
*& Form SET_PF_STATUS
text
-->EXTAB text
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB. "#EC CALLED
SET PF-STATUS 'ZFII_PF_STATUS'. " OF PROGRAM 'SAPLKKBL'.
ENDFORM. "set_pf_status
*& Form USER_COMMAND
Called from within the ALV processes.
PV_UCOMM contains the sy-ucomm from ALV
SELFIELD is a structure that contains all the data required to
process a user selection. The following is an example
of the SELFIELD structure and sample values:
TRIGGERS WHEN THE USER CLICK THE
FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM "#EC NEEDED
SELFIELD TYPE SLIS_SELFIELD. "#EC NEEDED
CASE PV_UCOMM.
WHEN '&IC1'.
when the user double clicks on any record this will show the
READ TABLE GIT_COST INTO GWA_COST INDEX SELFIELD-TABINDEX.
entire list of g/l accounts for which we calculated the sum.
IF SY-SUBRC EQ 0.
CLEAR: g_KOSTL.
g_KOSTL = GWA_COST-DEPARTMENT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_COST-DEPARTMENT
IMPORTING
OUTPUT = g_KOSTL.
CLEAR: R_HKONT.
REFRESH: R_HKONT.
R_HKONT-SIGN = 'I'.
R_HKONT-OPTION = 'BT'.
R_HKONT-LOW = GWA_COST-GLCODEFROM.
R_HKONT-HIGH = GWA_COST-GLCODETO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = R_HKONT-LOW
IMPORTING
OUTPUT = R_HKONT-LOW.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = R_HKONT-HIGH
IMPORTING
OUTPUT = R_HKONT-HIGH.
append r_hkont.
PERFORM DISPLAY_DETAILS.
ENDIF.
when OTHERS.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form display_details
text
--> p1 text
<-- p2 text
FORM DISPLAY_DETAILS .
PERFORM GET_VALUES_BSIS.
PERFORM FILL_FIELDCAT_ITEMS.
PERFORM DISPALY_ITEMS.
ENDFORM. " display_details
*& Form FILL_FIELDCAT_items
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_ITEMS .
CLEAR: GIT_ITEMSFIELDCAT. ", GWA_ITEMSFIELDCAT.
REFRESH: GIT_ITEMSFIELDCAT.
GFL_ITEMSLAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GFL_ITEMSLAYOUT-ZEBRA = 'X'.
CLEAR: G_ITEMSPOS.
G_ITEMSPOS = G_ITEMSPOS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_ITEMSFIELDCAT[] " Field Catalog
G_ITEMSPOS " Column Position
'HKONT' " InTab Field Name
'GIT_TOTALBSIS' " InTab Name
'10' " Output Length
'G/L Account' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_ITEMSPOS = G_ITEMSPOS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_ITEMSFIELDCAT[] " Field Catalog
G_ITEMSPOS " Column Position
'KOSTL' " InTab Field Name
'GIT_TOTALBSIS' " InTab Name
'10' " Output Length
'Cost Center' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_ITEMSPOS = G_ITEMSPOS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_ITEMSFIELDCAT[] " Field Catalog
G_ITEMSPOS " Column Position
'DMBTR' " InTab Field Name
'GIT_TOTALBSIS' " InTab Name
'18' " Output Length
'Amount' " Column Name Text
'CURR' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
'X' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
ENDFORM. " FILL_FIELDCAT_items
*& Form get_values_bsis
text
--> p1 text
<-- p2 text
FORM GET_VALUES_BSIS .
clear: " G_FTIS_DATUM,
G_FTIS_GJAHR, G_FTIS_MONAT.
G_FTIS_DATUM+0(6) = gwa_cost-YEARMONTH.
G_FTIS_DATUM+6(2) = '01'.
CALL FUNCTION 'FTI_FISCAL_YEAR_MONTH_GET'
EXPORTING
I_BUKRS = 'H901'
I_BUDAT = G_FTIS_DATUM
I_DZTERM = FTIS_DATUM-INITIAL
I_GJAHR = FTIS_GJAHR-INITIAL
IMPORTING
E_GJAHR = G_FTIS_GJAHR
E_MONAT = G_FTIS_MONAT.
IF NOT GIT_COST IS INITIAL.
CLEAR: GWA_BSIS, GWA_TOTALBSIS.
REFRESH: GIT_BSIS, GIT_TOTALBSIS.
SELECT
HKONT
SHKZG
DMBTR
KOSTL
FROM BSIS
INTO TABLE GIT_BSIS
WHERE BUKRS = P_COCODE
AND HKONT in R_HKONT
AND GJAHR = G_FTIS_GJAHR
AND MONAT = G_FTIS_MONAT
AND KOSTL eq g_KOSTL.
IF SY-SUBRC EQ 0.
LOOP AT GIT_BSIS INTO GWA_BSIS.
SHIFT GWA_BSIS-HKONT LEFT DELETING LEADING '0'.
GWA_TOTALBSIS-HKONT = GWA_BSIS-HKONT.
GWA_TOTALBSIS-KOSTL = GWA_BSIS-KOSTL.
IF GWA_BSIS-SHKZG = 'H'.
GWA_TOTALBSIS-DMBTR = GWA_BSIS-DMBTR * -1.
ELSE.
GWA_TOTALBSIS-DMBTR = GWA_BSIS-DMBTR.
ENDIF.
APPEND GWA_TOTALBSIS TO GIT_TOTALBSIS.
CLEAR: GWA_TOTALBSIS, GWA_BSIS.
ENDLOOP.
SORT GIT_TOTALBSIS ASCENDING BY HKONT KOSTL.
ENDIF.
ENDIF.
ENDFORM. " get_values_bsis
&---- -
Data lost when download data after ALV display in background
Hi, everyone, first i display the data in ALV Grid, then I upload the data into sap application sever, it is ok in foreground. But when i run the program at background and the data is more then one page in spool list, the file on application server will lost and only has data in last page of spool list. Is this SAP standard behavior? please advice, thanks.
There is a simple logic.
First i get all data and keep the data in interal table T_LIST.
Then call function REUSE_ALV_GRID_DISPLAY to display data in T_LIST.
Third, Using statement OPEN DATASTET and TRANSFER to upload data in T_LIST into application server.
In fact, it will be ok if run the program foreground. it will also be ok if upload data into appllication server before display data with ALV grid. But i just want to know the root cause why data lost in my current design. thanks. -
After ALV Report i need to display the text below that
Hi Experts,
I need a help.
I want to display a write statment after alv report is generated.pls help me.
Please Urgent.here is an example
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_html_end_of_list = 'END_OF_LIST_HTML'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
*& Form end_of_list_html
output at the end of the list - not in printed output *
FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
DATA: ls_text TYPE sdydo_text_element,
l_grid TYPE REF TO cl_gui_alv_grid,
f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
ls_text = 'Footer title'.
adds and icon (red triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'ICON_MESSAGE_ERROR_SMALL'.
adds test (via variable)
CALL METHOD end->add_text
EXPORTING
text = ls_text
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Bold text'
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Normal text'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Yellow triangle'
sap_emphasis = 'strong'.
adds and icon (yellow triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'ICON_LED_YELLOW'.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'More text'.
*set height of this section
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_grid.
CALL METHOD l_grid->parent->parent->(f)
EXPORTING
id = 3
height = 14.
ENDFORM. "end_of_list_html. -
Documentaion for the report in the ALV display
Hi
I am using the function module 'REUSE_ALV_LIST_DISPLAY
' to display the list. I want some options which can display the documentation of the report after ALV displays the list.
Now i am using the documentation (se38) for the report which we can see pressing a button 'i' on the selection screen.
RameshHi Ramesh,
i use it like this:
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = PROGNAME
I_CALLBACK_PF_STATUS_SET = 'MAIN'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_VARIANT = VARIANT
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
IT_SORT = SORT
IT_FILTER = FILTER
I_SAVE = 'A'
IT_EVENTS = EVENTS
IT_EVENT_EXIT = EVENT_EXIT
IS_PRINT = PRINT
I_TABNAME_HEADER = 'HEADER'
I_TABNAME_ITEM = 'BESTAND'
IS_KEYINFO = KEYINFO
TABLES
T_OUTTAB_HEADER = HEADER
T_OUTTAB_ITEM = BESTAND
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
And this:
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
aktueller Satz beider Tabellen lesen, da hierarchisch
READ TABLE HEADER INDEX RS_SELFIELD-TABINDEX.
READ TABLE BESTAND INDEX RS_SELFIELD-TABINDEX.
IF R_UCOMM EQ '&IC1' AND RS_SELFIELD-TABNAME = 'HEADER'.
IF RS_SELFIELD-FIELDNAME = 'QMNUM'.
PERFORM IW53 USING HEADER-QMNUM.
ENDIF.
IF RS_SELFIELD-FIELDNAME = 'AUFNR' AND HEADER-AUFNR <> SPACE.
PERFORM CS_AUFTRAG USING HEADER-AUFNR.
ENDIF.
IF RS_SELFIELD-FIELDNAME = 'EQUNR'.
PERFORM PM_HIER USING HEADER-EQUNR.
ENDIF.
IF RS_SELFIELD-FIELDNAME = 'MATNR'.
PERFORM MM03 USING HEADER-MATNR.
ENDIF.
IF RS_SELFIELD-FIELDNAME = 'SERIALNR'.
PERFORM IQ03 USING HEADER-MATNR HEADER-SERIALNR.
ENDIF.
ELSEIF R_UCOMM = '&IC1' AND RS_SELFIELD-TABNAME = 'BESTAND'.
IF RS_SELFIELD-FIELDNAME = 'OTGRP'.
PERFORM EXCEL_OBJEKT.
ENDIF.
ELSEIF R_UCOMM = 'REFR'.
Ausgabe neu einlesen
RS_SELFIELD-REFRESH = 'X'.
PERFORM DATEN_EINLESEN.
Programmdokumentation.
ELSEIF R_UCOMM = 'DOKU'.
CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'
EXPORTING
DOKCLASS = 'RE'
DOKNAME = PROGNAME
SHORT_TEXT = 'X'
EXCEPTIONS
CLASS_UNKNOWN = 1
OBJECT_NOT_FOUND = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I010 WITH 'Keine Dokumentation vorhanden!'.
ENDIF.
ELSEIF R_UCOMM = 'GRAPH'.
PERFORM GRAPHIK.
ELSE.
MESSAGE I010 WITH 'Bitte markieren sie eine gültige Tabellenzeile!'.
ENDIF.
ENDFORM.
And it works in the Output-List correct.
Regards, Dieter -
hi
I need to create spool after ALV display. I used this fn module RSPO_OPEN_SPOOLREQUEST and pass only the destination parameter - 'LP01'.
Spool erquest is created but no pages.. Pages 0.. Pls advise if there is any other parameter I need to fill for this fn module or any other way to achieve this.
Thanks
Arunachala.GHello Arunachala,
Please use the below steps :
1.>
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-box_fieldname = 'CHK'.
gd_layout-box_tabname = 'IT_SPOOL'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform.
2.> call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_interface_check = ' '
i_callback_program = gd_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_top_of_page = ''
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups =
IT_EVENTS =
i_save = 'X'
is_variant =
tables
t_outtab = it_spool[].
3. >Function :RSPO_OUTPUT_SPOOL_REQUEST
exporting
spool_request_id = ls_spool_id-id.
NB: data : ls_spool_id type sp01r_id,
Please try to do like this...
Any problem you have then please ask me...and tell me your task in details...and program also...what you have done..
Regards,
sujeet -
How to use Write statement along with ALV output
Hi expert,
currently i have a requirement where i am first displaying message with write statement and after that ALV should be displayed ...something like below:
vendor number is wrong.
material number is wrong.
plant is wrong.
and then here ALV output -list of records updated in the database.
but as of now the ALV is shown first and when going back then the write message information is dispayed.
can anyone help how we can get this in only one screen?
Thanks!!!
RajeshMay below example give you some idea.
TYPE-POOLS: slis.
DATA: BEGIN OF it_kna1 OCCURS 0,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
ort01 TYPE kna1-ort01,
END OF it_kna1.
DATA: it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
START-OF-SELECTION.
SELECT kunnr name1 ort01
FROM kna1 INTO TABLE it_kna1 UP TO 10 ROWS.
END-OF-SELECTION.
WRITE:/ 'Write Statement Display' HOTSPOT ON.
AT LINE-SELECTION.
CLEAR it_fcat.
it_fcat-fieldname = 'KUNNR'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'Customer'.
APPEND it_fcat.
CLEAR it_fcat.
it_fcat-fieldname = 'NAME1'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'Customer Name'.
APPEND it_fcat.
CLEAR it_fcat.
it_fcat-fieldname = 'ORT01'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'City'.
APPEND it_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fcat[]
TABLES
t_outtab = it_kna1[]. -
Need to use ALV instead of write:/ statement in this perform
How can I use ALV within this perform instead of using Write:/ in it.
Scroll the program. At the bottom there is use of write:/ statement.
How to use ALV in this perform?
FORM display_logfile .
TYPES: BEGIN OF lt_openbal,
bukrs TYPE bukrs,
hkont TYPE hkont,
augdt TYPE augdt,
augbl TYPE augbl,
zuonr TYPE dzuonr,
gjahr TYPE gjahr,
belnr TYPE belnr_d,
buzei TYPE buzei,
shkzg TYPE shkzg,
dmbtr TYPE dmbtr,
END OF lt_openbal,
BEGIN OF lt_log2,
hkont TYPE hkont,
opbal TYPE dmbtr,
exp TYPE dmbtr,
cap TYPE dmbtr,
err TYPE dmbtr,
END OF lt_log2,
BEGIN OF lt_zsct_record,
kongr TYPE ckml_kongr,
hkont TYPE hkont,
zcptp TYPE zdecptp,
zerrc TYPE zdeerrc,
END OF lt_zsct_record.
DATA: lw_zscs_record TYPE t_zscs_record,
lw_zsct_record TYPE lt_zsct_record,
li_zsct_record TYPE STANDARD TABLE OF lt_zsct_record,
li_zsct_record1 TYPE STANDARD TABLE OF lt_zsct_record,
lw_log1 TYPE t_zscs_record,
li_log1 TYPE STANDARD TABLE OF t_zscs_record,
li_temp TYPE STANDARD TABLE OF t_zsct_autoinv,
li_openbal TYPE STANDARD TABLE OF lt_openbal,
li_openbal_mod TYPE STANDARD TABLE OF lt_openbal,
li_log2 TYPE STANDARD TABLE OF lt_log2,
li_log2_t TYPE STANDARD TABLE OF lt_log2,
lw_log2 TYPE lt_log2,
lw_log2_t TYPE lt_log2,
lw_openbal_mod TYPE lt_openbal,
lw_openbal TYPE lt_openbal.
i_zscs_record1 = i_zscs_record.
DELETE i_zscs_record1 WHERE zerrf NE space.
SORT i_error_bapi BY recid.
SORT i_error_bdc BY recid.
SORT i_suc_bdc BY recid.
SORT i_suc_bapi BY recid.
SORT i_zscs_record1 BY recid.
LOOP AT i_zscs_record1 INTO lw_zscs_record.
lw_log1-recid = lw_zscs_record-recid.
lw_log1-kongr = lw_zscs_record-kongr.
lw_log1-hkont = lw_zscs_record-hkont.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
input = lw_zscs_record-projk
IMPORTING
output = lw_log1-projk.
lw_log1-werks = lw_zscs_record-werks.
lw_log1-matnr = lw_zscs_record-matnr.
lw_log1-zcptp = lw_zscs_record-zcptp.
lw_log1-zerrf = lw_zscs_record-zerrf.
To Check if the KONGR value is is equal to 'E'
IF lw_zscs_record-kongr = c_e.
READ TABLE i_error_bapi INTO w_error_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrc = w_error_bapi-number.
lw_log1-zertx = w_error_bapi-message.
ENDIF.
ELSE.
READ TABLE i_error_bdc INTO w_error_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrc = w_error_bdc-number.
lw_log1-zertx = w_error_bdc-message.
ENDIF.
ENDIF.
*****To Check if the KONGR value is is equal to 'E'
IF lw_zscs_record-kongr = c_e.
READ TABLE i_suc_bapi INTO w_suc_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrf = c_x.
*******To check if lw_log1-zertx = w_error_bapi-message.
ENDIF.
ELSE.
READ TABLE i_suc_bdc INTO w_suc_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrf = c_x.
********To check if lw_log1-zertx = w_error_bdc-message.
ENDIF.
ENDIF.
APPEND lw_log1 TO li_log1.
*To clear work areas
CLEAR: lw_log1,
w_error_bapi,
w_suc_bdc,
w_suc_bapi,
w_error_bdc,
lw_zscs_record.
ENDLOOP.
IF NOT i_zscs_record1 IS INITIAL.
*To retrieve required data from the custom table ZSCT_AUTOINV
SELECT saknr
fipos
geber
saknr_off
fipos_off
FROM zsct_autoinv
INTO TABLE i_autoinv
FOR ALL ENTRIES IN i_zscs_record1
WHERE saknr = i_zscs_record1-hkont.
IF sy-subrc = 0.
SORT i_autoinv.
ENDIF.
ENDIF.
Assigning I_AUTOINV data into a local internal table for further processing
li_temp[] = i_autoinv[ ].
Sort LI_TEMP by SAKNR
SORT li_temp BY saknr.
Delete adjacent duplicates from LI_TEMP comparing SAKNR
DELETE ADJACENT DUPLICATES FROM li_temp COMPARING saknr.
Check if LI_TEMP is initial
IF NOT li_temp[] IS INITIAL.
Retrieve required data from table BSIS for all the G/L accounts
SELECT bukrs
hkont
augdt
augbl
zuonr
gjahr
belnr
buzei
shkzg
dmbtr
FROM bsis
INTO TABLE li_openbal_mod
FOR ALL ENTRIES IN li_temp
WHERE bukrs = c_wfp
AND hkont = li_temp-saknr.
IF sy-subrc = 0.
ENDIF.
ENDIF.
SORT li_openbal_mod BY hkont.
****Retrieve data from table ZSCT_RECORD for further processing for
****all entries where ZERRF is equal to space
IF p_prsall = c_x.
SELECT kongr
hkont
zcptp
zerrc
FROM zsct_record "#EC CI_NOFIRST
INTO TABLE li_zsct_record
WHERE zerrf = space.
IF sy-subrc = 0.
*****Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
DELETE li_zsct_record WHERE hkont EQ space.
ENDIF.
ELSEIF p_cstcpt = c_x.
SELECT kongr
hkont
zcptp
zerrc
FROM zsct_record "#EC CI_NOFIRST
INTO TABLE li_zsct_record
WHERE zerrf = space
AND kongr NE c_e.
IF sy-subrc = 0.
******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
DELETE li_zsct_record WHERE hkont EQ space.
ENDIF.
ELSEIF p_cstexp = c_x.
SELECT kongr
hkont
zcptp
zerrc
FROM zsct_record "#EC CI_NOFIRST
INTO TABLE li_zsct_record
WHERE zerrf = space
AND kongr EQ c_e.
IF sy-subrc = 0.
******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
DELETE li_zsct_record WHERE hkont EQ space.
ENDIF.
ENDIF.
LOOP AT li_openbal_mod INTO lw_openbal.
IF lw_openbal-shkzg = c_shkzg1.
v_todmbtr = v_todmbtr + lw_openbal-dmbtr.
ELSEIF lw_openbal-shkzg = c_shkzg2.
v_todmbtr = v_todmbtr - lw_openbal-dmbtr.
ENDIF.
AT END OF hkont.
lw_log2-hkont = lw_openbal-hkont. "GL account
lw_log2-opbal = ABS( v_todmbtr ). "Open item balance
APPEND lw_log2 TO li_log2.
*log record appended with GL Account and account open item balance
CLEAR: v_todmbtr,
lw_openbal.
ENDAT .
ENDLOOP.
SORT li_log2 BY hkont.
LOOP AT li_log2 INTO lw_log2.
CLEAR v_totexppe.
CLEAR v_totcapit.
CLEAR v_toterror.
*Cost portion to be capitalised calculated
LOOP AT li_zsct_record INTO lw_zsct_record
WHERE hkont = lw_log2-hkont AND
kongr NE c_e AND zerrc IS INITIAL.
v_totcapit = v_totcapit + lw_zsct_record-zcptp. "CC calculated
ENDLOOP.
*Expensed cost portion calculated
LOOP AT li_zsct_record INTO lw_zsct_record WHERE
hkont = lw_log2-hkont AND
kongr = c_e AND zerrc IS INITIAL .
v_totexppe = v_totexppe + lw_zsct_record-zcptp. "ECP calculated
ENDLOOP.
*Errors calculated
LOOP AT li_zsct_record INTO lw_zsct_record WHERE
hkont = lw_log2-hkont AND
zerrc IS NOT INITIAL .
v_toterror = v_toterror + lw_zsct_record-zcptp. "Errors calculated
ENDLOOP.
lw_log2-exp = v_totexppe. "Expensed cost portion
lw_log2-cap = v_totcapit. "Cost capitalised
lw_log2-err = v_toterror. "Errors
*Cost portion capitalised expensed and errors in calculation are
*trans ported for related GL accont
MODIFY li_log2 FROM lw_log2
TRANSPORTING exp cap err.
ENDLOOP.
LOOP AT li_log2_t INTO lw_log2_t.
MODIFY li_log2 FROM lw_log2_t TRANSPORTING opbal WHERE hkont = lw_log2_t-hkont.
CLEAR : lw_log2_t.
ENDLOOP.
WRITE:/1(15) text-018,sy-datum. "SESSION DATE:
SKIP 2.
For printing the hear level of the output log
WRITE:/1(16) text-003, "Record ID number
20(11) text-004, "Reason Code
34(10) text-005, "GL Account
47(12) text-006, "Project Code
62(5) text-007, "Plant
70(9) text-008, "Commodity
82(25) text-009, "Cost portion To be posted
110(12) text-010, "Success Flag
125(10) text-011, "Error Code
138(50) text-012. "Error TXT
SKIP.
LOOP AT li_log1 INTO lw_log1.
WRITE:/1(16) lw_log1-recid,
20(11) lw_log1-kongr,
34(10) lw_log1-hkont,
47(12) lw_log1-projk,
62(5) lw_log1-werks,
70(9) lw_log1-matnr,
82(25) lw_log1-zcptp, "#EC UOM_IN_MES
110(12) lw_log1-zerrf,
125(10) lw_log1-zerrc,
138(80) lw_log1-zertx.
CLEAR:lw_log1.
ENDLOOP.
SKIP 2.
IF NOT li_log2 IS INITIAL.
ULINE.
WRITE:/1(16) text-013, "GL ACCOUNT CODE
20(17) text-014, "OPEN ITEM BALANCE
40(21) text-015, "EXPENSED COST PORTION
64(24) text-016, "CAPITALIZED COST PORTION
92(20) text-017. "ERRORS.
LOOP AT li_log2 INTO lw_log2.
WRITE:/1(16) lw_log2-hkont,
20(17) lw_log2-opbal,
40(21) lw_log2-exp,
64(24) lw_log2-cap,
92(20) lw_log2-err.
CLEAR:lw_log2.
ENDLOOP.
ENDIF.
ENDFORM. " DISPLAY_LOGFILEhi,
You need to use FM 'REUSE_ALV_LIST_DISPLAY' for this purpose. For using this FM, you need to create a field catlog which will contain all information about the coloumns you want to display for example their position, their text etc.
Below there is a small demo for achiving this.
TYPE-POOLS:slis.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
TYPES: BEGIN OF ty_itab1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
werks LIKE vbap-werks,
lgort LIKE vbap-lgort,
END OF ty_itab1.
DATA: itab1 TYPE TABLE OF ty_itab1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select_data.
END-OF-SELECTION.
PERFORM display.
FORM select_data .
SELECT vbeln
posnr
werks
lgort
INTO CORRESPONDING FIELDS OF TABLE itab1
FROM vbap
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
EXIT.
ENDIF.
ENDFORM.
IF alv_list = 'X'.
PERFORM build_fieldcat TABLES i_fieldcat[]
USING :
*-Output-field Table Len Ref fld Ref tab Heading Col_pos
'VBELN' 'ITAB1' 10 'VBAP' 'VBELN' '' 1,
'POSNR' 'ITAB1' 6 'VBAP' 'POSNR' '' 2,
'WERKS' 'ITAB1' 4 'VBAP' 'WERKS' '' 3,
'LGORT' 'ITAB1' 4 'VBAP' 'LGORT' '' 4.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = 'USER_COMMAND '
it_events = t_alv_events[]
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = itab1[]
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.
ENDIF.
FORM build_fieldcat TABLES fpt_fieldcat TYPE slis_t_fieldcat_alv
USING fp_field TYPE slis_fieldname
fp_table TYPE slis_tabname
fp_length TYPE dd03p-outputlen
fp_ref_tab TYPE dd03p-tabname
fp_ref_fld TYPE dd03p-fieldname
fp_seltext TYPE dd03p-scrtext_l
fp_col_pos TYPE sy-cucol.
*-- Local data declaration
DATA: wl_fieldcat TYPE slis_fieldcat_alv.
*-- Clear WorkArea
wl_fieldcat-fieldname = fp_field.
wl_fieldcat-tabname = fp_table.
wl_fieldcat-outputlen = fp_length.
wl_fieldcat-ref_tabname = fp_ref_tab.
wl_fieldcat-ref_fieldname = fp_ref_fld.
wl_fieldcat-seltext_l = fp_seltext.
wl_fieldcat-col_pos = fp_col_pos.
*-- Update Field Catalog Table
APPEND wl_fieldcat TO fpt_fieldcat.
ENDFORM. -
WRITE STATEMENT IS GETTING EXECUTED BUT NOT GETTING DISPLAYED
HII All,
i hv created a selection screen with push button. Now when i m clicking that pushbutton, output is not getting displayed..when i debug program ,control enters in switch case and also executes write statement but write statement is not getting displayed.. below is the code ..
SELECTION-SCREEN BEGIN OF BLOCK INPUT WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN PUSHBUTTON 10(20) TEXT-002 USER-COMMAND FIR.
SELECTION-SCREEN PUSHBUTTON 35(20) TEXT-003 USER-COMMAND SECOND.
SELECTION-SCREEN END OF BLOCK INPUT.
WA-EMP_NO = 123.
WA-EMP_CO = 'A'.
WA-EMP_N = 'APOORV'.
APPEND WA TO IT_TAB.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'FIR'.
PERFORM SUB1.
WHEN 'SECOND'.
APPEND LINES OF IT_TAB FROM 2 TO 3 TO IT_TAB1.
WRITE:/ 'SECOND INTERNAL TABLE CONTENTS'.
LOOP AT IT_TAB1 INTO WA1.
WRITE:/15 SY-TABIX, WA1-EMP_NO NO-ZERO, WA1-EMP_CO, WA1-EMP_N.
ENDLOOP.
ENDCASE.
FORM SUB1.
LOOP AT IT_TAB INTO WA.
WRITE:/ SY-TABIX, WA-EMP_NO NO-ZERO, WA-EMP_CO, WA-EMP_N.
ENDLOOP.
ENDFORM.
Plz help me..
Edited by: Julius Bussche on Jan 29, 2009 1:40 PM
Code tags added and please dont use Caps-Lock.HI,
SELECTION-SCREEN BEGIN OF BLOCK INPUT WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN PUSHBUTTON 10(20) TEXT-002 USER-COMMAND FIR.
SELECTION-SCREEN PUSHBUTTON 35(20) TEXT-003 USER-COMMAND SECOND.
SELECTION-SCREEN END OF BLOCK INPUT.
WA-EMP_NO = 123.
WA-EMP_CO = 'A'.
WA-EMP_N = 'APOORV'.
APPEND WA TO IT_TAB.
* AT SELECTION-SCREEN. "Comment this
START-OF_SELECTION. " Add this
CASE SY-UCOMM.
WHEN 'FIR'.
PERFORM SUB1.
WHEN 'SECOND'.
APPEND LINES OF IT_TAB FROM 2 TO 3 TO IT_TAB1.
WRITE:/ 'SECOND INTERNAL TABLE CONTENTS'.
LOOP AT IT_TAB1 INTO WA1.
WRITE:/15 SY-TABIX, WA1-EMP_NO NO-ZERO, WA1-EMP_CO, WA1-EMP_N.
ENDLOOP.
ENDCASE.
FORM SUB1.
LOOP AT IT_TAB INTO WA.
WRITE:/ SY-TABIX, WA-EMP_NO NO-ZERO, WA-EMP_CO, WA-EMP_N.
ENDLOOP.
ENDFORM. -
Write Statements are not getting Displayed
Hi All,
We are going for Upgrade from 4.7 to ECC. So, in my program we have few write statements which are not getting displayed in the output. Those write statments are seen as errors in the extended check as Char. strings w/o text elements will not be translated: 'Income Tax Worksheet'.
Could any one please help me to over come this errors and Display the wite statements.
Thanks
ShashikanthHave you mapped the checked and unchecked glyphs to be used?
Check the doc and blog for check boxes.
Regards
tim -
After refreshing ALV display, set it to the current cell that was modified.
Hello Experts,
I am currently using cl_gui_alv_grid for my ALV grid display. I have 1 editable column
which lets users input values. Now, When users press 'ENTER' in the keyboard I refresh
the ALV display to reflect the changes done. But the display always "moves back" to the first column
so it is tiresome to find the current cell that was modified. My question is, how do I set the ALV
display to just "stay put" in the current cell that was modified after pressing 'ENTER'?
Hope you can help me guys.Thank you and take care!Check this link
ALV scroll bar
Maybe you are looking for
-
Any ideas how to fix my mac book pro to canon pixma mp640 printer connection?
Anyone have any ideas how to fix my mac book pro to canon pimxa mp640 printer link? The two are connected manually yet the ! remains on the 'print' page next to the printer name. it was working fine until i changed the ink cartridges. Without the wir
-
I purchased an audiobook from iTunes On my iPhone. I got a new phone and after the back up, the books I downloaded were not there. iTunes wants me to repurchase the books I downloaded. Is there a way for me to Redon load my already purchased books
-
Create the file from data base
iam trying to upload material master data using direct input method in lsmw. i want one input text file which contains the information about material master data. can any one pls help me how to create this material master txt file from the data base.
-
I use Firefox 9 on Windows XP, desktop
-
Post one time customer payment with clearing
Dear, I paid one time customer billing using F-28. When i choosed a n open item (billing doc) with ope item selection as follows : - account : customent number - account type : D - standard OIs was ticked but there was a message :"no appropriate line