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

itab data display

Former Member
0 Likes
2,173

Hi,

I have itab1 data like this.

fld1-fld2

alfa 200000045

alfa 200000046

alfa 200000047

alfa 200000048

beta 200000051

beta 200000052

beta 200000053

beta 200000054

In the itab2 i want to display like this

alfa 200000045

-


200000046

-


200000047

-


200000048

beta 200000051

-


200000052

-


200000053

-


200000054

How to do this? My objective is display fld1 value only one time for all the values of fld2.

points guaranteed

cheers

kaki

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,144

hi Check the program out put there they are getting they are combining the airlines and showing it..

<b>BALVST02_GRID.</b>

26 REPLIES 26
Read only

Former Member
0 Likes
2,144

Hi,

loop at itab.

on change of itab-fld1.

write:/ itab-fld1,

itab-fld2.

endon.

write:/ itab-fld2.

endloop.

Try with this.....

Thanks

If this helps u reward points and close the thread.

Message was edited by: Deepak333 k

Read only

0 Likes
2,144

Hi all

This is my logic.I want to get STEXT value only once into T_FINAL.

"at new" is not working here.

LOOP AT T_DET.

  • SNO = SNO + 1.

T_FINAL-SNO = SNO.

T_FINAL-QMNUM = T_DET-QMNUM.

T_FINAL-QMTXT = T_DET-QMTXT.

T_FINAL-COST = T_DET-COST.

AT NEW STEXT.

<b>T_FINAL-STEXT = T_DET-STEXT.</b>

ENDAT.

LOOP AT ITAB WHERE QMNUM = T_DET-QMNUM.

T_FINAL-DESC = ITAB-DESC.

APPEND T_FINAL.

CLEAR T_FINAL.

IF T_FINAL-SNO = '0'.

T_FINAL-SNO = ''.

ENDIF.

ENDLOOP.

ENDLOOP.

kaki

Read only

0 Likes
2,144

Hi,

It seems there are some type C fields before STEXT in your internal table that is why your AT NEW is not working.

You can also follow an alternate method as follows,

DATA: lv_stext LIKE t_det-stext.

and then in your logic, instead of AT NEW

use the following,

<b>

IF lv_stext NE t_det-stext.

lv_stext = t_det-stext.

t_final-stext = t_det-stext.

ENDIF.</b>

so your revised logic will look as follows,

<b> DATA: lv_stext LIKE t_det-stext.</b>

LOOP AT T_DET.

  • SNO = SNO + 1.

T_FINAL-SNO = SNO.

T_FINAL-QMNUM = T_DET-QMNUM.

T_FINAL-QMTXT = T_DET-QMTXT.

T_FINAL-COST = T_DET-COST.

*AT NEW STEXT.

*T_FINAL-STEXT = T_DET-STEXT.

*ENDAT.

<b>

IF lv_stext NE t_det-stext.

lv_stext = t_det-stext.

t_final-stext = t_det-stext.

ENDIF.</b>

LOOP AT ITAB WHERE QMNUM = T_DET-QMNUM.

T_FINAL-DESC = ITAB-DESC.

APPEND T_FINAL.

CLEAR T_FINAL.

IF T_FINAL-SNO = '0'.

T_FINAL-SNO = ''.

ENDIF.

ENDLOOP.

ENDLOOP.

Hope this helps..

Sri

Message was edited by: Srikanth Pinnamaneni

Read only

0 Likes
2,144

Kaki,

I am surprise why you have abandoned the previous thread posted for the same question and also the solutions were provided.

Regards,

Ravi

Read only

0 Likes
2,144

Hi Ravi,

Thing is iam getting sorted data in the first column.But my long text column( which is having 4 lines for each doc.no) not getting sorted accordingly. It is shuffling.

Any way thanks for all the members..

Points allowted

cheers

kaki

Read only

0 Likes
2,144

Kaki,

If you have 4 lines for each document, where each line is showing some text, then yes when the user sorts the the text will be jumbled. We don't have a choice here.

If its not important then SORT it using a pre-defined criteria and do NOT give the option of sorting to the user.

Or you can provide options in the SELECTION screen and program it so that sorting happens in that fashion. However we cannot give the user to sort after the report is displayed.

Regards,

Ravi

Read only

0 Likes
2,144

Hi Ravi,

How to stop giving SORTING options in the ALV?I mean not to display on the tool bar.

kaki

Read only

0 Likes
2,144

Hi Kaki,

Use EXCLUDE option ..

set-pf status 'STAT' excluding ex_tab.

pass the pf-status to the FM.

Read only

0 Likes
2,144

Use

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = SY-REPID
<b>      I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'</b>
      I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
      IS_LAYOUT                = X_LAYOUT
      IT_FIELDCAT              = IT_FIELDCAT
      IT_EVENTS                = IT_EVENTS
    TABLES
      T_OUTTAB                 = IT_FINAL
    EXCEPTIONS
      PROGRAM_ERROR            = 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.
FORM PF_STATUS_SET USING    P_EXTAB TYPE SLIS_T_EXTAB.
***append the sort fcodes and exclude them...
  SET PF-STATUS 'STANDARD' EXCLUDING P_EXTAB.
ENDFORM.                    "PF_STATUS_SET

Read only

0 Likes
2,144

you can use it_excluding also append the fcodes to itab of same type and pass it to it_excluding table parameter

