2014 Apr 17 11:42 AM
Dear Experts.
I am facing problem in connecting the data populated by F4 search help in selection screen to SELECT and thus further processing of data (LOOP and write) is halted.
MY requirement: I have various already populated database tabels. I need to pull data from these fields into internal tables for further calculations.
First: I need to pull data from database table Zlt_Mita (having two fields M1 and M2). On the basis of M2 I need to SELECT various field data from other database fields to internal table. After this follows various looping Write and summing.
I introduced F4 Search help. With this search help I can select M1 by pressing F4 in its box. As soon as M1 is populated its corresponding M2 is also populated in the box before it. Now I want that based on this M2 as Where condition I should be able to SELECT certain fields from some database table and populate it into an internal table. I am unable to do this.
My Code:
TYPES: Begin OF ty_stdsatz,
S1 TYPE Zlt_stdsatz-S1,
S2 TYPE Zlt_stdsatz-S2,
END OF ty_stdsatz,
Begin OF ty_Mita,
M1 TYPE Zlt_mita-M1,
M2 TYPE Zlt_mita-M2,
END OF ty_mita,
Begin OF ty_kunde,
K1 TYPE Zlt_kunde-K1,
K2 TYPE Zlt_kunde-K2,
END OF ty_kunde,
Begin OF ty_Auftrag1,
A1 TYPE Zlt_Auftrag1-A1,
A2 TYPE Zlt_Auftrag1-A2,
A3 TYPE Zlt_Auftrag1-A3,
A4 TYPE Zlt_Auftrag1-A4,
P1 TYPE Zlt_Auftrag1-P1,
P2 TYPE Zlt_Auftrag1-P2,
P3 TYPE Zlt_Auftrag1-P3,
END OF ty_Auftrag1,
Begin OF ty_AZTN,
M2 TYPE Zlt_AZTNEW-M2,
K2 TYPE Zlt_AZTNEW-K2,
A2 TYPE Zlt_AZTNEW-A2,
P2 TYPE Zlt_AZTNEW-P2,
S2 TYPE Zlt_AZTNEW-S2,
D1 TYPE Zlt_AZTNEW-D1,
STD TYPE Zlt_AZTNEW-STD,
BES TYPE Zlt_AZTNEW-BES,
END OF ty_AZTN,
Begin OF ty_AZT3,
M2 TYPE Zlt_AZT3-M2,
K2 TYPE Zlt_AZT3-K2,
A2 TYPE Zlt_AZT3-A2,
P2 TYPE Zlt_AZT3-P2,
D1 TYPE Zlt_AZT3-D1,
STD TYPE Zlt_AZT3-STD,
BES TYPE Zlt_AZT3-BES,
END OF ty_AZT3,
Begin Of ty_DAT,
M1 TYPE Zlt_mita-M1,
M2 TYPE ZLT_mita-M2,
K1 TYPE ZLT_kunde-K1,
K2 TYPE ZLT_Kunde-K2,
A1 TYPE Zlt_Auftrag1-A1,
A2 TYPE ZLT_Auftrag1-A2,
A3 TYPE ZLT_Auftrag1-A3,
P1 TYPE Zlt_Auftrag1-P1,
P2 TYPE Zlt_Auftrag1-P2,
END OF ty_DAT,
Begin Of ty_DAT1,
M1 TYPE Zlt_mita-M1,
M2 TYPE ZLT_mita-M2,
K1 TYPE ZLT_kunde-K1,
K2 TYPE ZLT_Kunde-K2,
A1 TYPE Zlt_Auftrag1-A1,
A2 TYPE ZLT_Auftrag1-A2,
A3 TYPE ZLT_Auftrag1-A3,
P1 TYPE Zlt_Auftrag1-P1,
P2 TYPE Zlt_Auftrag1-P2,
D1 TYPE Zlt_AZTNEW-D1,
STD TYPE Zlt_AZTNEW-STD,
BES TYPE Zlt_AZTNEW-BES,
END OF ty_DAT1,
Begin OF ty_final,
M1 TYPE Zlt_mita-M1,
M2 TYPE Zlt_AZTN-M2,
K1 TYPE Zlt_kunde-K1,
K2 TYPE Zlt_AZTN-K2,
A1 TYPE Zlt_Auftrag1-A1,
A2 TYPE Zlt_AZTN-A2,
A3 TYPE Zlt_auftrag1-A3,
A4 TYPE Zlt_auftrag1-A4,
P1 TYPE Zlt_auftrag1-P1,
P2 TYPE Zlt_AZT-P2,
S1 TYPE Zlt_stdsatz-S1,
S2 TYPE Zlt_AZTNEW-S2,
D1 TYPE Zlt_AZTNEW-D1,
STD TYPE Zlt_AZTNEW-STD,
BES TYPE Zlt_AZTNEW-BES,
END OF ty_final,
Begin OF ty_finaln,
M1 TYPE Zlt_mita-M1,
M2 TYPE Zlt_AZTNEW-M2,
K1 TYPE Zlt_kunde-K1,
K2 TYPE Zlt_AZTNEW-K2,
A1 TYPE Zlt_Auftrag1-A1,
A2 TYPE Zlt_AZTNEW-A2,
P1 TYPE Zlt_auftrag1-P1,
P2 TYPE Zlt_AZTNEW-P2,
D1 TYPE Zlt_AZTNEW-D1,
STD TYPE Zlt_AZTNEW-STD,
BES TYPE Zlt_AZTNEW-BES,
END OF ty_finaln.
DATA: it_aztn TYPE STANDARD TABLE OF ty_aztn with header line,
it_azt3 TYPE STANDARD TABLE OF ty_azt3 with header line,
it_stdsatz TYPE STANDARD TABLE OF ty_stdsatz,
it_mita TYPE STANDARD TABLE OF ty_mita with header line,
it_mita1 TYPE STANDARD TABLE OF ty_mita with header line,
it_kunde TYPE STANDARD TABLE OF ty_kunde,
it_auftrag1 TYPE STANDARD TABLE OF ty_auftrag1 ,
it_dat TYPE STANDARD TABLE OF ty_dat with header line,
it_dat1 TYPE STANDARD TABLE OF ty_dat1 with header line,
it_final TYPE STANDARD TABLE OF ty_final,
it_finaln TYPE STANDARD TABLE OF ty_finaln with header line,
it_return TYPE STANDARD TABLE OF ddshretval with header line,
it_mapping TYPE STANDARD TABLE OF dselc.
DATA: wa_aztn TYPE ty_aztn,
wa_azt3 TYPE ty_azt3,
wa_stdsatz TYPE ty_stdsatz,
wa_mita TYPE ty_mita,
wa_kunde TYPE ty_kunde,
wa_auftrag1 TYPE ty_auftrag1,
wa_dat TYPE ty_dat,
wa_dat1 TYPE ty_dat1,
wa_final TYPE ty_final,
wa_final1 TYPE ty_final,
wa_finaln TYPE ty_finaln,
wa_return TYPE ddshretval,
wa_mapping TYPE dselc.
**************************************************************************************************
*Normal Parameters without F4 search help. The further SELECT works with this
*PARAMETERS: P_Mita TYPE ZLT_Mita-M1,
* P_Mitanr TYPE ZLT_AZTNEW-M2,
* P_Datum TYPE ZLT_AZTNEW-D1.
***************************************************************************************************
*Parameters with F4 Search Help. The further SELECT doesn't works with this.
SELECTION-SCREEN begin of block blk2 with frame title text-102.
SELECTION-SCREEN SKIP 2.
PARAMETERS: P_Mita TYPE ZLT_Mita-M1,
P_Mitanr TYPE ZLT_Mita-M2,
P_Datum TYPE ZLT_AZTNEW-D1.
SELECTION-SCREEN end of block blk2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_mita.
SELECT M1
M2
FROM ZLT_Mita
INTO TABLE it_mita1
UP TO 50 ROWS.
* WHERE sprach = sy-langu.
wa_mapping-fldname = 'F0001'.
wa_mapping-dyfldname = 'P_MITA'.
APPEND wa_mapping to it_mapping.
Clear wa_mapping.
wa_mapping-fldname = 'F0002'.
wa_mapping-dyfldname = 'P_MITANR'.
APPEND wa_mapping to it_mapping.
Clear wa_mapping.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'M1'
* PVALKEY = ' '
DYNPPROG = sy-cprog
DYNPNR = sy-dynnr
DYNPROFIELD = 'P_MITA'
* STEPL = 0
WINDOW_TITLE = 'Bildschrim für Mitarbeiter Kode'
* VALUE = ' '
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
tables
value_tab = it_mita
* FIELD_TAB =
RETURN_TAB = it_return
DYNPFLD_MAPPING = IT_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.
READ TABLE IT_RETURN WITH KEY FIELDNAME = 'F0001'
retfield = 'P_MITA'.
IF SY-SUBRC = 0.
P_MITA = it_return-fieldval.
ENDIF.
READ TABLE IT_RETURN WITH KEY FIELDNAME = 'F0002'
retfield = 'P_MITANR'.
IF SY-SUBRC = 0.
P_MITANR = it_return-fieldval.
ENDIF.
*************************************************************************************
SELECT M2
K2
A2
P2
S2
D1
STD
BES
FROM ZLt_AZTNEW
INTO TABLE it_AZTN
Where D1 = P_Datum
AND M2 = P_Mitanr.
* AND D1 = gv_datum.
IF sy-subrc <> 0.
MESSAGE s000(ZAZT_01).
ENDIF.
*Further code is followed by SELECT and LOOP and WRITE..
Here the above SELECT is not being initiated by P_Mitanr populated by F4 Search help.
Looking forward for guidance from experts.
Regards
Chandan
2014 Apr 17 12:21 PM
Hi
In the function module the value tab assigned is it_mita change it to it_mita1.
Regards
shambuling
2014 Apr 17 11:51 AM
Regards
2014 Apr 17 11:59 AM
Dear Mehwish,
Thanks a lot for replying.
As soon as I introduced START_OF SELECTION just before SELECT:
START-Of-SELECTION.
SELECT M2
K2
A2
P2
S2
D1
The F4 help stopped working.
Yes, Without introducing START_OF SELECTION just before SELECT. in debugging I can see data in P_mita and P_mitanr
Looking forward for a solution.
Regards
Chandan
2014 Apr 17 12:04 PM
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'EBELN'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = fname " Selection screen field name
value_org = 'S'
* MULTIPLE_CHOICE = ' '
TABLES
value_tab = lt_ebeln_disply
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
2014 Apr 17 12:21 PM
Hi
In the function module the value tab assigned is it_mita change it to it_mita1.
Regards
shambuling