Initializing fields in the declaration
Hello, I'm not exactly a newbie on Java (I've been using it since 4 years ago), but today I question has come to my mind:
What are the pros/cons of initializing a field directly in its declaration at the top of the class, like...
Set<String> setOfStrings=new HashSet<String>();
public constructor_of_the_class() {
}instead of initializing it 'setOfStrings' inside the constructor, like it is normally done? I guess that in the 1st way, as soon as the class is loaded by the JVM, even if it's not instantiated, that object is allocated, and a reference to it is assigned to the field 'setOfStrings'; with the 2nd 'common' way, instead, an instance of the class has to be created first...
It's just a curiosity, and I haven't been able to find a clue on the books I have...
Thanks a lot
giuffsalvo wrote:
I guess that in the 1st way, as soon as the class is loaded by the JVM, even if it's not instantiated, that object is allocated, and a reference to it is assigned to the field 'setOfStrings'; with the 2nd 'common' way, instead, an instance of the class has to be created first...I'm no expert here, but if the field is non-static, then it will not and cannot be instantiated or allocated on class load. Instead I believe that it will be instantiated on class creation, but before the constructor is called.
Similar Messages
-
Need to enhace tcode FD32 to add new screen fields on the initial screen
Hi All,
I am supposed to add two new screen fields on the initial screen of TCODE FD32,
I am unable to find any screen exit for that. Is there any screen exit present for that or is there any way to do this.
Kindly help me, solutions will be greatly rewarded.
Thanks in advance,
Nagaraju.check below
Transaction Code - FD32 Change Customer Credit Management
Exit Name Description
RFDRRANZ User exits: Accounts Receivable Information System
No of Exits: 1
Rewards if useful...............
Minal -
Unable to declare fields in the subscreen area of the the tabstrip created.
Hi All,
I am doing the screen enhancement for the Tcode ME52N using exit MEREQ001. I have added a screen 0111 in the Function Group XM02. On this subscreen i have created a tabstrip with 2 tabs and created element of the type Subscreen Area in the tab strip.
My requirement is to create few fields in the tabstrip subscreen area for update or display. But in the screen painter when i am trying to insert any of the screen elements i get the error "Illegal type for page element in Tabstrip".
Please advice me on how to get this done.
ThanksHi ,
I am afraid that this forum is not a correct forum for this issue. Since this forum is discuss about Windows form development. In my opinion, it is an issue regarding Windows System. I suggested you to post this thread to
answer.microsoft.com-Windows OS
Have a nice time!
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
To edit the field in the ALV report
Hi,
i want to edit the field of the ALV report what i need to do for that..
Thanks & Regards
Ashu Singhhi,
check the code,
REPORT zalv_fcat.* Output table T006 structure declarationTYPES : BEGIN OF ty_t006.
INCLUDE STRUCTURE t006.
TYPES : END OF ty_t006.*Internal table and wa declaration for T006
DATA : it_t006 TYPE STANDARD TABLE OF ty_t006,
wa_t006 TYPE ty_t006.*declarations for ALV
DATA: ok_code TYPE sy-ucomm,
fieldcatalog for T006
it_fielcat TYPE lvc_t_fcat,
fieldcatalog for fieldcatalog itself:
it_fielcatalogue TYPE lvc_t_fcat,
it_layout TYPE lvc_s_layo.*declaration for toolbar function
DATA: it_excl_func TYPE ui_functions.
Controls to display it_t006 and corresponding fieldcatalog
DATA: cont_dock TYPE REF TO cl_gui_docking_container,
cont_alvgd TYPE REF TO cl_gui_alv_grid.*controls to display the fieldcatalog as editable alv grid and container
DATA: cont_cust TYPE REF TO cl_gui_custom_container,
cont_editalvgd TYPE REF TO cl_gui_alv_grid.*intialization event
INITIALIZATION.*start of selection event
START-OF-SELECTION.
LOCAL CLASS Definition for data changed in fieldcatalog ALV
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_receiver DEFINITION
LOCAL CLASS implementation for data changed in fieldcatalog ALV
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION*data declaration for event receiver
DATA: event_receiver TYPE REF TO lcl_event_receiver.*end of selection event
END-OF-SELECTION.*setting the screen for alv output for table display and
*changed fieldcatalalogue display
SET SCREEN 600.
On this statement double click it takes you to the screen painter SE51. Enter the attributes
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen , Here we can give a title and customized menus
*Go to SE41 and create status 'STATUS600' and create THE function code 'SUBMIT'
*and 'EXIT' with icons and icon texts
Also create a TitleBar 'TITLE600' and give the relevant title.&----
*& Module STATUS_0600 OUTPUT
MODULE status_0600 OUTPUT.
SET PF-STATUS 'STATUS600'.
SET TITLEBAR 'TITLE600'.
CREATE ALV GRID CONTROL IF DOES NOT EXISTS INITIALLY
IF cont_dock IS INITIAL.
PERFORM create_alv.
ENDIF.ENDMODULE. " STATUS_0600 OUTPUT* PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes and based on the
*user command we can do the coding as shown below
*& Module USER_COMMAND_0600 INPUT
MODULE user_command_0600 INPUT.
CASE ok_code.
WHEN 'SUBMIT'.
*TO GET THE CURRENT FIELDCATALOGUE FROM THE FRONTEND
CALL METHOD cont_alvgd->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = it_fielcat.
*refresh the alv
CALL METHOD cont_alvgd->refresh_table_display.
*to Send Buffered Automation Queue to Frontend
CALL METHOD cl_gui_cfw=>flush.*Exit button clicked to leave the program
WHEN 'EXIT'.
LEAVE PROGRAM. ENDCASE.ENDMODULE. " USER_COMMAND_0600 INPUT&----
*& Form CREATE_ALV
&----FORM create_alv.*create a docking container and dock the control at the botton
CREATE OBJECT cont_dock
EXPORTING
dynnr = '600'
extension = 100
side = cl_gui_docking_container=>dock_at_bottom.*create the alv grid for display the table
CREATE OBJECT cont_alvgd
EXPORTING
i_parent = cont_dock.*create custome container for alv
CREATE OBJECT cont_cust
EXPORTING
container_name = 'CCONT'.
*create alv editable grid
CREATE OBJECT cont_editalvgd
EXPORTING
i_parent = cont_cust.* register events for the editable alv
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_data_changed FOR cont_editalvgd. CALL METHOD cont_editalvgd->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.*building the fieldcatalogue for the initial display
PERFORM build_fieldcat CHANGING it_fielcat it_fielcatalogue.*building the fieldcatalogue after the user has changed it
PERFORM change_fieldcat CHANGING it_fielcatalogue.*fetch data from the table
PERFORM fetch_data.* Get excluding functions for the alv editable tool bar APPEND cl_gui_alv_grid=>mc_fc_loc_append_row TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_cut TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort_asc TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort_dsc TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_subtot TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_graph TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_info TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_print TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_filter TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_views TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_export TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_paste TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_find TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_copy TO it_excl_func.
*Alv display for the T006 table at the bottom
CALL METHOD cont_alvgd->set_table_for_first_display
CHANGING
it_outtab = it_t006[]
it_fieldcatalog = it_fielcat[].
optimize column width of grid displaying fieldcatalog
it_layout-cwidth_opt = 'X'.* Get fieldcatalog of table T006 - alv might have
modified it after passing.
CALL METHOD cont_alvgd->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = it_fielcat[].to Send Buffered Automation Queue to Frontend CALL METHOD cl_gui_cfw=>flush. Display fieldcatalog of table T006 in editable alv grid
CALL METHOD cont_editalvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
it_toolbar_excluding = it_excl_func
CHANGING
it_outtab = it_fielcat[]
it_fieldcatalog = it_fielcatalogue[].
ENDFORM. " CREATE_alv
*& Form fetch_data
FORM fetch_data.* select data of T006
SELECT * FROM t006 INTO TABLE it_t006 UP TO 50 ROWS.
ENDFORM. " fetch_data
*& Form BUILD_FIELDCAT
FORM build_fieldcat CHANGING it_fldcat TYPE lvc_t_fcat
it_fcat TYPE lvc_t_fcat.
Fieldcatalog for table T006: it_fldcat
to generate the fields automatically CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T006'
CHANGING
ct_fieldcat = it_fldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*----
Fieldcatalog for table LVC_T_FCAT:it_fcat
Generate fieldcatalog of fieldcatalog structure.
This fieldcatalog is used to display fieldcatalog 'it_fldcat'
on the top of the screen. CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'LVC_S_FCAT'
CHANGING
ct_fieldcat = it_fcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
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. " BUILD_FIELDCAT
*& Form CHANGE_FIELDCAT
*after the user has modified the fieldcatalogue we build another fieldcat
*for the modified alv display
FORM change_fieldcat CHANGING it_fcat TYPE lvc_t_fcat. DATA ls_fcat TYPE lvc_s_fcat. LOOP AT it_fcat INTO ls_fcat.
ls_fcat-coltext = ls_fcat-fieldname.
ls_fcat-edit = 'X'. IF ls_fcat-fieldname = 'COL_POS' OR ls_fcat-fieldname = 'FIELDNAME'.
ls_fcat-key = 'X'.
ENDIF. MODIFY it_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " CHANGE_FIELDCAT
ref:saptechnical tutorial.
Regards,
Anirban -
Coloring a field in the internal table
Hi all,
How can I color a field in the internal table knowing that I'm developing a classic report.
Thanks in advance.hi,,,
check this code.
*-----TABLES DECLARATION
tables : kna1, "Customer Master
vbak, "Sales Document Header
vbap, "Sales Document Item
sscrfields. "Screen Field Table
& D A T A D E C L A R A T I O N &
data : begin of it_kna1 occurs 0,
kunnr type kna1-kunnr, "Customer Number
land1 type kna1-land1, "Country Key
name1 type kna1-name1, "Name
ort01 type kna1-ort01, "City
end of it_kna1.
data : begin of it_kna2 occurs 0,
kunnr type kna1-kunnr, "Customer Number
land1 type kna1-land1, "Country Key
name1 type kna1-name1, "Name
ort01 type kna1-ort01, "City
end of it_kna2.
data: begin of it_vbak occurs 0,
vbeln type vbak-vbeln, "Sales Document
erdat type vbak-erdat, "Date
ernam type vbak-ernam, "Name of Person
auart type vbak-auart, "Sales Document Type
end of it_vbak.
data: begin of it_vbap occurs 0,
vbeln type vbap-vbeln, "Sales Document
posnr type vbap-posnr, "Sales Document Item
matnr type vbap-matnr, "Material Number
matkl type vbap-matkl, "Material group
end of it_vbap.
data: v_count type int4, "Current Row Index
v_line like sy-lisel, "Contents of selected line
v_kunnr like kna1-kunnr.
& S E L E C T I O N S C R E E N &
selection-screen begin of block b1 with frame title text-001.
selection-screen begin of line.
parameters : rb1 radiobutton group g1 default 'X'.
selection-screen comment 5(20) text-002 for field rb1.
selection-screen end of line.
select-options : so_kunnr for kna1-kunnr obligatory.
parameters : p_hits(3) type c.
selection-screen begin of line.
parameters : rb2 radiobutton group g1.
selection-screen comment 5(20) text-003 for field rb2.
selection-screen end of line.
parameters : p_file like rlgrap-filename default 'c:\test'.
selection-screen pushbutton /33(10) custl user-command push1.
selection-screen pushbutton 58(10) custd user-command push2.
selection-screen end of block b1.
& I N I T I A L I Z A T I O N &
initialization.
move 'LOAD' to custl.
move 'DISP' to custd.
& A T L I N E S E L E C T I O N &
at selection-screen.
perform validate_kunnr.
& A T S E L E C T I O N S C R E E N O N V A L U E-R E Q U E S T &
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
importing
file_name = p_file.
& S T A R T O F S E L E C T I O N &
start-of-selection.
perform cust_details.
& S T A R T O F S E L E C T I O N &
top-of-page.
format color 3 intensified off.
write :/02(25) sy-repid.
write : 39(15) 'Page'(010), sy-pagno.
format color off.
format color 6 intensified off.
format color col_heading.
uline at :/1(60).
write: /1 sy-vline,
2 'Cust Number'(000),
14 sy-vline,
16 'Country'(007),
25 sy-vline,
26 'City'(008),
42 sy-vline,
43 'Region'(009),
60 sy-vline.
uline at :/1(60).
format color col_heading off.
& T O P O F P A G E D U R I N G L I N E S E L E C T I O N &
top-of-page during line-selection.
if sy-lsind eq 1 or sy-ucomm eq 'VBAK'.
format color col_heading.
uline at :/1(60).
write : /1 sy-vline,
2 'Docu No.'(011),
14 sy-vline,
16 'Date'(012),
26 sy-vline,
27 'Name'(013),
42 sy-vline,
43 'DType'(014),
60 sy-vline.
uline at :/1(60).
elseif sy-lsind eq 2 or sy-ucomm eq 'VBAK'.
set pf-status space.
uline at :/1(60).
write : /1 sy-vline,
2 'Docu No.'(015),
14 sy-vline,
16 'Sales Item'(016),
25 sy-vline,
26 'Mat No'(017),
42 sy-vline,
43 vbap-matkl,
50 'Mat Grp'(018),
60 sy-vline.
uline at :/1(60).
endif.
& AT USER-COMMAND &
at user-command.
case sy-ucomm.
when 'VBAK'.
perform sales_item.
when 'DELIVERY'.
clear it_vbak-vbeln.
get cursor value it_vbak-vbeln.
set parameter id 'AUN' field it_vbak-vbeln.
call transaction 'VA03' and skip first screen.
when 'DISP'.
perform display_basic.
endcase.
& AT LINE SELECTION &
at line-selection.
if sy-lsind = 1.
set pf-status 'DDDD'.
perform sales_header.
elseif sy-lsind = 2.
case sy-ucomm.
when 'PICK'.
set pf-status space.
perform sales_item.
when 'DELIVERY'.
clear it_vbak-vbeln.
get cursor value it_vbak-vbeln.
set parameter id 'AUN' field it_vbak-vbeln.
call transaction 'VA03' and skip first screen.
when 'DISP'.
perform display_basic.
endcase.
PERFORM sales_item.
endif.
& AT USER-COMMAND &
at user-command.
case sy-ucomm.
when 'VBAK'.
perform sales_item.
when 'DELIVERY'.
clear it_vbak-vbeln.
get cursor value it_vbak-vbeln.
set parameter id 'AUN' field it_vbak-vbeln.
call transaction 'VA03' and skip first screen.
when 'DISP'.
perform display_basic.
endcase.
& Form CUST_DETAILS &
form cust_details .
select kunnr
land1
name1
ort01
from kna1
into table it_kna1
where kunnr in so_kunnr.
if sy-subrc <> 0.
message 'SELECT VALID CUST NO' type 'I'.
else.
loop at it_kna1.
v_count = v_count + 1.
if sy-tabix < p_hits.
IF v_count <= p_hits.
move it_kna1 to it_kna2.
append it_kna2.
else.
exit.
endif.
endloop.
endif.
if not it_kna2[] is initial.
loop at it_kna2.
write : /1 sy-vline,
2 it_kna2-kunnr,
14 sy-vline,
16 it_kna2-land1,
25 sy-vline,
26 it_kna2-name1,
42 sy-vline,
43 it_kna2-ort01,
60 sy-vline.
uline at :/1(60).
endloop.
endif.
endform. " CUST_DETAILS
**& Form load_file
*form load_file .
*endform. " load_file
**& Form disp_file
*form disp_file .
*endform. " disp_file
*& Form VALIDATE_KUNNR
form validate_kunnr .
select single kunnr
from kna1
into kna1
where kunnr = so_kunnr.
endform. " VALIDATE_KUNNR
*& Form SALES_HEADER
form sales_header .
data : v_kna1(13).
v_kna1 = 'IT_KNA2-KUNNR'.
*get cursor line sy-lilli value v_line
clear v_kunnr.
get cursor field v_kna1 value v_kunnr.
v_kunnr = v_line+1(10).
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = v_kunnr
importing
output = v_kunnr.
select vbeln
erdat
ernam
auart
from vbak
into table it_vbak
where kunnr = v_kunnr.
if sy-subrc = 0.
loop at it_vbak.
write : /1 sy-vline,
2 it_vbak-vbeln,
14 sy-vline,
16 it_vbak-erdat,
26 sy-vline,
27 it_vbak-ernam,
42 sy-vline,
43 it_vbak-auart,
60 sy-vline.
uline at :/1(60).
endloop.
endif.
endform. " SALES_HEADER
*& Form SALES_ITEM
form sales_item .
data : v_vbeln(13).
v_vbeln = 'IT_VBAK-VBELN'.
clear it_vbak-vbeln.
get cursor field v_vbeln value it_vbak-vbeln.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = it_vbak-vbeln
importing
output = it_vbak-vbeln.
select vbeln
posnr
matnr
matkl
from vbap
into table it_vbap
where vbeln = it_vbak-vbeln.
loop at it_vbap .
write : /1 sy-vline,
2 it_vbap-vbeln,
14 sy-vline,
16 it_vbap-posnr,
25 sy-vline,
26 it_vbap-matnr,
42 sy-vline,
43 it_vbap-matkl,
60 sy-vline.
uline at :/1(60).
endloop.
endform. " SALES_ITEM
*& Form DISP_DOCU
form display_basic .
loop at it_kna1 into it_kna1.
format hotspot on.
write : /03 it_kna1-kunnr,
24 it_kna1-name1.
hide it_kna1-kunnr.
endloop.
endform. " display_basic
pls reward if useful
regards,
rekha -
Add additional field in the output list
Tcode(VL10G) .ie.out put list will not showing one new field.I want to add one more field to output list. field(VIKP-SDABW) In the SHP_VL10_ITEM and write the logic in the exit LV50R_VIEWG05----
>USEREXIT_PREPARE_LAYOUT_FILL.Plase explain me step-by-step.It is very uggent?Please help me.
Thanks & Regards,
sairamHi Sairam,
Go through this info.
/3 provides three "customization spots" that allow you to enhance FI/CO features without modifying the standard code. Although often collectively referred to as "user exits," two of the three have different names. SAP Enhancements are used to expand the standard functionality within SAP. Enhancements use function modules and are called from the standard SAP code. Each module in the system has a set of delivered enhancements that help companies expand the standard functionality where they need it. Enhancements were new in release 3.0.
The Open FI Interfaces or Business Transaction Events are also used to expand the standard functionality within SAP. These events are defined in the IMG. Business Transaction Events were new in release 4.0. They are not available for all modules and are not called on all integrated transactions into FI as of release 4.5B. This will change with each release and should be retested.The older User Exits in FI/CO are "Z" programs that are defined in table T80D for client-dependent user exits, and in table T80I for client-independent user exits. These are also used to expand the standard functionality within the FI/CO modules. These User Exits have been available since the early releases of SAP. All of these FI/CO User Exits are listed in this document in the Configuring User Exits (Older). The list is included because these User Exits are not a part of the Enhancements or Business Transaction Events and do not have an Info System for searching.
Benefits Standard SAP functionality can be enhanced without modification to the standard code.
Upgrades do not erase the functionality and it does not have to be re-transported or re-entered into the system. The enhancements should be thoroughly tested when upgrading to ensure the system will still work as implemented.
Configuring SAP Enhancements
Basic Steps in Configuring an Enhancement
Find the appropriate Enhancement.
Enter the ABAP code in the "Z" program within the function module.
Create a project.
Add the Enhancement to the project.
Activate the project.
Example Business Scenario for Enhancements
Company A has a requirement to validate all customer master records created with a U.S. address. The U.S. entity reports on the industry field on the customer master. This is only a U.S. requirement and should not be required for the other countries, so the field status would not work. To accomplish this requirement, Company A will need to set up an Enhancement for the customer master transaction. The necessary steps are detailed below with screenprints. This example was configured in a 4.6C system.
Detailed Steps
1. Tools ABAP Workbench Utilities Enhancements Definition Utilities List Enhancements
2. Do not execute this without any parameters! There are too many Enhancements and it will probably time out. Youre searching for a customer master exit. Enter mast in the short text (see Figure 1). Youll start there. Searching for an exit can be tricky, so make sure you try several things before giving up.
3. Execute the search.
Figure 1. Start Your Search for a Master Exit Here
4. Look through the list until you find the Enhancement for User exits: Customer Master Data.
5. Double-click on the enhancement SAPMF02D. This will take you to the details of the Enhancement and list the function modules included in the Enhancement.
6. To continue, double-click on the function module EXIT_SAPMF02D_001
7. This will take you to the source code for the function module. Click on the Import tab to review the tables/fields that are available for the Enhancement (see Figure 2).
Figure 2. The Tables That Are Available for the Enhancement
8. To view the tables/fields that can be changed in the function module, click on the Export and Changing tabs. For this function module, these tabs are empty because you can only validate data. You cannot change any fields in this enhancement.
9. Return to the Source Code tab.
10. Scroll down until you see the Include statement in the program. The "Z" program listed after the Include is where your code will be written (see Figure 3).
Figure 3. Your Program Will Begin After the Include Statement
11. Double-click on the Include. You will be prompted to create the include. Click on Yes to create.
12. At this point you will be prompted to enter a development class and to create a transport request. If you do not know which development class to use, please contact your technical team.
13. Enter the following ABAP code into the program (Figure 4):
User exit to ensure that all US customers have a group key
entered on the customer master.
if i_kna1-land1 = 'US' and
i_kna1-brsch = ' '.
message e001(F2).
endif.
Figure 4. The ABAP Code You Need to Enter
14. Note that the table name matches the table name in the import tab tables.
15. In this example you are using the standard message class F2 with message number 001. Normally, you will create your own message within your own message class. All customer message classes must begin with a "Z" and are created in transaction SE91.
16. Save the program.
17. The next step is to create the project. Go to transaction code CMOD or follow menu path: Tools ABAP Workbench Utilities Enhancements Project Management.
18. Enter the project name; begin the name with a "Z."
19. Click on the Create button.
Figure 5. Click on Create After You Type in the Project Name
20. Enter in a description for the project.
21. Click on the Enhancement Assignments button.
22. You will be prompted to save the enhancement. Click on Yes.
23. At this point you will be asked for a development class and to create a transport for the project. You may use the same one created when adding the ABAP code to the function module.
24. Enter the name of the enhancement SAPMF02D (see Figure 6).
Figure 6. Enter the Name of the Enhancement Here
25. Save the project.
26. Back out of the enhancement assignment.
27. Activate the project by hitting the Activate button.
The SAP Enhancement is ready to be tested! Try creating a customer with U.S. as the country and a blank group key. Be sure to test one with a group key to make sure the message is not displayed in error as well.
Configuring Business Transaction Events
Basic Steps in Configuring an Event
Make sure the application is active for Business Transaction Events.
Copy the sample interface function module into a "Z" function module.
Enter the ABAP code into the source code section of the new "Z" function module. You may choose to create a "Z" program to enter the code into and then insert the "Z" program into your function module source code.
Activate the function module.
Assign the function module to the event, country and application.
Example Business Scenario for Business Transaction Events
Company A would like to copy the group key field from the vendor master into the allocation field on all the line items within a vendor invoice and payments, including the vendor lines. This requirement assumes only one vendor is posted to in a document.
To accomplish this requirement, Company A will use the Business Transaction Event 1130, Post Document: SAP Internal Field Substitution.
1. IMG Menu Path: Financial Accounting Financial Accounting Global Settings Use Business Transaction Events Environment Infosystem (Processes).
2. Find the correct Business Event. You are updating a field, so you select the Processes Info System instead of the Publish and Subscribe Info System.
3. Execute the search with the defaults.
4. Find the correct interface for updating a document: Post Document: SAP- Internal Field Substitution (see Figure 7).
Figure 7. Find the Correct Interface for the Business Event
5. Put your cursor on the event and click on the Sample Function Module button.
6. You are now in transaction SE37 Function Builder. This is the function module (sample_process_00001130) you will need to copy into a "Z" name function module for your coding (see Figure 8).
Figure 8. This Is the Function Module You Need to Copy Your "Z" Name Function Module
7. Click on the Copy button.
8. Enter the "Z" function module name in the To Function Module field (see Figure 9).
9. Enter a Function Group. If you need to create a "Z" function group, go to transaction code SE37 and follow menu path: Go to Function Groups Create Group. A function group is a logical grouping of function modules, and the ABAP code is generated for function groups. You will be prompted for a development class and transport when creating the function group.
Figure 9. Enter Your "Z" Function Module Name Here
10. In Function Builder (transaction SE37), enter the new "Z" function module. Click on the Change button.
11. The system will default into the source code screen where you may enter your ABAP code.
12. Notice the tables available for the code. Additional tables may be declared if necessary.
13. Enter the following source code (see Figure 10):
tables: lfa1.
data: z_groupkey like lfa1-konzs.
z_groupkey = ' '.
loop at t_bseg.
check for vendor lines. If one is found, read the vendor master and
retrieve the group key field.
if t_bseg-koart eq 'K'.
select single konzs from lfa1 into z_groupkey
where lifnr = t_bseg-lifnr.
endif.
Move the group key field into all line items allocation field.
loop at t_bsegsub.
t_bsegsub-zuonr = z_groupkey.
modify t_bsegsub index sy-tabix.
endloop. "t_bsegsub
endloop. "t_bseg
Figure 10. The Screen Where You Enter Your Source Code
14. Save the function module.
15. Back out to the main Function Builder screen by clicking on the green arrow button.
16. Activate the function module by clicking on the Activate button (see Figure 11).
Figure 11. Activate the Function Module from This Screen
17. Assign the function module to the event in the IMG: Financial Accounting Financial Accounting Global Settings Business Transaction Events Settings Process Function Modules of an SAP Appl.
18. Hit enter past the warning messages that this is SAP data.
19. Click on the New Entries button.
20. Enter the process for your interface. In your example it is 00001130.
21. Enter the country the interface is valid for. If it is valid for all countries, leave this field blank.
22. Enter the application the interface should be called for. If it should be called for all applications, leave this field blank. Please note that not all integrated transactions are programmed to go through these interfaces! You will need to test to find out!
23. Enter the new "Z" function module (see Figure 12).
Figure 12. Enter Your New "Z" Function Module Here
24. Save the settings. At this point you will be prompted for a CTS number for the configuration change.
25. The Business Transaction Event is complete! You are ready for testing.
Configuring User Exits (Older)
Basic Steps in Configuring an User Exit
Create a "Z" program for the User Exits and enter the necessary ABAP code.
Enter the new program name into table T80D.
Configure the application to call the User Exit.
List of User Exits
Variable Field Movements
Substitutions in FI, CO, PCA
Validations in FI, CO, PCA
Rollups in SPL
Fixed Field Movements in SPL
Cost Center Summarization on Detail Screen
Sets Formula Variables
Example Business Scenario for User Exits
Company A would like to add a "Z" field in the Special Purpose Ledger to capture a Business Unit field for reporting. They have used all the standard SAP fields such as Business Area and Profit Center. The field will only be used for reporting and is only needed in the Special Purpose Ledger. You created a special ledger table (ZZSPL1) with field Z_BUNIT and need to populate this field based on a combination of G/L account, fund and functional area.
To accomplish this requirement, Company A will use the Variable Field Movement User Exit. To make maintenance easier, table ZZBUSUNIT was created with the G/L account, fund and functional area fields as key fields, and the business unit field as a non-key field. You generated the table maintenance so the table could be updated using transaction SM30. SAP users update the business unit determination rules in table ZZBUSUNIT by entering the G/L account, fund and functional area, and then the business unit that combination should be posting to. The User Exit will read table ZZBUSUNIT using the G/L account, fund and functional area from the posting transaction and determine the business unit. The steps for using the user exit are detailed below. This example was created on a 4.6C system.
1. Copy the delivered template User Exit program RGIVU000_TEMPLATE into a "Z" program. Follow menu path Tools ABAP Workbench Development ABAP Editor (transaction code SE38). In early releases, the delivered program was RGIVU000.
2. You will be prompted for a development class and a transport. Please check with the technical team for the correct development class.
3. At the initial ABAP Editor screen, enter your new "Z" program name, select the Source Code button and click on Change (see Figure 13).
Figure 13. To Enter Your New Code, Select Source Code and Click on the Change Button
4. Enter the following code in the User Exit (Figure 14):
FORM E01_MVC USING FROM_FIELD TO_FIELD.
to_field = 'CORP'. "Set a default business unit.
read table zzbusunit to determine the business unit field.
select single z_bunit from zzbusunit into to_field
where hkont = accit_glx-hkont and
geber = accit_glx-geber and
fkber = accit_glx-fkber.
ENDFORM.
Figure 14. Enter Your New Code at This Screen.
5. Activate the program by clicking on the Activate button.
6. Change the configuration in the User Exit table to point to your new "Z" program.
7. Follow the IMG menu path: Financial Accounting Special Purpose Ledger Basic Settings User Exits Maintain Client Specific User Exits.
8. The entry to maintain is application area GIMV: Variable Field Movement. Enter your "Z" program (see Figure 15).
Figure 15. Enter Your "Z" Program in the Application Area GIMV: Variable Field Movement
9. Save the changes.
10. The final configuration step is to assign the User Exit in the variable field movement for your special ledger table. In the IMG: Financial Accounting ? Special Purpose Ledger ? Basic Settings ? Master Data ? Maintain Field Movements. Field movements control how the fields in a special ledger table are populated. They can be populated straight from other fields in a posting or through User Exits.
Figure 16. After You Assign the Business Unit Field and the G/L Account, the Exit Field Should Contain U01.
11. Assign the business unit field as a receiver and the G/L account as the sender. The Exit field should contain U01 (see Figure 16).
12. The User Exit number U01 calls User Exit E01_MVC form in the "Z" program.
13. Save the field movement.
14. You are ready to test your User Exit!
Rewords some points.
Rgds,
P.Naganjana Reddy -
Hi all,
I have an NUMC field in the screen. when there is no values in that field( field is initial), It is displayed as "0".
I dont want that "0' to be displayed.
Is there any way to do it.
Santhoshjust look at the third write statement .
use <b>no-zero</b>
after write.
in a report,,
data : val type n.
val = 5.
write:/'value is', val.
val = val * 0.
write:/ 'value is', val.
write:/ 'value is', val no-zero.
in a module pool ..
if u r trying to remove it from the screen then declare the screen fields as char type and move the numc field to char type. this will do .
regards,
vijay
Message was edited by:
vijay k -
Reg:How to add fields to the scripts in detail
How to add fields to the scripts in detail.
Plz give me one example help me out.Hi
add fields to the scripts by sending that field between two &s.
for example if u want to add lifnr of lfa1 table then pass field like this.
&wa_lfa1-lifnr&.here wa_lfa1 is work area for internal table it_lfa1.
if name1 then &wa_lfa1-name1&
in this way you can add fields to the script under any window.
i am sending one example program for scripts.
&--structure declaration--
TYPES:BEGIN OF ST_LFA1,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
LAND1 TYPE LFA1-LAND1,
ORT01 TYPE ORT01,
REGIO TYPE REGIO,
END OF ST_LFA1.
TYPES:BEGIN OF ST_EKKO,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
AEDAT TYPE EKKO-AEDAT,
ERNAM TYPE EKKO-ERNAM,
BSTYP TYPE EKKO-BSTYP,
LIFNR TYPE EKKO-LIFNR,
END OF ST_EKKO.
TYPES:BEGIN OF ST_EKPO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
NETWR TYPE EKPO-NETWR,
END OF ST_EKPO.
&--internal table,work area declaration--
DATA:WA_LFA1 TYPE ST_LFA1,
IT_LFA1 TYPE STANDARD TABLE OF ST_LFA1,
WA_EKKO TYPE ST_EKKO,
IT_EKKO TYPE STANDARD TABLE OF ST_EKKO,
WA_EKPO TYPE ST_EKPO,
IT_EKPO TYPE STANDARD TABLE OF ST_EKPO.
&--data declaration--
DATA:TOTAL TYPE EKPO-NETWR,
V_EBELN TYPE EKKO-EBELN.
data: v_item(20) type c.
&--parameter for purchase document number--
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS P_PURDOC LIKE V_EBELN.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA_FROM_EKKO.
PERFORM GET_DATA_FROM_LFA1.
PERFORM GET_DATA_FROM_EKPO.
&--grand total--
LOOP AT IT_EKPO INTO WA_EKPO.
TOTAL = TOTAL + WA_EKPO-NETWR.
CLEAR WA_EKPO.
ENDLOOP.
&--open form--
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
FORM = 'Z_50886_VENDOR'
LANGUAGE = SY-LANGU
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for header details--
READ TABLE IT_EKKO INTO WA_EKKO INDEX 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEAD'
WINDOW = 'HEADER'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for item details--
LOOP AT IT_EKPO INTO WA_EKPO.
concatenate wa_ekko-ebeln wa_ekpo-ebelp into v_item.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
&--write form for vendor details--
READ TABLE IT_LFA1 INTO WA_LFA1 INDEX 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'VENDOR'
WINDOW = 'ADDRESS'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for grand total--
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'TOTAL'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--close form--
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form get_data_from_ekko
FORM GET_DATA_FROM_EKKO .
SELECT EBELN
BUKRS
AEDAT
ERNAM
BSTYP
LIFNR
FROM EKKO INTO TABLE IT_EKKO WHERE EBELN = P_PURDOC.
ENDFORM. " get_data_from_ekko
*& Form get_data_from_lfa1
FORM GET_DATA_FROM_LFA1 .
IF NOT IT_EKKO[] IS INITIAL.
SELECT LIFNR
NAME1
LAND1
ORT01
REGIO
FROM LFA1 INTO TABLE IT_LFA1 FOR ALL ENTRIES IN IT_EKKO WHERE
LIFNR = IT_EKKO-LIFNR.
ENDIF.
ENDFORM. " get_data_from_lfa1
*& Form get_data_from_ekpo
FORM GET_DATA_FROM_EKPO .
IF NOT IT_EKKO[] IS INITIAL.
SELECT EBELN
EBELP
LOEKZ
AEDAT
MATNR
NETWR
FROM EKPO INTO TABLE IT_EKPO
WHERE EBELN = P_PURDOC.
ENDIF.
ENDFORM. " get_data_from_ekpo -
How does APEX check for null values in Text Fields on the forms?
Hello all,
How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
Declare
v_valid boolean;
Begin
IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
v_valid := TRUE;
ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
v_valid := TRUE;
ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
v_valid := FALSE;
ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
v_valid := FALSE;
END IF;
return v_valid;
END;
My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
ThanksSee SQL report for LIKE SEARCH I have just explained how Select list return value works..
Cheers,
Hari -
How i can show the selection screen input field in the top of page in alv
hi ,
how i can show the selection screen input field in the top of page in alv grid output.
tell me the processHi,
excample from my program:
FORM topof_page.
DATA: l_it_header TYPE TABLE OF slis_listheader WITH HEADER LINE,
l_info LIKE l_it_header-info.
DATA: l_it_textpool TYPE TABLE OF textpool WITH HEADER LINE.
DATA: l_key LIKE l_it_textpool-key.
READ TEXTPOOL c_repid INTO l_it_textpool LANGUAGE sy-langu.
DEFINE m_selinfo.
if not &1 is initial.
clear l_it_header.
l_it_header-typ = 'S'.
l_key = '&1'.
translate l_key to upper case.
read table l_it_textpool with key key = l_key.
if sy-subrc = 0.
shift l_it_textpool-entry left deleting leading space.
l_it_header-key = l_it_textpool-entry .
endif.
loop at &1.
case &1-option.
when 'EQ'
or 'BT'
or 'CP'.
write &1-low to l_it_header-info.
when others.
write &1-low to l_it_header-info.
concatenate &1-option
l_it_header-info
into l_it_header-info
separated by space.
endcase.
if not &1-high is initial.
write &1-high to l_info left-justified.
concatenate l_it_header-info
l_info
into l_it_header-info
separated by space.
endif.
if &1-sign = 'E'.
concatenate ']'
l_it_header-info
into l_it_header-info.
endif.
append l_it_header.
clear: l_it_header-key,
l_it_header-info.
endloop.
endif.
END-OF-DEFINITION.
m_selinfo: s_trmdat,
s_trmext,
s_trmint,
s_fkdat,
s_delno,
s_vbeln,
s_deact,
s_kdmat.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = l_it_header[].
ENDFORM.
I hope, this will help you.
Regards
Nicole -
How to add 2 more field to the Header of FBL5N ALV report output
Hi All,
I have copied and made some modification to the standard transaction FBL5N and added some fields to the ALV report line Items but how to add fields to the header part i.e if you execute the transaction FBL5n, you will get the ALV report, in the header part customer no, company code then I need to add the 2 more fields. can any one tell me that which structure or where I need to add these fields to be appear in ALV output screen.
Thanks in advance.
Swapna.Hi Mohamed,
If you copied Z-FM successfully, then you have to go to subroutine TOP_OF_PAGE to add your field:
*& Form TOP_OF_PAGE
FORM top_of_page.
DATA: b_suppress LIKE boole-boole,
opfi_text LIKE eptext OCCURS 10 WITH HEADER LINE,
n_color TYPE i.
* IF NOT it_items-bukrs IS INITIAL "737295
* AND NOT it_items-konto IS INITIAL "737295
* AND NOT it_items-koart IS INITIAL. "737295
gs_items = gt_alv.
* ENDIF. "737295
* skip first call at top of page:
IF NOT gd_first_top IS INITIAL.
CLEAR gd_first_top.
EXIT.
ENDIF.
IF x_grid = c_x OR x_inet = c_x. "1012201
PERFORM grid_top_of_page.
EXIT.
ENDIF.
*... open FI: get header text.
* first fill some RFXPO fields for general info:
CLEAR: s_rfxpo, wa_kna1, wa_lfa1, wa_ska1.
s_rfxpo-bukrs = gs_items-bukrs.
s_rfxpo-kkber = gs_items-kkber.
s_rfxpo-koart = gs_items-koart.
s_rfxpo-konto = gs_items-konto.
s_rfxpo-vrbez = gs_variant-variant.
s_rfxpo-waers = gs_items-waers.
* update master record:
PERFORM fill_master_rec USING gs_items-koart
gs_items-konto
gs_items-bukrs. " note 698396
CALL FUNCTION 'OPEN_FI_PERFORM_00001640_E'
EXPORTING
i_rfxpo = s_rfxpo
i_kna1 = wa_kna1
i_lfa1 = wa_lfa1
i_ska1 = wa_ska1
IMPORTING
e_suppress_standard = b_suppress
TABLES
t_lines = opfi_text.
*... display open FI text:
IF x_konto_sort = 'X'.
LOOP AT opfi_text.
CASE opfi_text-color.
WHEN 1.
FORMAT COLOR 1.
WHEN 2.
FORMAT COLOR 2.
WHEN 3.
FORMAT COLOR 3.
WHEN 4.
FORMAT COLOR 4.
WHEN 5.
FORMAT COLOR 5.
WHEN 6.
FORMAT COLOR 6.
WHEN 7.
FORMAT COLOR 7.
ENDCASE.
WRITE: / opfi_text-text.
ENDLOOP.
FORMAT RESET.
ENDIF.
*... display other header text:
IF b_suppress NE 'X'.
PERFORM display_custom_header.
PERFORM display_ccard_lines.
ENDIF.
" Put your field somewhere...
ENDFORM. " TOP_OF_PAGE
Good luck,
Thanks, -
Master Detail Form - How 2 update a field in the Detail form using a query?
Hello,
I have a master detail form with, each master record having a fixed(6) number of detail records. One of the fields in the detail record is the PART_DESCRIPTION field. I am trying to update this field by querying Table_X. TABLE_X is in the format of (desciption id, description). Description id runs from 1 to 6.
When the form displays, the PART_DESCRIPTION field for the 6 detail records needs to be automatically populated with the six values of description stored in Table_X. How can this be done?
Tried using session storage objects, but made no headway.
Would greatly appreciate pointers on how to go about doing this.
Thanks.
DevIf you are on a Portal Version lesser than 3.0.9.8.3, then please try the following to populate
the PART_DESCRIPTION field.
Steps:-
1> Edit the form and go to the Additional PL/SQl section and put the following code in the
"...after displaying the page area" :-
declare
type t_vc_arr is table of varchar2(4000) index by binary_integer;
l_arr_desc t_vc_arr;
l_form_name varchar2(200);
l_form_state varchar2(500);
begin
l_form_name := p_session.get_module().get_name();
l_form_state := p_session.get_value_as_varchar2(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_FORM_STATE'
if l_form_state = 'QUERY_AND_SAVE' then
select description
bulk collect into l_arr_desc
from <schema>.table_x;
htp.p('
<script>
var descArr = new Array();
var Fidx = 1;
var formObj = document.WWVM'||p_session.get_id()||';
var fieldName = "'||l_form_name||'.DETAIL_BLOCK.PART_DESCRIPTION.0";
for i in 1..l_arr_desc.count loop
htp.p('descArr['||to_char(i-1)||']="'||l_arr_desc(i)||'";');
end loop;
htp.p('
for (var i=0; i < formObj.length; i++){
if (formObj.elements.name == fieldName+Fidx){
formObj.elements[i].value = descArr[Fidx-1];
++Fidx;
htp.p('</script>');
end if;
end; -
Date fields in the Maintainence View.
Hello friends,
I created a maintanence view which of 2 steps. This view contains a DATE field of data element type 'DATS". Now the problem is -"
1. In the first screen of the viewI am not able to see only the DATE field(Over view scr).
2. But I able to see the same field in the 2nd screen(Maintanence Screen).
Not only to my View I maintained ' Table Maintanence Generator" to some more tables.There also I am not able to see the date field in the first screen, unless it is a key field.
Thanks in advance.Hi
Step 1: Create & Maintain Table (SE11)
Screen 101: ABAP Dictionary: Initial Screen
Screen 102: Maintain Table -> Delivery and Maintenance
Screen 103: Maintain Table -> Fields
[] SE11: Enter Table Name -> Create
Enter Table Description (Mandatory Field)
Select Delivery Class
Set maintenance level
Enter Fields, Assign Data Elements
Save Entries
Check Inconsistencies
Activate Table
Go To Technical Settings (SCREEN 104)
Delivery Class: The delivery class controls the transport of table data when
installing or upgrading, in a client copy and when transporting between customer
systems. The delivery class is also used in the extended table
maintenance.
There are the following delivery classes:
A: Application table (master and transaction data).
C: Customer table, data is maintained by the customer only.
L: Table for storing temporary data.
G: Customer table. The customer namespace must be defined in table TRESC. (Use
Report RDDKOR54 here).
E: System table with its own namespaces for customer entries.
S: System table, data changes have the same status as program changes.
W: System table (e.g. table of the development environment) whose
data is transported with its own transport objects (e.g. R3TR PROG, R3TR TABL,
etc.).
Data Browser/Table View Maint.: This indicator specifies
whether it is possible to display/maintain a table or view using the maintenance
tools Data Browser (transaction SE16) and table view maintenance (transactions
SM30 and SM31).
MANDT field is mandatory for Client dependant tables
Technical Settings: The technical settings control, for example, table buffering.
Indexes: To speed up data selection, you can create secondary indexes for the table
Append Structure: Append structures are used for enhancements that are not included in the standard.
Screen 104: Maintain Technical Settings
Select Data Class (Mandatory) [APPL0]
Select Size Category (Table size - No. of records - Mandatory) [1 to 6]
Specify Buffering [allowed / not allowed]
Save
Check Inconsistencies
Activate & Go Back to Maintain Table Screen
Data Class: The data class defines the physical area of the database (for ORACLE
the TABLESPACE) in which your table is logically stored. If you choose a data
class correctly, your table will automatically be assigned to the correct area
when it is created on the database.
The most important data classes
are (other than the system data):
APPL0 Master data
APPL1 Transaction data
APPL2 Organizational and customizing data
Size category: The size category determines the probable space requirement for a table in the database.
Buffering: The buffering status specifies whether or not a table may be buffered.
Screen 105: Maintain Table
Screen 106: Maintain Enhancement Category (ECC 6.0 onwards)
-> Extras -> Enhancement Category
Select Enhancement Category
Enhancement Category: Structures and tables that were defined by SAP in the ABAP
Dictionary can be enhanced subsequently by customers using Customizing includes
or append structures. The enhancements do not only refer to structures/ tables
themselves, but also to dependent structures that adopt the enhancement as an
include or referenced structure. Append structures that only take effect at the
end of the original structure can also cause shifts - in the case of dependent
structures - even within these structures.
Screen 107: Maintain Table -> Table Maintenance Generator
Screen 108: Generate Table Maintenance Dialog: Generation Environment
-> Utilities -> Table Maintenance Generator OR [] SE54
Specify Authorization Group [&NC&]
Select Maintenance type [One Step/Two Step]
Mention Screen Numbers [1/2]
Save & Go Back
Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details. -
Access Not Made (Initialized Field)
Hello Experts,
I have come across a generic problem. I have defined a new field (material Type - MTART) in the field catalog and included the same in the new condition table (Country / Destination country / Material type / Cust tax cla / Material tax cla ). The condition table is included in the already defined access sequence. This access seuqnce is assigned to the tax conditn type ZWST.
A condition record maintained for the conditon type ZWST for newly defined access. When I create a sales order, the ZWST condition type is not picking up the record maintained for this access. Error message - 102 Access not made (Initialized field)
Subsequently, thecondition value from the next access is picked up.
Question - Did I miss any step during creation of a new field in the field catalog?
Thanks in advance for your kind help. Be assured to get the full points if answered satisfactorily.Hi
Error message - 102 Access not made (Initialized field)
If you are getting this msg in a sales order in the analysis why a particular condition type value has not been picked
Then this will not be a Error message and also not warning message
There will be a yellow exclamatory mark
Access not made (Initialized field) conceptually means
Suppose if you maintain a condition record say a condition type ZR00 for a sales org 1000 and DC 10 for a material X the price is Rs1000
Now in sales order the value for ZR00 is not coming and the message is Access not made (Initialized field)
This means that in the sales order either sales org is not 1000 or DC is not 10
Simply it means that condition record is maintained for sales org 1000 and DC 10 but your sales order is not created for those data
hence the access is not executed because the initialized fields sales org 1000 and DC 10 is missing
Hope you are getting my point
If it is understood then you can analyze your sales order and solve your error
Reply whether this input has been useful to you
Regards
Raja -
To find the date type fields in the row and validate those date fields
TYPES : BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
MTART TYPE MARA-MTART,
END OF TY_MARA.
DATA : it_mara TYPE STANDARD TABLE OF ty_mara,
it_mara1 TYPE STANDARD TABLE OF ty_mara,
wa_mara TYPE ty_mara.
loop at it_mara into wa_mara.
describe field wa_mara-ersda type c_data.
if c_data eq 'D'.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = wa_mara-ersda
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2
IF sy-subrc eq 0.
wa_mara-ersda = '00000000'.
append wa_mara to it_mara1.
write :wa_mara-matnr,wa_mara-ersda.
else.
wa_mara-ersda = '00000000'.
append wa_mara to it_mara1.
write :wa_mara-matnr,wa_mara-ersda.
ENDIF.
endif.
endloop.
This issue regarding how to find the date type fields in the row and validate those date fields.If its not a valid date ,i have to assign initial value to that.
I've tried that for single field using describe field.Please help me do that for all fields.Hi Sam,
I believe we had discussed the same issue in the below thread. Can you please refer the below one?
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d93e16ff-c123-4b36-b60b-60ccd34f6ca7/calculate-time-differences-in-infopath?forum=sharepointcustomizationprevious
If it's not helping you please let us know
Sekar - Our life is short, so help others to grow
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
you see a reply being an answer to the question of the thread, click "Mark As Answer
Maybe you are looking for
-
With Safari 3.1.1 et FireFox 5.0 on the web often connections using Java do not work , and i get the message : UnsatisfiedLinkError: GetProxyConfigURL I can't found "ProxyConfigURL" on the web, and after I have reinstalled Java, it's the same message
-
NiScope Initialize.viThe specific niScopeDAQ or niScopeDMF dll could not be loaded.
I am getting this error when I try to use both IVI-SCOPE and NI-SCOPE in TestStand. I make sure to close each reference before I use the next, but it seems like whichever one is called first will not release its reference unless I reboot the PC. I
-
Restarting AdminServer without shutting down Managed Server
Using Weblogic 10.3.5 on OEL v8 To clear some old stats I need to bounce the Admin Server running on port 7001. Would I have to stop the Managed server as well (my applications) for this? Or can I bounce Admin Server without stopping my application?
-
In criteria tab I have one dimension of Departments and one column that is a formula of two measures (measure1/measure2) The result is: Department --------MEASURE1/MEASURE2 Dept1 --------------------0,52 Dept2 --------------------0,52 Dept3 ---------
-
Time Machine Issue with Western Digital Hard Drive
I'm running snow leopard with a 300 GB WD External HD using TIme Machine. About every 4 months or so Time Machine gives me an error and says to repair the disk to fix the problem. I go to Disc Utility and try to repair it but it says "Disc cannot be