Application Development 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: 

LSMW - table control line selection

Former Member
0 Kudos

Hi ,

I am doing a recording to update the long text of operations using IA06 transaction, but when I need to select a particular operation number , in the recording it is showing the line number as (01) or (02) but I need to select a particular operation using its number (0010) or (0020). There is no position button in the transaction also. Please let me know how this kind of line selection can be done.

Regards,

Prabaharan.G

23 REPLIES 23

Former Member
0 Kudos

Try putting your cursor on any field in the line you want and then pressing F2.

Rob

Former Member
0 Kudos

Hi Bob,

My requirement is to select a particular operation number the number of which i read from an input file. If I have operation number 20 in the file then the cursor should focus on the operation 0020 and after selecting it , should open the long text editor and fill values in it.

Regards,

Prabaharan.G

0 Kudos

Yes - you have to figure out which line that will be on in your screen and then do what I said in the earlier post.

Rob

Former Member
0 Kudos

Hi Rob,

My query is if there are 20 operation lines starting from 0010 to 0200 and I need to update long text for operation number 40 then how will I make my cursor position on exactly fourty .

Regards,

Prabaharan.G

0 Kudos

The recording should do that for you. Put your cursor on the line and press F2. Doesn't that work?

Rob

Former Member
0 Kudos

Hi Rob,

The F2 option is working but only after selecting a particular line, but my question is how to select the particular operation number. If there are 20 operations and I want to select line of operation 50 it while the recording is running in background. I need to tell the system to select the line corresponding to operation number 50.

Regards,

Prabaharan.G

0 Kudos

You do that programmatically, by counting the number of lines that will display before the one you want. the problem will be if the one you want is not on the current page.

Rob

Former Member
0 Kudos

Hi Rob,

I thought of that option but assume if there are 10 operations 0010 to 0100.

and my requirement is to select operation line 30 , then using logic i will select the third line item, but if an user deletes operation 0010 and in that case 0020 will be in line 1 and then the logic would operation 40 instead of 30. Can you please let me know if an alternative is present for this.

Regards,

Prabaharan.G

0 Kudos

That's what I've been saying. You have to retrieve all of the operations so that you will know where each will fit on the screen.

Rob

Former Member
0 Kudos

Hi Rob,

Do you mean to say that before entering the transaction I need to retrieve all operation numbers corresponding to that planner group and keep it in an internal table , so that I could position the operation number line based on the internal table values. This sounds to be fine, but coding this in a BDC would be easy but within an LSMW would be bit difficult I suppose.

Regards,

Prabaharan.G

0 Kudos

Well, I was just thinking of BDC alone not LSMW. But yes, how else will you know which line to change without a position button?

Rob

0 Kudos

Why are trying to load texts using BDC? Use SAVE_TEXT function module instead, if the operations are already created. If they are not created already, then create them using LSMW and then go back to add texts using the function module. Do not attempt adding long texts using BDC.

0 Kudos

Srinivas - I completely missed the part about long texts. Yes, the text modules are the way to go, so long as nothing else is being updated.

Rob

Former Member
0 Kudos

Hi Rob and Srini,

Thanks for your inputs. But I am not much clear about the parameters to be passed to SAVE_TEXT function module. Any reference thread in SDN. Could you please send me the URL .

Regards,

Prabaharan.G

0 Kudos

Just type in SAVE_TEXT in the search area and you will get tonnes of them.

Former Member
0 Kudos

Hi,

I checked it but none of them is matching the long text update for operation in PM general task list. I checked the text id , it has the value 060A001000010000000100000001 what combination of values is this.

Regards,

Prabaharan.G

0 Kudos

It corresponds to the key fields of the primary table. In your case it may be PLFH. Verify the contents of this table with the values and see if it is correct table.

0 Kudos

Also check PLFL

Former Member
0 Kudos

Hi,

Using a BDC to update long text - Will it cause any problem in regards to data consistency.

