‎2014 Jan 29 7:15 AM
Hi all,
i am using some fields to e shown on table in module pool,
upon hitting enter, it should gets displayed in my table,
the problem is that, when i hits "enter", it is displaying my data
but again successive, it again displays all these entries.
But i wants that, after first enter, it should not come again
after any enter hits.
wa_final-sno = '1'.
wa_final-description = 'Material'.
wa_final-subject = 'Billing'.
APPEND wa_final TO it_final.
CLEAR wa_final.
wa_final-sno = '2'.
wa_final-description = 'Goods'.
wa_final-subject = 'Inputs'.
APPEND wa_final TO it_final.
CLEAR wa_final.
wa_final-sno = '3'.
wa_final-description = 'Cost'.
wa_final-subject = 'Value'.
APPEND wa_final TO it_final.
CLEAR wa_final.
WRITE : / WA_FINAL-SNO, WA_FINAL-DESCRIPTION wa_final-subject.
CLEAR : WA_FINAL.
‎2014 Jan 29 7:35 AM
Hi Shweta,
you can create a
PROCESS_ON_VALUE-REQUEST
in the PAI of your program,
then code in your main program to get those data.
‎2014 Jan 29 7:19 AM
Hi,
Before append statement, check whether the entry already exists in internal table or not. If not, only then append the entry.
or use MODULE on request.
Regards,
DPM
‎2014 Jan 29 7:23 AM
Hi Debopriyo,
i am not getting your points, please elaborate how could i do that.
‎2014 Jan 29 7:28 AM
wa_final-sno = '1'.
wa_final-description = 'Material'.
wa_final-subject = 'Billing'.
READ TABLE it_final INTO wa_final1 WITH KEY subject = wa_final-subject.
IF sy-subrc <> 0.
APPEND wa_final TO it_final.
ENDIF.
CLEAR wa_final.
‎2014 Jan 29 7:45 AM
Hi,
i have written according to you, but initially it_final is empty,
so it returns sy-subrc = 4.
So not fetching data, i have written like this, please tell me whats wrong with this code.
I have to declare another internal table or else.
wa_final-sno = '1'.
wa_final-description = 'Material'.
wa_final-subject = 'Billing'.
READ TABLE IT_FINAL INTO WA_FINAL WITH KEY SNO = WA_FINAL-SNO.
IF SY-SUBRC = 0.
APPEND wa_final TO it_final.
ENDIF.
CLEAR wa_final.
wa_final-sno = '2'.
wa_final-description = 'Goods'.
wa_final-subject = 'Inputs'.
READ TABLE IT_FINAL INTO WA_FINAL WITH KEY SNO = WA_FINAL-SNO.
IF SY-SUBRC = 0.
APPEND wa_final TO it_final.
ENDIF.
CLEAR wa_final.
wa_final-sno = '3'.
wa_final-description = 'Cost'.
wa_final-subject = 'Value'.
READ TABLE IT_FINAL INTO WA_FINAL WITH KEY SNO = WA_FINAL-SNO.
IF SY-SUBRC = 0.
APPEND wa_final TO it_final.
ENDIF.
CLEAR wa_final.
‎2014 Jan 29 7:52 AM
Hi,
You should not use serial number for comparision, either use description or subject.
I think I mistyped '=' instead of '<>' , in my previous thread.
okay put another check
IF NOT it_final[] IS INITIAL.
READ TABLE IT_FINAL INTO WA_FINAL WITH KEY SNO = WA_FINAL-SNO.
IF SY-SUBRC <> 0.
APPEND wa_final TO it_final.
ENDIF.
ELSE.
APPEND wa_final TO it_final.
ENDIF.
Regards,
DPM
‎2014 Jan 29 8:42 AM
Hi Debopriyo,
one more thing i have created a z table, along with above data, there are some more
fields, which will be entered by user, and after that i wants to save those data
in my ztable, what can i do.
Let say i have some fields say fld1, and fld2 that will be entered by user on run time
now, along with above mentioned field i wants to save these fields in my ztable.
How could i achieve this ?
‎2014 Jan 29 7:27 AM
hi Shweta Chouhan,
Just sort the internal table and delete the adjacent duplicates from the internal table...
sort itab ascending by filedname1 fileldname2......
delete adjacent duplicates from itab comparing fileldnale1........
It solves your issue...
Any further queries??
Thanks,
Vijay SR
‎2014 Jan 29 7:35 AM
Hi Shweta,
you can create a
PROCESS_ON_VALUE-REQUEST
in the PAI of your program,
then code in your main program to get those data.
‎2014 Jan 29 8:52 AM
Hi Sanjeev,
thanks a lot, i have solved it, now can you please tell me how could i save my data
in a ztable, when some entries has been done in table control .
‎2014 Jan 29 9:50 AM
In PAI,
IF sy-ucomm = 'SAVE'.
IF it_final IS NOT INITAIL.
MODIFY ztable FROM it_final.
ENDIF.
ENDIF.
‎2014 Jan 29 11:41 AM
Create PF Status with SAVE button.
Then in PAI write the function of save button.
if sy-ucomm = 'SAVE'.
if it_final is not initial.
insert ztab from table it_final.
endif.
endif
‎2014 Jan 29 12:25 PM
Hi Shweta,
here i am showing you a sample code, please change it accordingly
inside MODULE USER_COMMAND_9000 INPUT
write this code logic
CASE SY-UCOMM.
WHEN 'ENTER'.
PERFORM DISPLAY_DATA.
WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'SAVE'.
PERFORM SAVE_DATA.
ENDCASE.
CLEAR : SY-UCOMM.
Now write a FORM SAVE_DATA as shown below
FORM SAVE_DATA .
LOOP AT IT_FINAL INTO WA_FINAL.
your ztable work area-MANDT = SY-MANDT.
your ztable work area-field1 = your final table work area-field1.
your ztable work area-field2 = your final table work area-field2.
your ztable work area-field3 = your final table work area-field3.
your ztable work area-field4 = your final table work area-field4.
MODIFY ZTABLE FROM your ztable work area.
ENDLOOP.
CLEAR your ztable work area.
ENDFORM.
‎2014 Jan 29 8:08 AM
Hi,
Replace you PAI logic as below,
Data : w_line type int4.
describe table it_cra lines w_lines.
if tc-current_line > w_lines.
append wa_final to it_final.
else.
modify it_final from wa_final index tc-current_line.
endif.
Regards,
‎2014 Jan 29 8:33 AM
Hi shweta,
wa_final-sno = '1'.
wa_final-description = 'Material'.
wa_final-subject = 'Billing'.
APPEND wa_final TO it_final.
CLEAR wa_final.
wa_final-sno = '2'.
wa_final-description = 'Goods'.
wa_final-subject = 'Inputs'.
APPEND wa_final TO it_final.
CLEAR wa_final.
wa_final-sno = '3'.
wa_final-description = 'Cost'.
wa_final-subject = 'Value'.
APPEND wa_final TO it_final.
CLEAR wa_final.
sort it_final ascending. "Insert these lines , it will work for the multiple entry for each enter key
delete adjacent duplicates from it_final.
WRITE : / WA_FINAL-SNO, WA_FINAL-DESCRIPTION wa_final-subject.
CLEAR : WA_FINAL..
Thanks,
Vijay SR
‎2014 Jan 29 8:48 AM
‎2014 Jan 29 8:53 AM