2014 Aug 28 3:06 PM
Hello guys,
I got a problem with a customer report which works with bank data from table T012K.
I got three select-options for comp.code, house bank and ID:
SELECT-OPTIONS: s_bukrs FOR t012k-bukrs,
s_hbkid FOR t012k-hbkid,
s_hktid FOR t012k-hktid.
Now in bank branch data it can be possible that several house banks have the same ID, e.g. like
In my select-options I want to have the exact values which means when I type in s_hbkid 'DEUBA' and 'SPK' and in s_hktid '0001' and '0002', normally SAP will give me all 4 marked rows. But my problem is I want to do the selection more detailled, like for every house bank the user should be able to select its one range, e.g. DEUBA with 0001 only and SPK with 0002 only.
Of course I can do the simple way like putting thousands of house bank parameter fields and for every of that an own ID range, but that does not sound that comfort to me.
Is there any clever way for this? I'm thinking about making dynamic checkboxes for every housebank and if one checkbox is marked then the ID range will be displayed for it. But I dont know if it sound that clever
Any hints?
Regards
Michael
2014 Aug 29 11:01 AM
Hi Michael,
I had a similar problem: Select more materials depending from a quantity (each material with its own quantity). I solved it by adding a push button on the selection scrren. By pushing the button it displays a table in edit mode using function CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'.
There I can enter a material and its quantity. The select is done by looping the table (sorry descriptions are in german):
There is one problem with this method: The table elements cannot by saved in a selection variant.
To have the possibility to save them I added on the selection screen a field type string with the no display option, and by using CALL TRANSFORMATION, I tranform the table entries in an XML string to store it in my string field. By getting the selection variant, I did again a CALL TRASFORMATION to transform the XML string in table entries.
I hope this can help you.
Regards
Fred
2014 Aug 29 12:29 PM
Hey Fred,
interesting proposal, I'm just going to try it.
I'm normally working with ALV Grid OO so I do not have that detailled information about REUSE functions. Did you fill anything else than fieldcat, title, popup position fields and table?
In my first tests it worked but there is still some optimization work to do 😉
How did you make your popup with the number of rows? Did you create some 'dummy' positions where only value '0.000' is filled? So the number of rows is fixed, because I did not see any 'add new row button' (and I normally dont want to use it, because building up the whole ALV thing for selection screen sounds a bit weird 🙂 )?
PS: German is no problem, I'm from Germany 😉
Regards
Michael
2014 Aug 29 2:27 PM
Hi Michael,
in the INITIALIZATION. i'm doing
DO 10 TIMES.
APPEND INITIAL LINE TO gt_matnr.
ENDDO.
for the REUSE just send the fieldcatalog like that:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
is_layout_lvc = ls_layout
i_structure_name = 'ZPP_S_MAT_BEDARF_SEL'
it_fieldcat_lvc = lt_fieldcatalog
i_screen_start_column = 10
i_screen_start_line = 2
i_screen_end_column = 50
i_screen_end_line = 12
TABLES
t_outtab = gt_matnr.
in structure ls_layout you have to set
ls_layout-edit_mode = abap_true.
ls_layout-edit = abap_true.
I hope this helps.
rgs
Fred
2014 Aug 30 4:32 AM
For comfort you can leave the selection screen as it is and build the internal table having bank and ID by merging 2 select options. It would be a design decision to assume that every ID you enter would be related to bank at corresponding row position.
So you would need to loop at s_hbkid, read table s_hktid for index position and fill internal table having both bank and id.
Once internal table is ready, you can select t012k using for all entries.
2014 Sep 15 12:49 PM
Thanks a lot, that really looks good 🙂
Can you give me some more information about the TRANSFORMATION? I never used this and ABAP documentation only gives me some basic info 😉
Do I have to create an own XML for this, because something like
CALL TRANSFORMATION id
SOURCE outtab = gt_values
RESULT xml = p_string.
does not work. Which one instead of 'ID' do I have to take? And which event gives me the moment after variant is taken by user?
Thanks a lot!
Regards
Michael
2014 Sep 24 12:43 PM
Hi,
sorry for my late answer.
You have to create a simple transformation to trsform your tab in xml string or back from xml string in tab.
To create a transformation use transaction XSLT_TOOL.
You can follow a step by step doc here : Generate Simple Transformation for XML in ABAP - Part II | © Passionate about SAP - A Blog
Hope this helps
regards
Fred