while calling FM..

vijay

Read only

athavanraja
Active Contributor
0 Likes
2,144

you can use at new for this.

loop at itab1 .

at new fld1 .

move: itab1-fld1 to itab2-fld1 .

endat .

move itab1-fld2 to itab2-fld2 .

append itab2.

endloop .

Regards

Raja

Read only

Former Member
0 Likes
2,145

hi Check the program out put there they are getting they are combining the airlines and showing it..

<b>BALVST02_GRID.</b>

Read only

Former Member
0 Likes
2,144

Hi,

Use control break statements:

Note that first you need to sort your internal table.

SORT ITAB.

LOOP AT ITAB.

AT NEW FLD1.

WRITE: ITAB-FLD1, ITAB-FLD2.

ENDAT.

WRITE: ITAB-FLD2.

ENDLOOP.

Regards,

Sudhakar.

Read only

kanthimathikris
Advisor
Advisor
0 Likes
2,144

sort itab1 by fld1.

loop at itab1.

at new fld1.

write itab1-fld1.

endat.

write itab1-fld2.

endloop.

Message was edited by: Kanthimathi Krishnan

Read only

Former Member
0 Likes
2,144

hi kaki,

I think you are asking this doubt for ALV display..

I guess...Using alv you can group....

try to see the out put of the above program...

Read only

0 Likes
2,144

Yes vijay,

Iam working on ALV.Thing is i have ALV with 5 fields.One them having very long text and occupying 4 lines for one document number.If i group document numbers, this long text lines are shuffling.

So iam trying to group at ITAB level.

kaki

Read only

0 Likes
2,144

Hi Kaki .,

When you post a question in the forum, provide all related info. in your original question you didnt mention about ALV at all.

Regards

Raja

Read only

abdul_hakim
Active Contributor
0 Likes
2,144

hi

use the below code.

LOOP AT itab1.

AT NEW fld1.

MOVE itab1-fld1 TO itab2-fld1.

ENDAT.

MOVE itab1-fld2 TO itab2-fld2.

APPEND itab2.

CLEAR itab2.

ENDLOOP.

Regards,

Abdul

Read only

Former Member
0 Likes
2,144

Hi Kaki,

1. This is one of the way.

2. First & Foremost is use

GRID - REUSE_ALV_GRID_DISPLAY

(and not alv list)

( bcos in alv list it is not showing what is required)

3. Then, declare these : (if not declared)

DATA : SRT TYPE SLIS_T_SORTINFO_ALV.

DATA : SRTWA TYPE SLIS_SORTINFO_ALV.

(The second one SRTWA is for word area)

4. Then write :

SRTWA-FIELDNAME = 'BUKRS'. "<---- your field name

APPEND SRTWA TO SRT.

5. Then Call ur Display function module.

6. Make sure you pass this parameter.

IT_SORT = SRT

7 I tried at my end. Its working fine.

Hope it helps.

Regards,

Amit M.

Read only

Former Member
0 Likes
2,144

Hi

Move the itab1 fld1 one into itab1 fld1.

and use the following code

<b>loop at itab1.

itab2-f1 = itab1-f1.

collect itab2." omits redundancy

endloop.</b>

Regs

vijay

Read only

Former Member
0 Likes
2,144

Hi again,

1. IT_EXCLUDING

2. When u use the FM

REUSE_ALV_LIST_DISPLAY

or REUSE_ALV_GRID_DISPLAY

Pass the above parameter.

(Just see help on this parameter in SE37)

3. This parameter should contain

list of all Function Codes

which need to be deactivated from the toolbar.

Hope it helps.

Regards,

Amit M.

Read only

Former Member
0 Likes
2,144

Hi again,

1. Declare

DATA : EX TYPE SLIS_T_EXTAB.

DATA : EXWA TYPE SLIS_EXTAB.

2. Just before calling FM to display :

EXWA-FCODE = '&ODN'.

APPEND EXWA TO EX.

EXWA-FCODE = '&OUP'.

APPEND EXWA TO EX.

3. when calling FM, pass parameters

IT_EXCLUDING = EX

4. the first fcode is for toolbar button - sort descening

and the second fcode is for - sort ascending.

Hope it helps.

Regards,

Amit M.

Read only

0 Likes
2,144

Hi Amit,

Solved problem. Where did you find '&ODN' and '&OUP' in

function module using se37? Please tell me this.

Thanks vijay

points allowted

cheers

kaki

Read only

Former Member
0 Likes
2,144

Hi again,

1. First display the list.

( In fact u can display any alv list)

2. then /H --- start debuggin

3. Then click on toolbar button - sort

4. Debug window will come.

5. There check the value of sy-ucomm.

Very simple !

Since this was a new question,

a new thread would have been justified.

Regards,

Amit M.

Message was edited by: Amit Mittal

Message was edited by: Amit Mittal

Read only

0 Likes
2,144

Thanks amit,

I got it.

cheers

kaki

Read only

0 Likes
2,144

Hi amit,

Can we break the ALV line...I want like this

INDIA (HERE I WANT COMPLETE SPACE )

AP----MP-UP--

AP----MP-UP--

AP----MP-UP--

USA (HERE I WANT COMPLETE SPACE )

NY----AT--WA-

NY----AT--WA-

NY----AT--WA-

kaki