‎2009 Apr 29 6:13 AM
*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
‎2009 Apr 29 6:20 AM
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.
‎2009 Apr 29 6:26 AM
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.
‎2009 Apr 29 6:41 AM
Hello
Text for variable:
Table DD07T with DOMNAME = 'QBEWERTUNG'.
‎2009 Apr 29 6:47 AM
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
‎2009 Apr 29 7:53 AM
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.)
‎2009 Apr 29 7:58 AM
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.
‎2009 Apr 29 7:59 AM
what is the value in i_pruef-VBEWERTUNG while debugging before u assign it to 'CC'.
‎2009 Apr 29 8:03 AM
it is A which means the lot has been accepted, but when i execute case the problem arises.
‎2009 Apr 29 8:07 AM
try commenting the last WHEN statement corresponding to 'CC' value and see what happens.
‎2009 Apr 29 8:12 AM
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
‎2009 Apr 29 8:18 AM
I guess its bcoz i_pruef-VBEWERTUNG is declared as string type while CASE statement works on char type insted use if ...else.
‎2009 Apr 29 6:22 AM
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
‎2009 Apr 29 7:56 AM
Please do not have your subject in ALL CAPITALS. Please surround any ABAP code with
‎2009 Apr 29 8:00 AM