Dunning - Entire Coding in SMARTFORMS!!
Hi,
I need to develop one Dunning Program through Smartforms, generate a PDF and Mail the same.
I have few questions regarding the same.
u2022 Which Application do I need to choose in NACE as I see nothing related to Dunning?
u2022 If there is no Application then the question of Output type is ruled out. That means Driver Program is also ruled out.
u2022 If I need to code everything in Smartform itself I mean, PDF and E-Mailing .How can I achieve this.
Thanks in Advance for your help.
Hi Ullas,
For NACE on dunning,
Go to transaction NACE
2. Select EF application, click on output types
3. Select Output type NEU and double click on processing routines
4. Here you can give ur driver program name and script name
Check the link
about dunning form
hope this helps.
Regards,
SuryaD.
Edited by: SuryaD on Dec 18, 2009 10:56 PM
Edited by: SuryaD on Dec 18, 2009 10:57 PM
Similar Messages
-
Suppose I'm doing the coding in smartforms, then how to make a selection screen.Please explain with a sample code.
you must create a common report program to do the select-screen
then at last to call the smartform and importing parameter
call function 'SSF_FUNCTION_MODULE_NAME'
exporting formname = lf_formname 'your smartforms name
variant = ' '
direct_call = ' '
importing fm_name = lf_fm_name
exceptions no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
perform protocol_update.
endif.
endif.
call smartform invoice
call function lf_fm_name
exporting
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_appl_obj =
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = 'X'
is_bil_invoice = ls_bil_invoice
is_vbdkr = vbdkr
is_komk = komk
is_catsxt_data = i_catsxt_flow_back
importing document_output_info =
job_output_info =
job_output_options =
tables is_vbdpr = t_vbdpr
is_komv = tkomv
is_komvd = tkomvd
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
perform protocol_update.
endif. -
Dunning print with a SMARTFORM
Hi all,
I'm working (on ECC6 release) with dunning process (transaction F150) in which I have to print dunnings with a SMARTFORM.
In Customizing (SPRO->Financial Accounting(New)->Account Receivable and Accounr Payable->Business Transaction->Dunning->printout->assign dunning forms) I linked my SMARTFROM Z to 1 dunning level.
With the BTE I linked the event 1720 to the function SI_PRINT_DUNNING_NOTICE_SMARTF in which the funcion PRINT_DUNNING_NOTICE_SF is called.
Inside the function PRINT_DUNNING_NOTICE_SF the system fills some structures (gs_fs_mhnk, gs_sf_fsabe, gs_sf_t047, ....) and then call in a right wy SMARTFORM but when the dynamic function "fm_name" is called the only parameter passed (behind the other classic parameters xxxx) is SFPPARAM. This parameter (SFPPARAM-CONTENT) is filled with this strange string in which there are some (useful for my SMARTFORM) values:
"6002007103010SOL1DZ0010000176001 0 2007103020071030 00000000Z0011ZCEUR ##ခ獬##ခ獬##### "
before the dynamic function "fm_name" but when I enter in my SMARTFORM I don't see its value. Why?
How can I pass this values or the standard structures (gs_fs_mhnk, gs_sf_fsabe, gs_sf_t047, ....) to my SAMRTFORM?
Any help?
thank you
Gino BonfiglioliI used the best-practice tools for the dunning notice, if you used this you will find a complete smartforms ready to be used.
else, you could used the same method of this smartforms :
here it's the initialisation code:
CALL FUNCTION 'GET_SF_DUNN_DATA'
EXPORTING
is_sfparam = is_sfparam
IMPORTING
es_mhnk = mhnk
es_t001 = t001
es_knb5 = knb5
es_lfb5 = lfb5
es_t047 = t047
es_t047c = t047c
es_t047i = t047i
es_t056z = t056z
es_f150d = f150d
es_fsabe = fsabe
es_adrnr = adrnr
es_uadrnr = uadrnr
es_adrs = adrs
es_uadrs = uadrs
es_t047b = t047b
eb_testprint = testprint
e_langu = langu
e_lang2 = lang2
es_f150d_esr = f150d_esr
es_paymi = paymi
es_paymo = paymo
TABLES
t_mhnd = th_mhnd
EXCEPTIONS
no_parameters_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
sy-msgid = 'FM'.
sy-msgty = 'E'.
sy-msgno = 461.
RAISE others.
ENDIF.
h_t040a-text1 = space.
show_interest = space.
LOOP AT th_mhnd INTO mhnd WHERE xzins = ' '.
show_interest = 'X'.
EXIT.
ENDLOOP. -
Coding in Smartform inside a Text Box
Hi All,
Whether this code is correct inside a text box in a Smartform ?
:/ IF &GS_NAME1& <> ''.
<T2>&GS_NAME1&</>
ENDIF.
:/ IF &GS_NAME2& <> ''.
<T2>&GS_NAME2&</>
:/ ENDIF.
Thanks in Advance ,
Vivek K ..You cannot use IF statements inside the smartforms text nodes.
In you case, you need to create two text nodes.
one to print <T2>&GS_NAME1&</>, in the condition tabs update the condition with field name GS_NAME1 and select <> option on Operartor column and value as Inital for the comparison.
Second to print <T2>&GS_NAME2&</>, in the condition tabs update the condition with field name GS_NAME2 and select <> option on Operartor column and value as Inital for the comparison. -
Dunning letter -smartform - F150_DNN_SF
hi all,
am creating a smart form for dunning letter F150_DUNN_SF , we have three levels of dunning based on the past due days.
level 1 , level 2 and level 3 and each level has its own format for print output. so basically i need to trigger three smart forms for a customer.
I have created to three forms but functional team assigned it to the dunning level .
now my question is how these forms are triggered by dunning level and where should i do customization based on the dunning level in order to print the corresponding format the presumption that customer will always have three dunning levels of past due invoices.
example if there are 20 invoices past due.
10 Invoices- dunning level 1 ---trigger smartform 1
5 Invoices-dunning level 2 --trigger smartform 2
5 Invoices- dunning level 3-trigger smartform 3.
thanks
GOVIThe form trigger by dunning level is part of the dunning procedure configuration in the IMG. If I understand your question correctly though, it does not make sense for one customer to have multiple dunning levels. A customer has a single dunning level within a company. The customer may have various balance ages but only a single dunning level, which is assigned by the dunning program based on the dunning area.
-
Dunning Smartform F150_DUNN_SF configuration
Hi,
Could anyone let me know the steps involved in configuration of Dunning smartform, I am also having a requirement where I have to configure Dunning smart form F150_DUNN_SF with the standard print program.
Could you please explain me the steps to configure this smartform, I am able to configure a sap script for dunning but not the smartform.
Thanks in advance.
Best Regards,
Abnish JainHello
Based on the configuration in FBMP where the frequency is given and grace period is also given. Based on that the dunning levels are triggered when you dun a customer using F150. So each time in one run the dunning level is updated in the customer in the other dunning run the dunning level moves on to the next.
Thanks and Regards -
Dunning smartform F150_DUNN_SF Error ?
Hi All,
I have assigned the standard dunning smartform "F150_DUNN_SF" for dunning letter printout, i have also configured BTE event 1720 to trigger smartforms. While triggering the dunning letter from F150 transaction, its giving a error "ULINE not found". Please provide some solution to this error ?
Thanks & Regards,
Navneeth K.Hi,
Could you please let me know the steps involved in configuration of Dunning smartform, I am also having a requirement where I have to configure Dunning form F150_DUNN_SF with the standard print program.
Could you please explain me the steps to configure this, I am able to configure a script for dunning but not the smartform.
Thanks in advance.
Best Regards,
Abnish Jain -
Print Dunning Notice in Smartforms
Hi All,
I want to print a dunning notice in SAP Smartforms.
I have changed the settings required in customizing for Financial Accounts, Financial Accounting Global Settings -> Business Transaction Events changing the function module as FI_PRINT_DUNNING_NOTICE_SMARTF.
Then I created a smartform copying standard form F150_DUNN_SF & assigned it to my Dunning Procedure.
When this smartform is assigned a warning message was appeared saying "Form ZF150_DUNN_SF is not defined or is not active"
After all these settings when I tried to print the dunning notice, the program is terminated giving following reason:
Form ZF150_DUNN_SF language EN is not active and has no errors
Can anybody tell me how to rectify this issue please?
Thanks in Advance,
Inoka.Hi,
The message is a sapscript message (TD 422); the system doesn't use smart forms.
In my system it works.
My customizing is as following (under BTE / settings)
PS/functions modules/... of a SAP Appl.:
00001720 FI-FI FI_PRINT_DUNNING_NOTICE (as standard)
Products/... of a customer:
ZDUNNING xxxxxx X(active)
PS/functions modules/... of a customer:
00001720 ZDUNNING FI-FI PRINT_DUNNING_NOTICE_SF -
Regarding Selection Screen in smartforms
Hi:
I got the following requirement.
I've to make a smartform & do the coding in smartform itself. I'm not sure that how to populate a selection screen. I need to populate a Select-options. Please help me out.HI,
You can create the Selection screen in a program and call the Smartform function module in the Program and you can pass the Selection screen parameters to the Smartfor, if you create the Fields in FROM INTERFACE in Smartfroms, then that become import paramters in the function module and you can pass the selection screen fields to this paramters
Look at the below link, it is having the Program and the Progam using the select-options also
http://www.erpgenie.com/abap/smartforms.htm
Regards
Sudheer -
Looping the complete page in Smartforms
Hi,
How can I loop the entire page in smartforms which contain multiple windows?Hi Shah Kunal
A Simple Smartform Tutorial
SAP Smartforms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smartforms support printer, fax, e-mail, or the Internet (by using the generated XML output).
According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).
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
lobal 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
call function 'SSF_FUNCTION_MODULE_NAME'
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.
call function FM_NAME
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.
Reward if helpful
Regards
Lakshman -
Marketing Attributes and Communication info in pdf fact sheet.
Hi,
I have a requirement to get the communication details and marketing attributes in the pdf fact sheet.
Smartform CRM_ACC_ACCOUNT_OVERVIEW_PRN has no coding for these info, although both informations are available in online version.
There is a program CRM_MKTBP_ATTR_HISTORY availble to diplay attributes, but i have no clue how to bring the entire program in smartform. Can anyone help on this how to fetch these info in pdf?
Regards,
NeelHi Neel,
You can create a custom smart form for this . take the help of a ABAP programmer.
You can use tables ADRC for communication details .
For marketing attributes : you can use function module CRM_MKTBP_READ_BP_LIST giving the BP guid in table IT_BP_LIST. This will give you the attribute set along with the attributes and their values assigned to the BP.
Example call:
Test for function group CRM_MKTBP_DB
Function module CRM_MKTBP_READ_BP_LIST
Import parameters Value
IV_LANGU EN
Tables Value
IT_BP_LIST 1 Entry
Result: 1 Entry
ET_BP_ALLOCLIST 1 Entry
Result: 2 Entries
ET_RETURN 0 Entries
Result: 0 Entries
One you get these values you can pass this to your smart form.
Hope this helps
Best regards
Sourabh
Edited by: Sourabh Verma on Apr 9, 2009 9:31 AM -
Error in generic sync application
Hello Everyone.
I have tried an application after studying the generi sync examples in MDK.
I am creating the contacts application using the table merep_person.
I want to display the 4 fields namely firstname, lastname,profession and ***.
After doing the entire coding and deployment when i run the application from the client i get the following error :-
Error: 500
Location: /SAU_GENERIC_CONTACTS/start
Internal Servlet Error:
java.lang.ArrayIndexOutOfBoundsException: 2
at miProjectPackage.bean.TableViewBean.setTableContent(TableViewBean.java:77)
at miProjectPackage.MiProjectClass.loadBean(MiProjectClass.java:205)
at miProjectPackage.MiProjectClass.doHandleEvent(MiProjectClass.java:104)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGetNotThreadSafe(AbstractMEHttpServlet.java:346)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGet(AbstractMEHttpServlet.java:678)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.service(AbstractMEHttpServlet.java:326)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:534)
Please help me with this error.
Thanks & Regards.
SaurabhHello Jo,
Yes you are right that i need to modify the TableViewBean.java class. I have already done the following modification in order to display 4 fields.
private String[][] tableContent =
Also i have made the changes required in the servlet class.
Still the error persists. Suugest if this change is not proper.
Thanks & Regards.
Saurabh -
Editable ALV - how to throw an error message for a specific line & field
Hi all,
I've implemented an editable ALV and also the ON_DATA_CHECK event to check the values, entered in the ALV. So this works fine and I can check the values.
But now, I want to throw an error message corresponding to the field in the ALV, where the error occured.
How can I throw this error message corresponding to a specific line/field in the ALV?
I was using REPORT_ATTRIBUTE_ERROR_MESSAGE and REPORT_ELEMENT_ERROR_MESSAGE but without success.
I'm also using a loop over the "CHANGES" in the ALV and within this loop, I use
elem_alv = node_alv->get_element( index = <change>-element_index )
to get the element for the message.
CALL METHOD lo_message_manager->REPORT_ELEMENT_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'my message'
ELEMENT = elem_alv
* ATTRIBUTES =
* PARAMS =
* MSG_USER_DATA =
* IS_PERMANENT = ABAP_FALSE
* SCOPE_PERMANENT_MSG = CO_MSG_SCOPE_CTXT_ELEMENT
* MSG_INDEX =
* CANCEL_NAVIGATION =
* IS_VALIDATION_INDEPENDENT = ABAP_FALSE.
2.) is it right, that for an editable ALV, I can't use the WDDOBEFOREACTION to do the checks?
If I try to use this, I can't get the values of my ALV table to check it.
Thanks,
AndreasHi Andreas,
I have tried to replicate your problem and I am getting the desired output. I have a row by name TEMP_NEW in my ALV and I want to throw an error message whenever the user enters a value of 4 for that particular field. Please find my coding as below. The important thing is where we perform the actual comparison between the r_value and 4. r_value is defined in SALV_WD_S_TABLE_MOD_CELL as reference to type DATA. So suppose the user enters a value of say 3 in the TEMP_NEW field of the ALV then r_value would contain 3 but if you observe its type in debugging mode it would be as TYPE REF TO I and not TYPE I. So you cannot directly say something like:
"if ls_modified_cells-r_value = 3" as this would lead to a syntax error. Define a field-symbol say <temp> and then use it to get the actual value into it by saying like:
ASSIGN ls_modified_cells-r_value->* TO <temp>.
Then you can use this <temp> for comparison in your IF statement like:
IF <temp> = 3.
Find the entire coding as below:
METHOD check_data.
DATA: lr_node TYPE REF TO if_wd_context_node,
lr_element TYPE REF TO if_wd_context_element,
ls_modified_cells TYPE salv_wd_s_table_mod_cell.
FIELD-SYMBOLS <temp> TYPE data.
" get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
lr_node = wd_context->get_child_node( name = 'NODE' ).
LOOP AT r_param->t_modified_cells INTO ls_modified_cells.
lr_element = lr_node->get_element( index = ls_modified_cells-index ).
IF ls_modified_cells-attribute = 'TEMP_NEW'.
" Get the value extracted into the field symbol from the reference variable
ASSIGN ls_modified_cells-r_value->* TO <temp>.
" Use the value present in this field-symbol for your comparison
IF <temp> = 4.
" report message
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Sample message text'
element = lr_element
attribute_name = ls_modified_cells-attribute.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
Hope this helps resolve your problem.
Regards,
Uday -
Stuckup in search help FM!!
hi experts....
I have a simple report, where i need to populate search help.
the below is the coding wat i have used, but fetching a error.
pls help me out, Thnx alot .
if u want to see the entire coding too i will send...
Regards
Rachel.
seLECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: DDNUMBER for ZPAYMENT_DETAILS-CHECF.
SELECTION-SCREEN END OF BLOCK B1.
data: pname1(20) type c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR DDNUMBER-LOW.
pname1 = 'DDNUMBER-LOW'.
PERFORM F4_HELP_DDNUMBER using pname1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR DDNUMBER-HIGH.
pname1 = 'DDNUMBER-HIGH'.
PERFORM F4_HELP_DDNUMBER_high using pname1.
form F4_HELP_DDNUMBER using pname1.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'ZPAYMENT_DETAILS'
fieldname = 'checf'
SEARCHHELP = ' '
SHLPPARAM = ' '
DYNPPROG = sy-repid
DYNPNR = sy-dynnr
DYNPROFIELD = pname1
STEPL = 0
VALUE = ' '
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
SUPPRESS_RECORDLIST = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
SELECTION_SCREEN = ' '
IMPORTING
USER_RESET =
TABLES
RETURN_TAB = RET_TAB
EXCEPTIONS
FIELD_NOT_FOUND = 1
NO_HELP_FOR_FIELD = 2
INCONSISTENT_HELP = 3
NO_VALUES_FOUND = 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.
endform. " F4_HELP_DDNUMBER
*& Form F4_HELP_DDNUMBER_HIGH
text
--> p1 text
<-- p2 text
form F4_HELP_DDNUMBER_HIGH using pname1 .
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'zpayment_details'
fieldname = 'CHECF'
SEARCHHELP = ' '
SHLPPARAM = ' '
DYNPPROG = sy-repid
DYNPNR = sy-dynnr
DYNPROFIELD = pname1
STEPL = 0
VALUE = ' '
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
SUPPRESS_RECORDLIST = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
SELECTION_SCREEN = ' '
IMPORTING
USER_RESET =
TABLES
RETURN_TAB =
EXCEPTIONS
FIELD_NOT_FOUND = 1
NO_HELP_FOR_FIELD = 2
INCONSISTENT_HELP = 3
NO_VALUES_FOUND = 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.
endform. " F4_HELP_DDNUMBER_HIGHHi,
After the At selection-screen event, you need to write the select query.
Try this report
REPORT Z_TEST_F4_HELP.
TABLES: ZEMPLOYEE,MARA.
DATA: BEGIN OF ITAB OCCURS 0,
ENO LIKE ZEMPLOYEE-ENO,
ENAME LIKE ZEMPLOYEE-ENAME,
EAGE LIKE ZEMPLOYEE-EAGE,
SALARY LIKE ZEMPLOYEE-SALARY,
END OF ITAB.
PARAMETERS: P_ENO LIKE ZEMPLOYEE-ENO,
P_MATNR LIKE MARA-MATNR.
TYPES: BEGIN OF ts_mara,
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
END OF ts_mara.
DATA : lt_mara TYPE TABLE OF ts_mara.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR ERSDA ERNAM FROM MARA INTO TABLE LT_MARA UP TO 10 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'MATNR'
PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = LT_MARA
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 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.
Hope this helps you.
Thanks,
Ruthra -
"Implicit" Binding in ABAP OO?: the ALV method grid- check_changed_data
In this thread here:
Where/how would you add the actual DB update to BCALV_EDIT_03?
Uwe Schieferstein was kind enough to show that anyone can see the effect or outcome of the ALV check_changed_data method if they just add this code to the PAI of the SAP demo program BCALV_EDIT_03:
MODULE pai INPUT.
TRANSLATE ok_code TO UPPER CASE.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN 'SAVE'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
I_GRID_TITLE =
'Before CHECK_DATA_CHANGED -> changes not yet retrieved'
TABLES
t_outtab = gt_outtab
EXCEPTIONS
OTHERS = 99.
g_grid->check_changed_data( ).
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
I_GRID_TITLE =
'After CHECK_DATA_CHANGED -> changes retrieved'
TABLES
t_outtab = gt_outtab
EXCEPTIONS
OTHERS = 99.
PERFORM save_data.
WHEN OTHERS.
* do nothing
ENDCASE.
ENDMODULE. "pai INPUT
When looking at this code, the following question occurred to me:
<b>Question: How does check_changed_data know the itab to bring the changed back to, since it is called in the PAI with no arguments.</b>
The only answer I can see is that when the grid is first loaded in the PBO of BCALV_EDIT_03 in the usual way:
if g_custom_container is initial.
perform create_and_init_alv changing gt_outtab
gt_fieldcat
gs_layout.
endif.
the ABAP OO engine implicitly "binds" the back-end table gt_outtab to the ALV contol (i.e. the instance of CL_GUI_ALV_GRID that the program creates.)
So, if you answer this question, please do one of two things:
a) confirm that check_changed_data "knows" the correct itab to bring the data back to because the ABAP OO engine has, in fact, implicitly "bound" the control to the itab gt_outtab;
or
b) if this is not true, explain how check_changed_data knows what itab to bring the data back to.
Thanks very much in advance for whatever time anyone can afford to spend on this question.
djhHello David
I have modified my previous sample report again to +demonstrate +that the
grid instance knows exactly which itab is displayed. Unfortunately it is already a few years ago when I attended the excellent SAP course BC412 (Dialog Programming using EnjoyControls, held by a chinese SAP employee with a beautiful Palatine dialect). Thus, I +cannot explain +the technical details (which are somehow related to the automation queue and the control framework).
Here are the new modifications:
(1) Inbetween the data definitions and the local class definition I have added two parameters:
DATA: gt_outtab TYPE TABLE OF sflight.
PARAMETERS:
p_byref RADIOBUTTON GROUP rad1, " pass itab by reference
p_byval RADIOBUTTON GROUP rad1. " pass itab by value
* LOCAL CLASS Definition
(2) The parameters are evaluated in PBO module PBO:
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF g_custom_container IS INITIAL.
IF ( p_byval = 'X' ).
PERFORM create_and_init_alv_byval
CHANGING gt_outtab
gt_fieldcat
gs_layout.
ELSE. " ( p_byref = 'X' ).
PERFORM create_and_init_alv CHANGING gt_outtab
gt_fieldcat
gs_layout.
ENDIF.
ENDIF.
ENDMODULE. "pbo OUTPUT
(3) And here is the difference between the two routines:
*& Form create_and_init_alv_byval
* text
* <--P_GT_OUTTAB text
* <--P_GT_FIELDCAT text
* <--P_GS_LAYOUT text
FORM create_and_init_alv_byval
CHANGING
value(pt_outtab) LIKE gt_outtab[] " by value
pt_fieldcat TYPE lvc_t_fcat
ps_layout TYPE lvc_s_layo.
PERFORM create_and_init_alv CHANGING pt_outtab
pt_fieldcat
ps_layout.
ENDFORM. " create_and_init_alv_byval
*& Form CREATE_AND_INIT_ALV
* text
* <--P_GT_OUTTAB text
* <--P_GT_FIELDCAT text
* <--P_GS_LAYOUT text
FORM create_and_init_alv
CHANGING
pt_outtab LIKE gt_outtab[] " by reference
pt_fieldcat TYPE lvc_t_fcat
ps_layout TYPE lvc_s_layo.
DATA: lt_exclude TYPE ui_functions.
Now the crucial point is that the globally visible itab gt_outtab is passed
(a) by value to method g_grid->set_table_for_first_display (routine CREATE_AND_INIT_ALV_BYVAL)
(b) by reference to method g_grid->set_table_for_first_display (routine CREATE_AND_INIT_ALV_BYVAL)
If you run the report with the default (p_byref = 'X') then the report behave exactly like the original sample report.
However, if you choose p_byval = 'X' then the reports dumps as soon as you try to change the values of the ALV list (e.g. change a planetype and hit ENTER or even sorting is sufficient).
Why? The itab passed by value to the grid instance is not the same like gt_outtab!
Conclusion: Do not try to fool the grid instance...
Regards
Uwe
PS: The entire coding of the adjusted sample reports is shown below:
report ZUS_SDN_BCALV_EDIT_03_SAVE_1.
**PROGRAM bcalv_edit_03.
* Purpose:
* ~~~~~~~~
* In this example the user may change values of fields
* SEATSOCC (occupied seats) and/or PLANETYPE. The report checks
* the input value(s) semantically and provides protocol
* messages in case of error.
* To check program behavior
* ~~~~~~~~~~~~~~~~~~~~~~~~~
* Change values of the column "occupied seats" or "Planetype" or
* both (in the same line). Try to provocate errors.
* Click on the check symbol or press return to initiate checking.
* (ALV also checks input before any functions like sorting,
* filtering or doubleclick are processed. These functions are
* only active if the input does not contain any errors).
* The ALV Grid Control first checks if the input is correct
* according to DDIC-Information (Type, lenght). Then semantic
* checks are made by the application using event handler method
* HANDLE_DATA_CHANGED.
* Essential steps (search for '§')
* ~~~~~~~~~~~~~~~
* 1.Set status of columns PLANETYPE and SEATSOCC to editable.
* 2.Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
* 3.Optionally register ENTER to raise event DATA_CHANGED.
* (Per default the user may check data by using the check icon).
* 4.Define and implement event handler to handle event DATA_CHANGED.
* 5.Loop over table MT_GOOD_CELLS to check all values that are
* valid due to checks according to information of the DDIC.
* 6.Within a check cycle:
* 6a.Get new cell value to check it using method GET_CELL_VALUE.
* (In this case SEATSOCC).
* 6b.If the value is valid you may want to change values of
* other cells.
* 6c.If the value is not valid create an protocol entry in
* the application log.
* 6d.To access old values (which where not changed in this check cycle)
* use your output table GT_OUTTAB.
* 7.Display application log if an error has occured.
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
g_grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
g_max TYPE i VALUE 100.
* local class to handle semantic checks
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: g_event_receiver TYPE REF TO lcl_event_receiver.
DATA: gt_outtab TYPE TABLE OF sflight.
PARAMETERS:
p_byref RADIOBUTTON GROUP rad1, " pass itab by reference
p_byval RADIOBUTTON GROUP rad1. " pass itab by value
* LOCAL CLASS Definition
*§4.Define and implement event handler to handle event DATA_CHANGED.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
* This flag is set if any error occured in one of the
* following methods:
DATA: error_in_data TYPE c READ-ONLY.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
PRIVATE SECTION.
*** This flag is set if any error occured in one of the
*** following methods:
** DATA: error_in_data TYPE c.
* Methods to modularize event handler method HANDLE_DATA_CHANGED:
METHODS: check_planetype
IMPORTING
ps_good_planetype TYPE lvc_s_modi
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
METHODS: ch_new_plane_v_new_seatsocc
IMPORTING
psg_plane TYPE lvc_s_modi
psg_socc TYPE lvc_s_modi
ps_saplane TYPE saplane
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
METHODS: ch_new_plane_v_old_seatsocc
IMPORTING
psg_plane TYPE lvc_s_modi
ps_saplane TYPE saplane
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
METHODS: check_seatsocc
IMPORTING
ps_good TYPE lvc_s_modi
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
* This is a suggestion how you could comment your checks in each method:
* CHECK: fieldname(old/new value) !<comp> fieldname(old/new value)
* IF NOT: (What to tell the user is wrong about the input)
* Remarks:
* fieldname: fieldname of table for the corresponding column
* (old/new value): ckeck with value of GT_OUTTAB or MT_GOOD_CELLS.
* !<comp> : the value is valid if the condition <comp> holds.
* Example:
* CHECK seatsocc(new) !>= seatsmax(old)
* IF NOT: There are not enough number of seats according to this
* planetype.
ENDCLASS. "lcl_event_receiver DEFINITION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi.
error_in_data = space.
* semantic checks
* Identify columns which were changed and check input
* against output table gt_outtab or other new input values of one row.
* Table er_data_changed->mt_good_cells holds all cells that
* are valid according to checks against their DDIC data.
* No matter in which order the input was made this table is
* ordered by rows (row_id). For each row, the entries are
* sorted by columns according to their order in the fieldcatalog
* (not the defined order using field COL_POS but the order
* given by the position of the record in the fieldcatalog).
* The order is relevant if new inputs in several columns of
* the same row are dependent. In this example,
* method 'ch_new_plane_v_new_seatsocc' needs only to be called
* once since we know that the corresponding check is already done
* when checking column PLANETYPE (see also method 'check_seatsocc').
*§5.Loop over table MT_GOOD_CELLS to check all values that are
* valid due to checks according to information of the DDIC.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
* check if column PLANETYPE of this row was changed
WHEN 'PLANETYPE'.
CALL METHOD check_planetype
EXPORTING
ps_good_planetype = ls_good
pr_data_changed = er_data_changed.
* check if column SEATSOCC of this row was changed
WHEN 'SEATSOCC'.
CALL METHOD check_seatsocc
EXPORTING
ps_good = ls_good
pr_data_changed = er_data_changed.
ENDCASE.
ENDLOOP.
*§7.Display application log if an error has occured.
IF error_in_data EQ 'X'.
CALL METHOD er_data_changed->display_protocol.
ENDIF.
ENDMETHOD. "handle_data_changed
METHOD check_planetype.
* Overview of checks according to field PLANETYPE
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* a) Does the Planetype exists? (check against check table SAPLANE)
* b) Are the number of seats (SEATSMAX) of the new planetype
* sufficient to fullfill requested bookings (SEATSOCC)?
* b1) SEATSOCC (occupied seats) also changed within
* this check cycle.
* b2) SEATSOCC has not changed within this cycle.
DATA: l_planetype TYPE s_planetye,
ls_saplane TYPE saplane,
ls_good_seatsocc TYPE lvc_s_modi.
* Get new cell value to check it.
* (In this case: PLANETYPE).
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = ps_good_planetype-row_id
i_fieldname = ps_good_planetype-fieldname
IMPORTING
e_value = l_planetype.
* existence check: Does the plane exists?
SELECT SINGLE * FROM saplane INTO ls_saplane WHERE
planetype = l_planetype.
IF sy-subrc NE 0.
* In case of error, create a protocol entry in the application log.
* Possible values for message type ('i_msgty'):
* 'A': Abort (Stop sign)
* 'E': Error (red LED)
* 'W': Warning (yellow LED)
* 'I': Information (green LED)
CALL METHOD pr_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = text-m03 "Flugzeugtyp
i_msgv2 = l_planetype
i_msgv3 = text-m05 "exitstiert nicht
i_fieldname = ps_good_planetype-fieldname
i_row_id = ps_good_planetype-row_id.
error_in_data = 'X'.
EXIT. "plane does not exit, so we're finished here!
ENDIF.
* Check if other relevant fields of this row have been changed, too.
READ TABLE pr_data_changed->mt_good_cells INTO ls_good_seatsocc
WITH KEY row_id = ps_good_planetype-row_id
fieldname = 'SEATSOCC'.
IF sy-subrc = 0.
CALL METHOD ch_new_plane_v_new_seatsocc
EXPORTING
psg_plane = ps_good_planetype
psg_socc = ls_good_seatsocc
ps_saplane = ls_saplane
pr_data_changed = pr_data_changed.
ELSE.
CALL METHOD ch_new_plane_v_old_seatsocc
EXPORTING
psg_plane = ps_good_planetype
ps_saplane = ls_saplane
pr_data_changed = pr_data_changed.
ENDIF.
ENDMETHOD. " CHECK_PLANETYPE
METHOD ch_new_plane_v_new_seatsocc.
DATA: l_seatsocc TYPE s_seatsocc.
*§5a.Get new cell value to check it using method GET_CELL_VALUE.
* (In this case SEATSOCC).
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = psg_socc-row_id
i_fieldname = psg_socc-fieldname
IMPORTING
e_value = l_seatsocc.
* CHECK: SEATSMAX(of new planetype) !>= SEATSOCC(new value)
* IF NOT: Message for wrong planetype
IF ps_saplane-seatsmax GE l_seatsocc.
*§5b.If the value is valid you may want to change values of
* other cells.
CALL METHOD pr_data_changed->modify_cell
EXPORTING
i_row_id = psg_plane-row_id
i_fieldname = 'SEATSMAX'
i_value = ps_saplane-seatsmax.
ELSE.
*§5c.If the value is not valid create an protocol entry in
* the application log.
* Possible values for message type ('i_msgty'):
* 'A': Abort (Stop sign)
* 'E': Error (red LED)
* 'W': Warning (yellow LED)
* 'I': Information (green LED)
CALL METHOD pr_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = text-m03 "Flugzeugtyp
i_msgv2 = ps_saplane-planetype
i_msgv3 = text-m04 "hat nicht genug Sitzplätze
i_fieldname = psg_plane-fieldname
i_row_id = psg_plane-row_id.
error_in_data = 'X'.
ENDIF.
ENDMETHOD. "ch_new_plane_v_new_seatsocc
METHOD ch_new_plane_v_old_seatsocc.
DATA: l_old_seatsocc TYPE s_seatsocc,
ls_outtab TYPE sflight.
*§5d.To access old values (which where not changed in this check cycle)
* use your output table GT_OUTTAB.
READ TABLE gt_outtab INTO ls_outtab INDEX psg_plane-row_id.
l_old_seatsocc = ls_outtab-seatsocc.
* CHECK: SEATSMAX(of new planetype) !>= SEATSOCC(old value)
* IF NOT: Message for wrong planetype
IF ps_saplane-seatsmax GE l_old_seatsocc.
* ok->field seatsmax can be changed
CALL METHOD pr_data_changed->modify_cell
EXPORTING
i_row_id = psg_plane-row_id
i_fieldname = 'SEATSMAX'
i_value = ps_saplane-seatsmax.
ELSE.
CALL METHOD pr_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = text-m03 "Flugzeugtyp
i_msgv2 = ps_saplane-planetype
i_msgv3 = text-m04 "hat nicht genug Sitzplätze
i_fieldname = psg_plane-fieldname
i_row_id = psg_plane-row_id.
error_in_data = 'X'.
ENDIF.
ENDMETHOD. "ch_new_plane_v_old_seatsocc
*& Form CHECK_SEATSOCC
* text
* -->P_LS_GOOD text
* -->P_ER_DATA_CHANGED text
METHOD check_seatsocc.
DATA: l_seatsocc TYPE s_seatsocc,
l_old_seatsmax TYPE s_seatsmax,
ls_outtab TYPE sflight,
ls_good TYPE lvc_s_modi.
* Check if the planetype has changed, too.
READ TABLE pr_data_changed->mt_good_cells INTO ls_good
WITH KEY row_id = ps_good-row_id
fieldname = 'PLANETYPE'.
IF sy-subrc EQ 0.
* remark: the check
* seatsocc (new value) <= seatsmax (new value)
* was already handled by form 'ch_new_plane_v_new_seatsocc'.
* so we are finished here.
EXIT.
ENDIF.
* CHECK: seatsocc (new value) <= seatsmax (old value)
* IF NOT: Message that SEATSOCC is to high.
* get new cell value of SEATSOCC.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = ps_good-row_id
i_fieldname = ps_good-fieldname
IMPORTING
e_value = l_seatsocc.
* get old cell value of SEATSMAX
READ TABLE gt_outtab INTO ls_outtab INDEX ps_good-row_id.
l_old_seatsmax = ls_outtab-seatsmax.
IF l_seatsocc > l_old_seatsmax.
CALL METHOD pr_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = text-m01 "Die Anzahl der belegten Plätze
i_msgv2 = text-m02 "übersteigt die Kapazität des Flugzeugs
i_msgv3 = ls_outtab-planetype
i_fieldname = ps_good-fieldname
i_row_id = ps_good-row_id.
error_in_data = 'X'.
ENDIF.
ENDMETHOD. " CHECK_SEATSOCC
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
* MAIN *
END-OF-SELECTION.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF g_custom_container IS INITIAL.
IF ( p_byval = 'X' ).
PERFORM create_and_init_alv_byval
CHANGING gt_outtab
gt_fieldcat
gs_layout.
ELSE. " ( p_byref = 'X' ).
PERFORM create_and_init_alv CHANGING gt_outtab
gt_fieldcat
gs_layout.
ENDIF.
ENDIF.
ENDMODULE. "pbo OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
TRANSLATE ok_code TO UPPER CASE.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN 'SAVE'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_structure_name = 'SFLIGHT'
i_grid_title =
'Before CHECK_DATA_CHANGED -> changes not yet retrieved'
TABLES
t_outtab = gt_outtab
EXCEPTIONS
OTHERS = 99.
g_grid->check_changed_data( ).
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_structure_name = 'SFLIGHT'
i_grid_title =
'After CHECK_DATA_CHANGED -> changes retrieved'
TABLES
t_outtab = gt_outtab
EXCEPTIONS
OTHERS = 99.
PERFORM save_data.
WHEN OTHERS.
* do nothing
ENDCASE.
ENDMODULE. "pai INPUT
*& Form SAVE_DATA
* text
* --> p1 text
* <-- p2 text
FORM save_data .
IF ( g_event_receiver->error_in_data = 'X' ).
MESSAGE 'Error in data -> saving not possible' TYPE 'S'.
ELSE.
MESSAGE 'Data saved' TYPE 'S'. " simulates DB update
ENDIF.
ENDFORM. " SAVE_DATA
* FORM EXIT_PROGRAM *
FORM exit_program.
LEAVE PROGRAM.
ENDFORM. "exit_program
*& Form BUILD_FIELDCAT
* text
* <--P_GT_FIELDCAT text
FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = pt_fieldcat.
LOOP AT pt_fieldcat INTO ls_fcat.
IF ls_fcat-fieldname EQ 'PLANETYPE'
OR ls_fcat-fieldname EQ 'SEATSOCC'.
*§1.Set status of columns PLANETYPE and SEATSOCC to editable.
ls_fcat-edit = 'X'.
* Field 'checktable' is set to avoid shortdumps that are caused
* by inconsistend data in check tables. You may comment this out
* when the test data of the flight model is consistent in your system.
ls_fcat-checktable = '!'. "do not check foreign keys
MODIFY pt_fieldcat FROM ls_fcat.
ENDIF.
ENDLOOP.
ENDFORM. "build_fieldcat
*& Form create_and_init_alv_byval
* text
* <--P_GT_OUTTAB text
* <--P_GT_FIELDCAT text
* <--P_GS_LAYOUT text
FORM create_and_init_alv_byval
CHANGING
value(pt_outtab) LIKE gt_outtab[] " by value
pt_fieldcat TYPE lvc_t_fcat
ps_layout TYPE lvc_s_layo.
PERFORM create_and_init_alv CHANGING pt_outtab
pt_fieldcat
ps_layout.
ENDFORM. " create_and_init_alv_byval
*& Form CREATE_AND_INIT_ALV
* text
* <--P_GT_OUTTAB text
* <--P_GT_FIELDCAT text
* <--P_GS_LAYOUT text
FORM create_and_init_alv
CHANGING
pt_outtab LIKE gt_outtab[] " by reference
pt_fieldcat TYPE lvc_t_fcat
ps_layout TYPE lvc_s_layo.
DATA: lt_exclude TYPE ui_functions.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT g_grid
EXPORTING i_parent = g_custom_container.
* Build fieldcat and set columns PLANETYPE and SEATSOCC
* edit enabled.
PERFORM build_fieldcat CHANGING pt_fieldcat.
*§2.Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM exclude_tb_functions CHANGING lt_exclude.
SELECT * FROM sflight INTO TABLE pt_outtab UP TO g_max ROWS.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab.
* set editable cells to ready for input
CALL METHOD g_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
*§3.Optionally register ENTER to raise event DATA_CHANGED.
* (Per default the user may check data by using the check icon).
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CREATE OBJECT g_event_receiver.
SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* <--P_LT_EXCLUDE text
FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA ls_exclude TYPE ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
APPEND ls_exclude TO pt_exclude.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
Maybe you are looking for
-
I just got a new MacBook Pro with Snow Leopard installed. (ye~) I installed iWork '08 and tried Keynote, but I got some problem. On the editing mode, the background colors(or gradient) of themes look strange. They're kind of inverted, not exactly tho
-
Finder doesn't seem to open automatically when I drag a file onto it in the dock
I installed Mountain Lion yesterday. When I drag a file onto the Finder icon in the dock, it no longer open the finder window automatically. Is there a setting I can change to re-enable this in Mountain Lion Cheers Mikel
-
Help please transferring music from an I-pod Nano to an I-Pod Touch
Can anyone help me? I received an I-Pod Touch for Christmas and am wondering on how to transfer the music on my nano to my touch
-
How will Find my iPhone app help me track my iphone if someone has disabled the location services which doesnt require an unlock code?
-
dear all: who can list all user exit for t-code 'mb1b'? thank you !