Modify toolbar for alv using CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
Hi Experts,
I am using CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' inside an exit.
I need to modify the tolbar with just three options :-
a- add new row
b- delete rows
c- save data
Please guide me step by step as how to proceed as I am very new to ALV.
and after applying your solution to show the toolbar what should I do to Make these buttons working.
Thanks a lot for your replies in advance.
regards,
Udit
I'm not really sure why you would use an ALV grid display in a user exit. I'm not sure how that works. Another point is that the ALV object is really easier to use once you get used to it.
However:
Usually you would create a GUI status, and just add your buttons to it. Then when the function module is called specify the gui status, and user command.
For example
v_repid = sy-repid.
w_user_command = 'USER_COMMAND'
w_set_status = "Status you define below.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_bypassing_buffer = 'X'
i_callback_program = w_repid
i_callback_pf_status_set = w_set_status
i_callback_user_command = w_user_command
is_layout = w_layout
i_structure_name = 'ZGOODSMOVE'
tables
t_outtab = gt_outtab
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message e000 with 'Error in Displaying the Output Report'(025).
endif.
Put your code for the different functions into one user function module
form user_command using r_comm like sy-ucomm
rs_selfield type slis_selfield.
read table it_final1 index rs_selfield-tabindex. " This will give you back the row you selected
if sy-subrc = 0.
endif.
endform.
To define the GUI Status:
Copy the status from
Then change it to add your fields
Similar Messages
-
List display for ALV using class and methods
Hi friends
I want the list display for the ALV using Class and methods
which class and methods i can use.
Here we can't use the REUSE_ALV_LIST_DISPLAY and also GRID
I was done GRID display using class and methods but i want only list display for using class.
plz Give me sample code of list display not for grid.
Thanks
Nani.hi
please check with this code...
declare grid and container.
DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid,
o_dockingcontainer TYPE REF TO cl_gui_docking_container,
i_fieldcat TYPE lvc_t_fcat,"fieldcatalogue
w_layout TYPE lvc_s_layo."layout
If any events like double click,etc., are needed we have to add additional functionality.
call the screen in program.
Then , create the container as follows
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT o_dockingcontainer
EXPORTING
ratio = '95'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
ENDIF.
CREATE OBJECT o_alvgrid
EXPORTING
i_parent = o_dockingcontainer.
Build the fieldcatalog
create a output structure in SEll for the ALV output
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = <alv output>
CHANGING
ct_fieldcat = i_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE i030."Error in building the field catalogue
LEAVE LIST-PROCESSING.
ENDIF.
*If you need to modify the field catalog,modify it using field sysmbols
*setting the layout
w_layout-grid_title = title.
w_layout-zebra = 'X'.
then displaying the output
CALL METHOD o_alvgrid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = w_layout
CHANGING
it_outtab = i_output[]
it_fieldcatalog = i_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i032 ."Error in Displaying
LEAVE LIST-PROCESSING.
ENDIF.
*After that in PAI of the screen, you need to free the *object while going back from the screen(according to *your requirement)
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
PERFORM f9600_free_objects:
USING o_alvgrid 'ALV' text-e02,
USING o_dockingcontainer 'DOCKING'
text-e01.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9001 INPUT
*in the program, write the follwoing code
FORM f9600_free_objects USING pobject
value(ptype)
value(ptext).
DATA: l_objectalv TYPE REF TO cl_gui_alv_grid.
CASE ptype.
WHEN 'ALV'.
l_objectalv = pobject.
IF NOT ( l_objectalv IS INITIAL ).
CALL METHOD l_objectalv->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, l_objectalv.
PERFORM f9700_error_handle USING ptext.
ENDIF.
WHEN 'DOCKING'.
DATA: lobjectdock TYPE REF TO cl_gui_docking_container.
lobjectdock = pobject.
IF NOT ( lobjectdock IS INITIAL ).
CALL METHOD lobjectdock->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, lobjectdock.
PERFORM f9700_error_handle USING ptext.
ENDIF.
WHEN 'CONTAINER'.
DATA: lobjectcontainer TYPE REF TO cl_gui_container.
lobjectcontainer = pobject.
IF NOT ( lobjectcontainer IS INITIAL ).
CALL METHOD lobjectcontainer->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, lobjectcontainer.
PERFORM f9700_error_handle USING ptext.
ENDIF.
WHEN OTHERS.
sy-subrc = 1.
PERFORM f9700_error_handle USING
text-e04.
ENDCASE.
ENDFORM. " f9600_free_objects
FORM f9700_error_handle USING value(ptext).
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-e03
txt2 = sy-subrc
txt1 = ptext.
ENDIF.
endform.
also check with this
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
Hope this helps
if it helped, you can acknowledge the same by rewarding
regards
dinesh -
Displaying table using call function 'REUSE_ALV_GRID_DISPLAY'
I have created a table which has product code, product description, and product level. I am trying to display it using REUSE_ALV_GRID_DISPLAY. When I Check it, I get the following error message: "PVS2" is not an internal table - the "Occurs n" specification is missing.
Is it possible to copy PVS2 into another table, and then display that table using REUSE_ALV_GRID_DISPLAY?
I have patched together code from sdn, a client program, and my own code and I am starting to get confused. So, please help me.
Regards,
Al Lal
REPORT YABHINAV16.
* program to display products at chosen level *
Tables: T179, T179t.
types: begin of hierarchy,
prodh type t179-prodh,
vtext type t179t-vtext,
stufe type t179-stufe,
end of hierarchy.
types: begin of text,
prodh type t179t-prodh,
vtext type t179t-vtext,
end of text.
data: pvs type standard table of hierarchy initial size 0.
data: pvs2 type hierarchy.
data: it_text type standard table of text,
wa_text type text.
TYPE-POOLS:SLIS.
*For ALV
DATA: GT_FLD TYPE SLIS_T_FIELDCAT_ALV,
GT_EV TYPE SLIS_T_EVENT,
GT_HDR TYPE SLIS_T_LISTHEADER,
GT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: WA_FLD TYPE SLIS_FIELDCAT_ALV,
WA_EV TYPE SLIS_ALV_EVENT,
WA_HDR TYPE SLIS_LISTHEADER,
WA_SORT TYPE SLIS_SORTINFO_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DEFINE FLD.
WA_FLD-FIELDNAME = &1.
WA_FLD-TABNAME = &2.
WA_FLD-OUTPUTLEN = &3.
WA_FLD-SELTEXT_L = &4.
WA_FLD-SELTEXT_M = &5.
WA_FLD-SELTEXT_S = &6.
WA_FLD-COL_POS = &7.
WA_FLD-FIX_COLUMN = &8.
WA_FLD-DO_SUM = &9.
APPEND WA_FLD TO GT_FLD.
CLEAR WA_FLD.
END-OF-DEFINITION.
CONSTANTS: C_TOP TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA: MTRL LIKE SY-REPID,
TITLE LIKE SY-TITLE.
select-options level for t179-stufe no intervals.
start-of-selection.
Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
select prodh vtext from t179t into corresponding fields of table it_text for all entries in pvs where prodh = pvs-prodh.
end-of-selection.
sort pvs by prodh.
sort it_text by prodh.
loop at pvs into pvs2.
read table it_text into wa_text with key prodh = pvs2-prodh.
if sy-subrc eq 0.
pvs2-vtext = wa_text-vtext.
write: / pvs2-prodh, pvs2-vtext, pvs2-stufe.
endif.
* modify pvs2.
endloop.
perform BUILD_FIELDCAT.
perform GRID_DISPLAY.
form BUILD_FIELDCAT .
FLD 'PRODH' 'PVS2' '20' 'Product Hierarchy' ' ' ' ' '1' '' '' .
FLD 'VTEXT' 'PVS2' '40' 'Description ' ' ' ' ' '3' '' '' .
FLD 'STUFE' 'PVS2' '5' 'Level' ' ' ' ' '2' '' '' .
endform. " BUILD_FIELDCAT
form GRID_DISPLAY .
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = MTRL
I_CALLBACK_USER_COMMAND = 'C_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = C_TOP
I_STRUCTURE_NAME = 'PVS2'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = GT_FLD
IT_SORT = GT_SORT
I_DEFAULT = 'X'
I_SAVE = 'U'
IT_EVENTS = GT_EV
TABLES
T_OUTTAB = PVS2[]
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. " GRID_DISPLAYTYPE-POOLS : SLIS.
DATA : BEGIN OF WA_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
END OF WA_T001,
IT_T001 LIKE TABLE OF WA_T001.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
DATA : V_NAME LIKE SY-REPID.
SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE IT_T001 UP TO 15 ROWS. V_NAME = SY-REPID.
CALL FUCTION MODULE 'REUSE_ALV_FIELDCATLOG_MERGE. EXPORTING I_CALBACK_PROGRAM =
V_NAME I_INTERAL_TABNAME = 'WA_T001' I_INCLNAME = V_NAME CHANGING CT_FIELDCAT =
IT_FCAT.
CALL FUNCTION MODULE "REUSE_ALV_GRID_DISPLAY"
EXPORTING
I_CALLBACK_PROGRAM = V_NAME
IT_FCAT = IT_FCAT.
TABLES
T_OUTTAB = IT_T001
SY-REPID IS THE SYSTEM VARIABLE WHICH IS HAVING THE ABAP PROGRAM
OR CURRENT MAIN PROGRAM.
----- Sample Progam -
***INCLUDE YRVR058_DEST_WISE_SUMMARY_DF01 .
*& Form DISPLAY_DATA
text *-- Rajesh Vasudeva
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
IF ITAB[] IS NOT INITIAL.
PERFORM F_APPEND_BLOCK.
ELSE.
MESSAGE 'Data not found for the selection
criteria' TYPE 'S'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " display_data
*& Form f_append_block
text
--> p1 text
<-- p2 text
FORM F_APPEND_BLOCK .
DATA : L_WA_SORT TYPE SLIS_SORTINFO_ALV, "For
sort
L_WA_EVENTS TYPE SLIS_ALV_EVENT. "For
events
Event (Top of List)
CLEAR L_WA_EVENTS.
L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_LIST.
L_WA_EVENTS-FORM = C_TOPOFPAGE.
APPEND L_WA_EVENTS TO I_EVENTS_PART.
Event (Top of Page)
CLEAR L_WA_EVENTS.
L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
L_WA_EVENTS-FORM = 'F_DISPLAY_HEADER_PARTA'(031).
"f_display_header_part
APPEND L_WA_EVENTS TO I_EVENTS_PART.
Event (End of List)
CLEAR L_WA_EVENTS.
L_WA_EVENTS-NAME = SLIS_EV_END_OF_LIST.
L_WA_EVENTS-FORM = C_END_OF_LIST.
APPEND L_WA_EVENTS TO I_EVENTS_PART.
Set Layout Zebra
STRUCT_LAYOUT-ZEBRA = 'X'.
STRUCT_LAYOUT-NUMC_SUM = 'X'.
STRUCT_LAYOUT-TOTALS_TEXT = 'TOTAL:'(032).
set field catalog
PERFORM F_FIELD_CATALOG_PART.
ASSIGN ITAB[] TO <F_OUTTAB>.
V_PART = 'A'. "initiating list is A
PERFORM F_DISPLAY_BLOCK USING STRUCT_LAYOUT
I_FIELD_CAT_PART[]
C_TAB
I_EVENTS_PART[]
I_SORT_PART[].
ENDFORM. " f_append_block
*& Form f_field_catalog_part
text
--> p1 text
<-- p2 text
FORM F_FIELD_CATALOG_PART .
REFRESH I_FIELD_CAT_PART.
CLEAR I_FIELD_CAT_PART.
PERFORM F_CREATE_CATALOG USING :
*Month
C_TAB 'MONTH' 'MONTH' SPACE 'L' 7
I_FIELD_CAT_PART[],
*OBD
*C_TAB 'VBELN' 'Delivery' SPACE 'L' 12
I_FIELD_CAT_PART[],
*DATE
C_TAB 'WADAT_IST' 'Date' SPACE 'L' 10
I_FIELD_CAT_PART[],
*Destination
C_TAB 'CITY1' 'Destination' SPACE 'L' 25
I_FIELD_CAT_PART[],
*Qty By Road
C_TAB 'NTGEW_ROAD' 'Road Quantity' SPACE 'R' 16
I_FIELD_CAT_PART[],
*Rail Qty
C_TAB 'NTGEW_RAIL' 'Rail Quantity' SPACE 'R' 16 I_FIELD_CAT_PART[],
*Total Qty C_TAB 'TOT' 'Total Quantity' SPACE 'R' 16 I_FIELD_CAT_PART[], *RR/Trk No.
C_TAB 'EXTI2' 'Truck/RR No.' SPACE 'L' 17 I_FIELD_CAT_PART[].
ENDFORM. " f_field_catalog_part
*& Form f_DISPLAY_block
text
-->P_STRUCT_LAYOUT text
-->P_I_FIELD_CAT_PART[] text
-->P_C_TAB text
-->P_I_EVENTS_PART[] text
-->P_I_SORT_PART[] text
FORM F_DISPLAY_BLOCK USING FP_LAYOUT TYPE
SLIS_LAYOUT_ALV
FP_I_FCAT TYPE
SLIS_T_FIELDCAT_ALV
VALUE(FP_TABNAME) TYPE
ANY
FP_I_EVENTS TYPE
SLIS_T_EVENT
FP_I_SORT TYPE
SLIS_T_SORTINFO_ALV.
DATA: V_REPID TYPE SYREPID,
"current Program id
C_SAVE TYPE CHAR1 VALUE 'A'.
"variant save
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IS_LAYOUT = FP_LAYOUT
IT_FIELDCAT = FP_I_FCAT[]
IT_SORT = FP_I_SORT[]
I_SAVE = C_SAVE "variant
save
IT_EVENTS = FP_I_EVENTS[]
TABLES
T_OUTTAB = <F_OUTTAB>
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. " f_DISPLAY_block
*& Form f_create_catalog
text
-->P_C_TAB text
-->P_0085 text
-->P_0086 text
-->P_SPACE text
-->P_0088 text
-->P_5 text
-->P_I_FIELD_CAT_PART[] text
FORM F_CREATE_CATALOG USING FP_I_TABNAME TYPE
SLIS_TABNAME
FP_I_FIELDNAME TYPE SLIS_FIELDNAME
FP_I_SELTEXT TYPE
SCRTEXT_L
FP_I_DOSUM TYPE
CHAR1
FP_I_JUST TYPE C
FP_I_OUTPUTLEN TYPE
OUTPUTLEN
FP_I_FCAT TYPE
SLIS_T_FIELDCAT_ALV.
Record for field catalog
DATA: L_REC_FCAT TYPE SLIS_FIELDCAT_ALV.
L_REC_FCAT-TABNAME = FP_I_TABNAME.
L_REC_FCAT-FIELDNAME = FP_I_FIELDNAME.
L_REC_FCAT-SELTEXT_L = FP_I_SELTEXT.
L_REC_FCAT-DO_SUM = 'X'.
*l_rec_fcat-do_sum = ' '.
L_REC_FCAT-JUST = FP_I_JUST.
L_REC_FCAT-OUTPUTLEN = FP_I_OUTPUTLEN.
L_REC_FCAT-DECIMALS_OUT = '2'.
L_REC_FCAT-KEY = '1'.
APPEND L_REC_FCAT TO FP_I_FCAT.
ENDFORM. " f_create_catalog
Subroutines for Headings
*& Form f_display_header_partA
Display header for report for Part A
*& Form top_of_page
text
--> p1 text
<-- p2 text
FORM TOP_OF_PAGE .
SKIP 1.
WRITE:/25 ' Name of Company ',80 'RUN DATE' ,
SY-DATUM.
SKIP 1.
WRITE:/60 'RUN DATE' , SY-DATUM.
SKIP 1.
DATA: YR(4) TYPE N,
FIN_PRD(10) TYPE C.
IF S_DTABF-LOW+4(2) LT '04'.
YR = S_DTABF-LOW+0(4) - 1.
CONCATENATE YR '-' S_DTABF-LOW+2(2) INTO FIN_PRD.
ELSE.
YR = S_DTABF-LOW+0(4) + 1.
CONCATENATE S_DTABF-LOW0(4) '-' YR2(2) INTO
FIN_PRD.
ENDIF.
WRITE:/5 'DETAILS OF THE MONTH/DATE WISE DESPATCHES
MADE BY ROAD/RAIL DURING THE YEAR ' , FIN_PRD .
SKIP 1.
WRITE :/ 'SALES OFFICE : ' , P_SALES,' ' , RNAME.
SKIP 1.
ENDFORM. " DISPLAY_DATA
Award Points If Useful... -
Hi experts..
i got one requirement like i need to edit some rows particularly in alv....
Edit in alv output....is it possible to get that .....using normal function module with out using oops concept...
could any one pls help me...Hi Pendurti ,
If you want a particular field to be editable , simply define the fieldcatalog as
wa_fieldcatalog-edit = 'X'.
wa_fieldcatalog-input = 'X'.
for that field.
and
Now when you use FM ' Reuse alv grid display '
define USER_COMMAND
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = int_fieldcatalog
is_layout = wa_layout
TABLES
t_outtab = t_disp.
and now in form USER_COMMAND ; code as per following
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
endform.
Regards,
Yogendra Bhaskar -
How to use CALL FUNCTION '/1BCDWB/SF00000014' in smartform urgent
hiiiiiiiii
Iam doing classical report n i want my output to be printed in smartform.
So my output is in IT_FINAL table.In smartform in Form Interface Table column i had declare :::
Parameter Name: IT_FINAL
Type Assignment:LIKE
Associated Type:ZSD_FINAL ( Its a structure of IT_FINAL)
And in SE38..iam using...............
data: FM_NAME1 type RS38L_FNAM.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZCSF_SDPRSR03_PR'
importing
FM_NAME = FM_NAME1.
CALL FUNCTION FM_NAME1
EXPORTING
IT_FINAL = IT_FINAL.
So while running its giving dump..
I DONT KNOW HOW TO USE THE ABOVE FUNCTION MODULE.
CALL FUNCTION '/1BCDWB/SF00000014'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Please suggest me with example if possible......URGENT.
(Rewards if solved)
Regards.Hi
see the below doc and do accordingly
How to create a New smartfrom, it is having step by step procedure
http://sap.niraj.tripod.com/id67.html
step by step good ex link is....
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
Here is the procedure
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
<b>call function 'SSF_FUNCTION_MODULE_NAME'</b>
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
<b>call function FM_NAME</b>
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Smartform
you can check this link here you can see the steps and you can do it the same by looking at it..
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
SMARTFORMS STEPS.
1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
2. Create Table type(t_struct) of stracture in se11.
3. In your program declare Internal table(Itab) type table of structure(struct).
4. Define work area(wa) like line of internal table.
5. Open Tcode Smartforms
6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
8. In form pages and window, create Page node by default Page1 is available.
9. In page node you can create numbers of secondary window. But in form there is only one Main window.
10. By right click on page you can create windows or Go to Edit, Node, Create.
11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
13. In table there are three areas Header, Main Area, Footer.
14. Right click on the Main area create table line by default line type1 is there select it.
15. Divide line into cells according to your need then for each cell create Text node.
16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
17. Save form and activate it.
18. Then go to Environment, function module name, there you get the name of function module copy it.
19. In your program call the function module that you have copied from your form.
20. In your program in exporting parameter of function pass the internal table(itab).
SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
configure forms with data from an SAP System for the relevant business processes.
To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
SAP Smart Forms also support postage optimizing.
Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
What Transaction to start SAP Smart Forms?
Execute transaction SMARTFORMS to start SAP Smart Forms.
Key Benefits of SAP Smart Forms:
SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
These actions do not include writing of coding lines or using a Script language.
Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
For Web publishing, the system provides a generated XML output of the processed form.
Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
SmartForms System Fields
Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.
System fields of Smart Forms
&SFSY-DATE&
Displays the date. You determine the display format in the user master record.
&SFSY-TIME&
Displays the time of day in the form HH:MM:SS.
&SFSY-PAGE&
Inserts the number of the current print page into the text. You determine the format of the page number (for example, Arabic, numeric) in the page node.
&SFSY-FORMPAGES&
Displays the total number of pages for the currently processed form. This allows you to include texts such as'Page x of y' into your output.
&SFSY-JOBPAGES&
Contains the total page number of all forms in the currently processed print request.
&SFSY-WINDOWNAME&
Contains the name of the current window (string in the Window field)
&SFSY-PAGENAME&
Contains the name of the current page (string in the Page field)
&SFSY-PAGEBREAK&
Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])
&SFSY-MAINEND&
Is set as soon as processing of the main window on the current page ends
&SFSY-EXCEPTION&
Contains the name of the raised exception. You must trigger your own exceptions, which you defined in the form interface, using the user_exception macro (syntax: user_exception <exception name >).
Example Forms Available in Standard SAP R/3
SF_EXAMPLE_01
Simple example; invoice with table output of flight booking for one customer
SF_EXAMPLE_02
Similar to SF_EXAMPLE_01 but with subtotals
SF_EXAMPLE_03
Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request
Advantages of SAP Smart Forms
SAP Smart Forms have the following advantages:
1. The adaption of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore, power user forms can also make configurations for your business processes with data from an SAP system. Consultants are only required in special cases.
2. Displaying table structures (dynamic framing of texts)
3. Output of background graphics, for form design in particular the use of templates which were scanned.
4. Colored output of texts
5. User-friendly and integrated Form Painter for the graphical design of forms
6. Graphical Table Painter for drawing tables
7. Reusing Font and paragraph formats in forms (Smart Styles)
8. Data interface in XML format (XML for Smart Forms, in short XSF)
9. Form translation is supported by standard translation tools
10. Flexible reuse of text modules
11. HTML output of forms (Basis release 6.10)
12. Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release 6.10)
Regards
Anji -
Populate SELECT-OPTIONS default value using CALL FUNCTION
Hi Experts,
I would like to populate SELECT-OPTIONS s_currm default with value in w_currm, however, it doesn't seem to work. Can you please advise what the correct syntax is.
Note that CALL FUNCTION 'GET_CURRENT_YEAR' is working correctly and populating w_currm (as I can use it in a SQL SELECT statement), however, it does not seem to work for SELECT-OPTIONS s_currm.
Thank you for your time.
Code snippet is as a follows:
REPORT Z_DOWNLOAD_BSIS_TEST.
*Data Declaration
DATA: w_currm TYPE BSIS-MONAT.
*Define current fiscal month
CALL FUNCTION 'GET_CURRENT_YEAR'
EXPORTING
BUKRS = 'X999' " Company Code
DATE = SY-DATUM " Date to find fiscal year for
IMPORTING
CURRM = w_currm. " Current Fiscal Month
SELECT-OPTIONS s_currm FOR w_currm
DEFAULT w_currm. " The default value is NOT being populated (appears blank)Hi Venkat.O,
Thank you for your clear response. I have implemented your suggestion and it works, however, I now have a new problem.
Each time the report is executed or the "multiple selection" button is clicked the selection fields are populated once again with the default (low) values.
For example, when report is first opened the s_curry field displays '2010'. Clicking "multiple selection" results in another '2010' being populated. After executing the report the selection screen is populated again with '2010' (so we now have '2010' listed 3 times in the s_curry field).
How do I prevent the default values from repeating?
REPORT Z_DOWNLOAD_BSIS_TEST
*Data Declaration
DATA: w_currm TYPE BSIS-MONAT,
w_curry TYPE BSIS-GJAHR,
w_prevm TYPE BSIS-MONAT,
w_prevy TYPE BSIS-GJAHR.
SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE text-001 .
*Parameters to enter the path
PARAMETERS: FILENAME(128) OBLIGATORY DEFAULT '/usr/sap/tmp/TEST.txt'
LOWER CASE.
SELECT-OPTIONS: s_curry FOR w_curry,
s_currm FOR w_currm.
SELECTION-SCREEN END OF BLOCK b11.
AT SELECTION-SCREEN OUTPUT.
*Define current/previous financial periods
CALL FUNCTION 'GET_CURRENT_YEAR'
EXPORTING
BUKRS = 'X999' " Company Code
DATE = SY-DATUM " Date to find fiscal year for
IMPORTING
CURRM = w_currm " Current Fiscal Month
CURRY = w_curry " Current Fiscal Year
PREVM = w_prevm " Previous Fiscal Month
PREVY = w_prevy. " Previous Fiscal Year
s_curry-low = w_curry.
s_curry-option = 'EQ'.
s_curry-sign = 'I'.
APPEND s_curry.
CLEAR s_curry.
s_currm-low = w_currm.
s_currm-option = 'EQ'.
s_currm-sign = 'I'.
APPEND s_currm.
CLEAR s_currm. -
How to Modify Search for Leads using Date types in the Assgmnt Block Date
Hello Experts,
I have a requirement to modify the search for Leads using Dates in the Assignment Block Dates and using the Posting Date of the transaction.
Any ideas?
Thank you in advance,
JustinIf you look at the grants, you'll see that there are over 170 objects from the FLOWS_030000 granted to PUBLIC:
SQL> select count(*) from dba_tab_privs where owner= 'FLOWS_030000' and grantee = 'PUBLIC';
173
If we were go grant these privileges to a role, called APEX_APP_RU, and grant this role to APEX_PUBLIC_USER and any schemas an application is linked to (Workspace to Schema), would that be a workable solution?
The only problem I see right off hand that this might not work is that PUBLIC has synonyms created for the FLOWS_030000 objects. If we revoke the underlying privileges, because of the synonyms, this might not work.
SQL> select COUNT(*) from dba_synonyms where table_owner = 'FLOWS_030000' and owner = 'PUBLIC';
176
Does anyone else have any ideas? -
How to use CALL FUNCTION '/1BCDWB/SF00000014' in smartform
hiiiiiiiii
Iam doing classical report n i want my output to be printed in smartform.
So my output is in IT_FINAL table.In smartform in Form Interface Table column i had declare :::
Parameter Name: IT_FINAL
Type Assignment:LIKE
Associated Type:ZSD_FINAL ( Its a structure of IT_FINAL)
And in SE38..iam using...............
data: FM_NAME1 type RS38L_FNAM.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZCSF_SDPRSR03_PR'
importing
FM_NAME = FM_NAME1.
CALL FUNCTION FM_NAME1
EXPORTING
IT_FINAL = IT_FINAL.
So while running its giving dump..
I DONT KNOW HOW TO USE THE ABOVE FUNCTION MODULE.
CALL FUNCTION '/1BCDWB/SF00000014'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Please suggest me with example if possible......URGENT.
(Rewards if solved)
Regards.Hi Hemant
Before running u r program agai run ur smartfor the it will release fm take that one and place ur program and change that name to FM_NAME1 and check once -
I have problems for to use Start function inside a case structure.
I am doing data acquisition using the Config, Start and Read functions, all them inside a while loop. I want to use Config function only when certain conditions occur, so I put the function inside a case and no problem. But when I put the start function inside the same case, the acquisition is not good. Please view my attachment. My application is client-server type.
Attachments:
scope_server(config_start).vi 160 KBBoxer,
I checked your example and have several easy but important suggestions for you:
1.- First, make sure that the first time you initialize the VI, the AI Config and AI Start are executed, because based on the debug I made, your program doesn't do it, and this is very important.
2.- Add an AI Clear after the acquisition is done, so that you release the resources. This is a good programming technique, and may help you solve your issue.
3.- Add an Error Cluster, so that you know if an error occurred at some point of the acquisition. This will help you track the issue.
4.- What do you mean by "the acquisition is not good". What does it happen? What does it do? Do you get an error? <- This is the reason of step 3.
5.- Finally, if you have doubts
programming AI, check one of the shipping examples of LV. They can give you a much clearer idea.
Hope this helps,
L Aguila
Applications Engineeer
National Instruments -
How can use CALL FUNCTION READ_TEXT
Dear SAP Expert,
I am working in Journal Voucher of smart form. I want to show Long Text in SF.
So i am using the READ_TEXT function module to read SAP long text. and use Range of Clear Doc. in driver program.
i have one ITAB which have 20 rows.
problem is that CALL FUNCTION READ_TEXT is not working properly ...........
i WANT store Long text clear Doc. no. wise in my ITAB .
DATA: FORMNAME TYPE TDSFNAME VALUE 'ZFI_S_JOUR_VOUCHER'.
DATA: FM_NAME TYPE RS38L_FNAM.
lv_name = ITAB-BELNR.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = c_id
language = 'E'
name = lv_name
object = c_object
TABLES
lines = lt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5.
IF sy-subrc = 0.
ELSE.
LOOP AT lt_lines INTO wa_lines.
CONCATENATE ld_text wa_lines-tdline INTO ld_text.
ENDLOOP.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = FORMNAME
IMPORTING
FM_NAME = FM_NAME.
DATA: V_PRCTR LIKE BSIS-PRCTR.
CALL FUNCTION FM_NAME
EXPORTING
V_TYPE_DES = V_TYPE_DES
P_BUKRS = P_BUKRS
TABLES
IT_BKPF = IT_BKPF
ITAB = Itab
TY_BSIS = TY_BSIS.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " call_smhI [See this |http://wiki.sdn.sap.com/wiki/display/BOBJ/FunctionExampleREAD_TEXTABAPwrapper+function]
Check out the wiki session .
FUNCTION Z_AW_READ_TEXT_ALL.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(ID) TYPE THEAD-TDID
*" REFERENCE(LANGUAGE) TYPE THEAD-TDSPRAS
*" REFERENCE(NAME) TYPE THEAD-TDNAME
*" REFERENCE(OBJECT) TYPE THEAD-TDOBJECT
*" EXPORTING
*" REFERENCE(TEXT) TYPE CHAR2000
DATA BEGIN OF TEXTHEADER.
INCLUDE STRUCTURE THEAD.
DATA END OF TEXTHEADER.
DATA BEGIN OF TEXTLINES OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA END OF TEXTLINES.
CLEAR TEXTHEADER.
data: l_name type TDOBNAME."TR
l_name = name."TR
CALL FUNCTION 'READ_TEXT'
EXPORTING
OBJECT = OBJECT
ID = ID
LANGUAGE = LANGUAGE
NAME = l_NAME "TR
IMPORTING
HEADER = TEXTHEADER
TABLES
LINES = TEXTLINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT TEXTLINES.
CONCATENATE TEXT TEXTLINES into TEXT SEPARATED BY space.
ENDLOOP.
ENDFUNCTION.
Regards,
koolspy. -
Performance After Using Call Function
Hi All,
I have a program, where it is having some performance issues.
It is taking a lot of time at a customized Z Call Function.
Please suggest some solutions.Hi,
Firstly check if the Z Function module is remote enables or not...
if it is remote enabled then it will take some time....
then debug the function module and check which statement is hitting on performance, try to find out the other way round for that statement or if its a long loop then try to find out some optimized way for that loop...
still if you are not able to then paste the code of the z function module may be we are of some help there
Regards,
Siddarth -
Is It Possible to use Call Function in update task in perform on commit
Hi Friends,
I have to send an email once the commit work is done. so i am writing code like this,
Perform send_email on commit.
form send_email.
call function 'SO_NEW_DOCUMENT_SEND_API1' in update task
endform.
endform.
.... ( Some other code)
commit work.
But, I am getting error saying Update task is not possible. Please suggest me how to solve this.
Thanks in Advance,
Phani.Hi Phani,
Check whether <b>COMMIT Work</b> has be performed. I think this might be the problem.
Regards,
Prashanth -
Hi All,
I am populating data in ALV tree format using cl_gui_column_tree class methods. Now I want to have standard ALV functionality on top of my tree. How to acheive this?
Appreciate your help on the same.
Thanks & regards,
Prakash GhantasalaTree is not having a table structure,so the standard ALV toolbar is of logically no use and hence is not provided along with it.
Yet you can do R&D .To get the std ALV gui status you can copy the the gui status SALV_TABLE_STANDARD of program SALV_METADATA_STATUS -
MAPPING for xi USED-DEFINED FUNCTION(UDF)
Hi, all !
Does anybody know how to use package com.sap.engine.lib.security.http.* in the UDF ?
when i import it in the UDF ,the system reports " package com.sap.engine.lib.security.http does not exist"
can anybody help me ?
Thanks a lot in advance!
Edited by: ALAN WANG on Sep 16, 2008 10:44 AMHI,
Check Adapter Specific Message attributes.This blog will help you
The specified item was not found.
You can also go for variable substitution :-
When you specify the target directory and file name schema, you have option of setting variables and defining them in a table. The variables are replaced by elements from the XML structure at runtime.
http://help.sap.com/saphelp_nw2004s/helpdata/en/8e/464442c1a1c253e10000000a1550b0/content.htm
links on the dynamic variable substitution
The specified item was not found.
The specified item was not found.
Dynamic File Name Part 1
Dynamic File Name using XI 3.0 SP12 Part - I
Dynamic File Name Part 2
Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II
Thanks -
I use FM READ_TEXT with KOPF (ord header) = ID, and AUFK (ord text) = Object, to successfully retrieve the long text for an order.
I have another requirement to read the Inspection text from the material, that I can see if I do MM03.
Can I replace the ID and Object names to do this in the same order?
where can I see all of the available ID and object names to use?
Is there a better, or another way to get the inspection text?
Thank-You.double click on the text.....it will take u text editor there in menu bar
goto------>header...
here u can find all information.
Maybe you are looking for
-
Hi, I'm taking a java class at school, and I'm really, really bad at it. Anyway, I need help... I'm not even really sure what my problem is.. but I will try to explain. Anyway, I know I have a ton of problems, and I'm not even close to finishing the
-
Boilerplate text on SunOS 5.8
After I received a new computer: SUN Ultra-5_10 with SunOS 5.8, I have problems with Oracle Forms (Reports too). In the layout editor I cannot type a boilerplate text: When I activate this regime and try to type in something, symbols are not appear o
-
Constant Crashes with Specific FCP X Project.
Hey all, I've just recently upgraded to a 27" iMac with 24 gigs of ram, 2 gigs of video ram, 3.2 GHz i5, 1 TB Fusion drive, and I'm editing in FCP X. I'm running the latest Mountain Lion. 10.8.3 I'm doing a project now and I'm getting towards the end
-
Adding checkbox to JTable cell
Hi, I am tryin to add a checkbox to JTabel cell. But somehow i am ending up getting 'false' in the cell instead of checkbox. Can anyone please help me. here is my getColumnClass and getValuAt public Class getColumnClass(int column) { if(column==0) re
-
Hi All I know that this is a realyy old version but I love it & it does what I need it to. Operating system windows XP was completely wiped & I need to reinstall software from disc. Product no longer receives software support & I'm getting the error