2013 Jul 11 10:03 AM
Hi Experts ,
I have below piece of code , if zz_orgsys and zz_roeid field (custom fields in standard table) has value then it will perform below logic and print the Label xyz along with value in final invoice . But if these ZZ fields dont have any values then neither label nor any value will be printed in invoice . How can I apply the logic .
*** Logic to get roid
CLEAR : lv_orgsys, lv_roeid.
SELECT SINGLE zz_orgsys zz_roeid FROM vbak INTO (lv_orgsys , lv_roeid)
WHERE vbeln EQ w_ordno.
**Begin of Logic
IF sp_adrc-country EQ c_in AND
( lv_roeid+0(2) EQ c_ep OR lv_roeid+0(2) EQ c_eb )
AND lv_orgsys EQ c_epr.
PERFORM toget_lstcst_yinc.
ELSE.
CLEAR ws_kunnr.
CLEAR w_lstcst.
SELECT SINGLE kunnr FROM vbpa INTO ws_kunnr
WHERE vbeln = w_ordno
AND parvw = 'WE'.
PERFORM toget_lstcst.
ENDIF.
***End of logic
w_shipcst = w_lstcst.
CLEAR w_lstcst.
Thanks
2013 Jul 12 7:47 AM
Hi MM,
This is logic
CLEAR : lv_orgsys, lv_roeid.
SELECT SINGLE zz_orgsys zz_roeid FROM vbak INTO (lv_orgsys , lv_roeid)
WHERE vbeln EQ w_ordno.
**Begin of Logic
**Check if you got values in lv_orgsys and lv_roeid, if you got values then preform your logic else nothing.
IF lv_orgsys IS NOT INITIAL AND lv_roeid IS NOT INITIAL.
IF sp_adrc-country EQ c_in AND
( lv_roeid+0(2) EQ c_ep OR lv_roeid+0(2) EQ c_eb )
AND lv_orgsys EQ c_epr.
PERFORM toget_lstcst_yinc.
ELSE.
CLEAR ws_kunnr.
CLEAR w_lstcst.
SELECT SINGLE kunnr FROM vbpa INTO ws_kunnr
WHERE vbeln = w_ordno
AND parvw = 'WE'.
PERFORM toget_lstcst.
ENDIF.
***End of logic
ENDIF.
w_shipcst = w_lstcst.
CLEAR w_lstcst.
2013 Jul 11 11:05 AM
Hi,
i am not sure if it works but you can try something like this:
SELECT SINGLE zz_orgsys zz_roeid FROM vbak INTO (lv_orgsys , lv_roeid)
WHERE vbeln EQ w_ordno
AND zz_orgsys IS NOT NULL
AND zz_roeid IS NOT NULL.
IF sy-subrc = 0.
IF sp_adrc-country EQ c_in AND
( lv_roeid+0(2) EQ c_ep OR lv_roeid+0(2) EQ c_eb )
AND lv_orgsys EQ c_epr.
PERFORM toget_lstcst_yinc.
ELSE.
CLEAR ws_kunnr.
CLEAR w_lstcst.
SELECT SINGLE kunnr FROM vbpa INTO ws_kunnr
WHERE vbeln = w_ordno
AND parvw = 'WE'.
PERFORM toget_lstcst.
ENDIF.
ENDIF.
***End of logic
w_shipcst = w_lstcst.
CLEAR w_lstcst.
2013 Jul 11 11:42 AM
An other way:
SELECT SINGLE zz_orgsys zz_roeid FROM vbak INTO (lv_orgsys , lv_roeid)
WHERE vbeln EQ w_ordno.
if zz_orgsys is not INITIAL.
...
ENDIF.
Regards
Jürgen
2013 Jul 11 12:31 PM
Hi MM,
try this logic,hope this will work.
SELECT SINGLE zz_orgsys zz_roeid FROM vbak INTO (lv_orgsys , lv_roeid)
WHERE vbeln EQ w_ordno
AND zz_orgsys <> ''
AND zz_roeid <> ' '.
IF sy-subrc = 0.
clear:lv_roeid_temp.
lv_roeid_temp = lv_roeid+0(2).
IF sp_adrc-country EQ c_in AND
( lv_roeid_temp EQ c_ep OR lv_roeid_temp EQ c_eb )
AND lv_orgsys EQ c_epr.
PERFORM toget_lstcst_yinc.
ELSE.
CLEAR ws_kunnr.
CLEAR w_lstcst.
SELECT SINGLE kunnr FROM vbpa INTO ws_kunnr
WHERE vbeln = w_ordno
AND parvw = 'WE'.
PERFORM toget_lstcst.
ENDIF.
ENDIF.
***End of logic
w_shipcst = w_lstcst.
CLEAR w_lstcst.
2013 Jul 12 3:14 AM
Hi Sangamesh ,
Thanks .Will surely give a try . I am a functional so dont have a developer access key . Need to pass it on to a ABAP er . But with the above logic when there is no i/p the label wont be printed right ?
Because I dont want to print the label with blank value .
2013 Jul 11 12:51 PM
I hope you are using smartform for showing the final invoice print .
If so, add a condition for the label as well as the text element used for displaying these fileds such as :
if the variable to be printed is z_orgsys.
add condition
z_orgsys NE initial. for both the label as well as the value field.
(NE will be symbol in smart form in condition tab)
2013 Jul 12 3:12 AM
2013 Jul 11 1:02 PM
Dear,
can u send me full code and SF for more clarification of your problem.
2013 Jul 12 7:09 AM
Hi MM,
If u r using zz_orgsys and zz_roeid fields as ur value fields to print value and label field name say 'xyz' using,Then make sure that these fields are character fields.If there is no value,Then nothing will be printed invoice.
If they are not character fields,Then pass those values to character fields and put condition like.
If zz_orgsys is initial.
clear zz_orgsys.
endif.
If zz_roeid is initial.
clear zz_roeid.
endif.
Hope this will help you.
2013 Jul 12 7:47 AM
Hi MM,
This is logic
CLEAR : lv_orgsys, lv_roeid.
SELECT SINGLE zz_orgsys zz_roeid FROM vbak INTO (lv_orgsys , lv_roeid)
WHERE vbeln EQ w_ordno.
**Begin of Logic
**Check if you got values in lv_orgsys and lv_roeid, if you got values then preform your logic else nothing.
IF lv_orgsys IS NOT INITIAL AND lv_roeid IS NOT INITIAL.
IF sp_adrc-country EQ c_in AND
( lv_roeid+0(2) EQ c_ep OR lv_roeid+0(2) EQ c_eb )
AND lv_orgsys EQ c_epr.
PERFORM toget_lstcst_yinc.
ELSE.
CLEAR ws_kunnr.
CLEAR w_lstcst.
SELECT SINGLE kunnr FROM vbpa INTO ws_kunnr
WHERE vbeln = w_ordno
AND parvw = 'WE'.
PERFORM toget_lstcst.
ENDIF.
***End of logic
ENDIF.
w_shipcst = w_lstcst.
CLEAR w_lstcst.