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: 

Alv report output doubt..........

kabil_g
Active Participant
0 Kudos

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

1 ACCEPTED SOLUTION

VenkatRamesh_V
Active Contributor
0 Kudos

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.

26 REPLIES 26

Former Member
0 Kudos

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.

0 Kudos

Hi Charavarthi,

It has to display in row wise..........

A13001 : RMCODE1 RMDECSRIPTION1 USAGE1

A13001 :  RMCODE2 RMDECSRIPTION1 USAGE2

0 Kudos

you can try to fill the internal table such a way if there is different usage , store in next line.

0 Kudos

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.

VenkatRamesh_V
Active Contributor
0 Kudos

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.

0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

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

former_member202818
Active Contributor
0 Kudos

Hi Kabil,

loop the output internal table of FM read_text. inside loop process and append record to final output internal table.

0 Kudos

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

0 Kudos

i mean..


     LOOP AT  it_tline INTO wa_tline.

           gw_final-line wa_tline-tdline.

          append gw_final to it_final.

     ENDLOOP.

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

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

kabil_g
Active Participant
0 Kudos

Hi Frds,

It is getting output in column

I required here in row output...................

0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

Why are you calling raed_text twice?

0 Kudos

Two different text fetching,................

0 Kudos

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??

0 Kudos

ok. how many records are there in it_tline? that much records will be there in o/p table

0 Kudos

Hi Mukesh,

Its is showing in horizontal output... I need vertically.........

Former Member
0 Kudos

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

AnoopMayamkote
Participant
0 Kudos

Use control break statements and append to yur final internal table based on your requirement