I have an editable ALV buttons (via status gui), SAVE, REFRESH, and HISTORICAL.
I don't have any problem with save and refresh, but in historical i would like to show via popup an itab, but this itab needs to be editable or at least have any button to update changes.
It's important not to use a custom dynpro in this case. So, is there any FM to fill that requirements?
Thanks!
Edit:
Ok, it seems i will have to use a table control via dynpro.
I leave the issue unresolved to post my solution when I have it done
Have you tried the good old FM REUSE_ALV_GRID_DISPLAY and pass some values to these parameters?
i_screen_start_column = 5 " X0
i_screen_start_line = 5 " Y0
i_screen_end_column = 60 " X1
i_screen_end_line = 20 " Y1
(values are for example)
And in the fieldcat you should set up these flags to make the column editable.
ls_fieldcat-checkbox = abap_true.
ls_fieldcat-edit = abap_true.
Related
My task is to customize the Header Details Screen of the ME33K transaction, the goal is to add a box with new fields that should appear only if the Agreement type is the one I defined by using the transaction SPRO (ex: Agreement type ABC).
I started making an enhancement to that screen by using the CMOD transaction, I created a dummy box and field with some hard-coded input value and it's working fine.
My next step would be to make these new fields appear only if the Agreement is of type ABC, but I cannot find the correct approach.
I tried doing some Screen-Loop programming and deactivating the box and/or fields, but the only ones that get deactivated are the standard ones that exist already, the ones I added with the enhancement are not affected.
EDIT :
The enhancement I used was 'MM06E005'.
I wrote the following Screen-Loop code in the include provided in the 'EXIT_SAPMM06E_006' user exit :
loop at screen.
if screen-name = 'CUSTOM_FIELDS'.
screen-active = 0.
modify screen.
endif.
endloop.
The enhancement MM06E005 refers to the subscreen SAPLXM06 0101, that you have created with a box with all your custom screen fields.
To hide your custom screen fields, you must:
Call a PBO (Process Before Output) module, to be done in the flow logic of your subscreen (the one which contains the screen fields):
PROCESS BEFORE OUTPUT.
...
MODULE modify_screen_field_attributes.
...
PROCESS AFTER INPUT.
...
In the include LXM06O01 (preferrably), do this:
MODULE modify_screen_field_attributes OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'CUSTOM_FIELDS'. " name of one screen field
screen-active = 0. " hide the screen field
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
Dear all I need your help on the below desperately.
I have created an ALV from SALV and I have copied a GUI Status SALV_STANDARD from a standard program. Firstly I added 2 buttons the POSTNEW & POSTDIFF and after a day I added the SELECT button.
Depending on the selection of the user I want to enable or disable the buttons according to the business requirements.
I have this code in a procedure:
r_alv type reference CL_SALV_TABLE.
if status_name is not initial and report_name is not initial.
set pf-status status_name.
r_alv->set_screen_status(
pfstatus = status_name
report = report_name
set_functions = r_alv->c_functions_all ).
endif.
data: lit_functions_list type salv_t_ui_func,
lwa_functions_list like line of lit_functions_list.
r_functions = r_alv->get_functions( ). "Get Toolbar functions
lit_functions_list = r_functions->get_functions( ).
if i_button_name is not initial.
** Now hide the BUTTON
loop at lit_functions_list into lwa_functions_list.
if lwa_functions_list-r_function->get_name( ) = i_button_name.
lwa_functions_list-r_function->set_visible( i_button_visable ).
endif.
endloop.
endif.
The variables status_name, report_name, i_button_name and i_button_visable are parameters of the procedure and I think that their names show what they are carrying.
The internal table lit_functions_list has 60 records and the last 2 have data for the first 2 buttons and this is the reason that I can enable/disable them.
But there is no record with my 3rd button SELECT. Instead there is a record with the button MYFUNCTION which I have already deleted.
Can someone tell me what to do in order to have the 3rd button available in the lit_functions_list?
Can someone tell me why this itab has so many garbages?
Thanks in advance
Elias
Even I had the same problem. After I ran the report BALVBUFDEL it solved the issue.
Newly created buttons now coming inside the function list ..
lit_functions_list = r_functions->get_functions( ).
For Adding 3rd button in the lit_functions_list, You can use below code.
r_functions->set_function( NAME = 'BUT3' BOOLEAN = 'X' ).
you can also use add_function to add new button.
try.
r_functions->add_function(
name = 'BUT3'
icon = l_icon
text = l_text
tooltip = l_text
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
itab does not have garbage. It contains all the data related to status like menu bar, application tool bar and function keys.
Finally I found the answer at least to my problem. Let me describe again what I did:
I copy the GUI Status from the standard program SALV_DEMO_TABLE_FUNCTIONS to my program through Tcode SE41. I added 2 buttons POSTNEW & POSTDIF. Until now all working perfect and I can Enable/Disable these 2 buttons.
Next day the business asked me to add a button SELECT with which the user can make editable the corresponding SELECT column of the itab in order to choose which record to be posted. And here started my problem where the itab with the functions didn't contain the last created button SELECT. What I did was, I created a button through the design process of the GUI Status but I could not get it through the below code:
lit_functions_list = r_functions->get_functions( ).
With your answers I found other problems in my code but still I could not get the new button in the above itab.
Finally, yesterday evening I remembered, what someone told me in the past. In old systems (like oursSAP ECC 6.0 R701 SP007) sometimes the ALV buffer stuck and we have to reset it. So I run the program BALVBUFDEL and vuala the button SELECT appeared in the itab and I can now Enable or Disable.
So keep in mind that sometimes the ALV buffer needs a reset.
Thanks all for your help.
Elias
I would like to draw a box dynamically in SAP Script, whereas the POSITION YORIGIN for the box will be changing constantly depending on the availability of data for print.
For more Detail , Please have a look on the pic.
On page2 marked area, I want to display data on page3. Empty area on page2 is not fixed and vary depending on the data.Therefore , I have to display page3 data on empty space which is not fixed.
regards,
Umar Abdullah
You cannot specify the YORIGIN value dynamically, however here is one workaround how you can place box in a dynamic way. You can do this from print-program:
DATA: command TYPE c LENGTH 100.
command = 'BOX WIDTH ''17.5'' CM HEIGHT 5 CM FRAME 10 TW INTENSITY 15'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = command
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3.
This will insert new box on the form, and you can control the position by changing command string conditionally depending on the presence of data on page 2.
In a fillable form, I would like the two adjacent fields to become shaded (no input available) if the N/A radio button is selected. If either the Yes or No radio button is selected, I would like the first adjacent field to take the value from the PointValue field. How would I accomplish this? Thank you for your help.
That can be accomplished in various ways. One possibility would be the following, which you add to the form logic calculation script (if this is the only one, then be it), which you attach to a hidden (text) field whose sole purpose is to provide a holder for the form's calculation logic. BTW, this approach is considered best practice for a smart form, because it gives maximum control over the calculations, and creates the most efficient form.
Anyway, let's assume the group of checkboxes or radiobuttons is named "mySelect", and the field with the result/to be greyed out is named myResult. The return value of the n/a button shall be "na"
Then, you would have the following piece of code in the calculation script mentioned above:
if (this.getField("mySelect").value != "na") {
this.getField("myResult").readonly = false ;
this.getField("myResult").strokeColor = color.gray ;
this.getField("myResult").value = this.getField("mySelect").value.toString().replace(/Off/gim, "") ;
} else {
this.getField("myResult").readonly = true ;
this.getField("myResult").strokeColor = color.blac, ;
this.getField("myResult").value = "" ;
}
And that should do it.
I have a basic math test program, and 2 forms to allow the user to choose which function to test on.
The first form has a list of radio buttons with the 4 basic math functions and a button to load the next form.
The second form contains this code on Load...
'Change function sign to reflect chosen option
If frmOptions.rdoAdd.Checked Then
lblFunc.Text = "+"
ElseIf frmOptions.rdoSub.Checked Then
lblFunc.Text = "-"
ElseIf frmOptions.rdoMult.Checked Then
lblFunc.Text = "x"
ElseIf frmOptions.rdoDiv.Checked Then
lblFunc.Text = "÷"
End If
If I change the Checked field in the properties in form 1, it passes to form 2.
However if I use the radio buttons to choose a different option, form 2 sticks with the default choice from form 1.
EDIT
Changed a few lines based from input, but still having this issue.
I'll run through it again.
frmOptions has 4 radio buttons, addition is default chosen.
After selecting one, the user clicks a button to open frmTest.
The above code runs upon first load to change a label to reflect what was chosen on frmOption above.
On step 3, the label on frmTest that is supposed to be changed based on the Checked radio button from frmOption never changes. It doesn't even change on the first load of the form, so I think something is wrong with the Checked property of the radio buttons.
Hopefully this clears things up a bit.
It seems like there's not enough information here to know for sure.
It sounds like your first form is loading the second form with values the first time, but then on subsequent calls it doesn't load the second form because it's already loaded. Does that sound correct?
If so, then that you are probably setting values on the first form which get passed to the second form. Instead, create properties on the second form and load it first. Then have the first form manipulate those properties.
Try firing an event when the radio button changes instead of when form2 loads.
Try using the Form2.Shown event instead of Form2.Load.
A form is loaded only once, but it can be shown numerous times.
Have you tried
If My.Forms.Form1.Radiobutton_Name.Checked = True Then
lblFunc.Text = "+"
ElseIf My.Forms.Form1.Radiobutton_Name.Checked = True Then
lblFunc.Text = "-"
ElseIf My.Forms.Form1.Radiobutton_Name.Checked = True Then
lblFunc.Text = "x"
ElseIf My.Forms.Form1.Radiobutton_Name.Checked = True Then
lblFunc.Text = "÷"
End If