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

Problem in displaying the code

Former Member
0 Likes
1,496

*Please do not have your subject in ALL CAPITALS. Please surround any ABAP code with

{color}*
Hi,

I am working on a code in which i have to display the UD for a Inspection lot,the below mentioned code is working fine but i am facing a problem that there is a field 'QAVE-VBEWERTUNG' which consist of 3 types i.e. 'A' which means accepeted,'R' means rejected and '  ' means Non-Valuted.

I want to display the output  i.e. if it is 'A' then should be writtten Material us ok' and vice versa along with other data which had written in write statement.

Here's d code for it :-


Report ZNEW32 NO STANDARD PAGE HEADING.

TABLES: QAVE.

TYPES: BEGIN OF IT_QAVE,

PRUEFLOS TYPE QAVE-PRUEFLOS,

VBEWERTUNG TYPE QAVE-VBEWERTUNG,

VWERKS TYPE QAVE-VWERKS,

VNAME TYPE QAVE-VNAME,

END OF IT_QAVE.

DATA: T_QAVE TYPE IT_QAVE OCCURS 0,

W_QAVE TYPE IT_QAVE.

SELECT-OPTIONS: VWERKS FOR QAVE-VWERKS,

PRUEFLOS FOR QAVE-PRUEFLOS.

SELECT PRUEFLOS VBEWERTUNG VWERKS VNAME

FROM QAVE INTO TABLE T_QAVE

WHERE PRUEFLOS IN PRUEFLOS AND VWERKS IN VWERKS.

SORT T_QAVE BY PRUEFLOS.

LOOP AT T_QAVE INTO W_QAVE.

WRITE:/ W_QAVE-PRUEFLOS,W_QAVE-VBEWERTUNG,W_QAVE-VNAME.

ENDLOOP.




Plzz provide me guideleines to sove this problem.

Edited by: Matt on Apr 29, 2009 8:55 AM Added 

tags, changed title from ALL CAPITALS

Edited by: Matt on Apr 29, 2009 8:57 AM

14 REPLIES 14
Read only

Former Member
0 Likes
1,417

In ur loop statement :-

LOOP AT T_QAVE INTO W_QAVE.

if W_QAVE-VBEWERTUNG = 'A'.

WRITE:/ 'ur text for accepted' ,W_QAVE-PRUEFLOS,W_QAVE-VBEWERTUNG,W_QAVE-VNAME.

else if W_QAVE-VBEWERTUNG = 'R'.

WRITE:/ 'ur text for rejected' ,W_QAVE-PRUEFLOS,W_QAVE-VBEWERTUNG,W_QAVE-VNAME.

else if W_QAVE-VBEWERTUNG = ' '.

WRITE:/ 'ur text ,W_QAVE-PRUEFLOS,W_QAVE-VBEWERTUNG,W_QAVE-VNAME.

endif.

ENDLOOP.

Read only

0 Likes
1,417

Hi,

Thanks for your reply ,problem is solved. but 1 thing is there is it possible to the value of text in a variable bcoz i have to move further it to the SAPSCRIPT where i was displaying the only value in the script but not the text .

plzz provide me guidelines to solve this problem.

Read only

0 Likes
1,417

Hello

Text for variable:

Table DD07T with DOMNAME = 'QBEWERTUNG'.

Read only

0 Likes
1,417

Hi,

I had tried to work on the program of sap script where the data about A,R and ' ' is be differentiated .

here's d code:-

data: AA type string ,

BB type string,

CC type string,

i_pruef-vbewertung type string,

i_final2-vbewertung type string.

AA = 'This material is Accepted and good for consumption'.

BB = 'This material is Rejected and not good for consumption'.

CC = 'This material is Not valuated'.

LOOP AT i_pruef.

i_final2-werk = i_pruef-werk.

i_final2-art = i_pruef-art.

i_final2-matnr = i_pruef-matnr.

i_final2-charg = i_pruef-charg.

i_final2-prueflos = i_pruef-prueflos.

i_final2-aufnr = i_pruef-aufnr.

i_final2-gesstichpr = i_pruef-gesstichpr.

i_final2-losmenge = i_pruef-losmenge.

**********************************************************************

case i_pruef-VBEWERTUNG.

when 'A'.

i_pruef-vbewertung = AA. "New Field Added

when 'R'.

i_pruef-vbewertung = BB. "New Field Added

when ''.

i_pruef-vbewertung = CC. "New Field Added

endcase.

**********************************************************************

i_final2-vbewertung = i_pruef-vbewertung. "New Field Added

LOOP AT i_final1 WHERE prueflos = i_pruef-prueflos.

i_final2-vorglfnr = i_final1-vorglfnr.

i_final2-merknr = i_final1-merknr.

i_final2-pruefbemkt = i_final1-pruefbemkt.

i_final2-anzfehleh = i_final1-anzfehleh.

i_final2-original_input = i_final1-original_input.

i_final2-verwmerkm = i_final1-verwmerkm.

i_final2-kurztext = i_final1-kurztext.

i_final2-merkgew = i_final1-merkgew.

APPEND i_final2.

flag = 1.

ENDLOOP.

The problem is when i debugg the code in this the inspection lot UD Decision is going to the last statement of the CASE where as in reality it should store the first value of the case.

plzz provide me guidelines to solve this problem.

Edited by: ricx .s on Apr 29, 2009 8:35 AM

Read only

0 Likes
1,417

what is the value in i_pruef-VBEWERTUNG while debugging.

And in when clause give when ' ' . (instead of when '' , u need to give a space in between.)

Read only

0 Likes
1,417

Hi,

i had tried to give spce there where you had mentioned but still moving to the CC.

The real value which should be A as that inspection lot is being accepted.

Read only

0 Likes
1,417

what is the value in i_pruef-VBEWERTUNG while debugging before u assign it to 'CC'.

Read only

0 Likes
1,417

it is A which means the lot has been accepted, but when i execute case the problem arises.

Read only

0 Likes
1,417

try commenting the last WHEN statement corresponding to 'CC' value and see what happens.

Read only

0 Likes
1,417

Hi,

i had solved the problem by making the change in the code myself. thanks for ur help.

Edited by: ricx .s on Apr 29, 2009 9:16 AM

Read only

0 Likes
1,417

I guess its bcoz i_pruef-VBEWERTUNG is declared as string type while CASE statement works on char type insted use if ...else.

Read only

Former Member
0 Likes
1,417

HI,

The values for this QAVE-VBEWERTUNG field are stored in the domain level.

So you can hard code these values ....

like when ever A is coming

Loop at itab.

case QAVE-VBEWERTUNG .

when 'A'.

write:/ QAVE-VBEWERTUNG, 'Accepted (OK)' , W_QAVE-PRUEFLOS,W_QAVE-VNAME.

when 'R'.

write:/ QAVE-VBEWERTUNG, ' Rejected (not OK)' , W_QAVE-PRUEFLOS,W_QAVE-VNAME..

when others.

write:/ QAVE-VBEWERTUNG, 'Not valuated' , W_QAVE-PRUEFLOS,W_QAVE-VNAME..

endcase.

endloop.

regards,

Venkatesh

Read only

matt
Active Contributor
0 Likes
1,417

Please do not have your subject in ALL CAPITALS. Please surround any ABAP code with

Read only

Former Member
0 Likes
1,417

ok,next time i will.