on 05-24-2011 11:47 AM
Hi,
I am trying to write a If condition in script as below
/: IF &QALS-ANZGEB& = 1
S1 Sample Size,,1
/: ELSEIF &QALS-ANZGEB& > 1 AND &QALS-ANZGEB& <= 15
S1 Sample Size,,2
/:ELSE
S1 Sample size,,3
ENDIF
But only the statement after ELSE is executed ..Can you please tell me whats the error in the above.
I tired using '1' but still sample size 3 is printed.
Hi,
Please try and check in debug mode.
Go to SE71, give your script name. In the menu options 'Utilities', press 'Activate debugger'. Execute.
It will start executing in debugging mode. Execute step by step by F5 and reach your statement. Check the value in the field &QALS-ANZGEB& .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
ANZGEB is a quantityy field with 3 decimal spaces.
In debugging check , you should get 1.000 instead of 1 in its value.I amnot sure if this would work or not, but you can try comparing it to 1.000 and 15.000 and then see if work.or assign this fields value to a temp variable and compare that.
It should work.
And ye syour comparison constants are in quotes always. so its '1.000'.
Edited by: sap_wiz on May 26, 2011 2:13 PM
Hi,
thats strange, Lokes has shared a link with you,You can use that,
In brief , you nee dto create a subroutine pool through se38. In it create a subroutine.
And call it from teh script. You will pass ANZGEB as input parameter to it. And you can get the text as output.
Please refer the lokesh's link for details.
Thanks Lokesh and all.
Problem solved ,.
FORM GET_PACKSIZE TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.
LOOP AT in_tab INTO wa_tin.
IF sy-tabix = 1.
WS_ANZGEB = wa_tin-value.
ENDIF.
ENDLOOP.
IF WS_ANZGEB = 0.
ws_sample = 0.
ELSEIF WS_ANZGEB = 1.
ws_sample = 1.
ELSEIF WS_ANZGEB > 1 AND WS_ANZGEB <= 15.
ws_sample = 2.
ELSEIF WS_ANZGEB > 15 AND WS_ANZGEB <= 25.
ws_sample = 3.
ELSEIF WS_ANZGEB > 25 AND WS_ANZGEB <= 90.
ws_sample = 5.
ELSEIF WS_ANZGEB > 90 AND WS_ANZGEB <= 150.
ws_sample = 8.
ELSE.
ws_sample = 15.
ENDIF.
out_tab-name = 'SAMPLE'.
out_tab-value = WS_SAMPLE.
MODIFY out_tab INDEX 1 TRANSPORTING value.
ENDFORM.
Hi,
I need to create a dop down option status in that need to fill the value
Status = Status should have dropdown 3 drop down values like, Trip Completed/Open (3 and 0), Trip Completed and To be settled (3 and1), Trip Approved/To be settled (4and1) and Trip Approved/Settled (4and 2).
If we select any value and execute the report Trip details need to be identified & fetched from the table PTRV_CHANGE from Fields (ANTRG and ABREC).
i have created the drop down option but not getting how to fetch the values.Please help it out.
CASE so_stat.
WHEN 'A'.
READ TABLE lt_ptrv_change INTO ls_ptrv_change WITH KEY pernr = ls_ptrv_head-pernr
reinr = ls_ptrv_srec-pernr.
IF sy-subrc = 0.
ENDIF.
ENDCASE.
DATA : v_id TYPE vrm_id,
values TYPE vrm_values.
DATA : BEGIN OF vrm_value,
key(40) TYPE c,
text(80) TYPE c,
END OF vrm_value.
vrm_value-key = 'A'.
vrm_value-text = 'Trip Completed/Open '.
APPEND vrm_value TO values.
vrm_value-key = 'B'.
vrm_value-text = 'Trip Completed/To be settled'.
APPEND vrm_value TO values.
v_id = 'SO_STAT'.
vrm_value-key = 'C'.
vrm_value-text = 'Trip Approved/To be settled '.
APPEND vrm_value TO values.
vrm_value-key = 'D'.
vrm_value-text = 'Trip Approved/Settled '.
APPEND vrm_value TO values.
v_id = 'SO_STAT'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = v_id
values = values[]
EXCEPTIONS
id_illegal_name = 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tired using '1' but still sample size 3 is printed.
That's because the comparison is still not correct. You must use the character representation of the quantity value. Adjust your quantity comparisons to literals (in the correct format) and it will work...
As Lokesh suggested, if you have a custom driver program, it is always easier to use the internal representation in the code for comparison and set your value accordingly...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can do this calculation in your driver program itself.
In the program code like this:
IF QALS-ANZGEB = 1
w_text = 1
ELSEIF ( QALS-ANZGEB& > 1 AND QALS-ANZGEB <= 15 )
w_text = 2.
ELSE
w_text = 3
ENDIF.
Now call and print your text in script: Like below:
HT &w_text&
It would be much easier way.
Regards,
Lokesh.
Edited by: Lokesh Tarey on May 24, 2011 1:16 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did you debug and check?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.