Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem in table control wizard in module pool programming

Former Member
0 Likes
3,910

Hi All,

i have created a Screen having two subscreens, one having a table control wizards, whenever user puts any entries in it and presses enter button, it is creating a blank lines before that line, i need to stop it as i wants that when user enters any values in the table fields, and presses ENTER button, it should not create a blank line.

I am doing some stuffs in PAI , but not getting desired result, please tell me where should i code for the desired result. Here is the code of my PAI of that subscreen.

PROCESS AFTER INPUT.

LOOP AT G_ZTBC_2014_ITAB.
     CHAIN.
       FIELD ZPAYMENTS1-SNO.
       FIELD ZPAYMENTS1-CDATE.
       FIELD ZPAYMENTS1-CHEKNO.
       FIELD ZPAYMENTS1-AMOUNT.
       FIELD ZPAYMENTS1-BANKKEY.

       MODULE ZTBC_2014_MODIFY ON CHAIN-REQUEST.
     ENDCHAIN.

   ENDLOOP.


One more problem what i am getting is that i have a drop down list which i have called from VRM_SET_VALUES, it has two values to be displayed, but each time i am using it, it increases my list , but it should be only two always, please tell me what can i do. My code is


MODULE DISPLAY_LIST OUTPUT.
   wa_values-key = '1'.
   wa_values-text = 'Direct'.
   APPEND wa_values TO i_values.

   wa_values-key = '2'.
   wa_values-text = 'Indirect'.
   APPEND wa_values TO i_values.

id_name = 'ZSDPROJECT1-TYPE'.
   CALL FUNCTION 'VRM_SET_VALUES'
     EXPORTING
       ID              = id_name
       VALUES          = i_values
     EXCEPTIONS
       ID_ILLEGAL_NAME = 1
       OTHERS          = 2.
   IF SY-SUBRC <> 0.
* Implement suitable error handling here
   ENDIF.

ENDMODULE.

23 REPLIES 23
Read only

Former Member
0 Likes
2,818

Shweta,

MODULE ZTBC_2014_MODIFY ON CHAIN-REQUEST.


in module one append line.


comment that and check.



Regrding drop down list,


http://scn.sap.com/thread/1960601



regards,

Sandeep.

Read only

0 Likes
2,818

Hi ,

if i will comment the module ztbc_2014_modify on chain-request, it will disappeared the values entered on the screen-field, i am not getting your points, please clear it.

Read only

0 Likes
2,818

double click on that module.

then inside that one append line , comment that line.

Read only

0 Likes
2,818

Hi Sweatha,

use .

if i_values[] is initial .

start append the i_values.

endif.

this code will reduce increasing entries in list box.

for second thing u should debug the logic written by the standard code.

Regards,

Hiriyappa

Read only

0 Likes
2,818

Hi Sandeep,

i have already changes my code in that , please look at this code

MODULE ZTBC_2014_MODIFY INPUT.
   MOVE-CORRESPONDING ZPAYMENTS1 TO G_ZTBC_2014_WA.
*  MODIFY G_ZTBC_2014_ITAB
*    FROM G_ZTBC_2014_WA
*    INDEX ZTBC_2014-CURRENT_LINE.

  APPEND G_ZTBC_2014_WA TO G_ZTBC_2014_ITAB.
  CLEAR : G_ZTBC_2014_WA.
ENDMODULE.

Read only

0 Likes
2,818

1st thing is dont press each and every cell enter button, last cell press only.

and  when you press save button  that time use delete query to delete blank line from internal table.

Regards,

Sandeep

Read only

0 Likes
2,818

your second query,

add this line to start.

REFRESH Table_name .



MODULE DISPLAY_LIST OUTPUT.


REFRESH i_values.


   wa_values-key = '1'.

   wa_values-text = 'Direct'.

   APPEND wa_values TO i_values.

   wa_values-key = '2'.

   wa_values-text = 'Indirect'.

   APPEND wa_values TO i_values.

id_name = 'ZSDPROJECT1-TYPE'.

   CALL FUNCTION 'VRM_SET_VALUES'

     EXPORTING

       ID              = id_name

       VALUES          = i_values

     EXCEPTIONS

       ID_ILLEGAL_NAME = 1

       OTHERS          = 2.

   IF SY-SUBRC <> 0.

* Implement suitable error handling here

   ENDIF.

ENDMODULE.




hope it will helps.

regards,

Sandeep

Read only

0 Likes
2,818

Hi Sandeep,

we can't restrict user for any activities, we can't force them to do that, anyhow if i make a change as shown below, then i can restrict it for one entries

IF ZPAYMENTS1 IS NOT INITIAL.

MOVE-CORRESPONDING ZPAYMENTS1 TO G_ZTBC_2014_WA.
*  MODIFY G_ZTBC_2014_ITAB
*    FROM G_ZTBC_2014_WA
*    INDEX ZTBC_2014-CURRENT_LINE.

  APPEND G_ZTBC_2014_WA TO G_ZTBC_2014_ITAB.
  ENDIF.
  CLEAR : G_ZTBC_2014_WA.


but i want the sane for all the five fields, please tell me how could i achieve it for all table fields.

Read only

0 Likes
2,818