Using Save_text function module will it cause any problem or it is consistent.

Regards,

Prabaharan.G

0 Kudos

I'm not sure that you are <u>able</u> to update long texts using BDC. Using SAVE_TEXT will not lead to data inconsistencies so long as it is done correctly. So if your testing is adequate, you will be OK.

Rob

Former Member
0 Kudos

Hi ,

I am using the below code to update the long text existing for operations in general task list IA06, but though the save text returns sy-subrc = 0 the text is not getting updated. Can anyone advise on the problem in the code.

&----


*& Report ZPM_LONGTEXT_UPDATE

*&

REPORT ZPM_LONGTEXT_UPDATE.

TYPES: BEGIN OF T_GEN,

TPLNR LIKE RC27E-TPLNR,

PLNNR TYPE TAPL-PLNNR,

PLNAL TYPE TAPL-PLNAL,

VORNR TYPE PLPO-VORNR,

LONGTEXT(6000) TYPE C,

END OF T_GEN.

TYPES: BEGIN OF T_GENFIN,

mandt like sy-mandt,

PLNTY LIKE PLPO-PLNTY,

PLNNR LIKE PLPO-PLNNR,

PLNKN LIKE PLPO-PLNKN,

ZAEHL LIKE TAPL-ZAEHL,

LONGTEXT(6000) TYPE C,

END OF T_GENFIN.

DATA: IT_GEN TYPE TABLE OF T_GEN,

WA_GEN TYPE T_GEN.

DATA: IT_GENFIN TYPE TABLE OF T_GENFIN,

WA_GENFIN TYPE T_GENFIN.

DATA : LV_NAME LIKE STXH-TDNAME,

LV_OBJECT LIKE TCA09-OBJOPR,

LV_ID LIKE OPR_CLASS_DATA-IDENT,

LV_ERR_TEXT TYPE BAD_PATCH-DESCRIPT,

LV_SUC_TEXT TYPE BAD_PATCH-DESCRIPT,

LV_ECN_S LIKE TSK_CLASS_DATA-AENNR VALUE ' ',

LV_KEYDATE LIKE SY-DATUM,

LC_OPERATION(3) TYPE C VALUE 'OPR',

TCA01 TYPE TCA01,

TCA09 TYPE TCA09,

LV_LONGTEXT(300) TYPE C.

DATA : LV_PLPO TYPE STANDARD TABLE OF PLPO WITH HEADER LINE.

DATA : BEGIN OF LV_TAPL OCCURS 0,

TPLNR LIKE TAPL-TPLNR,

PLNTY LIKE TAPL-PLNTY,

PLNNR LIKE TAPL-PLNNR,

PLNAL LIKE TAPL-PLNAL,

ZKRIZ LIKE TAPL-ZKRIZ,

ZAEHL LIKE TAPL-ZAEHL,

END OF LV_TAPL.

DATA : BEGIN OF LV_HEADER.

INCLUDE STRUCTURE THEAD.

DATA : END OF LV_HEADER.

DATA : LT_LONG_TEXT TYPE TABLE OF TLINE WITH HEADER LINE,

LT_LONG_INIT TYPE TABLE OF TLINE WITH HEADER LINE,

LV_TEXT_LENGTH TYPE I,

LV_LOOP_TIMES TYPE I,

LV_CHAR_POS_LAST TYPE I,

LV_CHAR_POS_CURR TYPE I,

LV_NO_LINES TYPE I.

DATA : LV_PLNNR TYPE TAPL-PLNNR,

LV_PLNAL TYPE TAPL-PLNAL,

LV_VORNR TYPE PLPO-VORNR,

W_PATHUP1 TYPE STRING.

DATA: W_PATH1 TYPE IBIPPARMS-PATH.

SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS: P_INP TYPE IBIPPARMS-PATH.

SELECTION-SCREEN: END OF BLOCK B1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INP.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = W_PATH1.

IF W_PATH1 IS NOT INITIAL.

