2011 Apr 07 4:03 PM
Hi all,
I am trying to do a dynamic filtering with the matchcode of two parameters.
My program will be used to do the correspondence between two types of account.
For example:
If the first parameter is "BA000000" the second matchcode will only allow to choose between account who are like "BP000000"
I've done this but the filtering is not dynamic:
DATA: TAB_SKA1 TYPE TABLE OF SKA1,
WA_SKA1 LIKE SKA1,
TAB_TEMP TYPE TABLE OF SKA1.
SELECTION-SCREEN BEGIN OF BLOCK S_VARIABLE WITH FRAME TITLE TEXT-000.
PARAMETERS:
P_MAGNI LIKE SKA1-BILKT OBLIGATORY,
P_CORRES LIKE SKA1-BILKT OBLIGATORY.
SELECTION-SCREEN END OF BLOCK S_VARIABLE.
*Extracting Magnitude account
SELECT * FROM SKA1 INTO TABLE TAB_SKA1
WHERE KTOPL = 'PCBP'
AND KTOKS <> 'SG' AND KTOKS <> 'CG' AND KTOKS <> 'TI' AND KTOKS <> 'BQ'
ORDER BY SAKNR.
*Matchcode for P_MAGNI
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MAGNI.
IF P_CORRES IS INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MAGNI'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_SKA1.
ELSEIF P_CORRES+0(2) EQ 'BA'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BP'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MAGNI'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ELSEIF P_CORRES+0(2) EQ 'BP'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BA'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MAGNI'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ENDIF.
*Matchcode for P_CORRES
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_CORRES.
IF P_MAGNI IS INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_CORRES'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_SKA1.
ELSEIF P_MAGNI+0(2) EQ 'BA'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BP'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_CORRES'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ELSEIF P_MAGNI+0(2) EQ 'BP'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BP'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_CORRES'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ENDIF.Do you know how to do a dynamic filtering?
Thank you.
Hi all,
I am trying to do a dynamic filtering with the matchcode of two parameters.
My program will be used to do the correspondence between two types of account.
For example:
If the first parameter is "BA000000" the second matchcode will only allow to choose between account who are like "BP000000"
I've done this but the filtering is not dynamic:
DATA: TAB_SKA1 TYPE TABLE OF SKA1,
WA_SKA1 LIKE SKA1,
TAB_TEMP TYPE TABLE OF SKA1.
SELECTION-SCREEN BEGIN OF BLOCK S_VARIABLE WITH FRAME TITLE TEXT-000.
PARAMETERS:
P_MAGNI LIKE SKA1-BILKT OBLIGATORY,
P_CORRES LIKE SKA1-BILKT OBLIGATORY.
SELECTION-SCREEN END OF BLOCK S_VARIABLE.
*Extracting Magnitude account
SELECT * FROM SKA1 INTO TABLE TAB_SKA1
WHERE KTOPL = 'PCBP'
AND KTOKS <> 'SG' AND KTOKS <> 'CG' AND KTOKS <> 'TI' AND KTOKS <> 'BQ'
ORDER BY SAKNR.
*Matchcode for P_MAGNI
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MAGNI.
IF P_CORRES IS INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MAGNI'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_SKA1.
ELSEIF P_CORRES+0(2) EQ 'BA'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BP'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MAGNI'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ELSEIF P_CORRES+0(2) EQ 'BP'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BA'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MAGNI'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ENDIF.
*Matchcode for P_CORRES
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_CORRES.
IF P_MAGNI IS INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_CORRES'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_SKA1.
ELSEIF P_MAGNI+0(2) EQ 'BA'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BP'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_CORRES'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ELSEIF P_MAGNI+0(2) EQ 'BP'.
LOOP AT TAB_SKA1 INTO WA_SKA1.
IF WA_SKA1-SAKNR+0(2) EQ 'BP'.
APPEND WA_SKA1 TO TAB_TEMP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'SKA1'
RETFIELD = 'SAKNR'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_CORRES'
STEPL = 0
WINDOW_TITLE = 'Comptes Magnitude'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = TAB_TEMP.
CLEAR TAB_TEMP.
ENDIF.Do you know how to do a dynamic filtering?
Thank you.
2011 Apr 07 4:26 PM
Where is that relationship between accounts maintained? You simply need to read that table and check the condition before building your internal table. It doesn't look like you're actually using the group account functionality but if you are just check the value of the field.
2011 Apr 08 8:33 AM
Where is that relationship between accounts maintained?
In fact, this program will be used by clients to fill the relationship table.
Its SELECT is not being executed
That is because some char are not copied, the "NE" are missing, I will edit my first post.
I can't edit the first post, so here is the good SELECT:
SELECT * FROM SKA1 INTO TABLE TAB_SKA1
WHERE KTOPL = 'PCBP'
AND KTOKS NE 'SG' AND KTOKS NE 'CG' AND KTOKS NE 'TI' AND KTOKS NE 'BQ'
ORDER BY SAKNR.Edited by: yohann.fourre on Apr 8, 2011 9:35 AM
2011 Apr 08 2:25 PM
Hi Fourre.
That is because some char are not copied, the "NE" are missing, I will edit my first post.
You didn't understand.
It's missing the event:
INITIALIZATIONCode sample: [ABAP Program to Read or Populate Selection Screen Parameters Dynamically|http://wiki.sdn.sap.com/wiki/display/Snippets/ABAPProgramtoReadorPopulateSelectionScreenParameters+Dynamically]
[ ]'s
Douglas Sant'Ana Santos | SAP ABAP
Company: Linkup
[Business Card|http://www.sdn.sap.com/irj/scn/bc?u=qshtq78wnzc%3d]
2011 Apr 07 7:17 PM
Hi,
Its SELECT is not being executed and its internal table (TAB_SKA1) is empty.
Try this:
...
INITIALIZATION.
*Extracting Magnitude account
SELECT * FROM SKA1 INTO TABLE TAB_SKA1
WHERE KTOPL = 'PCBP'
AND KTOKS 'SG' AND KTOKS 'CG' AND KTOKS 'TI' AND KTOKS 'BQ'
ORDER BY SAKNR.
...
Regards.
[ ]'s
Douglas Sant'Ana Santos | SAP ABAP
Company: Linkup
[Business Card|http://www.sdn.sap.com/irj/scn/bc?u=qshtq78wnzc%3d]
2011 Apr 08 8:44 AM
Appologies, I accidentaly post my answer to different thread.
Regards
Marcin
Edited by: Marcin Pciak on Apr 8, 2011 9:45 AM
2011 Apr 08 2:43 PM
If user has not pressed ENTER or executed any other function code, you wont get the current value of the other field in the F4 processing. e.g if user has input P_MAGNI and immediatelly press F4 on P_CORRES, the value of P_MAGNI in the program is the value before the screen display.
So you must begin the F4 processing of either filed by reading the current screen value of the other field, for this purpose use FM [DYNP_VALUES_READ|http://www.sdn.sap.com/irj/scn/advancedsearch?query=dynp_values_read].
Regards,
Raymon
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |