09-11-2014 10:24 AM
Hi Frds,
A13001 : is Material Number..
I have maintained text in material master
1st : RMCODE1 RMDECSRIPTION1 USAGE1
2nd : RMCODE2 RMDECSRIPTION1 USAGE2
Present output is A13001 : RMCODE1 RMDECSRIPTION1 USAGE1 RMCODE2 RMDECSRIPTION1 USAGE2
My customer is asking in alv output as given below...
A13001 : RMCODE1 RMDECSRIPTION1 USAGE1
A13001 : RMCODE2 RMDECSRIPTION1 USAGE2
For reference screen shot attached........
Pls help me ........
Regards,
Kabil
09-11-2014 12:26 PM
Hi kabil,
try this,
Hope you are getting the both fields using single input. why cant you try to append the second text field to first text field using append for two times.
Eg: append wa to itab.
clear wa.
if lv_text is not initial. "Second Description.
wa-text1 = lv_text.
append wa to itab.
clear wa.
endif.
Regards,
Venkat.
09-11-2014 12:13 PM
Hi kabil,
After fetching the text by using fm READ_TEXT you can concatenate it with the material separated by ':'.With these you can easily solve your requirement.
Regards,
Chakradhar.
09-11-2014 12:20 PM
Hi Charavarthi,
It has to display in row wise..........
A13001 : RMCODE1 RMDECSRIPTION1 USAGE1
A13001 : RMCODE2 RMDECSRIPTION1 USAGE2
09-11-2014 12:28 PM
you can try to fill the internal table such a way if there is different usage , store in next line.
09-11-2014 12:51 PM
Hi Kabil,
Hope you are getting all the texts into a work area and appending it to an internal table.It's better to upload the texts as separate records into an internal table and also modify the field catalog and the list of output fields.
Regards,
Chakradhar.
09-11-2014 12:26 PM
Hi kabil,
try this,
Hope you are getting the both fields using single input. why cant you try to append the second text field to first text field using append for two times.
Eg: append wa to itab.
clear wa.
if lv_text is not initial. "Second Description.
wa-text1 = lv_text.
append wa to itab.
clear wa.
endif.
Regards,
Venkat.
09-11-2014 12:35 PM
Hi Venkatesh,
For each line i m building a field catalog one field as i shown... in screen shot
it has to diplay vertically..............
Ex: a line1
a line2
a line3
material number A : a has to repeat and display in vertical format
a line1
a line2
a line3
09-11-2014 12:39 PM
Hi kabil,
Hope it helpful..
Eg: append wa to itab.
clear wa-maktx. "clear the items what you don't want to repeat.
if lv_text is not initial. "Second Description.
wa-text1 = lv_text.
append wa to itab.
clear wa.
endif.
Regards,
Venkat.
09-11-2014 12:32 PM
Hi
First change the fieldcatalog now , with only three fields ( one for RM material , RM description , and last one for your text ) .
Now after fetching text you append as different line entry in the table . The work are will have RMmaterial and Description also.
Hope this helps.
Regards
Vaibhav Juneja
09-11-2014 12:41 PM
Hi Kabil,
loop the output internal table of FM read_text. inside loop process and append record to final output internal table.
09-11-2014 12:46 PM
Hi Sreekanth,
Pls find my piece of code as you said...........
FORM fill_final .
DATA : it_tline TYPE TABLE OF tline,
wa_tline LIKE LINE OF it_tline.
DATA : text(250) TYPE c.
DATA : wrk_name TYPE thead-tdname.
REFRESH gt_final.
LOOP AT gt_mara INTO gw_mara.
MOVE: gw_mara-matnr TO gw_final-matnr,
gw_mara-werks TO gw_final-werks.
READ TABLE gt_makt INTO gw_makt WITH KEY matnr = gw_mara-matnr.
IF sy-subrc = 0.
MOVE : gw_makt-maktx TO gw_final-maktx.
ENDIF.
REFRESH : it_tline.
CLEAR : wrk_name.
wrk_name = gw_final-matnr.
* CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
* EXPORTING
* input = gw_final-line1
* IMPORTING
* output = gw_final-line1
* EXCEPTIONS
* length_error = 1
* OTHERS = 2.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'GRUN'
language = 'E'
name = wrk_name
object = 'MATERIAL'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = it_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_tline INTO wa_tline.
CASE sy-tabix.
WHEN 1.
gw_final-line1 = wa_tline-tdline.
WHEN 2.
gw_final-line2 = wa_tline-tdline.
WHEN 3.
gw_final-line3 = wa_tline-tdline.
WHEN 4.
gw_final-line4 = wa_tline-tdline.
ENDCASE.
ENDLOOP.
REFRESH : it_tline.
CLEAR : wrk_name.
wrk_name = gw_final-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'IVER'
language = 'E'
name = wrk_name
object = 'MATERIAL'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = it_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_tline INTO wa_tline.
CASE sy-tabix.
WHEN 1.
gw_final-line5 = wa_tline-tdline.
WHEN 2.
gw_final-line6 = wa_tline-tdline.
WHEN 3.
gw_final-line7 = wa_tline-tdline.
WHEN 4.
gw_final-line8 = wa_tline-tdline.
ENDCASE.
ENDLOOP.
APPEND gw_final TO gt_final.
CLEAR gw_final.
ENDLOOP.
ENDFORM. " FILL_FINAL
09-11-2014 12:54 PM
i mean..
LOOP AT it_tline INTO wa_tline.
gw_final-line = wa_tline-tdline.
append gw_final to it_final.
ENDLOOP.
09-11-2014 12:56 PM
Hi Kabil,
Hope it help full.
data: dummy type gw_final.
dummy = gw_final.
APPEND gw_final TO gt_final.
CLEAR: gw_final-line2, gw_final-line2. "Except Material
if dummy-line2 is not initial.
gw_final-line2 = dummy-line2.
APPEND gw_final TO gt_final.
CLEAR: gw_final, dummy.
endif.
Regards,
Venkat.
09-11-2014 1:08 PM
Hi Venkatesh ,
Append will insert a new record ...
Totally i have 8 lines in tat
a 1st line
a 2nd line
a 3rd line
a 4th line
a 5th line
a 6th line
a 7th line
a 8th line
09-11-2014 1:20 PM
Hi kabil,
I misunderstand your requirement.
Eg: material descrip1 descript2.
001 Demo1 Demo2
Desired output.
Material Descip1
001 Demo1
001 Demo2.
I told suggestions for above for it can you explain with some eg,
Regards,
Venkat.
09-11-2014 1:21 PM
hi ,
i have a doubt in your logic first is why you are calling the fm 2 times
and second is if you need different row then append statement should be inside the loop of table it_tline .
Regards.
Jaydeep
09-11-2014 12:50 PM
Hi Frds,
It is getting output in column
I required here in row output...................
09-11-2014 1:01 PM
There is no way to do that with an ALV.
All given solutions are not a solution as the output gets corrupted when the user is resorting or filtering the content.
The only way i can see is using ABAP2XLSX, creating an excel sheet and formatting the field and then displaying the excel. But this is not an ALV solution.
09-11-2014 1:02 PM
Dear Kabil,
Use nested loop for solve your issue.
example:
itab For material
itab1 for material description
now using both of the internal table i can append into the final table
loop at itab .
loop at itab1.
write your logic and pass the value to wa_final workarea.
append wa_final to ifinal.
endloop.
endlooop.
using the above nested loop you can solve your issue.
Thanks,
Mukesh
09-11-2014 1:12 PM
Hi Mukesh,
Now its displaying in column wise................. a 1st line a 2nd line a 3rd line
I want output like these....
Totally i have 8 lines in tat
a 1st line
a 2nd line
a 3rd line
a 4th line
a 5th line
a 6th line
a 7th line
a 8th line
09-11-2014 1:14 PM
09-11-2014 1:16 PM
09-11-2014 1:21 PM
Hi kabil,
Are you write the code like the below code.
LOOP AT gt_mara INTO gw_mara.
MOVE: gw_mara-matnr TO gw_final-matnr,
gw_mara-werks TO gw_final-werks.
READ TABLE gt_makt INTO gw_makt WITH KEY matnr = gw_mara-matnr.
IF sy-subrc = 0.
MOVE : gw_makt-maktx TO gw_final-maktx.
ENDIF.
REFRESH : it_tline.
CLEAR : wrk_name.
wrk_name = gw_final-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'GRUN'
language = 'E'
name = wrk_name
object = 'MATERIAL'
TABLES
lines = it_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
LOOP AT it_tline INTO wa_tline.
gw_final-line1 = wa_tline-tdline.
append gw_final to gt_final.
ENDLOOP.
endloop.
if your code is like the above code then the output will show in below format
a 1st line
a 2nd line
a 3rd line
a 4th line
a 5th line
a 6th line
a 7th line
a 8th line
if not then what's issue??
09-11-2014 1:21 PM
ok. how many records are there in it_tline? that much records will be there in o/p table
09-15-2014 5:48 AM
Hi Mukesh,
Its is showing in horizontal output... I need vertically.........
09-12-2014 4:30 AM
Hi
Rather than doing this :
LOOP AT it_tline INTO wa_tline.
CASE sy-tabix.
WHEN 1.
gw_final-line1 = wa_tline-tdline.
WHEN 2.
gw_final-line2 = wa_tline-tdline.
WHEN 3.
gw_final-line3 = wa_tline-tdline.
WHEN 4.
gw_final-line4 = wa_tline-tdline.
ENDCASE.
ENDLOOP.
You can :
LOOP AT it_tline INTO wa_tline.
gw_final-line1 = wa_tline-tdline.
append wa_final to gw_final.
clear wa_final .
gw_final-line1 = wa_tline-tdline.
append wa_final to gw_final.
clear wa_final .
gw_final-line1 = wa_tline-tdline.
append wa_final to gw_final.
clear wa_final .
gw_final-line1 = wa_tline-tdline.
append wa_final to gw_final.
clear wa_final .
ENDLOOP.
Regards
Vaibhav Juneja
09-15-2014 7:52 AM
Use control break statements and append to yur final internal table based on your requirement