F SAP ABAP Internal Table value check sample program | CodeTheta

SAP ABAP Internal Table value check sample program

September 02, 2019

Code :
REPORT ZVP_PRACTICE.

TYPESBEGIN OF STPRODUCT,
         PRODUCT_NAME     TYPE CHAR10,
         PRODUCT_QUANTITY TYPE CHAR10,
       END OF STPRODUCT.

DATAIT_STPRODUCT TYPE STANDARD TABLE OF STPRODUCT,
      WA_STPRODUCT TYPE STPRODUCT,
      LV_VAR       TYPE I.

WA_STPRODUCT-PRODUCT_NAME 'SOAP'.
WA_STPRODUCT-PRODUCT_QUANTITY 10.
APPEND WA_STPRODUCT TO IT_STPRODUCT.
CLEAR WA_STPRODUCT.

WA_STPRODUCT-PRODUCT_NAME 'SHAMPOO'.
WA_STPRODUCT-PRODUCT_QUANTITY 5.
APPEND WA_STPRODUCT TO IT_STPRODUCT.
CLEAR WA_STPRODUCT.

WA_STPRODUCT-PRODUCT_NAME 'BRUSH'.
WA_STPRODUCT-PRODUCT_QUANTITY 3.
APPEND WA_STPRODUCT TO IT_STPRODUCT.
CLEAR WA_STPRODUCT.

WA_STPRODUCT-PRODUCT_NAME 'OIL PACKET'.
WA_STPRODUCT-PRODUCT_QUANTITY 9.
APPEND WA_STPRODUCT TO IT_STPRODUCT.
CLEAR WA_STPRODUCT.

WA_STPRODUCT-PRODUCT_NAME 'PERFUME'.
WA_STPRODUCT-PRODUCT_QUANTITY 5.
APPEND WA_STPRODUCT TO IT_STPRODUCT.
CLEAR WA_STPRODUCT.



LOOP AT IT_STPRODUCT INTO WA_STPRODUCT.
  WRITE:/ WA_STPRODUCT-PRODUCT_NAME'|',
          WA_STPRODUCT-PRODUCT_QUANTITY'|'.


  IF WA_STPRODUCT-PRODUCT_QUANTITY 3.
    LV_VAR WA_STPRODUCT-PRODUCT_QUANTITY.
  ENDIF.


  ULINE.
ENDLOOP.

IF LV_VAR 3.
  WRITE:'LOW STOCK FOUND'.
ELSE.
  WRITE:'NOT FOUND'.
ENDIF.

 
Output :

IDE Used To Test This Code : SAP GUI 730

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment