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

Quantity is Zero condition

Former Member
0 Likes
523

Hi,

I am creating Sales order based on selected records, if any item Quantity is Zero, I have to go to next item. The order should not have line items with qty Zero. How should I do this.

Thanks,

Veni.



      LOOP AT gt4_zprice INTO gs_zprice1.
        IF gs_zprice1-crmemo IS INITIAL.
          AT NEW kunnr.
            MOVE 'Y' TO lv_flg.
          ENDAT.

          IF lv_flg EQ 'Y'.
            PERFORM headerdata.
            PERFORM texts.
            CLEAR lv_flg.
          ENDIF.

          PERFORM itemdata.
          APPEND gs_zprice1 TO gt3_zprice.
          CLEAR gs_zprice1.
          AT END OF kunnr.
            PERFORM call_function.
            PERFORM update_pricetable.
            PERFORM errorcheckandcommit.

            REFRESH gt2_zprice.
            CLEAR chbox.
            CLEAR lv_lines.

            REFRESH partner.
            REFRESH item.
            REFRESH itemx.
            REFRESH lt_schedules_in.
            REFRESH lt_schedules_inx.
            REFRESH conditions1.
            REFRESH order_text.
            lv_itemno = 10.
          ENDAT.
        ELSE.
          REFRESH gt2_zprice.
          CLEAR chbox.
        ENDIF.
      ENDLOOP.



FORM itemdata.

* Partner data
* Sold to
  partner-partn_role = 'AG'.
  partner-partn_numb = gs_zprice1-kunnr.
  APPEND partner.

* ITEM DATA
  itemx-updateflag = 'I'.

* Line item number.
  item-itm_number = lv_itemno.
  itemx-itm_number = 'X'.

* Material
  item-material = gs_zprice1-matnr.
  itemx-material = 'X'.

* Plant
  item-plant    = gs_zprice1-werks.
  itemx-plant   = 'X'.

* Quantity
  item-target_qty = gs_zprice1-eohqty.
  itemx-target_qty = 'X'.
  APPEND item.
  APPEND itemx.

*Fill schedule lines
  lt_schedules_in-itm_number = lv_itemno.
  lt_schedules_in-sched_line = '0001'.
  lt_schedules_in-req_qty    = gs_zprice1-eohqty.
  APPEND lt_schedules_in.

*Fill schedule line flags
  lt_schedules_inx-itm_number  = lv_itemno.
  lt_schedules_inx-sched_line  = '0001'.
  lt_schedules_inx-updateflag  = 'I'.
  lt_schedules_inx-req_qty     = 'X'.
  APPEND lt_schedules_inx.

*Conditions
  lv_pprice = gs_zprice1-sprice - gs_zprice1-eprice.

  conditions1-itm_number  = lv_itemno.
  conditions1-cond_type   = 'ZCPP'.
  conditions1-cond_value  = lv_pprice.
  conditions1-currency    = 'USD'.
  conditions1-cond_unit   = 'EA'.
  conditions1-cond_p_unt = 1.
  APPEND conditions1.

  lv_itemno = lv_itemno + 10.
ENDFORM.                    " itemdata

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
491

HI Veni,

Just add this code before

PERFORM itemdata.

IF gs_zprice1-eohqty IS INITIAL.

CONTINUE.

ENDIF.

PERFORM itemdata.

Regards,

Atish

2 REPLIES 2
Read only

Former Member
0 Likes
492

HI Veni,

Just add this code before

PERFORM itemdata.

IF gs_zprice1-eohqty IS INITIAL.

CONTINUE.

ENDIF.

PERFORM itemdata.

Regards,

Atish

Read only

0 Likes
491

Thank you Atish. The problem is solved with your logic.

Regards,

Veni.