MOVE W_PATH1 TO W_PATHUP1.

MOVE W_PATH1 TO P_INP.

ENDIF.

START-OF-SELECTION.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = W_PATHUP1

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '|'

TABLES

DATA_TAB = IT_GENFIN

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF NOT IT_GENFIN[] IS INITIAL.

LOOP AT IT_GENFIN INTO WA_GENFIN.

  • Prepare the key for saving the text. Used in table STXH.

CONCATENATE SY-MANDT

WA_GENFIN-PLNTY

WA_GENFIN-PLNNR

WA_GENFIN-PLNKN

WA_GENFIN-ZAEHL INTO LV_NAME.

CALL FUNCTION 'INIT_TEXT'

EXPORTING

ID = 'PLPO'

LANGUAGE = 'E'

NAME = LV_NAME

OBJECT = 'ROUTING'

IMPORTING

HEADER = LV_HEADER

TABLES

LINES = LT_LONG_INIT

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

  • Split long text into table.

LV_TEXT_LENGTH = STRLEN( WA_GENFIN-LONGTEXT ).

LV_CHAR_POS_CURR = 0.

LV_CHAR_POS_LAST = 0.

LV_LOOP_TIMES = LV_TEXT_LENGTH DIV 80.

DO LV_LOOP_TIMES TIMES.

LV_CHAR_POS_CURR = LV_CHAR_POS_CURR + 80.

LT_LONG_TEXT-TDLINE =

WA_GENFIN-LONGTEXT+LV_CHAR_POS_LAST(80).

LT_LONG_TEXT-TDFORMAT = '*'.

APPEND LT_LONG_TEXT.

LV_CHAR_POS_LAST = LV_CHAR_POS_CURR - 1.

ENDDO.

  • Write the left-over.

LT_LONG_TEXT-TDLINE = WA_GENFIN-LONGTEXT.

  • LV_LONGTEXT+LV_CHAR_POS_LAST.

LT_LONG_TEXT-TDFORMAT = '*'.

APPEND LT_LONG_TEXT.

LT_LONG_TEXT-TDLINE = WA_GENFIN-LONGTEXT.

  • LV_LONGTEXT+LV_CHAR_POS_LAST.

LT_LONG_TEXT-TDFORMAT = '*'.

APPEND LT_LONG_TEXT.

LT_LONG_TEXT-TDLINE = WA_GENFIN-LONGTEXT.

  • LV_LONGTEXT+LV_CHAR_POS_LAST.

LT_LONG_TEXT-TDFORMAT = '*'.

APPEND LT_LONG_TEXT.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = LV_HEADER

  • INSERT = ' '

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = LT_LONG_TEXT

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

CALL FUNCTION 'COMMIT_TEXT'.

  • EXPORTING

  • OBJECT = '*'

  • NAME = '*'

  • ID = '*'

  • LANGUAGE = '*'

  • SAVEMODE_DIRECT = ' '

  • KEEP = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • COMMIT_COUNT =

  • TABLES

  • T_OBJECT =

  • T_NAME =

  • T_ID =

  • T_LANGUAGE =

.

WRITE:/ 'Text Updated for',WA_GENFIN-PLNTY,WA_GENFIN-PLNNR,

WA_GENFIN-PLNKN,

WA_GENFIN-ZAEHL.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

Regards,

Prabaharan.G

Former Member
0 Kudos

Hi,

I added a select statement on PLPO table statement based on the PLNTY, PLNNR, PLNKN, ZAEHL which i gave as input to the function module. Then in the work area I modified the TXTSP to hold the value 'E' (language key) and modified the table plpo based on the work area and the function module worked. Also one very important thing is that I need to use INTTAB_SAVE_TEXT function module instead of SAVE_TEXT function module.

But How to initialize the long text once it is updated.

Regards,

Prabaharan.G

Former Member
0 Kudos

For long text updation finally SAVE_TEXT function module is working.