‎2011 Jan 25 6:18 AM
Hi All,
We have two reports, report A is for displaying data using ALV GRID, we want to let user select some lines in A and then click a button to transfer selected records to report B and make relevant select-options value default to the selected records. I tried the statement "IMPORT XXX FROM MEMORY ID XXX" in report B but seems ALV will empty them while switching to new report so I cannot get any result. Because the selection conditions in report A are a bit complex, so I can neither use "SUBMIT A EXPORTING LIST TO MEMORY WITH SEL = 'X' AND RETURN." in report B. Is there any solution?
Thank you!
Best Regards,
Jeff
‎2011 Jan 25 9:01 AM
Hi jeff
instead of ALV u can use a Table control with multiple selection enabled then when user selects the records a marker field on the internal table can be used to identify the selected fields
after pressing the button in the function code handled event use the marker fields to identify the correct rows and format them as you need and call submit with selection structure attached
Please reply if you need further clarification
Regards
Prageeth Wijekoon
‎2011 Jan 25 9:01 AM
Hi jeff
instead of ALV u can use a Table control with multiple selection enabled then when user selects the records a marker field on the internal table can be used to identify the selected fields
after pressing the button in the function code handled event use the marker fields to identify the correct rows and format them as you need and call submit with selection structure attached
Please reply if you need further clarification
Regards
Prageeth Wijekoon
‎2011 Jan 25 10:58 AM
Hi Prageeth,
The difficulty I'm facing now is not how to choose the rows in the ALV GRID, but is how to export the selected data into some other program which has different TCODE. So I don't think it can be possible if I change to table control display. However, if you have solution like to share with me, please tell me.
Thanks!
Regards,
Jeff
‎2011 Jan 27 3:58 AM
See the example below
REPORT ZTEST.
TYPE-POOLS: SLIS.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: BEGIN OF TA_MARC OCCURS 0 ,
CHBOX(1)." TYPE C.
INCLUDE STRUCTURE MARC.
DATA: END OF TA_MARC.
SELECT *
FROM MARC
INTO CORRESPONDING FIELDS OF TABLE TA_MARC
UP TO 10 ROWS.
DATA: IS_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: I_GRID_SETTINGS TYPE LVC_S_GLAY.
I_GRID_SETTINGS-EDT_CLL_CB = 'X'.
*IS_LAYOUT-box_fieldname = 'CHBOX'.
*IS_LAYOUT-box_tabname = 'TA_MARC'.
*IS_LAYOUT-edit = 'X'.
WA_FIELDCAT-SELTEXT_L = 'Check'.
WA_FIELDCAT-FIELDNAME = 'CHBOX'.
WA_FIELDCAT-CHECKBOX = 'X'.
WA_FIELDCAT-EDIT = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-SELTEXT_L = 'Material'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
*WA_FIELDCAT-edit = 'X'. If U want to Make Material as Editable Field
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-SELTEXT_L = 'Plant'.
WA_FIELDCAT-FIELDNAME = 'WERKS'.
WA_FIELDCAT-EDIT = ''.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
IS_LAYOUT = IS_LAYOUT
I_GRID_SETTINGS = I_GRID_SETTINGS
TABLES
T_OUTTAB = TA_MARC.
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->R_SELFIELD text
*----------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
RANGES : MATNR FOR MARA-MATNR.
LOOP AT TA_MARC WHERE CHBOX = 'X'.
MATNR-SIGN = 'I'.
MATNR-OPTION = 'EQ'.
MATNR-LOW = TA_MARC-MATNR.
MATNR-HIGH = ''.
APPEND MATNR.
ENDLOOP.
SUBMIT ZTEST1 VIA SELECTION-SCREEN WITH MATNR IN MATNR and RETURN.
ENDFORM. "USER_COMMANDWhen u will select rows in ZTEST ALV and press submit button data will pass to ZTEST1 on selection screen.
REPORT ztest1.
tables: mara.
select-OPTIONS: matnr for mara-matnr.
BREAK-POINT.Hope u are looking for same.
Thanks,
Suyog.
‎2011 Jan 27 7:03 AM
Hi Suyog,
Thank you very much for your code. Yes, my requirement is similiar. But there still have some minor differences. Actually we've report A which has a SELECT-OPTION P_EBELN and some other filters in selection screen, but in our report B we have both EBELN and EBELP, so if user select multiple rows in report B and then click a button to navigate to report A, with the help of your solution, we can easily transfer EBELN into P_EBELN, but it's still not easy to transfer EBELP and match it to related EBELN. So I think it'll be greatly helpful if we can keep memory data among different reports and programs. Is there any other way?
Anyway, your code gives me a good direction that i can work on. Thank you again.
Regards,
Jeff