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

how to get the cursor position from screen in module pool program

Former Member
0 Likes
3,155

Hi,

I am doing the module pool program, I have one table control in one screen.

I have to give functionality to the user that when the user enters first record in the table control and after filling the last field

when he presses enter the cursor will have to come in the starting field of the second record.

I know the logic , but i m bit confused.

Can any body help me to solve this....

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,544

Hi,

Check this code,

Write it in the PBO

MODULE SET_CURSOR_WERTKONTRAKT.

MODULE SET_CURSOR_WERTKONTRAKT OUTPUT.

PERFORM SET_CURSOR USING 'VBAP-ZWERT'.

ENDMODULE. " SET_CURSOR_WERTKONTRAKT OUTPUT

FORM SET_CURSOR USING US_FELDNAME.

DATA: DA_TFILL LIKE SY-TFILL.

DESCRIBE TABLE IVBAP LINES DA_TFILL.

  • FCODE 'Create Position':

  • ==> Cursor to the first free line set to make the new position

  • Can be created directly

.

IF DA_TFILL EQ 0.

SET CURSOR FIELD US_FELDNAME LINE 1. -


> set cursor position

ELSE.

SET CURSOR FIELD US_FELDNAME LINE 2.

ENDIF.

  • Product proposal actively

  • Set ==> cursor in the first row

IF DPP_ACTIVE EQ CHARX AND

XVBAP_UMFANG_OPV IS INITIAL.

  • in the 'target volume' if available

IF KOPGR_MIT_ZMENG CS TVAK-KOPGR.

SET CURSOR FIELD 'VBAP-ZMENG' LINE 1.

EXIT.

ELSE.

  • Else in the field 'Order quantity'

SET CURSOR FIELD 'RV45A-KWMENG' LINE 1.

EXIT.

ENDIF.

ENDIF.

Hope it helps you,

Regards,

Abhijit G. Borkar

Hi,

I am doing the module pool program, I have one table control in one screen.

I have to give functionality to the user that when the user enters first record in the table control and after filling the last field

when he presses enter the cursor will have to come in the starting field of the second record.

I know the logic , but i m bit confused.

Can any body help me to solve this....

thanks

4 REPLIES 4
Read only

mukundkansara
Participant
0 Likes
1,544

You can do it by using SET CURSOR command,

E.G. SET CURSOR FIELD 'WA_MST-SRNO' LINE 1.

Read only

Former Member
0 Likes
1,544

Hi,

There is no specific coding required further the same..

use

LOOP AT IT_SCARR INTO ITAB WITH CONTROL TC_ITAB

CURSOR TC_ITAB-CURRENT_LINE.

Module <...>

ENDLLOP.

in PBO - and fill the table control in above module

Nag

Read only

Former Member
0 Likes
1,545

Hi,

Check this code,

Write it in the PBO

MODULE SET_CURSOR_WERTKONTRAKT.

MODULE SET_CURSOR_WERTKONTRAKT OUTPUT.

PERFORM SET_CURSOR USING 'VBAP-ZWERT'.

ENDMODULE. " SET_CURSOR_WERTKONTRAKT OUTPUT

FORM SET_CURSOR USING US_FELDNAME.

DATA: DA_TFILL LIKE SY-TFILL.

DESCRIBE TABLE IVBAP LINES DA_TFILL.

  • FCODE 'Create Position':

  • ==> Cursor to the first free line set to make the new position

  • Can be created directly

.

IF DA_TFILL EQ 0.

SET CURSOR FIELD US_FELDNAME LINE 1. -


> set cursor position

ELSE.

SET CURSOR FIELD US_FELDNAME LINE 2.

ENDIF.

  • Product proposal actively

  • Set ==> cursor in the first row

IF DPP_ACTIVE EQ CHARX AND

XVBAP_UMFANG_OPV IS INITIAL.

  • in the 'target volume' if available

IF KOPGR_MIT_ZMENG CS TVAK-KOPGR.

SET CURSOR FIELD 'VBAP-ZMENG' LINE 1.

EXIT.

ELSE.

  • Else in the field 'Order quantity'

SET CURSOR FIELD 'RV45A-KWMENG' LINE 1.

EXIT.

ENDIF.

ENDIF.

Hope it helps you,

Regards,

Abhijit G. Borkar

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,544

The logic is in PAI get the curdor position and in PBO set the cursor.

use

GET CURSOR FIELD f LINE lin offset off.

SET CURSOR FIELD f LINE lin offset off.

the variable lin holds your current line, f holds the field and off holds the offset.