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

REGARDING DROP DOWNBOX IN MODULE- POOL PROGRAM.

Former Member
0 Likes
2,193

HI All ,

I have developed a module pool program in that i have used drop down box ,

So all the logic i had written in PBO events. I am getting the drop-down list ,

but proble is that when I am choosing the value from the drop down box list the value get selected , but when i press Enter the value Disappears simultaneously all the values in the drop down box is repeated.

i set break-point on this logic. ten i found that after seeing the output when i press enter the cursor goes to break-point once again and whole process of data fetching begins and ij o/p value get repeated in drop down box.

plz help ,

below is the CODE.

SELECT * FROM CABN INTO CORRESPONDING FIELDS OF TABLE IT_CABN WHERE ATNAM = MR_MN.
SELECT * FROM CAWN INTO CORRESPONDING FIELDS OF TABLE IT_CAWN FOR ALL ENTRIES IN IT_CABN
                                                              WHERE ATINN = IT_CABN-ATINN.

DATA :      valuess   TYPE VRM_VALUES,
            valuee    LIKE LINE OF values.

DATA : w_index TYPE N.
CLEAR valuee.
w_index = 1 .
LOOP AT IT_CAWN.
    concatenate w_index IT_CAWN-ATINN into w_index.
      valuee-key = w_index.
      valuee-TEXT = IT_CAWN-ATWRT.
    APPEND valuee TO VALUESS.
       w_index =  w_index + 1 .
CLEAR valuee.
CLEAR : IT_CAWN ,IT_CABN.
ENDLOOP.

CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    ID                    = 'ATWRT'
    VALUES                = VALUESS.
* EXCEPTIONS
*   ID_ILLEGAL_NAME       = 1
*   OTHERS                = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. 

Regards,

Anup........

Moderator Message: Please do not type in CAPS. And always enclose your in ... your code... tags.

Edited by: kishan P on Sep 17, 2010 10:11 AM

11 REPLIES 11
Read only

Former Member
0 Likes
1,427

Hi,

Try this.


    IF sy-ucomm ne 'ENTR'.
              your code...
   ENDIF.
   

Regards,

Nithya

Read only

Former Member
0 Likes
1,427

This message was moderated.

Read only

Former Member
0 Likes
1,427

Don't program the buildup code for the dropdown in your PBO. Program at in the PAI part for that field:

something in like:

FIELD blabla MODULE dropdown AT VALUE-REQUEST

After each user action (like ENTER), the screen flow returns to your PBO and starts processing your PBO logic again. That's why your dropdown is duplicated.

But if you insist on keeping it in the PBO: make sure your dropdown list doesn't get appended again with the values from CAWNT.

PS. i'm glad you found the unique key.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,427

if lv_mn ne MR_MN.  "Only if mr_mn is different  <----add this
lv_mn = MR_MN.
SELECT * FROM CABN INTO CORRESPONDING FIELDS OF TABLE IT_CABN WHERE ATNAM = MR_MN.
SELECT * FROM CAWN INTO CORRESPONDING FIELDS OF TABLE IT_CAWN FOR ALL ENTRIES IN IT_CABN
                                                              WHERE ATINN = IT_CABN-ATINN.
 
DATA :      valuess   TYPE VRM_VALUES,
            valuee    LIKE LINE OF values.
 
DATA : w_index TYPE N.
CLEAR valuee.
w_index = 1 .
LOOP AT IT_CAWN.
    concatenate w_index IT_CAWN-ATINN into w_index.
      valuee-key = w_index.
      valuee-TEXT = IT_CAWN-ATWRT.
    APPEND valuee TO VALUESS.
       w_index =  w_index + 1 .
CLEAR valuee.
CLEAR : IT_CAWN ,IT_CABN.
ENDLOOP.
endif.
 
CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    ID                    = 'ATWRT'
    VALUES                = VALUESS.
* EXCEPTIONS
*   ID_ILLEGAL_NAME       = 1
*   OTHERS                = 2.
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 only