Hi Sandeep,

thanks one of my problem get resolved but again the problem of table control wizards still persist,

please tell me the required solution.

Read only

0 Likes
2,818

try this one,



IF ZPAYMENTS1-BANKKEY  IS NOT INITIAL.

MOVE-CORRESPONDING ZPAYMENTS1 TO G_ZTBC_2014_WA.
*  MODIFY G_ZTBC_2014_ITAB
*    FROM G_ZTBC_2014_WA
*    INDEX ZTBC_2014-CURRENT_LINE.

  APPEND G_ZTBC_2014_WA TO G_ZTBC_2014_ITAB.
  ENDIF.
  CLEAR : G_ZTBC_2014_WA.

Regards,

Sandeep



Read only

0 Likes
2,818

Hi,

as i told you this will not  work, as according to you if a user puts sno and cdate and presses ENTER

then the values will be disappeared, according to you , you have put checked on bankkey, but the user can press enter after any field.

IF ZPAYMENTS1-BANKKEY IS NOT INITIAL.

MOVE-CORRESPONDING ZPAYMENTS1 TO G_ZTBC_2014_WA.

APPEND G_ZTBC_2014_WA TO G_ZTBC_2014_ITAB.
ENDIF.

CLEAR : G_ZTBC_2014_WA.


when i have written this, then when i put sno and cdate, it disappears from my table field.

Read only

0 Likes
2,818

hi Shweta,

simple coding for that.

use sel field in your internal table

put logic in PAI part

loop at itab.

module insert_data.

under this put code

( if itab-sel is initial.

itab-sel = 'x'.

append itab.

else.

modify itab index tc_current-line.

endif.)

endloop

note :- sel field should be the part of internal table

hope it helps.

with regards,

vikas

Read only

0 Likes
2,818

Hi Vikas,

while creating my table control wizard, i haven't used SEL, so how could i use it.

Read only

0 Likes
2,818

you have to mention the sel field in your internal table

later that table name you can provide in wizard.

or if fields are less then create in manually...

you will learn new things

with regards,

vikas

Read only

0 Likes
2,818

Shweta,

check this link, how to use table control with wizards properly explained with screen shot,

http://www.saptechnical.com/Tutorials/ABAP/TableControl/Index.htm

there MARK is used for SEL.

Regards,

Sandeep

Read only

Former Member
0 Likes
2,818

hi shweta,

              your first query need more information to understand..

as per your second query kindly clear the work area.. or I Would suggest to use your fix value for drop down in the domain (value range) level.

hope it will help

regards,

vikas

Read only

0 Likes
2,818

Hi Vikas,

when i cleared the work area nothing changes.

i have fixed two values to show in output as Direct and Indirect, and for the same i have written the above  mentioned code, but it repeats the values.

Read only

0 Likes
2,818

Hi,

     Instead of clearing work area, refresh value table i,e


MODULE DISPLAY_LIST OUTPUT.

Refresh i_values[].

....


Regards

Read only

hiriyappa_myageri
Participant
0 Likes
2,818

make use of get cursor line and set cursor line.

Read only

0 Likes
2,818

Hi Myageri,

please elaborate at some extent what are you saying, i am not getting properly. Here is the code i have written, please tell me the required changes i have to make.

MODULE ZTBC_2014_MODIFY INPUT.

IF ZPAYMENTS1-BANKKEY IS NOT INITIAL.

   MOVE-CORRESPONDING ZPAYMENTS1 TO G_ZTBC_2014_WA.

MODULE ZTBC_2014_MODIFY INPUT.

IF ZPAYMENTS1-BANKKEY IS NOT INITIAL.

   MOVE-CORRESPONDING ZPAYMENTS1 TO G_ZTBC_2014_WA.

Read only

Former Member
0 Likes
2,818


Hi,

I think you have another " APPEND wa_values TO i_values " anywhere else (maybe in ZTBC_2014_MODIFY ON CHAIN-REQUEST or in any other places),

you have to put an IF conditien that if your WA is not initial, then appending happens.

Regards,

Farzin

Read only

Former Member
0 Likes
2,818

Any help please.

Read only

Former Member
0 Likes
2,818

Shweta,

I  have create same scenario here and it is working fine.

when you press single ENTER that time not append any line after fill all row data that time press double ENTER.

and related to blank line

use below code


this is my program code.


MODULE TB_MARA_MODIFY INPUT.

   APPEND WA_MARA TO GT_MARA .

   DELETE gt_mara WHERE matnr is INITIAL.

   clear: WA_MARA.

ENDMODULE.

note-> gt_mara is my internal table wa_mara is workarea.

same you do in your code.


MODULE ZTBC_2014_MODIFY INPUT.

  APPEND ZPAYMENTS1 TO ZPAYMENTS1.

  DELETE ZPAYMENTS1 WHERE cdate is INITIAL.

clear ZPAYMENTS1.

ENDMODULE.

I think your internal table name and workarea name same.


one more think as per my observation when you create table control wizards no need to select SEC column filed. this field only pass as index.


just  follow this link

http://www.saptechnical.com/Tutorials/ABAP/TableControl/Page2.htm



hope you understand and it helps to you.



Regards,

Sandeep