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

copy internal table from standard program into custom program and modify to

Former Member
0 Likes
1,330

Hi experts,

Can you please help me with this, I need to modify stansard ALV report ( transaction TPM13) and add G/L account to it,

but I am not able to copy internal table from standard program into my custom program. Then I need to add G/L account and display.

SUBMIT RTPM_TRL_SHOW_FLOWS

USING SELECTION-SET GS_VARIANT

EXPORTING LIST TO MEMORY AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = listobject

EXCEPTIONS

not_found = 1

OTHERS = 2.

*LIST_INDEX = SY-LSIND.

CALL FUNCTION 'LIST_TO_ASCI'

*EXPORTING

*LIST_INDEX = -1

*WITH_LINE_BREAK = 'X'

TABLES

LISTASCI = o_list

LISTOBJECT = LISTOBJECT

EXCEPTIONS

LIST_INDEX_INVALID = 1

OTHERS = 2.

IF SY-SUBRC NE 0.

MESSAGE I162(00) WITH 'Error -- the list index was invalid.'.

EXIT.

ENDIF.

LOOP AT O_LIST.

if sy-tabix > 4.

SPLIT o_LIST-fields AT '|' INTO FINAL_ITAB-COMP_CODE FINAL_ITAB-GLACCT .

*FINAL_ITAB-COMP_CODE = c_bukrs.

  • FINAL_ITAB-GLACCT = g_glacct.

  • append final_itab.

*

ENDIF.

ENDLOOP.

CALL FUNCTION 'WRITE_LIST'

TABLES

listobject = LISTOBJECT

EXCEPTIONS

empty_list = 1

OTHERS = 2.

Can you please tell me how to split? can I split in to internal table fields directly?

PLease help me with this. Thank you so much for your help!

Regards,

Thanvi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
912

hello ,

y dont u create a enhancement spot for that standard program.

regards

Prabhu

5 REPLIES 5
Read only

Former Member
0 Likes
913

hello ,

y dont u create a enhancement spot for that standard program.

regards

Prabhu

Read only

0 Likes
912

Hi Prabhu,

Can you please tell me about Enhancement spot and how to do it with example.

Thanks for your reply.

Read only

Former Member
0 Likes
912

This message was moderated.

Read only

former_member215917
Active Participant
0 Likes
912

Hi,

Instead of creating enhancement spots, why dont you find an user-exit in that stadard program and export required table to memory? then in your program you can import it from memory and use it.

Let me know if this helps.

Gouri.

Read only

0 Likes
912

Hi Friend ,

Please see this code for getting the standard program data into internal table of your program and also splitting data .


SUBMIT RM07DOCS using SELECTION-SCREEN '1000'
WITH matnr = S_MATNR
WITH werks = S_WERKS
WITH charg = S_CHARG
WITH budat-low = S_BUDAT-low
WITH budat-high = S_BUDAT-high EXPORTING LIST TO MEMORY AND RETURN .
 
 
EXPORTING LIST TO MEMORY AND RETURN .
 
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
 listobject = listtab
EXCEPTIONS
not_found = 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.
 
* List tab contains data in hexa format.
 
DESCRIBE TABLE listtab LINES n .
 
DATA: BEGIN OF LIST_tab OCCURS 0,
*fiedls1(1024) TYPE c,
fields1(2048) type c,
END OF LIST_tab.
 
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1
WITH_LINE_BREAK = 'X'
TABLES
LISTASCI = LIST_tab
LISTOBJECT = LISTTAB
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3.
 
*Table list_tab contains the output in a single field fields1. all the fields are separated by a '|'
  
loop at list_tab.
  if sy-tabix >= 7.
*Using the split you can split the data into  separate field data and  move into internal table or  variables* 
   split list_tab-fields1 at '|' into v_non 
                                          v_werks
                                          v_matnr 
                                          v_maktx 
                                          v_charg
                                          v_stock.
*move variables to your output internal table.
endloop
 

Regards

Edited by: Loganathan girishkumar on Nov 20, 2009 5:58 PM