0 Likes
1,427

Hi,

I was facing the same problems, as I am pretty much into screen development since last many days..

Better if you can write the fill dropdown procedure into previous screen's PAI. so that it will run once only and also there you can check the values[] initial or not brfore calling FM VRM_SET_VALUES, so that it would not give dump, if in some cases your values will not get filled in the values table.

And when you create variable in the top include with the same name as your dropdown name in screen, It will automatically hold value. And it dont get blank when you press Enter. it should be " d_variable like line of values ".

Let me know if it helps or you need any other help regarding module pool.

Regards,

bh_hir

Read only

0 Likes
1,427

Hi ,

Still I am facing the problem if i press enter key on on the keyboard then the value in the box get cleared . but i want stable value for that.

so -please help.

Read only

0 Likes
1,427

Hi,

Write the coding as :

DATA : valuess TYPE VRM_VALUES,

valuee LIKE LINE OF values,

V_ATWRT type vrm_id ,

ATWRT(10).

DATA : w_index TYPE N.

CLEAR valuee.

w_index = 1 .

V_ATWRT = 'ATWRT'.

LOOP AT IT_CAWN.

concatenate w_index IT_CAWN-ATINN into w_index.

valuee-key = w_index.

valuee-TEXT = IT_CAWN-ATWRT.

APPEND valuee TO VALUESS.

w_index = w_index + 1 .

CLEAR valuee.

CLEAR : IT_CAWN ,IT_CABN.

ENDLOOP.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = V_ATWRT

VALUES = VALUESS.

  • EXCEPTIONS

  • ID_ILLEGAL_NAME = 1

  • OTHERS = 2.

Regards,

Srini.

Read only

0 Likes
1,427

Hi,

I assume that your dropdown's screen name is ATWRT - i/o field of type listbox or listbox with key.

now declare in top include as,

DATA: ATWRT  like line of values.

now in populating dropdown,

CALL FUNCTION 'VRM_SET_VALUES'
      EXPORTING
        id     = 'ATWRT'
        values = values.

It should not get cleared when you press enter.

Let me know if it works!

Thanks & Regards,

bh_hir

Read only

awin_prabhu
Active Contributor
0 Likes
1,427

Hi Rockabap,

Its very simple. Set a flag once u fetched data and next time check that flag before fecthcing data.

Ex:


DATA: flag type c.  " Declare in TOP include as global data.

IF flag NE 'X'.   " check flag

SELECT * FROM CABN INTO CORRESPONDING FIELDS OF TABLE IT_CABN WHERE ATNAM = MR_MN.
SELECT * FROM CAWN INTO CORRESPONDING FIELDS OF TABLE IT_CAWN FOR ALL ENTRIES IN IT_CABN
                                                              WHERE ATINN = IT_CABN-ATINN.
 
DATA :      valuess   TYPE VRM_VALUES,
            valuee    LIKE LINE OF values.
 
DATA : w_index TYPE N.
CLEAR valuee.
w_index = 1 .
LOOP AT IT_CAWN.
    concatenate w_index IT_CAWN-ATINN into w_index.
      valuee-key = w_index.
      valuee-TEXT = IT_CAWN-ATWRT.
    APPEND valuee TO VALUESS.
       w_index =  w_index + 1 .
CLEAR valuee.
CLEAR : IT_CAWN ,IT_CABN.
ENDLOOP.
 
CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    ID                    = 'ATWRT'
    VALUES                = VALUESS.
* EXCEPTIONS
*   ID_ILLEGAL_NAME       = 1
*   OTHERS                = 2.
IF SY-SUBRC  0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. 

flag = 'X'.   " Once u fetched all data, set flag
ENDIF.

Thanks..

Read only

Former Member
0 Likes
1,427

good answer

Read only

Former Member
0 Likes
1,427

The rules of the forum state that you need to re.ward the posts that helped you achieve your goal. This will help others who search to arrive at the solution. If you do not do this excercise, all your future posts will be locked!

pk